Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Conexión con bases de datos
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Conexión con bases de datos

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 30-08-2008
Yensis22 Yensis22 is offline
Miembro
 
Registrado: feb 2008
Posts: 78
Poder: 19
Yensis22 Va por buen camino
Question From de faturacion delphi 7 me esta dando error

estoy creando un pequeno from de faturacion el cual me esta dando unu erro cuando ejecuto los calculos.

este es el codigo

Código Delphi [-]
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, ADODB, StdCtrls, DBCtrls, Grids, DBGrids, Buttons, Mask,
  ExtCtrls;
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);
  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 xouble;
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;
 
 
end.

adema lo subi a la web si lo pueden chequiar aqui esta el link

http://www.4shared.com/get/60995750/...06C8AB4FB.dc61
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Dando opcidad... aeff API de Windows 0 20-10-2006 02:47:41
Error dando formato a un TFMTBCDField HiroProtagonist Conexión con bases de datos 7 18-05-2006 00:46:04
Dando vueltas con las capas CHiCoLiTa Providers 0 24-01-2006 12:09:55
Abrir una forma dando doble click? JavierO Varios 3 13-08-2005 05:07:19
Dando ánimos a un amigo santana Humor 1 21-07-2004 12:57:46


La franja horaria es GMT +2. Ahora son las 05:01:03.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi