📄 unitinoutdjqry.~pas
字号:
//物料名称
if edtWlmc_4.text<>'' then
begin
strTemp:=strTemp+'(b.Mate_Name='''+trim(edtWlmc_4.text)+''') and';
end;
//规格型号
if edtType_4.text<>'' then
begin
strTemp:=strTemp+'(b.Mate_Type='''+trim(edtType_4.text)+''') and';
end;
//经手人
if edtJsr_4.text<>'' then
begin
strTemp:=strTemp+'(a.TL_Man='''+trim(edtJsr_4.text)+''') and';
end;
//检验人
if edtJyr_4.text<>'' then
begin
strTemp:=strTemp+'(a.Exam_Man='''+trim(edtJyr_4.text)+''') and';
end;
//审批人
if edtAudit_4.text<>'' then
begin
strTemp:=strTemp+'(a.Audit_man='''+trim(edtAudit_4.text)+''') and';
end;
//制单人
if edtZdr_4.text<>'' then
begin
strTemp:=strTemp+'(a.Oper_id='''+trim(edtZdr_4.text)+''') and';
end;
//物料类别
if cbbLb_4.text<>'' then
begin
i:=cbbLb_4.Items.IndexOf(cbbLb_4.text);
if i=-1 then
begin
for j:=0 to high(listLb) do
if listLb[j]=cbbLb_4.text then
begin
i:=j;
break;
end;
end;
if i<>-1 then
begin
strtemp:=strtemp+' (b.Mate_Class='''+listLb[i]+''') and';
end;
end;
//起始日期
str1:=copy(meStart_4.text,1,4); //2003
str2:=copy(meStart_4.text,5,2); //07
str3:=copy(meStart_4.text,7,2); //28
strStart:=trim(str1)+trim(str2)+trim(str3); //2003年07月28日
//截止日期
str1:=copy(meEnd_4.text,1,4); //2003
str2:=copy(meEnd_4.text,5,2); //07
str3:=copy(meEnd_4.text,7,2); //28
strEnd:=trim(str1)+trim(str2)+trim(str3); //2003年07月28日
if (meStart_4.text<>'') and (meEnd_4.text<>'') then //
begin
insert('-',strStart,5);
insert('-',strStart,8);
insert('-',strEnd,5);
insert('-',strEnd,8);
//strtemp:=strtemp+' convert(varchar(10),a.In_Date,21)='''+strStart+''' and';
strtemp:=strtemp+' (convert(varchar(10),a.In_Date,21)>='''+strStart+
''' and convert(varchar(10),a.In_Date,21)<='''+strEnd+''') and '
end
else if meStart_4.text<>'' then
begin
insert('-',strStart,5);
insert('-',strStart,8);
strtemp:=strtemp+' convert(varchar(10),a.In_Date,21)>='''+strStart+''' and';
end
else if meEnd_4.text<>'' then
begin
insert('-',strEnd,5);
insert('-',strEnd,8);
strtemp:=strtemp+' convert(varchar(10),a.In_Date,21)<='''+strEnd+''' and'
end;
//
if (edtRkdh_4.text='') and (edtJhbh_4.text='') and (edtNum_4.text='')
and (edtPrice_4.text='') and (edtTotalPrice_4.text='') and (cbbLb_4.text='')
and (edtWlbm_4.text='') and (edtWlmc_4.text='') and (edtType_4.text='')
and (edtJsr_4.text='') and (edtAudit_4.text='') and (edtJyr_4.text='')
and (meStart_4.text='') and (meEnd_4.text='') then
begin //如果全部为空,就查询所有的资料
//application.messagebox('请至少输入一个查询条件','提示',mb_ok+mb_iconwarning);
//edtRkdh_4.setfocus;
strTemp:=copy(strtemp,1,length(strtemp)-6);
with qry_4 do
begin
close;
sql.clear;
sql.add(strTemp);
open;
end;
lbl_4.Caption:=inttostr(qry_4.RecordCount)+' 条';
end else //查询满足条件的
begin
str:=copy(strtemp,1,length(strtemp)-4);
with qry_4 do
begin
close;
sql.clear;
sql.add(str);
open;
end;
lbl_4.Caption:=inttostr(qry_4.RecordCount)+' 条';
end;
//向退料入库添加内容--------------------------------
clistbox4.clear;
clistbox4.Items:=qry_4.FieldDefList;
for i:=0 to clistbox4.items.Count - 1 do
begin
clistbox4.Checked[i]:=true;
end;
//------
maxlength:=0;
for i:=0 to clistbox4.items.count - 1 do
begin
if maxlength < length(clistbox4.Items.Strings[i]) then
begin
maxlength:=length(clistbox4.Items.Strings[i]);
strmax:=clistbox4.Items.Strings[i];
end;
end;
DC:=getDC(0);
savefont:=selectobject(DC,font.handle);
gettextextentpoint32(DC,pchar(strmax),maxlength,Textsize);
MaxWidth:=Textsize.cx+getsystemmetrics(SM_CXBORDER)*4+50;
selectobject(Dc,savefont);
releaseDC(0,DC);
SendMessage(cListBox2.Handle, LB_SETHORIZONTALEXTENT, MaxWidth, 0);
end;
procedure TfrmInOutDjQry.BitBtnProductOutClick(Sender: TObject);
var
str,strTemp:string;
str1,str2,str3,strStart,strEnd:string;
i,j:integer;
MaxWidth: integer;
DC:HDC;
savefont:Hfont;
Textsize:Tsize;
maxlength:integer;
strmax:string;
begin
if PageControl2.ActivePage=TabSheetProductOut then //成品出库
begin
TabSheetCg_1.TabVisible:=false;
TabSheetZz_1.TabVisible:=false;
TabSheetProductIn_1.TabVisible:=false;
TabSheetTL_1.TabVisible:=false;
TabSheetProductOut_1.TabVisible:=true;
TabSheetLy_1.TabVisible:=false;
TabSheetBf_1.TabVisible:=false;
end;
strTemp:=' select a.Out_Bill as 入库单号,a.Plan_id as 计划编号, '+
' a.Mate_Code as 物料编码,b.Mate_Name as 物料名称, '+
' b.Mate_Type as 规格型号,b.Mate_Class as 物料类别, '+
' a.Cust_id as 客户代码,a.KfNo as 库房,a.KwNo as 库位, '+
' a.Out_Date as 出库日期,a.Out_Type as 出库类别, '+
' a.Out_Amount as 出库数量,a.Out_Price as 单价, '+
' a.Out_Zj as 总价,a.Out_Post as 过帐标志, '+
' a.Out_man 经手人,a.Exam_man as 检验人, '+
' a.Oper_id as 制单人,a.Ck_memo as 备注 '+
' from Mate_Ck a '+
' left outer join Mate_Basic b on a.Mate_Code=b.Mate_Code where' ;
//出库单号
if edtCkdh_5.text<>'' then
begin
strTemp:=strTemp+'(a.Out_Bill='''+trim(edtCkdh_5.text)+''') and ';
end;
//计划编号
if edtJhbh_5.text<>'' then
begin
strTemp:=strTemp+'(a.Plan_id='''+trim(edtJhbh_5.text)+''') and ';
end;
//入库数量
if edtNum_5.text<>'' then
begin
strTemp:=strTemp+'(a.Out_Amount='''+trim(edtNum_5.text)+''') and';
end;
//入库单价
if edtPrice_5.text<>'' then
begin
strTemp:=strTemp+'(a.Out_Price='''+trim(edtPrice_5.text)+''') and';
end;
//入库总价
if edtTotalPrice_5.text<>'' then
begin
strTemp:=strTemp+'(a.Out_Zj='''+trim(edtTotalPrice_5.text)+''') and';
end;
//物料编码
if edtWlbm_5.text<>'' then
begin
strTemp:=strTemp+'(a.Mate_Code='''+trim(edtWlbm_5.text)+''') and';
end;
//物料名称
if edtWlmc_5.text<>'' then
begin
strTemp:=strTemp+'(b.Mate_Name='''+trim(edtWlmc_5.text)+''') and';
end;
//规格型号
if edtType_5.text<>'' then
begin
strTemp:=strTemp+'(b.Mate_Type='''+trim(edtType_5.text)+''') and';
end;
//经手人
if edtJsr_5.text<>'' then
begin
strTemp:=strTemp+'(a.Out_Man='''+trim(edtJsr_5.text)+''') and';
end;
//检验人
if edtJyr_5.text<>'' then
begin
strTemp:=strTemp+'(a.Exam_Man='''+trim(edtJyr_5.text)+''') and';
end;
//制单人
if edtZdr_5.text<>'' then
begin
strTemp:=strTemp+'(a.Oper_id='''+trim(edtZdr_5.text)+''') and';
end;
//物料类别
if cbbLb_5.text<>'' then
begin
i:=cbbLb_5.Items.IndexOf(cbbLb_5.text);
if i=-1 then
begin
for j:=0 to high(listLb) do
if listLb[j]=cbbLb_5.text then
begin
i:=j;
break;
end;
end;
if i<>-1 then
begin
strtemp:=strtemp+' (b.Mate_Class='''+listLb[i]+''') and';
end;
end;
//起始日期
str1:=copy(meStart_1.text,1,4); //2003
str2:=copy(meStart_1.text,5,2); //07
str3:=copy(meStart_1.text,7,2); //28
strStart:=trim(str1)+trim(str2)+trim(str3); //2003年07月28日
//截止日期
str1:=copy(meEnd_5.text,1,4); //2003
str2:=copy(meEnd_5.text,5,2); //07
str3:=copy(meEnd_5.text,7,2); //28
strEnd:=trim(str1)+trim(str2)+trim(str3); //2003年07月28日
if (meStart_5.text<>'') and (meEnd_5.text<>'') then //
begin
insert('-',strStart,5);
insert('-',strStart,8);
insert('-',strEnd,5);
insert('-',strEnd,8);
//strtemp:=strtemp+' convert(varchar(10),a.In_Date,21)='''+strStart+''' and';
strtemp:=strtemp+' (convert(varchar(10),a.In_Date,21)>='''+strStart+
''' and convert(varchar(10),a.In_Date,21)<='''+strEnd+''') and '
end
else if meStart_5.text<>'' then
begin
insert('-',strStart,5);
insert('-',strStart,8);
strtemp:=strtemp+' convert(varchar(10),a.In_Date,21)>='''+strStart+''' and';
end
else if meEnd_5.text<>'' then
begin
insert('-',strEnd,5);
insert('-',strEnd,8);
strtemp:=strtemp+' convert(varchar(10),a.In_Date,21)<='''+strEnd+''' and'
end;
//
if (edtCkdh_5.text='') and (edtJhbh_5.text='') and (edtNum_5.text='')
and (edtPrice_5.text='') and (edtTotalPrice_5.text='') and (cbbLb_5.text='')
and (edtWlbm_5.text='') and (edtWlmc_5.text='') and (edtType_5.text='')
and (edtJsr_5.text='') and (edtZdr_5.text='') and (edtJyr_5.text='')
and (meStart_5.text='') and (meEnd_5.text='') then
begin
//application.messagebox('请至少输入一个查询条件','提示',mb_ok+mb_iconwarning);
//edtCkdh_5.setfocus;
strTemp:=copy(strtemp,1,length(strtemp)-6);
with qry_5 do
begin
close;
sql.clear;
sql.add(strTemp);
open;
end;
lbl_5.Caption:=inttostr(qry_5.RecordCount)+' 条';
end else
begin
str:=copy(strtemp,1,length(strtemp)-4);
with qry_5 do
begin
close;
sql.clear;
sql.add(str);
open;
end;
lbl_5.Caption:=inttostr(qry_5.RecordCount)+' 条';
end;
//向成品出库添加内容--------------------------------
clistbox5.clear;
clistbox5.Items:=qry_5.FieldDefList;
for i:=0 to clistbox5.items.Count - 1 do
begin
clistbox5.Checked[i]:=true;
end;
//------
maxlength:=0;
for i:=0 to clistbox5.items.count - 1 do
begin
if maxlength < length(clistbox5.Items.Strings[i]) then
begin
maxlength:=length(clistbox5.Items.Strings[i]);
strmax:=clistbox5.Items.Strings[i];
end;
end;
DC:=getDC(0);
savefont:=selectobject(DC,font.handle);
gettextextentpoint32(DC,pchar(strmax),maxlength,Textsize);
MaxWidth:=Textsize.cx+getsystemmetrics(SM_CXBORDER)*4+50;
selectobject(Dc,savefont);
releaseDC(0,DC);
SendMessage(cListBox2.Handle, LB_SETHORIZONTALEXTENT, MaxWidth, 0);
end;
procedure TfrmInOutDjQry.BitBtnLyClick(Sender: TObject);
var
str,strTemp:string;
str1,str2,str3,strStart,strEnd:string;
i,j:integer;
MaxWidth: integer;
DC:HDC;
savefont:Hfont;
Textsize:Tsize;
maxlength:integer;
strmax:string;
begin
if PageControl2.ActivePage=TabSheetLy then //领用出库
begin
TabSheetCg_1.TabVisible:=false;
TabSheetZz_1.TabVisible:=false;
TabSheetProductIn_1.TabVisible:=false;
TabSheetTL_1.TabVisible:=false;
TabSheetProductOut_1.TabVisible:=false;
TabSheetLy_1.TabVisible:=true;
TabSheetBf_1.TabVisible:=false;
end;
strTemp:=' select a.Ly_Bill as 领用单号,a.Plan_id as 计划编号, '+
' a.Mate_Code as 物料编码,b.Mate_Name as 物料名称, '+
' b.Mate_Type as 规格型号,b.Mate_Class as 物料类别, '+
' a.Dept_id as 部门,a.KfNo as 库房,KwNo as 库位, '+
' a.Out_Type as 出库类别,a.Out_Date as 出库日期, '+
' a.Out_Amount as 出库数量,a.Out_Price as 单价, '+
' a.Out_Zj as 总价,a.Out_Post as 过帐标志, '+
' a.Out_man as 经手人,a.Checker as 检验人, '+
' a.Oper_id as 制单人,a.Out_Memo as 备注 '+
' from Mate_Ly a '+
' left outer join Mate_Basic b on a.Mate_Code=b.Mate_Code where';
//出库单号
if edtCkdh_6.text<>'' then
begin
strTemp:=strTemp+'(a.Ly_Bill='''+trim(edtCkdh_6.text)+''') and ';
end;
//计划编号
if edtJhbh_6.text<>'' then
begin
strTemp:=strTemp+'(a.Plan_id='''+trim(edtJhbh_6.text)+''') and ';
end;
//出库数量
if edtNum_6.text<>'' then
begin
strTemp:=strTemp+'(a.Out_Amount='''+trim(edtNum_6.text)+''') and';
end;
//出库单价
if edtPrice_6.text<>'' then
begin
strTemp:=strTemp+'(a.Out_Price='''+trim(edtPrice_6.text)+''') and';
end;
//出库总价
if edtTotalPrice_6.text<>'' then
begin
strTemp:=strTemp+'(a.Out_Zj='''+trim(edtTotalPrice_6.text)+''') and';
end;
//物料编码
if edtWlbm_6.text<>'' then
begin
strTemp:=strTemp+'(a.Mate_Code='''+trim(edtWlbm_6.text)+''') and';
end;
//物料名称
if edtWlmc_6.text<>'' then
begin
strTemp:=strTemp+'(b.Mate_Name='''+trim(edtWlmc_6.text)+''') and';
end;
//规格型号
if edtType_6.text<>'' then
begin
strTemp:=strTemp+'(b.Mate_Type='''+trim(edtType_6.text)+''') and';
end;
//经手人
if edtJsr_6.text<>'' then
begin
strTemp:=strTemp+'(a.Out_Man='''+trim(edtJsr_6.text)+''') and';
end;
//检验人
if edtJyr_6.text<>'' then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -