[firebase-br] Ajuda Por favor
Ivan Cesar
kswoofer em gmail.com
Ter Fev 14 10:35:37 -03 2006
Desculpe a ignorancia, aqui vai a unit pra esclarecimento.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IBCustomDataSet, IBUpdateSQL, DB, IBQuery, ExtCtrls, DBCtrls,
Grids, DBGrids, IBDatabase;
type
TForm1 = class(TForm)
IBTransaction: TIBTransaction;
IBDatabase: TIBDatabase;
DBGrid1: TDBGrid;
DBGrid2: TDBGrid;
DBNavigator1: TDBNavigator;
DataSource1: TDataSource;
DataSource2: TDataSource;
IBQuery1: TIBQuery;
IBQuery2: TIBQuery;
IBUpdateSQL1: TIBUpdateSQL;
IBUpdateSQL2: TIBUpdateSQL;
IBQuery1IDPEDIDO: TIntegerField;
IBQuery1IDNOTA: TIntegerField;
IBQuery1DATAPEDIDO: TDateField;
IBQuery1CFOP: TIntegerField;
IBQuery1IDCLIENTE: TIntegerField;
IBQuery1FRETE: TFloatField;
IBQuery1SEGURO: TFloatField;
IBQuery1OUTRASDESPESAS: TFloatField;
IBQuery1TOTALPEDIDO: TFloatField;
IBQuery1NFIMPRESSA: TSmallintField;
IBQuery1DIVNOTA: TSmallintField;
IBQuery1OBSERVACOES: TMemoField;
IBQuery2IDPEDIDO: TIntegerField;
IBQuery2IDITEM: TIntegerField;
IBQuery2IDPRODUTO: TIntegerField;
IBQuery2QUANTIDADE: TFloatField;
IBQuery2VALORUNITARIO: TFloatField;
IBQuery2DESCONTO: TFloatField;
procedure IBQuery1AfterCancel(DataSet: TDataSet);
procedure IBQuery1AfterPost(DataSet: TDataSet);
procedure EditMaster(DataSet: TDataSet);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure IBQuery2NewRecord(DataSet: TDataSet);
procedure IBQuery1AfterScroll(DataSet: TDataSet);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.IBQuery1AfterCancel(DataSet: TDataSet);
begin
IBQuery2.CancelUpdates;
IBQuery1.CancelUpdates;
end;
procedure TForm1.IBQuery1AfterPost(DataSet: TDataSet);
begin
IBDatabase.ApplyUpdates([IBQuery1, IBQuery2]);
IBTransaction.CommitRetaining;
end;
procedure TForm1.EditMaster(DataSet: TDataSet);
begin
IBQuery1.Edit;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
IBQuery1.Open;
IBQuery2.Open;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
IBDatabase.Connected:= False;
end;
procedure TForm1.IBQuery2NewRecord(DataSet: TDataSet);
begin
IBQuery2IDPEDIDO.Value:= IBQuery1IDPEDIDO.Value;
end;
procedure TForm1.IBQuery1AfterScroll(DataSet: TDataSet);
begin
IBQuery2.ParamByName('IDPEDIDO').Value:= IBQuery1IDPEDIDO.Value;
end;
end.
Mais detalhes sobre a lista de discussão lista