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


unit Unit25; 
 
interface 
 
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls, 
  Buttons, ExtCtrls, Grids, DBGrids, DB; 
 
type 
  Tlist_Articles = class(TForm) 
    OKBtn: TButton; 
    CancelBtn: TButton; 
    DBGrid1: TDBGrid; 
    Edit1: TEdit; 
    Label1: TLabel; 
    Image2: TImage; 
    ch: TRadioGroup; 
    DB_Lst_FRN: TSpeedButton; 
    Edit2: TEdit; 
    CheckBox: TCheckBox; 
    procedure NouveauClick(Sender: TObject); 
    procedure Edit1Change(Sender: TObject); 
    procedure FormClose(Sender: TObject; var Action: TCloseAction); 
    procedure Button1Click(Sender: TObject); 
    procedure OKBtnClick(Sender: TObject); 
//    procedure CancelBtnClick(Sender: TObject); 
    procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; 
      DataCol: Integer; Column: TColumn; State: TGridDrawState); 
    procedure DB_Lst_FRNClick(Sender: TObject); 
    procedure FormActivate(Sender: TObject); 
  private 
    { Private declarations } 
  public 
  Recher:Variant;code_fourni:integer;  
    { Public declarations } 
  end; 
 
var 
  list_Articles: Tlist_Articles; 
 
implementation 
//Initialization; 
 
uses Unit3, Unit9, Unit24; 
 
{$R *.dfm} 
 
procedure Tlist_Articles.NouveauClick(Sender: TObject); 
begin 
data.Articles.Append; 
Sai_articles.Showmodal; 
end; 
 
procedure Tlist_Articles.Edit1Change(Sender: TObject); 
VAR 
leFiltre:String; 
begin 
//if  edit2.GetTextLen=0 Then RAise Exception.Create('Choisir un Fournisser'); 
leFiltre:=''; 
 if CheckBox.Checked=False THEN 
   begin 
      case Ch.ItemIndex Of 
      0:leFiltre:='[Référence]='''+Edit1.Text+'*'''; 
      1:leFiltre:='Designation='''+Edit1.Text+'*'''; 
      end; 
    end; 
 if CheckBox.Checked=True THEN 
  Begin 
      IF (edit1.GetTextLen<>0) then 
        BEGIN 
         case Ch.ItemIndex Of 
          0:leFiltre:='[Référence]='''+Edit1.Text+'*'' AND Code_FRN='''+IntToStr(code_fourni)+'''' ; 
          1:leFiltre:='Designation='''+Edit1.Text+'*'' AND Code_FRN='''+IntToStr(code_fourni)+'''' ; 
         end; 
        End 
      ELSE 
         leFiltre:='Code_FRN='''+IntToStr(code_fourni)+'''' ; 
   end; 
 
      DATA.Articles.Filter:=leFiltre; 
      data.Articles.Filtered:=true; 
 
IF(edit1.GetTextLen=0) AND (CheckBox.Checked=False) then Data.Articles.Filtered:=false; 
    //end 
    //else 
//    Data.Articles.Filtered:=false; 
end; 
 
procedure Tlist_Articles.FormClose(Sender: TObject; 
  var Action: TCloseAction); 
begin 
Data.Articles.Filtered:=false; 
edit1.Text:=''; 
end; 
 
procedure Tlist_Articles.Button1Click(Sender: TObject); 
begin 
data.Articles.Edit; 
Sai_articles.Showmodal; 
 
end; 
 
procedure Tlist_Articles.OKBtnClick(Sender: TObject); 
begin 
  Recher:=data.ArticlesRfrence.Value; 
end; 
procedure Tlist_Articles.DBGrid1DrawColumnCell(Sender: TObject; 
  const Rect: TRect; DataCol: Integer; Column: TColumn; 
  State: TGridDrawState); 
begin 
if not ( gdFocused in State ) then 
  begin 
  if Data.articlesStock_Reel.Value<=Data.articlesQte_Mini.Value then 
        Dbgrid1.Canvas.Font.Color := clred 
    else 
//        Dbgrid1.Canvas.Brush.Color := clblack; 
        Dbgrid1.Canvas.Font.Color:=clblack; 
     Dbgrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State); 
  end; 
 
end; 
 
 
procedure Tlist_Articles.DB_Lst_FRNClick(Sender: TObject); 
begin 
if List_Fournisseurs.showmodal=mrOk Then 
begin 
  code_fourni:=List_Fournisseurs.code_FRN; 
//  Label2.Caption:=List_Fournisseurs.code_FRN; 
edit2.Text:=List_Fournisseurs.Fourni; 
    //data.FournisseursRaison.Value; 
  list_Articles.Edit1Change(Sender); 
end;   
end; 
 
procedure Tlist_Articles.FormActivate(Sender: TObject); 
begin 
Edit1Change(Sender); 
end; 
 
end.