📄 invhisreport.~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 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 TfrmHisReport.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(90249,'Balance stock in');
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 TfrmHisReport.btnQueryClick(Sender: TObject);
begin
if rdoReport.ItemIndex <> -1 then begin
if iKind = 99 then dm_inventory.Read_InventoryHisRpt(true, FAllRptList,iKind)
else dm_inventory.Read_InventoryHisRpt(false, FAllRptList,iKind);
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 TfrmHisReport.TabClientDataChange(Sender: TObject);
begin
if iKind = 99 then dm_inventory.Read_InventoryHisRpt(true, FAllRptList,iKind)
else dm_inventory.Read_InventoryHisRpt(false, FAllRptList,iKind);
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 TfrmHisReport.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] := dm_inventory.GetMaterialCode(lcP^.MAT_RID);
Item.SubItems[02] := lcP^.MAT_NM;
if lcp^.KIND = 1 then
Item.SubItems[03] := lcp^.USE_GUAGE
else Item.SubItems[03] := lcp^.USE_GUAGE;
Item.SubItems[04] := dm_inventory.GetUnitTypeName(lcP^.MAT_RID);
if lcp^.KIND = 1 then Item.SubItems[05] := FormatFloat('#,##0.00',abs(lcP^.USE_QUANTITY))
else Item.SubItems[05] := FormatFloat('#,##0.00',abs(lcP^.QUANTITY));
Item.SubItems[06] := FormatFloat('#,##0.00',abs(lcP^.UNT_PRICE));
if lcp^.KIND = 1 then
Item.SubItems[07] := FormatFloat('#,##0.00',abs(lcP^.USE_AMOUNT))
else Item.SubItems[07] := FormatFloat('#,##0.00',abs(lcP^.TTL_PRICE));
Item.SubItems[08] := dm_inventory.Get_EmpName(lcP^.input_empid);
Item.SubItems[09] := lcP^.PaperNo;
case lcp^.KIND of
0: Item.SubItems[10] := dm_inventory.Get_IOIDName(lcp^.Inout_id,1);
1: Item.SubItems[10] := dm_inventory.Get_IOIDName(lcp^.Inout_id,2);
2: Item.SubItems[10] := dm_inventory.Get_IOIDName(lcp^.Inout_id,3);
3: Item.SubItems[10] := dm_inventory.Get_IOIDName(lcp^.Inout_id,4);
4: Item.SubItems[10] := GetMultiLingalMsg(90249,'Balance stock in');
else Item.SubItems[10] := dm_inventory.Get_IOIDName(lcp^.Inout_id,0);
end;
Item.SubItems[11] := formatdatetime('yy/mm/dd',lcP^.DATE);
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] := lcP^.NOTE;
end;
end;
end;
procedure TfrmHisReport.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 TfrmHisReport.SetListViewColumn;
var
Column: TListColumn;
begin
LstViewQry.Columns.Clear;
FColumnCnt := 0;
case FColumnCaptionType of
2: begin
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 8;
Column.Caption := GetMultiLingalMsg(90094,'Kind');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 7;
Column.Caption := GetMultiLingalMsg(90027,'Stock ID');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90028,'Material Code');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 12;
Column.Caption := GetMultiLingalMsg(90029,'Material Name');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90031,'Guage Name');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 6;
Column.Alignment := taLeftJustify;
Column.Caption := GetMultiLingalMsg(90032,'Unit Name');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 8;
Column.Alignment := taRightJustify;
Column.Caption := GetMultiLingalMsg(90149,'Total Quantity');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90150,'Total Amount');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 16;
Column.Alignment := taRightJustify;
Column.Caption := GetMultiLingalMsg(90065,'Remarks');
Inc(FColumnCnt);
end;
else begin
//--
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 8;
Column.Caption := GetMultiLingalMsg(90094,'Kind');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 7;
Column.Caption := GetMultiLingalMsg(90027,'Stock ID');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90028,'Material Code');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 12;
Column.Caption := GetMultiLingalMsg(90029,'Material Name');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90031,'Guage Name');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 6;
Column.Alignment := taLeftJustify;
Column.Caption := GetMultiLingalMsg(90032,'Unit Name');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 8;
Column.Alignment := taRightJustify;
Column.Caption := GetMultiLingalMsg(90095,'Quantity');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 8;
Column.Caption := GetMultiLingalMsg(90033,'Unit Price');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 10;
Column.Alignment := taRightJustify;
Column.Caption := GetMultiLingalMsg(90150,'Total Amount');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 8;
Column.Caption := GetMultiLingalMsg(90247,'Manager Man');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 12;
Column.Alignment := taRightJustify;
Column.Caption := GetMultiLingalMsg(90246,'Manager Paper');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 8;
Column.Alignment := taRightJustify;
Column.Caption := GetMultiLingalMsg(90097,'Manager Type');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 8;
Column.Caption := GetMultiLingalMsg(90052,'Date');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 8;
Column.Caption := GetMultiLingalMsg(90063,'Mold Code');
Inc(FColumnCnt);
//--
Column := LstViewQry.Columns.Add;
Column.Width := LstViewQry.Font.Size * 8;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -