1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
procedure TForm1.btn1Click(Sender: TObject);
Var
i : Integer;
N_Fact,Num_Bord,S : string;
aNoFact : Array of string;
begin
if Dialogs.MessageDlg('Confirmer la suppression des factures sélectionnées ?',
mtConfirmation, [mbAbort, mbYes], 0, mbYes) = mrYes then begin
with DbGrd1 do begin
I := 0;
while i <= SelectedRows.Count -1 do begin
DataSource.DataSet.GotoBookmark(pointer(SelectedRows.Items[i]));
SetLength(aNoFact, (i + 1) );
aNoFact[i] := DataSource.DataSet.FieldByName('N_Facture').AsString;
I := I + 1;
end;
end;
if not IbTransaction1.InTransaction then IbTransaction1.StartTransaction;
IBQuery1.SQL.Text := 'DELETE FROM ENTETEFACT WHERE N_FACTURE=:N_FACT';
for i := low(aNoFact) to High(aNoFact) do begin
IBQuery1.Params.ParamByName('N_FACT').Value := aNoFact[i];
IBQuery1.ExecSql;
end;
IbTransaction1.Commit;
IBTransaction1.Active := True;
end;
IBQuery1.Close;
IBQuery1.SQL.Clear;
Mmo1.Clear;
Num_Bord := ComboBox1.Text;
Try
S:='Select N_Facture,Date_Facture,Mont_OFF,Mont_Ass,Mont_Fact,N_Assure,Centre,(Mont_OFF+Mont_Ass+Mont_Fact) AS Total From ENTETEFACT where N_Bourdereau= :Num_Bord order By N_Facture';
IBQuery1.SQL.Add(S);
IBQuery1.Params.ParamByName('Num_bord').Value := ComboBox1.Text;
IBQuery1.Open;
Except;
End;
end; |
Partager