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


unit Unit15; 
 
interface 
 
uses Windows,Messages, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls, 
  Buttons, ExtCtrls, DBCtrls, Mask,db, ComCtrls, CheckLst, Dialogs, ExtDlgs; 
 
type 
  TN_dossier = class(TForm) 
    Panel1: TPanel; 
    Shape1: TShape; 
    Label12: TLabel; 
    Image1: TImage; 
    Panel2: TPanel; 
    Label1: TLabel; 
    Label2: TLabel; 
    OKBtn: TButton; 
    CancelBtn: TButton; 
    DBEdit1: TDBEdit; 
    DBEdit2: TDBEdit; 
    PageControl1: TPageControl; 
    TabSheet1: TTabSheet; 
    Label3: TLabel; 
    Label4: TLabel; 
    Label5: TLabel; 
    Label6: TLabel; 
    Label7: TLabel; 
    Label16: TLabel; 
    Label17: TLabel; 
    Label8: TLabel; 
    Label11: TLabel; 
    DBEdit3: TDBEdit; 
    DBEdit4: TDBEdit; 
    DBEdit12: TDBEdit; 
    DBEdit13: TDBEdit; 
    DBEdit14: TDBEdit; 
    DBEdit15: TDBEdit; 
    DBEdit16: TDBEdit; 
    DBEdit6: TDBEdit; 
    DBEdit10: TDBEdit; 
    TabSheet2: TTabSheet; 
    Label18: TLabel; 
    Label9: TLabel; 
    DBImage1: TDBImage; 
    BitBtn3: TBitBtn; 
    BitBtn4: TBitBtn; 
    GroupBox2: TGroupBox; 
    Label10: TLabel; 
    Label19: TLabel; 
    Label20: TLabel; 
    DBEdit7: TDBEdit; 
    DBEdit8: TDBEdit; 
    DBEdit9: TDBEdit; 
    OpenPicture: TOpenPictureDialog; 
    procedure OKBtnClick(Sender: TObject); 
    procedure CancelBtnClick(Sender: TObject); 
    procedure FormActivate(Sender: TObject); 
    procedure FormClose(Sender: TObject; var Action: TCloseAction); 
    procedure BitBtn3Click(Sender: TObject); 
    procedure BitBtn4Click(Sender: TObject); 
  private 
    { Private declarations } 
  public 
    { Public declarations } 
  end; 
 
var 
  N_dossier: TN_dossier; 
 
implementation 
 
uses Unit3, Unit36, Unit1, Unit77; 
 
{$R *.DFM} 
 
procedure TN_dossier.OKBtnClick(Sender: TObject); 
 
//Type 
//TMois = set Of ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septebmre','Octobre','Novembre'] ; 
var 
Cible,DataDir,NomAlias:string; 
I:Integer; 
begin 
 
if dbedit1.GetTextLen=0 then Raise Exception.Create('Entrée le Code'); 
data.Dossiers.Post; 
//Traitement_Dossier.Animate1.CommonAVI:=aviCopyFiles; 
data.Dossiers.Edit; 
dataDir:='C:\ges-com\DOSSIER'+data.DossiersCode.Value; 
CreateDir(DataDir); 
NomAlias:='Ges-Com'+data.DossiersCode.Value; 
data.CreationAlias(NomAlias,datadir); 
data.DossiersAliase.Value:=NomAlias; 
Data.DossiersCible.Value:=dataDir; 
data.Dossiers.Post; 
data.setdabaseAlis(data.DossiersAliase.Value); 
 
//Traitement_Dossier.Show; 
//Traitement_Dossier.Update; 
                        /// Création des Base de données 
//******************************  CLIENTS  *********************************** 
//.ProgressBar1.Position:=10; 
//Traitement_Dossier.ProgressBar1.Position:=10; 
//face.Progress. 
 with data.Clients do begin 
    Active := False; 
    TableType := data.Clients.TableType;// ttParadox; 
    TableName := 'Clients'; 
 FieldDefs.Clear; 
    FieldDefs.Add('code_cli', ftFloat, 0, False); 
    FieldDefs.Add('Type', ftString,15 , False); 
    FieldDefs.Add('Raison', ftString, 40, False); 
    FieldDefs.Add('Activite', ftString, 40, False); 
    FieldDefs.Add('Adresse', ftString,50, False); 
    FieldDefs.Add('Ville', ftString, 15, False); 
    FieldDefs.Add('Tel', ftString, 14, False); 
    FieldDefs.Add('Fax', ftString, 14, False); 
    FieldDefs.Add('NRC', ftString, 25, False); 
    FieldDefs.Add('MF', ftString, 25, False); 
    FieldDefs.Add('AI', ftString, 25, False); 
    FieldDefs.Add('Banque', ftString, 20, False); 
    FieldDefs.Add('Adresse_bnq', ftString, 50, False); 
    FieldDefs.Add('N_Compte', ftString, 25, False); 
    FieldDefs.Add('Mode_Reglement', ftString,20, False); 
    FieldDefs.Add('CA',ftCurrency,0, False); 
    FieldDefs.Add('Solde',ftCurrency,0, False); 
    FieldDefs.Add('Reste',ftCurrency,0, False); 
    FieldDefs.Add('mt_verse',ftCurrency,0, False); 
    FieldDefs.Add('Site', ftString, 70, False); 
    FieldDefs.Add('E-mail', ftString, 70, False); 
 IndexDefs.Clear; 
    IndexDefs.Add('', 'Code_Cli', [ixPrimary]); 
 CreateTable; 
 end; 
 //Traitement_Dossier.ProgressBar1.Position:=30; 
 face.Progress.Position:=1; 
