📄 invreport.pas
字号:
exit;
end;
if (trim(edtSuplier.Text)<>'') then
if not (IntToStr(lcp^.SUP_CD) = trim(edtSuplier.Text)) then begin
result := false;
exit;
end;
if trim(edtIssPaper.Text)<>'' then
if not(trim(edtIssPaper.Text)=lcp^.ISS_PAPERNO) then begin
result := false;
exit;
end;
if iKind <> 99 then begin
if (lcp^.KIND <> iKind) then begin
result := false;
exit;
end;
end;
end;
var
ix: integer;
lcpA: PINVENTORY;
begin
sList.Clear;
for ix := 0 to FAllRptList.Count - 1 do
begin
lcpA := FAllRptList[ix];
if not SetQryCheck(lcpA) then continue;
sList.Add(lcpA);
end;
result := sList
end;
procedure TfrmReport.Set_QryList_FromTabs(iTab: integer);
function SetQryCheck(lcP: PINVENTORY): Boolean;
var i: Integer;
WDate: array[0..1] of TDateTime;
begin
Result := True;
//--
WDate[0] := strtodatetime(formatdatetime('yyyy/mm/dd',edtFDate.Date)+' 00:00:00');
WDate[1] := strtodatetime(formatdatetime('yyyy/mm/dd',edtEDate.Date)+' 23:59:59');
if ((WDate[0] > 2)and(formatdatetime('yyyy/mm/dd',WDate[0]) > formatdatetime('yyyy/mm/dd',lcP^.DATE)))or
((WDate[1] > 2)and(formatdatetime('yyyy/mm/dd',WDate[1]) < formatdatetime('yyyy/mm/dd',lcP^.DATE)))then begin
Result := False;
Exit;
end;
if trim(edtMatCode.Text)<>'' then
if not(dm_Inventory.GetMaterialRID(trim(edtMatCode.Text))=lcp^.MAT_RID) then begin
result := false;
exit;
end;
if trim(edtMoldID.Text)<>'' then
if NOT(dm_Inventory.GetOrderRID(trim(edtMoldID.Text))=lcp^.ODR_RID) then begin
result := false;
exit;
end;
if trim(edtStkID.Text)<>'' then
if not(lcp^.STK_ID=trim(edtStkID.Text)) then begin
result := false;
exit;
end;
if (trim(edtSuplier.Text)<>'') then
if not (IntToStr(lcp^.SUP_CD) = trim(edtSuplier.Text)) then begin
result := false;
exit;
end;
if trim(edtIssPaper.Text)<>'' then
if not(trim(edtIssPaper.Text)=lcp^.ISS_PAPERNO) then begin
result := false;
exit;
end;
if iKind <> 99 then begin
if (lcp^.KIND <> iKind) then begin
result := false;
exit;
end;
end;
end;
var i,j: integer;
lcP,lcPA: PINVENTORY;
iView: Boolean;
FTmpList: TList;
iBool: Boolean;
begin
if FAllRptList = nil then exit;
if FAllRptList.Count = 0 then exit;
FQueryList.Clear;
FTmpList := TList.Create;
FTmpList.Clear;
for i:=0 to FAllRptList.Count-1 do begin
lcP := FAllRptList.Items[i];
if not SetQryCheck(lcp) then continue;
iView := CheckViewData(lcP, rdoTitle.ItemIndex, TabClientData.TabIndex);
if not iView then Continue;
case rdoReport.itemIndex of
4..7: begin
iBool := false;
for j:=0 to FTmpList.Count-1 do
begin
lcPA := FTmpList[j];
if ((lcpA^.STK_ID=lcp^.STK_ID)and(lcPA^.MAT_RID = lcp^.MAT_RID)and(lcpA^.GUAGE_ID=lcP^.GUAGE_ID)) then begin
lcPA^.QUANTITY := lcPA^.QUANTITY + lcP^.QUANTITY;
lcPA^.TTL_PRICE := lcPA^.TTL_PRICE + lcP^.TTL_PRICE;
iBool := true;
break;
end;
end;
if not iBool then begin
new(lcPA);
ZeroMemory(lcPA, Sizeof(TINVENTORY));
lcPA^.REC_ID := lcP^.REC_ID;
lcPA^.KIND := lcP^.KIND;
lcpA^.STK_ID := lcp^.STK_ID;
lcPA^.MAT_RID := lcp^.MAT_RID;
lcPA^.MAT_NM := lcp^.MAT_NM;
lcpA^.GUAGE_ID := lcp^.GUAGE_ID;
lcPA^.QUANTITY := lcp^.QUANTITY;
lcPA^.TTL_PRICE := lcP^.TTL_PRICE;
FTmpList.Add(lcpA);
FQueryList := FTmpList;
end;
end;
else FQueryList.Add(lcP);
end;
end;
//
end;
Function TfrmReport.CheckViewData(lcP: PINVENTORY; rdoTitleIndex,TabIndex: integer): boolean;
var
TmpV: Variant;
begin
Result := False;
if lcP=Nil then Exit;
if (rdoTitleIndex<0) or (TabIndex<0) then Exit;
if rdoTitleIndex = 11 then
begin
Result:=True;
Exit;
end;
case rdoTitleIndex of
0: TmpV := formatDatetime('yy/mm/dd',lcp^.DATE);
1: TmpV := dm_inventory.GetMaterialCode(lcp^.MAT_RID);
2: TmpV := dm_inventory.Get_Shizai_KubunName(dm_inventory.GetMaterialTypeID(lcp^.MAT_RID));
3: TmpV := strpas(lcp^.paperno);
4: TmpV := dm_inventory.GetOrderNo(lcP^.ODR_RID);
5: TmpV := inttostr(lcp^.SUP_CD);
6: TmpV := inttostr(lcp^.MAK_CD);
7: TmpV := dm_inventory.Get_EmpName(lcp^.recieve_EmpID);
8: TmpV := dm_inventory.Get_EmpName(lcp^.input_empid);
9: begin
case lcp^.KIND of
0: TmpV := dm_inventory.Get_IOIDName(lcp^.Inout_id,1);
1: TmpV := dm_inventory.Get_IOIDName(lcp^.Inout_id,2);
2: TmpV := dm_inventory.Get_IOIDName(lcp^.Inout_id,3);
3: TmpV := dm_inventory.Get_IOIDName(lcp^.Inout_id,4);
4: TmpV := GetMultiLingalMsg(90248,'Balance');
else TmpV := dm_inventory.Get_IOIDName(lcp^.Inout_id,0);
end;
end;
10: TmpV := dm_inventory.GetDepartName_fromEmpID(lcp^.RECIEVE_EMPID);
11: TmpV := 'ALL';
end;
try
if TmPV = FGroupValue[TabIndex] then Result:=True;
except
Result:=False;
end;
end;
procedure TfrmReport.btnQueryClick(Sender: TObject);
begin
if rdoReport.ItemIndex <> -1 then begin
if iKind = 99 then dm_inventory.Read_InventoryRpt(true, FAllRptList,iKind, edtFDate.Date,edtEDate.Date)
else dm_inventory.Read_InventoryRpt(false, FAllRptList,iKind, edtFDate.Date,edtEDate.Date);
Set_QueryedList(FQueryList);
CreateTabs_ByGroup(rdoTitle.ItemIndex,FQueryList);
TabClientDataChange(self);
end
else begin
if rdoManager.ItemIndex <> -1 then begin
case rdoManager.ItemIndex of
0: begin
dm_inventory.Read_InOutStkList(formatdatetime('yyyy/mm/dd',edtFDate.date),formatdatetime('yyyy/mm/dd',edtEDate.date));
TabClientData.Tabs.Clear;
SetListView_InOutStk(0);
end;
else begin
dm_inventory.Read_InOutStkList_Cost(formatdatetime('yyyy/mm/dd',edtFDate.date),formatdatetime('yyyy/mm/dd',edtEDate.date));
TabClientData.Tabs.Clear;
SetListView_InOutStk(1);
end;
end; // end case
end;
end;
////////////////////////////////////
end;
///////////////////////////////////
///////////////////////////////////
procedure TfrmReport.TabClientDataChange(Sender: TObject);
begin
if iKind = 99 then dm_inventory.Read_InventoryRpt(true, FAllRptList,iKind,edtFDate.Date,edtEDate.Date)
else dm_inventory.Read_InventoryRpt(false, FAllRptList,iKind,edtFDate.Date,edtEDate.Date);
Set_QueryedList(FQueryList);
Set_QryList_FromTabs(TabClientData.TabIndex);
SetListView;
if LstViewQry.Items.Count>0 then begin
LstViewQry.ToPItem.Selected := False;
LstViewQry.ToPItem.Selected := True;
end;
end;
procedure TfrmReport.MakeItemCaption(Item: TListItem);
//-- Init int value and '' to 0 value
function IntToStrNull(INum: Integer): string;
begin
if INum = 0 then Result := ''
else Result := IntToStr(INum);
end;
var lcP: PINVENTORY;
begin
if Item = nil then Exit;
if Item.Data = nil then Exit;
lcP := Item.Data;
Item.ImageIndex := lcP^.KIND;
case lcP^.KIND of
0: Item.Caption := GetMultiLingalMsg(90104, 'In');
1: Item.Caption := GetMultiLingalMsg(90105, 'Out');
2: Item.Caption := GetMultiLingalMsg(90098, 'Return');
3: Item.Caption := GetMultiLingalMsg(90099, 'Tune');
4: Item.Caption := GetMultiLingalMsg(90248,'Balance');
else Item.Caption := '';
end;
case FColumnCaptionType of
2: begin
Item.SubItems[00] := lcp^.STK_ID;
Item.SubItems[01] := dm_inventory.GetMaterialCode(lcP^.MAT_RID);
Item.SubItems[02] := lcP^.MAT_NM;
Item.SubItems[03] := dm_inventory.Get_GuageName(lcP^.MAT_RID, lcp^.GUAGE_ID);
Item.SubItems[04] := dm_inventory.GetUnitTypeName(lcP^.MAT_RID);
Item.SubItems[05] := FormatFloat('#,##0.00',abs(lcP^.QUANTITY));
Item.SubItems[06] := FormatFloat('#,##0.00',abs(lcP^.TTL_PRICE));
Item.SubItems[07] := '';
end;
else begin
Item.SubItems[00] := lcp^.STK_ID;
Item.SubItems[01] := lcp^.PAPERNO;
Item.SubItems[02] := formatdatetime('yy/mm/dd',lcP^.DATE);
Item.SubItems[03] := dm_inventory.GetMaterialCode(lcP^.MAT_RID);
Item.SubItems[04] := lcP^.MAT_NM;
if lcp^.KIND = 1 then
Item.SubItems[05] := lcp^.USE_GUAGE
else Item.SubItems[05] := dm_inventory.Get_GuageName(lcP^.MAT_RID, lcp^.GUAGE_ID);
Item.SubItems[06] := dm_inventory.GetUnitTypeName(lcP^.MAT_RID);
if lcp^.KIND = 1 then Item.SubItems[07] := FormatFloat('#,##0.00',abs(lcP^.USE_QUANTITY))
else Item.SubItems[07] := FormatFloat('#,##0.00',abs(lcP^.QUANTITY));
Item.SubItems[08] := FormatFloat('#,##0.00',abs(lcP^.UNT_PRICE));
if lcp^.KIND = 1 then
Item.SubItems[09] := FormatFloat('#,##0.00',abs(lcP^.USE_AMOUNT))
else Item.SubItems[09] := FormatFloat('#,##0.00',abs(UserDecimalDefine(lcP^.TTL_PRICE,2)));
Item.SubItems[10] := dm_inventory.Get_EmpName(lcP^.input_empid);
case lcp^.KIND of
0: Item.SubItems[11] := dm_inventory.Get_IOIDName(lcp^.Inout_id,1);
1: Item.SubItems[11] := dm_inventory.Get_IOIDName(lcp^.Inout_id,2);
2: Item.SubItems[11] := dm_inventory.Get_IOIDName(lcp^.Inout_id,3);
3: Item.SubItems[11] := dm_inventory.Get_IOIDName(lcp^.Inout_id,4);
4: Item.SubItems[11] := GetMultiLingalMsg(90249,'Balance Stock In');
else Item.SubItems[11] := dm_inventory.Get_IOIDName(lcp^.Inout_id,0);
end;
Item.SubItems[12] := dm_inventory.GetOrderNo(lcp^.ODR_RID);
Item.SubItems[13] := dm_inventory.GetPartCode(lcp^.ODR_RID, lcp^.PAT_RID);
Item.SubItems[14] := strpas(lcp^.ISS_PAPERNO);
Item.SubItems[15] := dm_inventory.GetShigenName(lcp^.SUP_CD);
Item.SubItems[16] := dm_inventory.GetShigenName(lcp^.MAK_CD);
Item.SubItems[17] := lcP^.NOTE;
end;
end;
end;
procedure TfrmReport.SetListView;
var i,j: Integer;
lcP: PINVENTORY;
Item: TListItem;
begin
Screen.Cursor := crHourGlass;
with LstViewQry.Items do begin
BeginUpdate;
Clear;
EndUpdate;
end;
SetListViewColumn;
//--
LstViewQry.Items.BeginUpdate;
FQueryList.Sort(TListSortCompare(@ListSortCompare));
FOnMakeItemCaption := True;
try
for i := 0 to FQueryList.Count-1 do begin
lcP := FQueryList.Items[i];
Item := LstViewQry.Items.Add;
for j := 0 to FColumnCnt-1 do Item.Subitems.Add('');
lcP^.ITEM := Item;
Item.Data := lcP;
MakeItemCaption(Item);
end;
finally
FOnMakeItemCaption := False;
LstViewQry.Items.EndUpdate;
if LstViewQry.Items.Count > 0 then LstViewQry.TopItem.Selected := True;
Screen.Cursor := crDefault;
end;
end;
procedure TfrmReport.SetListViewColumn;
var
Column: TListColumn;
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -