📄 ckdtj_unit.pas
字号:
unit CKDTJ_Unit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrlsEh, TFlatComboBoxUnit, Buttons;
type
TCKDTJ_Form = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
FlatComboBox1: TFlatComboBox;
FlatComboBox2: TFlatComboBox;
FlatComboBox3: TFlatComboBox;
FlatComboBox4: TFlatComboBox;
DBDateTimeEditEh1: TDBDateTimeEditEh;
DBDateTimeEditEh2: TDBDateTimeEditEh;
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
CKDTJ_Form: TCKDTJ_Form;
implementation
uses DMUnit, RPTUnit;
{$R *.dfm}
procedure TCKDTJ_Form.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=cafree;
end;
procedure TCKDTJ_Form.FormDestroy(Sender: TObject);
begin
CKDTJ_Form:=nil;
end;
procedure TCKDTJ_Form.BitBtn2Click(Sender: TObject);
begin
Close;
end;
procedure TCKDTJ_Form.FormCreate(Sender: TObject);
begin
with DM.CKDM_ADOQ do
begin
Close;
Open;
end;
while not DM.CKDM_ADOQ.Eof do
begin
FlatCombobox1.Items.Add(DM.CKDM_ADOQ.FieldByName('CKD_NO').AsString);
DM.CKDM_ADOQ.Next;
end;
with DM.CG_ADOQ do
begin
Close;
Open;
end;
while not DM.CG_ADOQ.Eof do
begin
FlatCombobox3.Items.Add(DM.CG_ADOQ.FieldByName('CG_NAME').AsString);
DM.CG_ADOQ.Next;
end;
with DM.STOCK_ADOQ do
begin
Close;
Open;
end;
while not DM.STOCK_ADOQ.Eof do
begin
FlatCombobox2.Items.Add(DM.STOCK_ADOQ.FieldBYName('STOCK_NAME').AsString);
DM.STOCK_ADOQ.Next;
end;
with DM.ITEM_ADOQ do
begin
Close;
Open;
end;
while not DM.ITEM_ADOQ.Eof do
begin
FlatComBoBox4.Items.Add(DM.ITEM_ADOQ.FieldByName('ITEM_NAME').AsString);
DM.ITEM_ADOQ.Next;
end;
end;
procedure TCKDTJ_Form.BitBtn1Click(Sender: TObject);
var
S:String;
begin
S:=' SELECT CM.CKD_NO,CM.CKD_TIME,S.STOCK_NAME,CG.CG_NAME,I.ITEM_NAME,CP.ITEM_SORT, '+
'CP.ITEM_UNIT,CP.ITEM_PRICE,CP.ITEM_NUM,CP.ITEM_SHNUM,CP.ITEM_MON FROM CKD_M CM '+
' LEFT JOIN CKD_P CP ON CP.CKD_NO=CM.CKD_NO LEFT JOIN ITEM_ITEM I ON '+
' I.ITEM_ID=CP.ITEM_NO LEFT JOIN ITEM_CG CG ON CG.CG_ID=CM.CKD_MAN '+
' LEFT JOIN ITEM_STOCK S ON S.STOCK_ID=CM.CKD_STOCK WHERE 2>1';
if Flatcombobox1.ItemIndex>=0 then
S:=S+' AND CM.CKD_NO='''+Flatcombobox1.Text+'''';
if FlatCombobox2.ItemIndex>=0 then
S:=S+' AND S.STOCK_NAME='''+Flatcombobox2.Text+'''';
if FlatCombobox3.ItemIndex>=0 then
S:=S+' AND CG.CG_NAME='''+Flatcombobox3.Text+'''';
if FlatCombobox4.ItemIndex>=0 then
S:=S+' AND I.ITEM_NAME='''+Flatcombobox4.Text+'''';
if (Trim(Copy(DBDateTimeEditEh1.Text,0,1))<>'') and (Trim(Copy(DBDateTimeEditEh2.Text,0,1))<>'') then
S:=S+' AND CM.CKD_TIME>='''+DBDateTimeEditEh1.Text+''' AND CM.CKD_TIME<='''+DBDateTimeEditEh2.Text+'''';
with DM.CKDTJADOQ do
begin
Close;
SQL.Clear;
SQL.Add(S);
Open;
end;
RPTDM.CKDTJ_Rpt.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'RPT/出库统计单.frf');
RPTDM.CKDTJ_Rpt.ShowReport;
end;
procedure TCKDTJ_Form.BitBtn3Click(Sender: TObject);
begin
FlatCombobox1.Items.Clear;
FlatCombobox2.Items.Clear;
FlatCombobox3.Items.Clear;
FlatCombobox4.Items.Clear;
DBDateTimeEditEh1.Clear;
DBDateTimeEditEh2.Clear;
with DM.CKDM_ADOQ do
begin
Close;
Open;
end;
while not DM.CKDM_ADOQ.Eof do
begin
FlatCombobox1.Items.Add(DM.CKDM_ADOQ.FieldByName('CKD_NO').AsString);
DM.CKDM_ADOQ.Next;
end;
with DM.CG_ADOQ do
begin
Close;
Open;
end;
while not DM.CG_ADOQ.Eof do
begin
FlatCombobox3.Items.Add(DM.CG_ADOQ.FieldByName('CG_NAME').AsString);
DM.CG_ADOQ.Next;
end;
with DM.STOCK_ADOQ do
begin
Close;
Open;
end;
while not DM.STOCK_ADOQ.Eof do
begin
FlatCombobox2.Items.Add(DM.STOCK_ADOQ.FieldBYName('STOCK_NAME').AsString);
DM.STOCK_ADOQ.Next;
end;
with DM.ITEM_ADOQ do
begin
Close;
Open;
end;
while not DM.ITEM_ADOQ.Eof do
begin
FlatComBoBox4.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 + -