//****************************** FOURNISSEURS ********************************* 
 with data.Fournisseurs do begin 
    Active := False; 
    TableType := data.Fournisseurs.TableType; 
    TableName := 'Fournisseurs'; 
 FieldDefs.Clear; 
    FieldDefs.Add('code_FR', ftFloat, 0, False); 
    FieldDefs.Add('Raison', ftString, 30, False); 
    FieldDefs.Add('Adresse', ftstring, 60, False); 
    FieldDefs.Add('Ville', ftString, 15, False); 
    FieldDefs.Add('Payer', ftString, 15, False);     
    FieldDefs.Add('Tel', ftString, 14, False); 
    FieldDefs.Add('Fax', ftString, 15, False); 
    FieldDefs.Add('NRC', ftString, 15, False); 
    FieldDefs.Add('MF', ftString, 15, False); 
    FieldDefs.Add('AI', ftString, 15, False); 
    FieldDefs.Add('Banque', ftString, 15, False); 
    FieldDefs.Add('Mode_Reglement', ftString,20, False); 
    FieldDefs.Add('Adresse_bnq', ftString, 30, False); 
    FieldDefs.Add('N_Compte', ftString, 15, False); 
    FieldDefs.Add('CA',ftCurrency,0, False); 
    FieldDefs.Add('Solde',ftCurrency,0, False); 
    FieldDefs.Add('Reste',ftCurrency,0, False); 
    FieldDefs.Add('mt_verse',ftCurrency,0, False);   
    FieldDefs.Add('Site', ftString, 70, False); 
    FieldDefs.Add('E-mail', ftString, 70, False); 
 IndexDefs.Clear; 
    IndexDefs.Add('', 'Code_FR', [ixPrimary]); 
 CreateTable; 
 end; 
 face.Progress.Position:=2; 
//****************************** Articles ********************************* 
 with data.Articles do begin 
    Active := False; 
    TableType := data.Articles.TableType; 
    TableName := 'Articles'; 
 FieldDefs.Clear; 
    FieldDefs.Add('Référence', ftString,15, False); 
    FieldDefs.Add('Designation', ftString,100, False); 
    FieldDefs.Add('Unite_mesure', ftString, 15, False); 
    FieldDefs.Add('poids', ftfloat, 0, False); 
    FieldDefs.Add('Prix_A', ftCurrency, 0, False); 
    FieldDefs.Add('Code_Tva', ftFloat,0, False); 
    FieldDefs.Add('Taux_Tva', ftFloat,0, False); 
    FieldDefs.Add('Code_Familles', ftFloat,0, False); 
    FieldDefs.Add('Familles', ftString,25, False); 
    FieldDefs.Add('Stock_Reel', ftFloat,0, False); 
    FieldDefs.Add('Stock_Théorique', ftFloat,0, False); 
    FieldDefs.Add('Qte_Mini', ftFloat,0, False); 
    FieldDefs.Add('Qte_Maxi', ftFloat,0, False); 
    FieldDefs.Add('code_locale', ftFloat,0, False); 
    FieldDefs.Add('Locale',ftString,20, False); 
     FieldDefs.Add('TM_client',ftFloat,0, False); 
    FieldDefs.Add('TM_Grossiste',ftfloat,0, False); 
    FieldDefs.Add('TM_revendeur',ftFloat,0, False); 
    FieldDefs.Add('HT_client',ftCurrency,0, False); 
    FieldDefs.Add('HT_Grossiste',ftCurrency,0, False); 
    FieldDefs.Add('HT_revendeur',ftCurrency,0, False); 
    FieldDefs.Add('TTC_client',ftCurrency,0, False); 
    FieldDefs.Add('TTC_Grossiste',ftCurrency,0, False); 
    FieldDefs.Add('TTC_revendeur',ftCurrency,0, False); 
    FieldDefs.Add('Cde_Clients',ftFloat,0, False); 
    FieldDefs.Add('Cde_Fournisseurs',ftFloat,0, False); 
    FieldDefs.Add('Entree',ftFloat,0, False); 
    FieldDefs.Add('Sortie',ftFloat,0, False); 
    FieldDefs.Add('PMP',ftCurrency,0, False); 
    FieldDefs.Add('CodeBar',ftString,40, False); 
    FieldDefs.Add('Qte_Colis',ftFloat,0, False); 
    FieldDefs.Add('Detail',ftMemo,200, False); 
    FieldDefs.Add('Image',ftGraphic,0, False); 
    FieldDefs.Add('Code_FRN',ftFloat,0, False); 
    FieldDefs.Add('Fournisseur',ftString,80, False); 
    FieldDefs.Add('qte_Inv',ftFloat,0, False); 
    FieldDefs.Add('Prix_Total_Entree',ftCurrency,0, False); 
    FieldDefs.Add('Prix_Total_Sortie',ftCurrency,0, False); 
    fielddefs.Add('Date_creation',ftDate,0,false); 
    fielddefs.Add('Mouvementer',ftboolean,0,false); 
    fielddefs.add('Qte_initiale',ftfloat,0,false); 
 IndexDefs.Clear; 
    IndexDefs.Add('', 'Référence',[ixPrimary]); 
 
 CreateTable; 
 end; 
 face.Progress.Position:=3; 
//*******************************************HIS_ARTICLES 
 with data.HIS_ART do begin 
    Active := False; 
    TableType := data.HIS_ART.TableType; 
    TableName := 'His_Art'; 
 FieldDefs.Clear; 
    FieldDefs.Add('reference', ftString, 15, False); 
    FieldDefs.Add('N_piece', ftfloat,0, False); 
    FieldDefs.Add('Type', ftString,10, False); 
    FieldDefs.Add('N_Ligne', ftAutoinc,0, False); 
    fielddefs.Add('Designation',ftstring,80,false); 
    FieldDefs.Add('Raison', ftString,40, False); 
    FieldDefs.Add('DAte', ftDate,0, False); 
    FieldDefs.Add('Qte', ftfloat,0, False); 
    FieldDefs.Add('Prix', ftCurrency,0, False); 
    FieldDefs.Add('Sens', ftString,1, False); 
    FieldDefs.Add('Qte_SRT', ftfloat,0, False); 
    FieldDefs.Add('Val_SRT', ftcurrency,0, False); 
    FieldDefs.Add('Qte_Ent', ftfloat,0, False); 
    FieldDefs.Add('Val_Ent', ftCurrency,0, False);     
 IndexDefs.Clear; 
    IndexDefs.Add('', 'Reference;N_piece;Type', [ixPrimary]); 
 CreateTable; 
 end; 
 face.Progress.Position:=4; 
//*****************************Compsé******************************** 
{ with data.Composer do begin 
    Active := False; 
    TableType := data.Composer.TableType; 
    TableName := 'Composer'; 
 FieldDefs.Clear; 
    FieldDefs.Add('Reference', ftFloat, 0, False); 
    FieldDefs.Add('N_Ligne', ftAutoInc, 0, False); 
    FieldDefs.Add('Code', ftFloat, 0, False); 
    FieldDefs.Add('Designation', ftString, 40, False); 
    FieldDefs.Add('UM', ftString, 40, False); 
    FieldDefs.Add('Info', ftString,60, False); 
    FieldDefs.Add('Qte', ftFloat, 0, False); 
    FieldDefs.Add('decher', ftFloat, 0, False); 
    FieldDefs.Add('Active',ftBoolean,0, False); 
 IndexDefs.Clear; 
    IndexDefs.Add('', 'Reference;N_ligne', [ixPrimary]); 
 CreateTable; 
 end;} 
 
//**************************************************************Matière 1er 
{ with data.Matier_P do begin 
    Active := False; 
    TableType := data.Matier_P.TableType; 
    TableName := 'Martier_P'; 
 FieldDefs.Clear; 
    FieldDefs.Add('Code', ftFloat, 0, False); 
    FieldDefs.Add('Designation', ftString, 80, False); 
    FieldDefs.Add('Code_UM', ftFloat, 0, False); 
    FieldDefs.Add('Code_Tva', ftFloat,0, False); 
    FieldDefs.Add('Taux_Tva', ftFloat,0, False); 
    FieldDefs.Add('Taux_Decher', ftFloat,0, False); 
    FieldDefs.Add('UM', ftString, 80, False); 
    FieldDefs.Add('Qte', ftFloat, 0, False); 
    FieldDefs.Add('Stock_Alert', ftFloat, 0, False); 
    FieldDefs.Add('Decher', ftFloat, 0, False); 
    FieldDefs.Add('PMP',ftCurrency,0, False); 
    FieldDefs.Add('info',ftMemo,200, False); 
    FieldDefs.Add('Qtefabrique',ftFloat,0, False); 
 
 IndexDefs.Clear; 
    IndexDefs.Add('', 'Code', [ixPrimary]); 
 CreateTable; 
 end; 
 } 
 
//**************************************************************Matière 1er 
 
//************************************FAmilles*******************************8 
{ with data.familles do begin 
    Active := False; 
    TableType := data.familles.TableType; 
    TableName := 'Familles'; 
 FieldDefs.Clear; 
    FieldDefs.Add('code', ftfloat,0, False); 
    FieldDefs.Add('Libelle', ftString, 50, False); 
 IndexDefs.Clear; 
    IndexDefs.Add('', 'code', [ixPrimary]); 
 CreateTable; 
 end;} 
//******************************Compteur******************************** 
 with data.Compteur do begin 
    Active := False; 
    TableType := data.Compteur.TableType; 
    TableName := 'Compteur'; 
 FieldDefs.Clear; 
    FieldDefs.Add('Clients', ftFloat, 0, False); 
    FieldDefs.Add('Fournisseurs', ftFloat, 0, False); 
    FieldDefs.Add('Articles', ftFloat, 0, False); 
    FieldDefs.Add('Familles', ftFloat, 0, False); 
//    FieldDefs.Add('Fabrication', ftFloat, 0, False); 
  //  FieldDefs.Add('Casser', ftFloat, 0, False); 
    FieldDefs.Add('Facture', ftFloat, 0, False); 
    FieldDefs.Add('Avoire', ftFloat, 0, False); 
    FieldDefs.Add('Devis', ftFloat, 0, False); 
    FieldDefs.Add('Localisations', ftFloat, 0, False); 
    FieldDefs.Add('Entree', ftFloat, 0, False); 
    FieldDefs.Add('Sortie', ftFloat, 0, False); 
    FieldDefs.Add('Timbre', ftFloat, 0, False); 
    FieldDefs.Add('Taux_Decher', ftFloat, 0, False); 
    FieldDefs.Add('Matier_P', ftFloat, 0, False); 
    FieldDefs.Add('Cdeclient', ftFloat, 0, False); 
    FieldDefs.Add('CdeFournisseurs', ftFloat, 0, False); 
    FieldDefs.Add('FactureFournisseurs', ftFloat, 0, False); 
    FieldDefs.Add('AvoirsFournisseurs', ftFloat, 0, False); 
    FieldDefs.Add('BLFournisseurs', ftFloat, 0, False); 
    FieldDefs.Add('BLclient', ftFloat, 0, False); 
    FieldDefs.Add('Taux de Decher', ftFloat, 0, False); 
    FieldDefs.Add('TVA', ftFloat, 0, False); 
    FieldDefs.Add('Inventaire', ftFloat, 0, False); 
CreateTable; 
 end; 
 face.Progress.Position:=5; 
//*****************************Tva******************************** 
 with data.Tva do begin 
    Active := False; 
    TableType := data.Tva.TableType; 
    TableName := 'Tva'; 
 FieldDefs.Clear; 
    FieldDefs.Add('code', ftFloat, 0, False); 
    FieldDefs.Add('Taux', ftFloat,0, False); 
 IndexDefs.Clear; 
    IndexDefs.Add('', 'Code', [ixPrimary]); 
 CreateTable; 
 end; 
 face.Progress.Position:=6; 
//*****************************Locale******************************** 
{with data.Localisations do begin 
    Active := False; 
    TableType :=data.Localisations.TableType; 
    TableName := 'Localisations'; 
 FieldDefs.Clear; 
    FieldDefs.Add('code', ftFloat, 0, False); 
    FieldDefs.Add('Libelle', ftString,20, False); 
 IndexDefs.Clear; 
    IndexDefs.Add('', 'Code', [ixPrimary]); 
 CreateTable; 
 end;} 
  face.StatusBar1.Visible:=FAlse; 
  face.Panel2.Visible:=True; 
  face.Progress.Max:=19; 
 //******************************Tet_Vente**************************************** 
FOR I:=1 To 2 DO 
BEGIN 
 with data.T_Ventes do begin 
    Active := False; 
    TableType :=data.T_Ventes.TableType; 
    IF I=1 then TableName := 'CT_Ventes' ELSE TableName := 'T_Ventes'; 
 FieldDefs.Clear; 
    FieldDefs.Add('code', ftfloat, 0 ,False); 
    FieldDefs.Add('Type', ftString,20, False); 
    FieldDefs.Add('code_Cli', ftFloat, 0, False); 
    FieldDefs.Add('Raison', ftString,50, False); 
    FieldDefs.Add('Adresse', ftString, 60, False); 
    FieldDefs.Add('Ville', ftString,20, False); 
    FieldDefs.Add('Tel', ftString,14, False); 
    FieldDefs.Add('Fax', ftString,14, False); 
    FieldDefs.Add('NRC', ftString,25, False); 
    FieldDefs.Add('MF', ftString,25, False); 
    FieldDefs.Add('AI', ftString,25, False); 
    FieldDefs.Add('Total_HT',ftCurrency,0, False); 
    FieldDefs.Add('Total_TTC',ftcurrency,0, False); 
    FieldDefs.Add('Frais_Port',ftCurrency,0, False); 
    FieldDefs.Add('Total_Taxe',ftCurrency,0, False); 
    FieldDefs.Add('Escompte',ftCurrency,0, False); 
    FieldDefs.Add('Date',ftdate,0, False); 
    FieldDefs.Add('Echeance',ftDate,0, False); 
    FieldDefs.Add('Remise',ftCurrency,0, False); 
    FieldDefs.Add('Mode de reglement',ftString,15, False); 
    FieldDefs.Add('Timbre',ftCurrency,0, False); 
    FieldDefs.Add('Type_Client',ftString,20, False); 
    FieldDefs.Add('Regler',ftBoolean,0, False); 
    FieldDefs.Add('Transfere',ftBoolean,0, False); 
    FieldDefs.Add('Mt_Régler',ftCurrency,0, False); 
    FieldDefs.Add('Net a Payer',ftCurrency,0, False); 
    FieldDefs.Add('Info',ftMemo,200, False); 
    FieldDefs.Add('N_Lot', ftString, 25, False); 
    FieldDefs.Add('Designation_Lot', ftString, 25, False); 
    FieldDefs.Add('Exo_TVA', ftBoolean,0, False); 
    FieldDefs.Add('Réf payements', ftString,100, False); 
    FieldDefs.Add('Gestion_Stock', ftBoolean,0, False); 
    FieldDefs.Add('Montant_Rest',ftCurrency,0, False); 
 IndexDefs.Clear; 
    IndexDefs.Add('', 'Code;type', [ixPrimary]); 
 CreateTable; 
 END; 
end; 
 face.Progress.Position:=7; 
//********************************L_Ventes****************************************** 
FOR I:=1 TO 2 DO 
BEGIN 
with data.L_Ventes do begin 
    Active := False; 
    TableType :=data.L_Ventes.TableType; 
    IF i=1 THEN TableName := 'CL_Ventes' ELSE TableName := 'L_Ventes'; 
 FieldDefs.Clear; 
    FieldDefs.Add('code', ftfloat, 0, False); 
    FieldDefs.Add('Type', ftString,10, False); 
    FieldDefs.Add('Date', ftDate, 0 ,False); 
    FieldDefs.Add('Code_cli', ftFloat,0, False); 
    FieldDefs.Add('N_Ligne', ftAutoInc,0, False);     
    FieldDefs.Add('Référence', ftString, 15, False); 
    FieldDefs.Add('Désignation', ftString,100, False); 
    FieldDefs.Add('Qté', ftFloat,0, False); 
    FieldDefs.Add('Prix HT',ftCurrency,0, False); 
    FieldDefs.Add('Prix revien',ftCurrency,0, False); 
    FieldDefs.Add('Marge',ftFloat,0, False); 
    FieldDefs.Add('Prix TTC',ftCurrency,0, False); 
    FieldDefs.Add('Total HT',ftCurrency,0, False); 
    FieldDefs.Add('Total TTC',ftCurrency,0, False); 
     FieldDefs.Add('Remis',ftCurrency,0, False); 
    FieldDefs.Add('Tva',ftFloat,0, False); 
    FieldDefs.Add('N_Lot', ftString, 25, False); 
    FieldDefs.Add('Designation_Lot', ftString, 25, False); 
 IndexDefs.Clear; 
    IndexDefs.Add('', 'Code;Type;Date;code_cli;N_Ligne', [ixPrimary]); 
 CreateTable; 
END; 
end; 
 face.Progress.Position:=8; 
//**************************************Règlements************************** 
For I:=1 to 2 do 
BEGIN 
 with data.Reglements do begin 
    Active := False; 
    TableType := data.Reglements.TableType; 
   // If i=1 Then  TableName:='C_Reglements'  ELSE 
    TableName:='Reglements'; 
 FieldDefs.Clear; 
    FieldDefs.Add('code', ftfloat, 0, False); 
    FieldDefs.Add('type', ftString, 10, False); 
    FieldDefs.Add('code_Cli', ftFloat, 0, False); 
    FieldDefs.Add('N_Ligne', ftAutoInc,0, False); 
    FieldDefs.Add('Mode_Reglment', ftString, 20, False); 
    FieldDefs.Add('Date',ftdate,0, False); 
    FieldDefs.Add('Mt_régler',ftCurrency,0, False); 
    FieldDefs.Add('Ref', ftString, 70, False); 
 IndexDefs.Clear; 
    IndexDefs.Add('', 'Code;Type;code_Cli;N_ligne', [ixPrimary]); 
 CreateTable; 
END; 
 end; 
  face.Progress.Position:=9; 
//**************************************Règlements************************** 
for i:=1 to 2 do 
Begin 
 with data.Reg_Achats do begin 
    Active := False; 
    TableType := data.Reg_Achats.TableType; 
    //if i=1 then    TableName := 'C_Reg_Achats' else 
    TableName := 'Reg_Achats' ; 
 FieldDefs.Clear; 
    FieldDefs.Add('code', ftfloat, 0, False); 
    FieldDefs.Add('type', ftString, 10, False); 
    FieldDefs.Add('code_FRN', ftFloat, 0, False); 
    FieldDefs.Add('N_Ligne', ftAutoInc,0, False); 
    FieldDefs.Add('Mode_Reglment', ftString, 20, False); 
    FieldDefs.Add('Date',ftdate,0, False); 
    FieldDefs.Add('Mt_régler',ftCurrency,0, False); 
    FieldDefs.Add('Ref', ftString, 70, False); 
 IndexDefs.Clear; 
    IndexDefs.Add('', 'Code;Type;code_FRN;N_Ligne', [ixPrimary]); 
 CreateTable; 
end; 
 end; 
 face.Progress.Position:=10; 
//**********************************Tete Stock******************************************* 
 
 with data.T_Stock do begin 
    Active := False; 
    TableType :=data.T_Stock.TableType; 
    TableName := 'T_Stock'; 
 FieldDefs.Clear; 
    FieldDefs.Add('code', ftfloat, 0, False); 
    FieldDefs.Add('Type', ftString, 10, False); 
    FieldDefs.Add('code_FRN', ftFloat, 0, False); 
    FieldDefs.Add('Raison', ftString,30, False); 
    FieldDefs.Add('Adresse', ftMemo, 200, False); 
    FieldDefs.Add('Ville', ftString,20, False); 
    FieldDefs.Add('Tel', ftString,14, False); 
    FieldDefs.Add('Fax', ftString,14, False); 
    FieldDefs.Add('NRC', ftString,20, False); 
    FieldDefs.Add('MF', ftString,20, False); 
    FieldDefs.Add('AI', ftString,20, False); 
    FieldDefs.Add('Total HT',ftCurrency,0, False); 
    FieldDefs.Add('Date',ftDate,0, False); 
 IndexDefs.Clear; 
    IndexDefs.Add('', 'Code;Type', [ixPrimary]); 
 CreateTable; 
end; 
 face.Progress.Position:=11; 
//********************************L_Stock****************************************** 
with data.L_Stock do begin 
    Active := False; 
    TableType :=data.L_Stock.TableType; 
    TableName := 'L_Stock'; 
 FieldDefs.Clear; 
    FieldDefs.Add('code', ftfloat, 0, False); 
    FieldDefs.Add('Type', ftString, 10, False); 
    FieldDefs.Add('Date', ftDate,0, False); 
    FieldDefs.Add('N_Ligne', ftAutoInc,0, False); 
    FieldDefs.Add('Reference', ftstring, 15, False); 
    FieldDefs.Add('Designation', ftString,100, False); 
    FieldDefs.Add('Prix HT',ftCurrency,0, False); 
    FieldDefs.Add('Qte', ftFloat,0, False); 
    FieldDefs.Add('Total HT',ftCurrency,0, False); 
 IndexDefs.Clear; 
    IndexDefs.Add('', 'Code;type;Date;N_ligne', [ixPrimary]); 
 CreateTable; 
end; 
 face.Progress.Position:=12; 
//***********FABRICATION*************************************** 
 {with data.T_Fabrication do begin 
    Active := False; 
    TableType :=data.T_Fabrication.TableType; 
    TableName := 'T_Fabrication'; 
 FieldDefs.Clear; 
    FieldDefs.Add('code', ftString, 10, False); 
    FieldDefs.Add('Type', ftString, 20, False); 
    FieldDefs.Add('N_Lot', ftString, 15, False); 
    FieldDefs.Add('Designation', ftString, 15, False); 
    FieldDefs.Add('total_MP', ftFloat, 0, False); 
    FieldDefs.Add('total_PF', ftFloat, 0, False); 
    FieldDefs.Add('total_decher_MP', ftFloat, 0, False); 
    FieldDefs.Add('total_decher_PF', ftFloat, 0, False); 
    FieldDefs.Add('Total HT',ftCurrency,0, False); 
    FieldDefs.Add('Info', ftMemo, 200, False); 
    FieldDefs.Add('Date',ftDate,0, False); 
 IndexDefs.Clear; 
    IndexDefs.Add('', 'Code', [ixPrimary]); 
 CreateTable; 
end; 
//********************************L_Stock****************************************** 
with data.L_Fabrication do begin 
    Active := False; 
    TableType :=data.L_Fabrication.TableType; 
    TableName := 'L_Fabrication'; 
 FieldDefs.Clear; 
    FieldDefs.Add('code', ftString, 10, False); 
    FieldDefs.Add('Date', ftDate,0, False); 
    FieldDefs.Add('Type', ftString,15, False); 
    FieldDefs.Add('N_Ligne', ftAutoInc,0, False); 
    FieldDefs.Add('N_balle', ftFloat, 0, False); 
    FieldDefs.Add('Designation_Balle', ftString,40, False); 
    FieldDefs.Add('Couleur', ftString,15, False); 
    FieldDefs.Add('Qte_Utiluser', ftFloat, 0, False); 
    FieldDefs.Add('Decher_MP', ftFloat, 0, False); 
    FieldDefs.Add('Reference', ftString,15,  False); 
    FieldDefs.Add('Designation', ftString,60, False); 
    FieldDefs.Add('Prix HT',ftCurrency,0, False); 
    FieldDefs.Add('Qte_fabrique', ftFloat,0, False); 
    FieldDefs.Add('decher_PF', ftFloat,0, False); 
    FieldDefs.Add('Total HT',ftCurrency,0, False); 
    FieldDefs.Add('Info', ftString,60, False); 
    FieldDefs.Add('N_Lot', ftString, 15, False); 
    FieldDefs.Add('Designation_Lot', ftString, 25, False); 
    FieldDefs.Add('U_M', ftString,20, False); 
 IndexDefs.Clear; 
    IndexDefs.Add('', 'Code;Date;Type;N_ligne', [ixPrimary]); 
 CreateTable; 
end;} 
 
//*END FABRICATION ******************************************* 
//******************************Tet_Achats **************************************** 
FOR I:=1 To 2 DO 
BEGIN 
 with data.T_Achats do begin 
    Active := False; 
    TableType :=data.T_Achats.TableType; 
    IF I=1 then TableName := 'CT_Achats' ELSE TableName := 'T_Achats'; 
 FieldDefs.Clear; 
    FieldDefs.Add('code', ftfloat, 0 ,False); 
    FieldDefs.Add('Type', ftString,10, False); 
    FieldDefs.Add('code_FRN', ftFloat, 0, False); 
    FieldDefs.Add('Raison', ftString,50, False); 
    FieldDefs.Add('Adresse', ftString, 60, False); 
    FieldDefs.Add('Ville', ftString,20, False); 
    FieldDefs.Add('Tel', ftString,14, False); 
    FieldDefs.Add('Fax', ftString,14, False); 
    FieldDefs.Add('NRC', ftString,25, False); 
    FieldDefs.Add('MF', ftString,25, False); 
    FieldDefs.Add('AI', ftString,25, False); 
    FieldDefs.Add('Total_HT',ftCurrency,0, False); 
    FieldDefs.Add('Total_TTC',ftcurrency,0, False); 
    FieldDefs.Add('Frais_Port',ftCurrency,0, False); 
    FieldDefs.Add('Total_Taxe',ftCurrency,0, False); 
    FieldDefs.Add('Escompte',ftCurrency,0, False); 
    FieldDefs.Add('Date',ftdate,0, False); 
    FieldDefs.Add('Echeance',ftDate,0, False); 
    FieldDefs.Add('Remise',ftCurrency,0, False); 
    FieldDefs.Add('Mode de reglement',ftString,15, False); 
    FieldDefs.Add('Timbre',ftCurrency,0, False); 
    FieldDefs.Add('Type_Client',ftString,20, False); 
    FieldDefs.Add('Regler',ftBoolean,0, False); 
    FieldDefs.Add('Transfere',ftBoolean,0, False); 
    FieldDefs.Add('Mt_Régler',ftCurrency,0, False); 
    FieldDefs.Add('Net a Payer',ftCurrency,0, False); 
    FieldDefs.Add('Exo_TVA', ftBoolean,0, False); 
    FieldDefs.Add('Ref', ftString,100, False); 
    FieldDefs.Add('Gestion_Stock', ftBoolean,0, False); 
    FieldDefs.Add('Montant_Rest',ftCurrency,0, False);         
 IndexDefs.Clear; 
    IndexDefs.Add('', 'Code;Type', [ixPrimary]); 
 CreateTable; 
END 
end; 
 face.Progress.Position:=13; 
//********************************L_Achats****************************************** 
FOR I:=1 TO 2 DO 
BEGIN 
with data.L_Achats do begin 
    Active := False; 
    TableType :=data.L_Achats.TableType; 
    IF i=1 THEN TableName := 'CL_Achats' ELSE TableName := 'L_Achats'; 
 FieldDefs.Clear; 
    FieldDefs.Add('code', ftfloat, 0, False); 
    FieldDefs.Add('Type', ftString,20, False); 
    FieldDefs.Add('Date', ftDate, 0 ,False); 
    FieldDefs.Add('code_frn', ftfloat,0, False); 
    FieldDefs.Add('N_Ligne', ftAutoInc,0, False); 
    FieldDefs.Add('Référence', ftstring, 10, False); 
    FieldDefs.Add('Désignation', ftString,100, False); 
    FieldDefs.Add('Qté', ftFloat,0, False); 
    FieldDefs.Add('Prix HT',ftCurrency,0, False); 
    FieldDefs.Add('Prix revien',ftCurrency,0, False); 
    FieldDefs.Add('Marge',ftFloat,0, False); 
    FieldDefs.Add('Prix TTC',ftCurrency,0, False); 
    FieldDefs.Add('Total HT',ftCurrency,0, False); 
    FieldDefs.Add('Total TTC',ftCurrency,0, False); 
    FieldDefs.Add('Remis',ftCurrency,0, False); 
    FieldDefs.Add('Tva',ftFloat,0, False); 
 IndexDefs.Clear; 
    IndexDefs.Add('', 'Code;type;date;code_frn;N_Ligne', [ixPrimary]); 
 CreateTable; 
END; 
end; 
 face.Progress.Position:=14; 
//***************************Statistique Ventes 
Cible:=DataDir+'\Stat_Ventes.db'; 
Copyfile('C:\ges-Com\Parametre\Statistique.db',PChar(Cible),True); 
 face.Progress.Position:=15; 
//***********************Total CA des Ventes 
with data.CA_Vente do begin 
    Active := False; 
    TableType :=data.CA_Vente.TableType; 
    TableName := 'CA_Ventes'; 
 FieldDefs.Clear; 
    FieldDefs.Add('HT',ftCurrency,0, False); 
    FieldDefs.Add('TTC',ftCurrency,0, False); 
    FieldDefs.Add('Taxe',ftCurrency,0, False); 
    FieldDefs.Add('Clients',ftCurrency,0, False); 
    FieldDefs.Add('Timbre',ftCurrency,0, False); 
 CreateTable; 
END; 
 face.Progress.Position:=16; 
//***************************Statistique DES ACHATS 
 
Cible:=DataDir+'\Stat_Achats.db'; 
Copyfile('C:\Ges-Com\Parametre\Statistique.db',PChar(Cible),True); 
 face.Progress.Position:=17; 
with data.CA_Vente do begin 
    Active := False; 
    TableType :=data.CA_Vente.TableType; 
    TableName := 'CA_Achats'; 
 FieldDefs.Clear; 
    FieldDefs.Add('HT',ftCurrency,0, False); 
    FieldDefs.Add('TTC',ftCurrency,0, False); 
    FieldDefs.Add('Taxe',ftCurrency,0, False); 
    FieldDefs.Add('Clients',ftCurrency,0, False); 
    FieldDefs.Add('Timbre',ftCurrency,0, False); 
 CreateTable; 
END; 
 face.Progress.Position:=18; 
 
//***************************************************************************** 
 
//*************************FIN************************************************* 
//Initialiastion des code 
Data.Compteur.Open; 
data.Compteur.Edit; 
data.CompteurFacture.Value:=1; 
Data.CompteurDevis.Value:=1; 
data.CompteurAvoire.Value:=1; 
data.CompteurEntree.Value:=1; 
data.compteursortie.Value:=1; 
data.CompteurCdeClient.Value:=1; 
data.CompteurBLclient.Value:=1; 
data.CompteurCdeFournisseurs.Value:=1; 
data.CompteurFactureFournisseurs.Value:=1; 
data.CompteurAvoirsFournisseurs.Value:=1; 
data.CompteurBLFournisseurs.Value:=1; 
//data.CompteurInventaire.Value:=1; 
data.Compteur.Post; 
face.Progress.Position:=19; 
face.StatusBar1.Visible:=True; 
face.Panel2.Visible:=FAlse; 
face.Progress.Position:=0; 
 
face.Fermer1Click(Sender); 
Close; 
End; 
procedure TN_dossier.CancelBtnClick(Sender: TObject); 
begin 
data.Dossiers.Cancel; 
close; 
end; 
 
procedure TN_dossier.FormActivate(Sender: TObject); 
begin 
 
Face.activemenu(false); 
Face.StatusBar1.Panels[0].Text:='Dossier -> : '; 
face.DesActiveBouton; 
//face.PageScroller.Visible:=False; 
Data.FermerBase; 
 
end; 
 
procedure TN_dossier.FormClose(Sender: TObject; var Action: TCloseAction); 
begin 
Traitement_Dossier.Close; 
if data.Dossiers.State in [dsedit,dsinsert] Then 
  data.Dossiers.Cancel; 
 
end; 
 
procedure TN_dossier.BitBtn3Click(Sender: TObject); 
begin 
if OpenPicture.Execute then 
data.DossiersLOGO.LoadFromFile(OpenPicture.FileName); 
 
end; 
 
procedure TN_dossier.BitBtn4Click(Sender: TObject); 
begin 
 
data.DossiersLOGO.Clear; 
 
end; 
 
end.