⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cgdtj_unit.pas

📁 餐营的数据核算,模拟入库,出库,库存.对餐营的流程详细叙述
💻 PAS
字号:
unit CGDTJ_Unit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Mask, DBCtrlsEh, TFlatComboBoxUnit, Buttons, DBGridEh,
  DBLookupEh, DB, ADODB;

type
  TCGDTJ_Form = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    DBDateTimeEditEh1: TDBDateTimeEditEh;
    DBDateTimeEditEh2: TDBDateTimeEditEh;
    FlatComboBox1: TFlatComboBox;
    FlatComboBox2: TFlatComboBox;
    FlatComboBox3: TFlatComboBox;
    BitBtn3: TBitBtn;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormDestroy(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  CGDTJ_Form: TCGDTJ_Form;

implementation

uses DMUnit, RPTUnit;

{$R *.dfm}

procedure TCGDTJ_Form.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=cafree;
end;

procedure TCGDTJ_Form.FormDestroy(Sender: TObject);
begin
CGDTJ_FORM:=nil;
end;

procedure TCGDTJ_Form.BitBtn2Click(Sender: TObject);
begin
Close;
end;

procedure TCGDTJ_Form.FormCreate(Sender: TObject);
begin
  with DM.JHM_ADOQ do
  begin
    Close;
    Open;
  end;
  while not DM.JHM_ADOQ.Eof do
  begin
    Flatcombobox1.Items.Add(DM.JHM_ADOQ.FieldByName('CGD_NO').AsString);
    DM.JHM_ADOQ.Next;
  end;
  with DM.CG_ADOQ do
  begin
    Close;
    Open;
  end;
  while not DM.CG_ADOQ.Eof do
  begin
    Flatcombobox2.Items.Add(DM.CG_ADOQ.FieldByName('CG_NAME').AsString);
    DM.CG_ADOQ.Next;
  end;
  with DM.ITEM_ADOQ do
  begin
    Close;
    Open;
  end;
  while not DM.ITEM_ADOQ.Eof do
  begin
    Flatcombobox3.Items.Add(DM.ITEM_ADOQ.FieldByName('ITEM_NAME').AsString);
    DM.ITEM_ADOQ.Next;
  end;
end;

procedure TCGDTJ_Form.BitBtn1Click(Sender: TObject);
var
  S:string;
begin
  S:='SELECT JM.CGD_NO,CG.CG_NAME,JM.CGD_TIME,I.ITEM_NAME,'+
     'JP.ITEM_SORT,JP.ITEM_UNIT,JP.ITEM_PRICE,JP.ITEM_NUM,'+
     'JP.ITEM_MON FROM JH_CGDM JM LEFT JOIN JH_CGDP JP ON '+
     'JM.CGD_NO=JP.CGD_NO LEFT JOIN ITEM_CG CG ON '+
     'CG.CG_ID=JM.CGD_MAN LEFT JOIN ITEM_ITEM I ON '+
     'I.ITEM_ID=JP.ITEM_NO WHERE 2>1';
  if Flatcombobox1.ItemIndex>=0 then
    S:=S+' AND JM.CGD_NO='''+Flatcombobox1.Text+'''';
  if Flatcombobox2.ItemIndex>=0 then
    S:=S+' AND CG.CG_NAME='''+Flatcombobox2.Text+'''';
  if Flatcombobox3.ItemIndex>=0 then
    S:=S+' AND I.ITEM_NAME='''+Flatcombobox3.Text+'''';
  if (Trim(Copy(DBDateTimeEditEh1.Text,0,1))<>'') or (Trim(Copy(DBDateTimeEditEh2.Text,0,1))<>'') then
    S:=S+' AND JM.CGD_TIME>='''+DBDateTimeEditEh1.Text+''' AND JM.CGD_TIME<='''+DBDateTimeEditEh2.Text+'''';
  with DM.CGTJADOQ do
  begin
    Close;
    SQL.clear;
    SQL.add(S);
    Open;
  end;
  RPTDM.CGTJ_Rpt.LoadFromFile(ExtractFilePath(ParamStr(0)) +   'RPT/采购统计单.frf');
  RPTDM.CGTJ_Rpt.ShowReport;
end;

procedure TCGDTJ_Form.BitBtn3Click(Sender: TObject);
begin
  FlatCombobox1.Items.Clear;
  FlatCombobox2.Items.Clear;
  FlatCombobox3.Items.Clear;
  DBDateTimeEditEh1.Clear;
  DBDateTimeEditEh2.Clear;
  with DM.JHM_ADOQ do
  begin
    Close;
    Open;
  end;
  while not DM.JHM_ADOQ.Eof do
  begin
    Flatcombobox1.Items.Add(DM.JHM_ADOQ.FieldByName('CGD_NO').AsString);
    DM.JHM_ADOQ.Next;
  end;
  with DM.CG_ADOQ do
  begin
    Close;
    Open;
  end;
  while not DM.CG_ADOQ.Eof do
  begin
    Flatcombobox2.Items.Add(DM.CG_ADOQ.FieldByName('CG_NAME').AsString);
    DM.CG_ADOQ.Next;
  end;
  with DM.ITEM_ADOQ do
  begin
    Close;
    Open;
  end;
  while not DM.ITEM_ADOQ.Eof do
  begin
    Flatcombobox3.Items.Add(DM.ITEM_ADOQ.FieldByName('ITEM_NAME').AsString);
    DM.ITEM_ADOQ.Next;
  end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -