Yensis22
31-08-2008, 18:29:53
Hola muchacho gracia de antemano pos su atencion a mi poregunata.
Estoy creando un from con tres tablas en access que es de facturacion pero me esta dando algunos problema por eso le pido si no es mucha molestia en el foro hay alguna codigo que pueda toma como emplos para realizar los calculos
[QUOTE]
Tfactura Tfacturadetalle Tfactcob
Numero_factura Fatura Detalle Numero Factura
Direccion Numero Factura Fecha
Tipo Cliente Cliente Cliente
Fecha Factura Equipos RNC
Equipos Monto Equipos
NCF Importe condicion
Monto ITBIS Monto
Total Descuento Fecha_vence
ITBIS Pagado Total
Descuento Total Forma Pago
Forma Pago
Comentario
[QUOTE]
type
TForm1 = class(TForm)
Label1: TLabel;
GroupBox1: TGroupBox;
Panel2: TPanel;
Label2: TLabel;
Label15: TLabel;
DBGrid1: TDBGrid;
DBMemo1: TDBMemo;
DSFuncionBoton: TDataSource;
Bevel2: TBevel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
SpeedButton8: TSpeedButton;
SpeedButton9: TSpeedButton;
SpeedButton10: TSpeedButton;
SpeedButton11: TSpeedButton;
SpeedButton12: TSpeedButton;
DataSource1: TDataSource;
GroupBox2: TGroupBox;
DBNavigator1: TDBNavigator;
BitBtn1: TBitBtn;
Label11: TLabel;
MaskEdit1: TMaskEdit;
Label3: TLabel;
Label12: TLabel;
DBEdit5: TDBEdit;
DBEdit2: TDBEdit;
Label13: TLabel;
DBEdit9: TDBEdit;
Label14: TLabel;
DBComboBox2: TDBComboBox;
Label16: TLabel;
DBComboBox3: TDBComboBox;
Label17: TLabel;
DBEdit3: TDBEdit;
Label18: TLabel;
Label20: TLabel;
FTotales: TPanel;
Label6: TLabel;
Label9: TLabel;
Label4: TLabel;
LM: TLabel;
Label26: TLabel;
DataSource2: TDataSource;
DataSource3: TDataSource;
DBText1: TDBText;
DBText2: TDBText;
DBText3: TDBText;
DBText4: TDBText;
DBText5: TDBText;
DBText6: TDBText;
DBEdit1: TDBEdit;
DBEdit4: TDBEdit;
procedure SpeedButton6Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton9Click(Sender: TObject);
procedure SpeedButton7Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton12Click(Sender: TObject);
procedure SpeedButton10Click(Sender: TObject);
procedure SpeedButton11Click(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure DataSource2DataChange(Sender: TObject; Field: TField);
// procedure DSFuncionBotonDataChange(Sender: TObject; Field: TField);
procedure BitBtn1Click(Sender: TObject);
procedure DBNavigator1Click(Sender: TObject; Button: TNavigateBtn);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.SpeedButton6Click(Sender: TObject);
begin
ConexionDB.Query1.Cancel();
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
Var x:Double;
begin
ConexionDB.Query1.Last();
If ( ConexionDB.Query1.IsEmpty) And ( ConexionDB.Query1.IsEmpty) Then
Begin
X:=1;
End
Else
Begin
X:= ConexionDB.Query1['idcliente']+1;
end;
ConexionDB.Query1.Append;
ConexionDB.Query1['idcliente']:=X;
DBEdit5.SetFocus();
end;
procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
ConexionDB.Query1.Post();
end;
procedure TForm1.SpeedButton9Click(Sender: TObject);
begin
ConexionDB.Query1.Next();
end;
procedure TForm1.SpeedButton7Click(Sender: TObject);
begin
close;
end;
procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
conexiondb.Query1.Edit();
end;
procedure TForm1.SpeedButton12Click(Sender: TObject);
begin
conexiondb.Query1.First();
end;
procedure TForm1.SpeedButton10Click(Sender: TObject);
begin
conexiondb.Query1.Prior();
end;
procedure TForm1.SpeedButton11Click(Sender: TObject);
begin
conexiondb.Query1.Last;
end;
procedure TForm1.SpeedButton5Click(Sender: TObject);
begin
if MessageDlg('¿Esta Seguro que Desea Borrar Este registro?',
mtConfirmation, [mbYes, mbNo], 0) = mrYes then
ConexionDB.Query1.Delete();
end;
procedure TForm1.DataSource2DataChange(Sender: TObject; Field: TField);
begin
If ConexionDB.Query1.State In[DsInsert,DsEdit] Then
Begin
SpeedButton2.Enabled := True;
SpeedButton1.Enabled := False;
SpeedButton6.Enabled := True;
SpeedButton3.Enabled := False;
SpeedButton5.Enabled := True;
SpeedButton7.Enabled := False;
SpeedButton8.Enabled := False;
End
Else
Begin
SpeedButton2.Enabled := False;
SpeedButton1.Enabled := True;
SpeedButton6.Enabled := False;
SpeedButton3.Enabled := True;
SpeedButton5.Enabled := False;
SpeedButton7.Enabled := True;
SpeedButton8.Enabled := True;
End
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
var
importe: double;
monto: double;
ITBIS: double;
Total: double;
Apagar: double;
//retencion: double;
descuento: double;
ivaf: double;
acuenta: double;
begin
if (conexiondb.Query1.state=dsinsert) or (conexiondb.Query1.state=dsedit) then
conexiondb.Query1.Post;
monto := 0;
conexiondb.Query1.First;
while not conexiondb.Query1.Eof do
begin
if not varisnull(conexiondb.Query1.FieldByName('importe').value) then
importe := conexiondb.Query1.FieldByName('importe').value
else
importe:=0;
monto := importe + monto;
conexiondb.Query1.next;
end;
if not varisnull(conexiondb.Query1.fieldbyname('descuento').value) then
descuento := conexiondb.Query1.fieldbyname('descuento').value
else
descuento := 0;
monto := monto -(descuento/ 100)* monto;
if not varisnull(conexiondb.Query1.fieldbyname('ITBIS').value) then
if (conexiondb.Query1.fieldbyname('Cambio').value <> 0) and
(not (varisnull(conexiondb.Query1.fieldbyname('Cambio').value))) then
else
ITBIS := ITBIS;
total := monto + ITBIS;
if not varisnull(conexiondb.Query1.fieldbyname('ACuenta').value) then
ACuenta := conexiondb.Query1.fieldbyname('ACuenta').value
else
acuenta := 0;
//if not varisnull(conexiondb.Query1.fieldbyname('Retencion').value) then
// retencion := conexiondb.Query1.fieldbyname('Retencion').value
//else
//retencion := 0;
//apagar := total - acuenta - retencion;
conexiondb.Query1.Edit;
conexiondb.Query1.FieldByName('Tmonto').value :=
formatfloat('###,###,###,##0.00;(###,###,###,##0.00);0', monto);
conexiondb.Query1.FieldByName('TotalITBIS').value :=
formatfloat('###,###,###,##0.00;(###,###,###,##0.00);0', ITBIS);
conexiondb.Query1.FieldByName('TotalRecibo').value :=
formatfloat('###,###,###,##0.00;(###,###,###,##0.00);0', total);
conexiondb.Query1.FieldByName('APagar').value :=
formatfloat('###,###,###,##0.00;(###,###,###,##0.00);0', apagar);
conexiondb.Query1.FieldByName('Euros').value :=
formatfloat('###,###,###,##0.00;(###,###,###,##0.00);0', apagar);
conexiondb.Query1.Post;
end;
procedure TForm1.DBNavigator1Click(Sender: TObject; Button: TNavigateBtn);
begin
ConexionDB.Query2.Active:=false;
ConexionDB.Query2.Filter:=('factura_numero=')+ ConexionDB.Query1['factura_numero'];
ConexionDB.Query2.Filtered:=true;
ConexionDB.Query2.Active:=true;
end;
end.
aqui esta el fron completo en prueba link
http://www.4shared.com/file/60995750/f26caab9/puebas.html
http://www.4shared.com/file/61199992/babb9ff2/facturacion.html
Gracias y espero que me puedan ayudar
Estoy creando un from con tres tablas en access que es de facturacion pero me esta dando algunos problema por eso le pido si no es mucha molestia en el foro hay alguna codigo que pueda toma como emplos para realizar los calculos
[QUOTE]
Tfactura Tfacturadetalle Tfactcob
Numero_factura Fatura Detalle Numero Factura
Direccion Numero Factura Fecha
Tipo Cliente Cliente Cliente
Fecha Factura Equipos RNC
Equipos Monto Equipos
NCF Importe condicion
Monto ITBIS Monto
Total Descuento Fecha_vence
ITBIS Pagado Total
Descuento Total Forma Pago
Forma Pago
Comentario
[QUOTE]
type
TForm1 = class(TForm)
Label1: TLabel;
GroupBox1: TGroupBox;
Panel2: TPanel;
Label2: TLabel;
Label15: TLabel;
DBGrid1: TDBGrid;
DBMemo1: TDBMemo;
DSFuncionBoton: TDataSource;
Bevel2: TBevel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
SpeedButton8: TSpeedButton;
SpeedButton9: TSpeedButton;
SpeedButton10: TSpeedButton;
SpeedButton11: TSpeedButton;
SpeedButton12: TSpeedButton;
DataSource1: TDataSource;
GroupBox2: TGroupBox;
DBNavigator1: TDBNavigator;
BitBtn1: TBitBtn;
Label11: TLabel;
MaskEdit1: TMaskEdit;
Label3: TLabel;
Label12: TLabel;
DBEdit5: TDBEdit;
DBEdit2: TDBEdit;
Label13: TLabel;
DBEdit9: TDBEdit;
Label14: TLabel;
DBComboBox2: TDBComboBox;
Label16: TLabel;
DBComboBox3: TDBComboBox;
Label17: TLabel;
DBEdit3: TDBEdit;
Label18: TLabel;
Label20: TLabel;
FTotales: TPanel;
Label6: TLabel;
Label9: TLabel;
Label4: TLabel;
LM: TLabel;
Label26: TLabel;
DataSource2: TDataSource;
DataSource3: TDataSource;
DBText1: TDBText;
DBText2: TDBText;
DBText3: TDBText;
DBText4: TDBText;
DBText5: TDBText;
DBText6: TDBText;
DBEdit1: TDBEdit;
DBEdit4: TDBEdit;
procedure SpeedButton6Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton9Click(Sender: TObject);
procedure SpeedButton7Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton12Click(Sender: TObject);
procedure SpeedButton10Click(Sender: TObject);
procedure SpeedButton11Click(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure DataSource2DataChange(Sender: TObject; Field: TField);
// procedure DSFuncionBotonDataChange(Sender: TObject; Field: TField);
procedure BitBtn1Click(Sender: TObject);
procedure DBNavigator1Click(Sender: TObject; Button: TNavigateBtn);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.SpeedButton6Click(Sender: TObject);
begin
ConexionDB.Query1.Cancel();
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
Var x:Double;
begin
ConexionDB.Query1.Last();
If ( ConexionDB.Query1.IsEmpty) And ( ConexionDB.Query1.IsEmpty) Then
Begin
X:=1;
End
Else
Begin
X:= ConexionDB.Query1['idcliente']+1;
end;
ConexionDB.Query1.Append;
ConexionDB.Query1['idcliente']:=X;
DBEdit5.SetFocus();
end;
procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
ConexionDB.Query1.Post();
end;
procedure TForm1.SpeedButton9Click(Sender: TObject);
begin
ConexionDB.Query1.Next();
end;
procedure TForm1.SpeedButton7Click(Sender: TObject);
begin
close;
end;
procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
conexiondb.Query1.Edit();
end;
procedure TForm1.SpeedButton12Click(Sender: TObject);
begin
conexiondb.Query1.First();
end;
procedure TForm1.SpeedButton10Click(Sender: TObject);
begin
conexiondb.Query1.Prior();
end;
procedure TForm1.SpeedButton11Click(Sender: TObject);
begin
conexiondb.Query1.Last;
end;
procedure TForm1.SpeedButton5Click(Sender: TObject);
begin
if MessageDlg('¿Esta Seguro que Desea Borrar Este registro?',
mtConfirmation, [mbYes, mbNo], 0) = mrYes then
ConexionDB.Query1.Delete();
end;
procedure TForm1.DataSource2DataChange(Sender: TObject; Field: TField);
begin
If ConexionDB.Query1.State In[DsInsert,DsEdit] Then
Begin
SpeedButton2.Enabled := True;
SpeedButton1.Enabled := False;
SpeedButton6.Enabled := True;
SpeedButton3.Enabled := False;
SpeedButton5.Enabled := True;
SpeedButton7.Enabled := False;
SpeedButton8.Enabled := False;
End
Else
Begin
SpeedButton2.Enabled := False;
SpeedButton1.Enabled := True;
SpeedButton6.Enabled := False;
SpeedButton3.Enabled := True;
SpeedButton5.Enabled := False;
SpeedButton7.Enabled := True;
SpeedButton8.Enabled := True;
End
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
var
importe: double;
monto: double;
ITBIS: double;
Total: double;
Apagar: double;
//retencion: double;
descuento: double;
ivaf: double;
acuenta: double;
begin
if (conexiondb.Query1.state=dsinsert) or (conexiondb.Query1.state=dsedit) then
conexiondb.Query1.Post;
monto := 0;
conexiondb.Query1.First;
while not conexiondb.Query1.Eof do
begin
if not varisnull(conexiondb.Query1.FieldByName('importe').value) then
importe := conexiondb.Query1.FieldByName('importe').value
else
importe:=0;
monto := importe + monto;
conexiondb.Query1.next;
end;
if not varisnull(conexiondb.Query1.fieldbyname('descuento').value) then
descuento := conexiondb.Query1.fieldbyname('descuento').value
else
descuento := 0;
monto := monto -(descuento/ 100)* monto;
if not varisnull(conexiondb.Query1.fieldbyname('ITBIS').value) then
if (conexiondb.Query1.fieldbyname('Cambio').value <> 0) and
(not (varisnull(conexiondb.Query1.fieldbyname('Cambio').value))) then
else
ITBIS := ITBIS;
total := monto + ITBIS;
if not varisnull(conexiondb.Query1.fieldbyname('ACuenta').value) then
ACuenta := conexiondb.Query1.fieldbyname('ACuenta').value
else
acuenta := 0;
//if not varisnull(conexiondb.Query1.fieldbyname('Retencion').value) then
// retencion := conexiondb.Query1.fieldbyname('Retencion').value
//else
//retencion := 0;
//apagar := total - acuenta - retencion;
conexiondb.Query1.Edit;
conexiondb.Query1.FieldByName('Tmonto').value :=
formatfloat('###,###,###,##0.00;(###,###,###,##0.00);0', monto);
conexiondb.Query1.FieldByName('TotalITBIS').value :=
formatfloat('###,###,###,##0.00;(###,###,###,##0.00);0', ITBIS);
conexiondb.Query1.FieldByName('TotalRecibo').value :=
formatfloat('###,###,###,##0.00;(###,###,###,##0.00);0', total);
conexiondb.Query1.FieldByName('APagar').value :=
formatfloat('###,###,###,##0.00;(###,###,###,##0.00);0', apagar);
conexiondb.Query1.FieldByName('Euros').value :=
formatfloat('###,###,###,##0.00;(###,###,###,##0.00);0', apagar);
conexiondb.Query1.Post;
end;
procedure TForm1.DBNavigator1Click(Sender: TObject; Button: TNavigateBtn);
begin
ConexionDB.Query2.Active:=false;
ConexionDB.Query2.Filter:=('factura_numero=')+ ConexionDB.Query1['factura_numero'];
ConexionDB.Query2.Filtered:=true;
ConexionDB.Query2.Active:=true;
end;
end.
aqui esta el fron completo en prueba link
http://www.4shared.com/file/60995750/f26caab9/puebas.html
http://www.4shared.com/file/61199992/babb9ff2/facturacion.html
Gracias y espero que me puedan ayudar