📄 sfc_shiftinoutsumqry_c.pas
字号:
unit Sfc_ShiftInOutSumQry_C;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Condition, Db, AdODB, StdCtrls, Mask, ExtEdit;
Type
TFrm_Sfc_ShiftInOutSumQry_C = Class(TFrm_Base_Condition)
Label1: TLabel;
MEdt_Starttime: TMaskEdit;
MEdt_EndTime: TMaskEdit;
Label2: TLabel;
Label3: TLabel;
Lbl_DeptName: TLabel;
ExtEdt_DeptCode: TExtEdit;
Label4: TLabel;
Label5: TLabel;
Cmbx_MoFinishShift: TComboBox;
procedure btn_okClick(Sender: TObject);
procedure MEdt_EndTimeExit(Sender: TObject);
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Frm_Sfc_ShiftInOutSumQry_C: TFrm_Sfc_ShiftInOutSumQry_C;
implementation
uses Sys_Global;
{$R *.DFM}
procedure TFrm_Sfc_ShiftInOutSumQry_C.btn_okClick(Sender: TObject);
var
Bill,BillLine,ShiftType:String;
begin
inherited;
if Param1='Out' then
begin
Bill:='InvOutBill';
BillLine:='InvOutBillLine';
end
else if Param1='In' then
begin
Bill:='InvInBill';
BillLine:='InvInBillLine';
end;
if Cmbx_MoFinishShift.Text='全部汇总' then
begin
Condition:='Select '+BillLine+'.ItemCode'
+',Item.ItemName'
+','' '' as ShiftType'
+','+BillLine+'.ItemCode+'' ''+Item.ItemName As ItemCodeName'
+',Uom.UomName'
+',Sum('+BillLine+'.InvBillQty) As InvBillQty'
+' From '+BillLine
+' Join '+Bill+' On '+BillLine+'.InvBillId='+Bill+'.InvBillId'
+' Join Item On '+BillLine+'.ItemCode=Item.ItemCode'
+' Join Uom On Item.UomCode=Uom.UomCode'
+' Where '+Bill+'.InvBillWHChck=1'
+' And '+Bill+'.DeptCode='''+ExtEdt_DeptCode.Text+''''
+' And '+Bill+'.InvBillDate>='''+MEdt_Starttime.Text+''''
+' And '+Bill+'.InvBillDate<='''+MEdt_EndTime.Text+''''
+ShiftType
+' Group By '+BillLine+'.ItemCode,Item.ItemName,Uom.UomName';
end
else
begin
if Cmbx_MoFinishShift.Text='全部' then
ShiftType:=''
else
ShiftType:=' And '+Bill+'.ShiftType='''+Cmbx_MoFinishShift.Text+'''';
Condition:='Select '+BillLine+'.ItemCode'
+',Item.ItemName'
+','+BillLine+'.ItemCode+'' ''+Item.ItemName As ItemCodeName'
+',Uom.UomName'
+','+Bill+'.ShiftType'
+',Sum('+BillLine+'.InvBillQty) As InvBillQty'
+' From '+BillLine
+' Join '+Bill+' On '+BillLine+'.InvBillId='+Bill+'.InvBillId'
+' Join Item On '+BillLine+'.ItemCode=Item.ItemCode'
+' Join Uom On Item.UomCode=Uom.UomCode'
+' Where '+Bill+'.InvBillWHChck=1'
+' And '+Bill+'.DeptCode='''+ExtEdt_DeptCode.Text+''''
+' And '+Bill+'.InvBillDate>='''+MEdt_Starttime.Text+''''
+' And '+Bill+'.InvBillDate<='''+MEdt_EndTime.Text+''''
+ShiftType
+' Group By '+BillLine+'.ItemCode,Item.ItemName,Uom.UomName,'+Bill+'.ShiftType';
end;
ConditionHint:='部门: '+ExtEdt_DeptCode.Text+' '+Lbl_DeptName.Caption
+'/班别:'+Cmbx_MoFinishShift.Text+'/日期: '+MEdt_Starttime.Text+' 到 '
+MEdt_EndTime.Text;
ModalResult:=mrOk;
end;
procedure TFrm_Sfc_ShiftInOutSumQry_C.MEdt_EndTimeExit(Sender: TObject);
begin
inherited;
DateCheck(Sender);
if StrToDateTime(MEdt_Starttime.Text)>StrToDateTime(MEdt_EndTime.Text) then
begin
DispInfo('查询终止日期不能小于起始日期!',3);
TWinControl(Sender).SetFocus;
Abort;
end;
end;
procedure TFrm_Sfc_ShiftInOutSumQry_C.FormActivate(Sender: TObject);
begin
inherited;
if Cmbx_MoFinishShift.Items.Count=0 then
begin
InitShiftCmBx(AdoQry_tmp,Cmbx_MoFinishShift,False);
Cmbx_MoFinishShift.Items.Insert(0,'全部');
Cmbx_MoFinishShift.Items.Insert(0,'全部汇总');
Cmbx_MoFinishShift.ItemIndex:=1;
MEdt_Starttime.Text:=FormatDateTime('yyyy.mm',Now)+'.01';
MEdt_EndTime.Text:=FormatDateTime('yyyy.mm.dd',Now);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -