📄 frm_allexportbillsearch.pas
字号:
unit Frm_AllExportBillSearch;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Frm_Cargo, XPMenu, ComCtrls, StdCtrls, Buttons, ExtCtrls;
type
TFrmAllExportBillSearch = class(TFrmCargo)
Label10: TLabel;
Label2: TLabel;
Label4: TLabel;
Label6: TLabel;
Label1: TLabel;
Label5: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Panel1: TPanel;
BitBtn2: TBitBtn;
BitBtn1: TBitBtn;
ChkDiscard: TCheckBox;
ChkMain: TRadioButton;
ChkHawb: TRadioButton;
EdtFileNo: TEdit;
ComCusCode: TComboBox;
EdtHAWB: TEdit;
GoDate: TDateTimePicker;
DGoDate: TDateTimePicker;
ComYWY: TComboBox;
ChkFinish: TCheckBox;
ChkNotFinish: TCheckBox;
ComConsign: TComboBox;
EdtCusCodeName: TEdit;
EdtConsignName: TEdit;
EdtBy: TEdit;
ComLoad: TComboBox;
ComAgent: TComboBox;
ComTrustType: TComboBox;
ComTrustSource: TComboBox;
ChkConfirm: TCheckBox;
ChkNotConfirm: TCheckBox;
EdtOper: TEdit;
Comyctrans: TComboBox;
ChkWt: TCheckBox;
ChkCY: TCheckBox;
StartDate: TDateTimePicker;
EndDate: TDateTimePicker;
procedure FormCreate(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FrmAllExportBillSearch: TFrmAllExportBillSearch;
implementation
uses Frm_Main, Frm_AllExportBillInfo;
{$R *.dfm}
procedure TFrmAllExportBillSearch.FormCreate(Sender: TObject);
var
Sqlstr: string;
begin
inherited;
SqlStr :=
'Select CusCode,CusCName From CustomerInfo where CharIndex(''发货人'',CusTypeDesc)>0 ';
FrmMain.Full_FilterCombobox(comcuscode, SqlStr, 'cuscode', 'CusCName');
SqlStr :=
'Select CusCode,CusCName From CustomerInfo where CharIndex(''收货人'',CusTypeDesc)>0 ';
FrmMain.Full_FilterCombobox(comconsign, SqlStr, 'cuscode', 'CusCName');
SqlStr :=
'Select CusCode,CusCName From CustomerInfo where CharIndex(''目的港代理'',CusTypeDesc)>0 ';
FrmMain.Full_FilterCombobox(comAgent, SqlStr, 'cuscode', 'CusCName');
{港口代码}
Sqlstr := 'Select PortCode,PortCName From PortInfo';
FrmMain.Full_FilterCombobox(comload, SQLStr, 'portcode', 'portname');
FrmMain.Full_ComboBox(comYWY, 'BussinessMan', 'code', 'name');
{委托来源}
SqlStr := 'Select CusCode,CusCName From CustomerInfo';
FrmMain.Full_FilterCombobox(Comtrustsource, SqlStr, 'cuscode', 'CusCName');
{委托类型}
FrmMain.Full_ComboBox(comTrusttype, 'TrustTypeInfo', 'Code', 'CName');
GoDate.date := Date;
Dgodate.date := date;
Startdate.date := Date;
EndDate.date := date;
end;
procedure TFrmAllExportBillSearch.BitBtn2Click(Sender: TObject);
var
sTmp:String;
Flag:integer;
i:integer;
SqlText,sqltext1:string;
begin
inherited;
shortDateFormat := 'yyyy-mm-dd';
SQLtext:='select a.Filecode,a.Fileno,a.Maincode,a.filegroup,a.agentcode,a.By1,'+
'a.airportto,a.fdate1,a.dexecdate '+
'from FileTable a '+
'where a.inout=1 '+
' and Substring(a.filecode,1,1)=''K''';
{分单记录查询}
if chkhawb.Checked then
begin
stmp:=trim(edthawb.text);
if sTmp <> '' then
sqltext:=sqltext+' And a.filecode in (select maincode from filetable where hawb like ''%'+sTmp+'%'') ';
Stmp:=trim(edtfileno.text);
if sTmp <> '' then
sqltext:=sqltext+' And a.filecode in (select maincode from filetable where fileno like ''%'+sTmp+'%'') ';
stmp:=edtcuscodename.text;
if sTmp <> '' then
sqltext:=sqltext+' And a.filecode in (select maincode from filetable where cuscodename='''+sTmp+''') ';
stmp:=edtconsignname.text;
if sTmp <> '' then
sqltext:=sqltext+' And a.filecode in (select maincode from filetable where consignname='''+sTmp+''') ';
stmp:=FrmMain.getfieldtext(comload.text);
if sTmp <> '' then
sqltext:=sqltext+' And a.filecode in (select maincode from filetable where airportto='''+sTmp+''') ';
stmp:=FrmMain.getfieldtext(comagent.text);
if sTmp <> '' then
sqltext:=sqltext+' And a.filecode in (select maincode from filetable where agentcode='''+sTmp+''') ';
stmp:=FrmMain.getfieldtext(comywy.text);
if sTmp <> '' then
sqltext:=sqltext+' And a.filecode in (select maincode from filetable where Bussiness='''+sTmp+''') ';
stmp:=edtby.Text;
if sTmp <> '' then
sqltext:=sqltext+' And a.filecode in (select maincode from filetable where by1='''+sTmp+''') ';
stmp:=edtoper.Text;
if sTmp <> '' then
sqltext:=sqltext+' And a.filecode in (select maincode from filetable where operate='''+sTmp+''') ';
stmp:=FrmMain.getfieldtext(comtrustsource.text);
if sTmp <> '' then
sqltext:=sqltext+' And a.filecode in (select maincode from filetable where trustsource='''+sTmp+''') ';
stmp:=FrmMain.getfieldtext(comtrusttype.text);
if sTmp <> '' then
sqltext:=sqltext+' And a.filecode in (select maincode from filetable where trusttype='''+sTmp+''') ';
stmp:=comyctrans.text;
if sTmp <> '' then
begin
if stmp='空空' then
sqltext:=sqltext+' And a.filecode not in (select maincode from filetable where filecode in (select filecode from fileocean)) '
else
sqltext:=sqltext+' And a.filecode in (select maincode from filetable where filecode in (select filecode from fileocean where truckocean='''+sTmp+''')) ';
end;
if chkfinish.Checked and chknotfinish.Checked then
else
begin
if chkfinish.Checked then
sqltext:=sqltext+' And a.filecode in (select maincode from filetable where befinish=1) ';
if chknotfinish.Checked then
sqltext:=sqltext+' And a.filecode in (select maincode from filetable where befinish=0) ';
end;
if chkconfirm.Checked and chknotconfirm.Checked then
else
begin
if chkconfirm.Checked then
sqltext:=sqltext+' And a.filecode in (select maincode from filetable where keydown=1) ';
if chknotconfirm.Checked then
sqltext:=sqltext+' And a.filecode in (select maincode from filetable where keydown=0) ';
end;
if (Chkwt.Checked) and (Chkcy.checked) then
sqltext:=sqltext+' And a.filecode in (select maincode from '+
' filetable where dexecdate>='''+datetimetostr(int(godate.date))+''' '+
' and dexecdate<='''+datetimetostr(int(dgodate.date))+''') '+
' and a.filecode in (select maincode from filetable where fdate1>='''+datetimetostr(int(startdate.date))+''' '+
' and fdate1<='''+datetimetostr(int(enddate.date))+''')'
else
begin
if chkwt.Checked then
sqltext:=sqltext+' And a.filecode in (select maincode from '+
' filetable where dexecdate>='''+datetimetostr(int(godate.date))+''' '+
' and dexecdate<='''+datetimetostr(int(dgodate.date))+''') ';
if chkcy.Checked then
sqltext:=sqltext+' and a.filecode in (select maincode from filetable where fdate1>='''+datetimetostr(int(startdate.date))+''' '+
' and fdate1<='''+datetimetostr(int(enddate.date))+''')';
end;
end;
if chkmain.Checked then
begin {主单记录}
stmp:=trim(edthawb.text);
if sTmp <> '' then
sqltext:=sqltext+' And a.maincode like ''%'+sTmp+'%'' ';
Stmp:=trim(edtfileno.text);
if sTmp <> '' then
sqltext:=sqltext+FrmMain.SetSearchStr('a.fileno',Stmp);
stmp:=edtcuscodename.text;
if sTmp <> '' then
sqltext:=sqltext+' And a.CusCodename='''+sTmp+''' ';
stmp:=edtconsignname.text;
if sTmp <> '' then
sqltext:=sqltext+' And a.consignname='''+sTmp+''' ';
stmp:=FrmMain.getfieldtext(comload.text);
if sTmp <> '' then
sqltext:=sqltext+' And a.airportto='''+sTmp+''' ';
stmp:=FrmMain.getfieldtext(comagent.text);
if sTmp <> '' then
sqltext:=sqltext+' And a.agentcode='''+sTmp+''' ';
stmp:=FrmMain.getfieldtext(comywy.text);
if sTmp <> '' then
sqltext:=sqltext+' And a.Bussiness='''+sTmp+''' ';
stmp:=FrmMain.getfieldtext(comTrustsource.text);
if sTmp <> '' then
sqltext:=sqltext+' And a.trustsource='''+sTmp+''' ';
stmp:=FrmMain.getfieldtext(comTrusttype.text);
if sTmp <> '' then
sqltext:=sqltext+' And a.trusttype='''+sTmp+''' ';
stmp:=edtby.Text;
if sTmp <> '' then
sqltext:=sqltext+' And a.by1='''+sTmp+''' ';
stmp:=edtoper.Text;
if sTmp <> '' then
sqltext:=sqltext+' And a.operate='''+sTmp+''' ';
stmp:=comyctrans.text;
if sTmp <> '' then
begin
if stmp='空空' then
sqltext:=sqltext+' And a.filecode not in (select filecode from fileocean) '
else
sqltext:=sqltext+' And a.filecode in (select filecode from fileocean where truckocean='''+sTmp+''') ';
end;
if chkfinish.Checked and chknotfinish.Checked then
else
begin
if chkfinish.Checked then
sqltext:=sqltext+' And a.befinish=1 ';
if chknotfinish.Checked then
sqltext:=sqltext+' And a.befinish=0 ';
end;
if chkconfirm.Checked and chknotconfirm.Checked then
else
begin
if chkconfirm.Checked then
sqltext:=sqltext+' And a.keydown=1 ';
if chknotconfirm.Checked then
sqltext:=sqltext+' And a.keydown=0 ';
end;
if (chkwt.checked) and (chkcy.checked) then
sqltext:=sqltext+' And a.Dexecdate>='''+datetimetostr(int(godate.date))+''' '+
' and a.Dexecdate<='''+datetimetostr(int(dgodate.date))+''' '+
' And a.fdate1>='''+datetimetostr(int(startdate.date))+''' '+
' and a.fdate1<='''+datetimetostr(int(enddate.date))+''' '
else
begin
if Chkwt.Checked then
sqltext:=sqltext+' And a.Dexecdate>='''+datetimetostr(int(godate.date))+''' '+
' and a.Dexecdate<='''+datetimetostr(int(dgodate.date))+'''';
if Chkcy.Checked then
sqltext:=sqltext+' And a.fdate1>='''+datetimetostr(int(startdate.date))+''' '+
' and a.fdate1<='''+datetimetostr(int(enddate.date))+'''';
end;
end;
FrmAllExportBillInfo.QryTrust.Close;
FrmAllExportBillInfo.QryTrust.sql.text:=sqltext;
FrmAllExportBillInfo.QryTrust.open;
if (FrmAllExportBillInfo.QryTrust.RecordCount=0) then
Begin
ShowMessage('没有符合条件的记录,请继续!');
Exit;
End;
FrmAllExportBillInfo.LV.Items.Clear;
FrmMain.AddData(FrmAllExportBillInfo.lv,FrmAllExportBillInfo.QryTrust);
close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -