www.pudn.com > Source.rar > Regroup_Unit.pas, change:2007-02-04,size:3516b


unit Regroup_Unit; 
 
interface 
 
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls, 
  Buttons, ExtCtrls, ComCtrls; 
 
type 
  TRegroup_Frm = class(TForm) 
    OKBtn: TButton; 
    CancelBtn: TButton; 
    GroupBox1: TGroupBox; 
    DULabel: TLabel; 
    Label1: TLabel; 
    Date_du: TDateTimePicker; 
    date_Au: TDateTimePicker; 
    GroupBox2: TGroupBox; 
    Edit1: TEdit; 
    BTlisteClients: TSpeedButton; 
    GroupBox3: TGroupBox; 
    CheckBox1: TCheckBox; 
    choix_piece: TRadioGroup; 
    procedure BTlisteClientsClick(Sender: TObject); 
    procedure OKBtnClick(Sender: TObject); 
    procedure FormActivate(Sender: TObject); 
    procedure FormClose(Sender: TObject; var Action: TCloseAction); 
  private 
    code_client:Integer; 
    { Private declarations } 
  public 
  piece_Grouper:Boolean; 
    { Public declarations } 
  end; 
 
var 
  Regroup_Frm: TRegroup_Frm; 
 
implementation 
 
uses Unit23, Unit3, Unit26, Unit28; 
 
{$R *.dfm} 
 
procedure TRegroup_Frm.BTlisteClientsClick(Sender: TObject); 
begin 
if List_Clients.ShowModal=mrOk then 
  begin 
  data.Clients.FindKey([List_Clients.CodeClient]); 
  edit1.Text:=data.ClientsRaison.Value; 
  code_client:=list_clients.CodeClient; 
  end; 
 
end; 
 
procedure TRegroup_Frm.OKBtnClick(Sender: TObject); 
Var 
Choix_Pce:string; 
begin 
data.L_Ventes.MasterFields:=''; 
 
if choix_piece.ItemIndex=0 Then Choix_Pce:='Facture' Else Choix_Pce:='Avoir'; 
data.L_Ventes.Filter:='(Date>='''+DatetoStr(Date_du.date)+''')And (Date<='''+DateToStr(Date_Au.date)+''') And (Code_Cli='''+InttoStr(code_client)+''') AND (Type='''+Choix_Pce+''')'; 
data.L_Ventes.Filtered:=true; 
Data.CL_Ventes.Open; 
Data.CL_Ventes.First; 
while not data.CL_Ventes.Eof do data.CL_Ventes.Delete; 
//Copier dans CL_Ventes 
data.L_Ventes.First; 
  //-----------Copier ds Cl_ventes 
  while not data.L_Ventes.Eof do 
    BEGIN 
    data.CL_Ventes.AppendRecord([NIL,NIL,NIL,data.L_VentesCode_cli.Value,NIL, 
    data.L_VentesRfrence.Value,data.L_VentesDsignation.Value, 
    data.L_VentesQt.Value,data.L_VentesPrixHT.Value,NIL,NIL,NIL,Data.L_VentesRemis.Value, 
    Data.L_VentesTva.Value,data.L_VentesN_Lot.Value,data.L_VentesDesignation_Lot.Value]); 
    data.L_Ventes.Next; 
    END; 
if choix_piece.ItemIndex=0 Then 
  //Facture 
choix_Ventes.Choix.ItemIndex:=0 
 Else 
 //Avoir 
choix_Ventes.Choix.ItemIndex:=2; 
data.T_Ventes.Append; 
data.Clients.FindKey([code_client]); 
Data.T_VentesCode_cli.Value:=code_client; 
 
//Data.T_Ventes.Edit; 
data.L_Ventes.First; 
data.CL_Ventes.First; 
 
while not data.CL_Ventes.Eof do 
  BEGIN 
  data.L_Ventes.AppendRecord([data.T_Ventescode.Value,Data.T_VentesDate.Value, 
  Data.T_VentesType.Value,data.CL_VentesCode_cli.Value,NIL,data.CL_VentesRfrence.Value,data.CL_VentesDsignation.Value, 
  data.CL_VentesQt.Value,data.CL_VentesPrixHT.Value,NIL,NIL,NIL,Data.CL_VentesRemis.Value, 
  Data.CL_VentesTva.Value, data.CL_VentesN_Lot.Value,data.CL_VentesDesignation_Lot.Value]); 
  data.CL_Ventes.Next; 
  end; 
Data.CT_Ventes.Close; 
data.CL_Ventes.Close; 
//data.C_Reglements.Close; 
data.T_Ventes.Post; 
data.L_Ventes.MasterFields:='code;Type'; 
data.L_Ventes.Filtered:=false; 
data.T_Ventes.EDIT; 
Ventes.ModifierClick(sender); 
 
end; 
 
 
procedure TRegroup_Frm.FormActivate(Sender: TObject); 
begin 
edit1.text:=''; 
piece_Grouper:=True; 
 
 
end; 
 
procedure TRegroup_Frm.FormClose(Sender: TObject; 
  var Action: TCloseAction); 
begin 
piece_Grouper:=FAlse; 
ventes.ClientChange(sender); 
end; 
 
end.