Ok Por las sugerencias..
Cita:
|
Ese error me lo manda cuando lo ejecuto y le doy clic en el botón cálculo pero no me marca ninguna línea. Aquí de bajo esta la imagen del from de factura y el código del proyecto completo. Por si lo quiere chequear.
|
Código Delphi
[-]
procedure TFFacturacion.BitBtn1Click(Sender: TObject);
var
a,b,c,d,e,f,g,h :real;
begin
a:= StrTofloat(Editcantidad.Text);
b:= StrTofloat(EMonto.Text);
d:= StrTofloat(EDesc.Text);
f:= StrTofloat(EImp.Text);
c:= a * b;
e:= c * d / 100;
g:= (c - e) * f / 100;
h:= c - e + g;
ESTotal.Text:= floatToStr(c);
EDescuento.Text:=floatToStr(e);
EImpuesto.Text:=floatToStr(g);
ETotal.Text:= floatToStr(Round(h));
Qfacturacion.SQL.Text := 'Insert into Facturacion Values ('+QuotedStr(ECodFactura.Text)+', '+
QuotedStr(EdiCliente.Text)+ ', '+ LabDireccion.Caption+ ' :FechaFactura, '+QuotedStr(Editequipo.Text)+ ', '+
QuotedStr(EditRNC.Text)+ ', '+QuotedStr(DBComboBox2.Text)+', '+QuotedStr(EMonto.Text)+', '+
QuotedStr(Editcantidad.Text)+', '+QuotedStr(ETotal.Text)+', '+QuotedStr(EImp.Text)+', '+
QuotedStr(EDesc.Text)+', '+QuotedStr(DBComboBox3.Text)+ ', '+QuotedStr(ESTotal.Text)+ ', '+
QuotedStr(EDescuento.Text)+', '+QuotedStr(EImpuesto.Text)+')';
Qfacturacion.Parameters.ParamByName('FechaFactura').Value:= DateToStr(DateTimePicker1.Date);
Qfacturacion.ExecSQL;
end;
Imagen http://www.4shared.com/file/61462793...cturacion.html
Código fuente http://www.4shared.com/file/61464202...5/sistema.html
Cita:
Por otra parte de este mismo from de factura yo tengo un botón busca, que lo que yo quiero que el me realice es que cunado yo lo llame me traiga otro from eso el me lo hace bien, pero que cuando yo le de le de clic a un cliente este me lo inserte en el edit de cliente de la factura esto lo que no me esta haciendo este es el código que tengo es este botón esta variable Nom_Cliente esta de clarada como publica Nom_Cliente: string; en el otro from que se llama FRegistroclient.
|
Código Delphi
[-]
FRegistroclient:=TFRegistroclient.Create(self);
try
FRegistroclient.ShowModal;
finally
If FRegistroclient.Nom_Cliente <> '' then
EdiCliente.Text := FRegistroclient.Nom_Cliente;
LabDireccion.Caption:= QuotedStr(FRegistroclient.Direccion);
FRegistroclient.Free;
end;
end;
Código Delphi
[-]unit FFactura;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, StdCtrls, Buttons, DBCtrls, Grids, DBGrids, Mask, ExtCtrls,
ComCtrls, ADODB;
type
TFFacturacion = class(TForm)
Label1: TLabel;
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;
GroupBox1: TGroupBox;
Panel2: TPanel;
Label2: TLabel;
Label15: TLabel;
Label11: TLabel;
Label3: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label20: TLabel;
DBText3: TDBText;
DBComboBox2: TDBComboBox;
DBComboBox3: TDBComboBox;
DBGrid1: TDBGrid;
DBMemo1: TDBMemo;
GroupBox2: TGroupBox;
DBNavigator1: TDBNavigator;
DataSource1: TDataSource;
DataSource3: TDataSource;
DateTimePicker1: TDateTimePicker;
Qfacturacion: TADOQuery;
ECodFactura: TEdit;
EdiCliente: TEdit;
Editequipo: TEdit;
Editcantidad: TEdit;
EditRNC: TEdit;
Panel1: TPanel;
Label7: TLabel;
Label8: TLabel;
Label19: TLabel;
Button2: TButton;
EMonto: TEdit;
EDescuento: TEdit;
EImpuesto: TEdit;
ETotal: TEdit;
Button1: TButton;
EDesc: TEdit;
EImp: TEdit;
ESTotal: TEdit;
Label26: TLabel;
Label4: TLabel;
BSeleccionar: TSpeedButton;
Label5: TLabel;
LabDireccion: TLabel;
BSeleccionarComercial: TSpeedButton;
ADOQuery1: TADOQuery;
ADOQuery2: TADOQuery;
BitBtn1: TBitBtn;
procedure FormCreate(Sender: TObject);
procedure BSeleccionarClick(Sender: TObject);
procedure SpeedButton7Click(Sender: TObject);
procedure BSeleccionarComercialClick(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
public
end;
var
FFacturacion: TFFacturacion;
implementation
uses FRegiclientes, FRegitequip;
{$R *.dfm}
procedure TFFacturacion.FormCreate(Sender: TObject);
begin
DateTimePicker1.Date:= Now;
Qfacturacion.SQL.Text:='SELECT DISTINCTROW Max([Facturacion].[NumeroFactura])AS [NumeroFactura]FROM Facturacion';
Qfacturacion.Open;
ECodFactura.Text:= IntToStr(Qfacturacion.Fields[0].AsInteger+3);
end;
procedure TFFacturacion.BSeleccionarClick(Sender: TObject);
begin
FRegistroclient:=TFRegistroclient.Create(self);
try
FRegistroclient.ShowModal;
finally
If FRegistroclient.Nom_Cliente <> '' then
EdiCliente.Text := FRegistroclient.Nom_Cliente;
LabDireccion.Caption:= QuotedStr(FRegistroclient.Direccion);
FRegistroclient.Free;
end;
end;
procedure TFFacturacion.SpeedButton7Click(Sender: TObject);
begin
Close;
end;
procedure TFFacturacion.BSeleccionarComercialClick(Sender: TObject);
begin
Fregequipos:=TFregequipos.Create(self);
try
Fregequipos.ShowModal;
finally
If Fregequipos.Dequipo <> '' then
EdiCliente.Text := Fregequipos.Dequipo;
Fregequipos.Free;
end;
end;
procedure TFFacturacion.BitBtn1Click(Sender: TObject);
var
a,b,c,d,e,f,g,h :real;
begin
a:= StrTofloat(Editcantidad.Text);
b:= StrTofloat(EMonto.Text);
d:= StrTofloat(EDesc.Text);
f:= StrTofloat(EImp.Text);
c:= a * b;
e:= c * d / 100;
g:= (c - e) * f / 100;
h:= c - e + g;
ESTotal.Text:= floatToStr(c);
EDescuento.Text:=floatToStr(e);
EImpuesto.Text:=floatToStr(g);
ETotal.Text:= floatToStr(Round(h));
Qfacturacion.SQL.Text := 'Insert into Facturacion Values ('+QuotedStr(ECodFactura.Text)+', '+
QuotedStr(EdiCliente.Text)+ ', '+ LabDireccion.Caption+ ' :FechaFactura, '+QuotedStr(Editequipo.Text)+ ', '+
QuotedStr(EditRNC.Text)+ ', '+QuotedStr(DBComboBox2.Text)+', '+QuotedStr(EMonto.Text)+', '+
QuotedStr(Editcantidad.Text)+', '+QuotedStr(ETotal.Text)+', '+QuotedStr(EImp.Text)+', '+
QuotedStr(EDesc.Text)+', '+QuotedStr(DBComboBox3.Text)+ ', '+QuotedStr(ESTotal.Text)+ ', '+
QuotedStr(EDescuento.Text)+', '+QuotedStr(EImpuesto.Text)+')';
Qfacturacion.Parameters.ParamByName('FechaFactura').Value:= DateToStr(DateTimePicker1.Date);
Qfacturacion.ExecSQL;
end;
end.