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

📄 lcrkdtj_unit.~pas

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

interface

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

type
  TLCRKDTJ_Form = class(TForm)
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    FlatComboBox1: TFlatComboBox;
    FlatComboBox2: TFlatComboBox;
    FlatComboBox3: TFlatComboBox;
    FlatComboBox4: TFlatComboBox;
    FlatComboBox5: TFlatComboBox;
    DBDateTimeEditEh1: TDBDateTimeEditEh;
    DBDateTimeEditEh2: TDBDateTimeEditEh;
    BitBtn3: TBitBtn;
    Label8: TLabel;
    FlatComboBox6: TFlatComboBox;
    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
  LCRKDTJ_Form: TLCRKDTJ_Form;

implementation

uses DMUnit, RPTUnit;

{$R *.dfm}

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

procedure TLCRKDTJ_Form.FormDestroy(Sender: TObject);
begin
LCRKDTJ_Form:=nil;
end;

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

procedure TLCRKDTJ_Form.FormCreate(Sender: TObject);
begin
  with DM.LCRKDM_ADOQ do
  begin
    Close;
    Open;
  end;
  while not DM.LCRKDM_ADOQ.Eof do
  begin
    FlatCombobox1.Items.Add(DM.LCRKDM_ADOQ.FieldByName('LCRKD_NO').AsString);
    DM.LCRKDM_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.LCBASE_ADOQ do
  begin
    Close;
    Open;
  end;
  while not DM.LCBASE_ADOQ.Eof do
  begin
    Flatcombobox3.Items.Add(DM.LCBASE_ADOQ.FieldByName('LC_NAME').AsString);
    DM.LCBASE_ADOQ.Next;
  end;
  with DM.LCROAD_ADOQ do
  begin
    Close;
    OPen;
  end;
  while not DM.LCROAD_ADOQ.Eof do
  begin
    FlatCombobox4.Items.Add(DM.LCROAD_ADOQ.FieldByName('LCROAD_NAME').AsString);
    DM.LCROAD_ADOQ.Next;
  end;
  with DM.LCITEM_ADOQ do
  begin
    Close;
    Open;
  end;
  while not DM.LCITEM_ADOQ.Eof do
  begin
    FlatComBoBox5.Items.Add(DM.LCITEM_ADOQ.FieldByName('ITEM_NAME').AsString);
    DM.LCITEM_ADOQ.Next;
  end;
  with DM.CLASS_ADOQ do
  begin
    Close;
    OPen;
  end;
  while not DM.CLASS_ADOQ.Eof do
  begin
    FlatCombobox6.Items.Add(DM.CLASS_ADOQ.FieldByName('CLASS_NAME').AsString);
    DM.CLASS_ADOQ.Next;
  end;
end;

procedure TLCRKDTJ_Form.BitBtn1Click(Sender: TObject);
var
 S:String;
begin
  S:='SELECT LM.LCRKD_NO,CG.CG_NAME,LM.LCRKD_TIME,LB.LC_NAME,C.CLASS_NAME, '+
     'LR.LCROAD_NAME,LCI.ITEM_NAME,LP.LCRKD_SORT,LP.LCRKD_UNIT, '+
     'LP.LCRKD_PRICE,LP.LCRKD_NUM,LP.LCRKD_MON FROM LCRKD_M LM '+
     'LEFT JOIN LCRKD_P LP ON LM.LCRKD_NO=LP.LCRKD_NO '+
     'LEFT JOIN ITEM_CG CG ON CG.CG_ID=LM.LCRKD_MAN '+
     'LEFT JOIN LCBASE LB ON LM.LCRKD_CARNO=LB.LC_NO '+
     'LEFT JOIN LCITEM_ITEM LCI ON LP.LCRKD_ITEMNO=LCI.ITEM_NO '+
     'LEFT JOIN LCROAD_ITEM LR ON LR.LCROAD_NO=LM.LCRKD_ROAD '+
     'LEFT JOIN CLASS_ITEM C ON LM.LCRKD_BZ=C.CLASS_ID WHERE 2>1 ';
  if FlatComBoBox1.ItemIndex>=0 then
    S:=S+' AND LM.LCRKD_NO='''+FlatComBoBox1.Text+'''';
  if Flatcombobox2.ItemIndex>=0 then
    S:=S+' AND CG.CG_NAME='''+FlatComBoBox2.Text+'''';
  if Flatcombobox3.ItemIndex>=0 then
    S:=S+' AND LB.LC_NAME='''+FlatComBoBox3.Text+'''';
  if Flatcombobox4.ItemIndex>=0 then
    S:=S+' AND LR.LCROAD_NAME='''+FlatComBoBox4.Text+'''';
  if Flatcombobox5.ItemIndex>=0 then
    S:=S+' AND LCI.ITEM_NAME='''+FlatComBoBox5.Text+'''';
  if Flatcombobox6.ItemIndex>=0 then
    S:=S+' AND C.CLASS_NAME='''+FlatComBoBox6.Text+'''';
  if (Trim(Copy(DBDateTimeEditEh1.Text,0,1))<>'') and (Trim(Copy(DBDateTimeEditEh2.Text,0,1))<>'') then
    S:=S+' AND LM.LCRKD_TIME>='''+DBDateTimeEditEh1.Text+''' AND LM.LCRKD_TIME<='''+DBDateTimeEditEh2.Text+'''';
  with DM.LCRKDTJ_ADOQ do
  begin
    Close;
    SQL.Clear;
    SQL.Add(S);
    OPen;
  end;
  RPTDM.LCRKDTJ_Rpt.LoadFromFile(ExtractFilePath(ParamStr(0)) +   'RPT/列车入库统计单.frf');
  RPTDM.LCRKDTJ_Rpt.DesignReport;//.ShowReport;
end;

procedure TLCRKDTJ_Form.BitBtn3Click(Sender: TObject);
begin
  FlatCombobox1.Items.Clear;
  FlatCombobox2.Items.Clear;
  FlatCombobox3.Items.Clear;
  FlatCombobox4.Items.Clear;
  FlatCombobox5.Items.Clear;
  FlatCombobox6.Items.Clear;
  DBDateTimeEditEh1.Clear;
  DBDateTimeEditEh2.Clear;
  with DM.LCRKDM_ADOQ do
  begin
    Close;
    Open;
  end;
  while not DM.LCRKDM_ADOQ.Eof do
  begin
    FlatCombobox1.Items.Add(DM.LCRKDM_ADOQ.FieldByName('LCRKD_NO').AsString);
    DM.LCRKDM_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.LCBASE_ADOQ do
  begin
    Close;
    Open;
  end;
  while not DM.LCBASE_ADOQ.Eof do
  begin
    Flatcombobox3.Items.Add(DM.LCBASE_ADOQ.FieldByName('LC_NAME').AsString);
    DM.LCBASE_ADOQ.Next;
  end;
  with DM.LCROAD_ADOQ do
  begin
    Close;
    OPen;
  end;
  while not DM.LCROAD_ADOQ.Eof do
  begin
    FlatCombobox4.Items.Add(DM.LCROAD_ADOQ.FieldByName('LCROAD_NAME').AsString);
    DM.LCROAD_ADOQ.Next;
  end;
  with DM.LCITEM_ADOQ do
  begin
    Close;
    Open;
  end;
  while not DM.LCITEM_ADOQ.Eof do
  begin
    FlatComBoBox5.Items.Add(DM.LCITEM_ADOQ.FieldByName('ITEM_NAME').AsString);
    DM.LCITEM_ADOQ.Next;
  end;
  with DM.CLASS_ADOQ do
  begin
    Close;
    OPen;
  end;
  while not DM.CLASS_ADOQ.Eof do
  begin
    FlatCombobox6.Items.Add(DM.CLASS_ADOQ.FieldByName('CLASS_NAME').AsString);
    DM.CLASS_ADOQ.Next;
  end;
end;

end.

⌨️ 快捷键说明

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