📄 invoicelist.pas
字号:
//--
sqty := 0;
samt := 0;
sListView.Items.BeginUpdate;
FQueryList.Sort(TListSortCompare(@ListSortCompare));
FOnMakeItemCaption := True;
try
for i := 0 to FQueryList.Count-1 do begin
lcP := FQueryList.Items[i];
sqty := sqty + lcp^.QUANTITY;
samt := samt + lcp^.TTL_PRICE;
Item := sListView.Items.Add;
for j := 0 to FColumnCnt-1 do Item.Subitems.Add('');
lcP^.ITEM := Item;
Item.Data := lcP;
MakeItemCaption(sListView,Item);
end;
finally
FOnMakeItemCaption := False;
sListView.Items.EndUpdate;
if sListView.Items.Count > 0 then sListView.TopItem.Selected := True;
lblTotalQty.Caption := '目前记录汇总数量:' + FormatFloat('#,##0.0000',sqty);
lblToalAmount.Caption := '目前记录汇总金额:' + FormatFloat('#,##0.0000',roundTo(samt,-4));
stsBarCnt.Panels[0].Text := '符合条件的记录有:'+ IntToStr(sListView.Items.Count)+' 条';
Screen.Cursor := crDefault;
end;
end;
procedure TfrmInvoiceList.SetListViewColumn(sListView: TGradLineListView);
var
Column: TListColumn;
begin
sListView.Columns.Clear;
FColumnCnt := 0;
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90061,'Invoice NO');
Inc(FColumnCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 6;
Column.Caption := GetMultiLingalMsg(90124,'SerialNum');
Inc(FColumnCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 11;
Column.Caption := GetMultiLingalMsg(32093,'Order Code');
Inc(FColumnCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 12;
Column.Caption := GetMultiLingalMsg(90236,'Issue Paper');
Inc(FColumnCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 12;
Column.Caption := GetMultiLingalMsg(90053,'Paper NO');
Inc(FColumnCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 8;
Column.Caption := GetMultiLingalMsg(90052,'Date');
Inc(FColumnCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 12;
Column.Caption := GetMultiLingalMsg(90063,'Mold Code');
Inc(FColumnCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 12;
Column.Caption := GetMultiLingalMsg(90064, 'Part Code');
Inc(FColumnCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 20;
Column.Caption := GetMultiLingalMsg(90028,'Material Code');
Inc(FColumnCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 20;
Column.Caption := GetMultiLingalMsg(90029,'Material Name');
Inc(FColumnCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 14;
Column.Caption := GetMultiLingalMsg(90031,'Guage');
Inc(FColumnCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 6;
Column.Caption := GetMultiLingalMsg(90032,'Unit Name');
Inc(FColumnCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 8;
Column.Caption := GetMultiLingalMsg(90055,'IN Quantity');
Inc(FColumnCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 8;
Column.Caption := GetMultiLingalMsg(90033,'Unit Price');
Inc(FColumnCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 8;
Column.Caption := GetMultiLingalMsg(70222, 'Process Cost');
Inc(FColumnCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90056,'IN Amount');
Inc(FColumnCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 16;
Column.Caption := '供应商';
Inc(FColumnCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 16;
Column.Caption := '制造商';
Inc(FColumnCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 16;
Column.Alignment := taLeftJustify;
Column.Caption := GetMultiLingalMsg(90065,'Remarks');
Inc(FColumnCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 6;
Column.Caption := '仓库';
Inc(FColumnCnt);
end;
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
procedure TfrmInvoiceList.CreateTabs_ByGroup(rdoIndex: integer; sList: TList; sTab: TTabControl);
var tmpTabIndex: integer;
i,j: integer;
lcp: PINVENTORY;
tmpGroupTitle: variant;
iGroupFind: Boolean;
begin
tmpTabIndex := 0;
sTab.Tabs.Clear;
case TabsCtrlAccount.TabIndex of
0: begin
btnAccount.Caption := GetMultiLingalMsg(90116,'Run Accounted');
PNLList.Caption := GetMultiLingalMsg(90117,'Un-Accounted List');
end;
1: begin
btnAccount.Caption := GetMultiLingalMsg(90119,'Cancel Accounted');
PNLList.Caption := GetMultiLingalMsg(90118,'Accounted List');
end;
end;
for i := 0 to sList.Count - 1 do
begin
lcp := sList[i];
if lcp = nil then continue;
case rdoIndex of
0: tmpGroupTitle := strpas(lcp^.paperno);
1: tmpGroupTitle := dm_inventory.GetShigenName(lcp^.SUP_CD);
2: tmpGroupTitle := strPas(lcp^.invoice_no);
3: tmpGroupTitle := formatDatetime('yy/mm/dd',lcp^.DATE);
4: tmpGroupTitle := dm_inventory.GetOrderNo(lcp^.ODR_RID);
5: tmpGroupTitle := dm_inventory.GetShigenName(lcp^.MAK_CD);
6: tmpGroupTitle := strPas(lcp^.HAT_CODE);
7: tmpGroupTitle := strPas(lcp^.STK_ID);
8: tmpGroupTitle := 'ALL';
end;
//-- 判断是否有找到抬头信息
iGroupFind := false;
for j := 0 to tmpTabIndex - 1 do
begin
try
if tmpGroupTitle = FGroupValue[j] then begin
iGroupFind := true;
break;
end;
except
end;
end;
if not iGroupFind then begin //-- 没找到当前资料的抬头则新增tabs
FGroupValue[tmpTabIndex] := tmpGroupTitle;
inc(tmpTabIndex);
sTab.Tabs.Add(tmpGroupTitle);
end;
end;
//////////////////////////////////////////////
//-- 初始化TabClientData.TabIndex value
if tmpTabIndex >0 then sTab.TabIndex := 0
else sTab.TabIndex := -1;
end;
function TfrmInvoiceList.Set_QueryedList(sList: TList; AccStatus: Integer): TList;
function SetQryCheck(lcP: PINVENTORY): Boolean;
var i: Integer;
WDate: array[0..1] of TDateTime;
begin
Result := True;
//--
WDate[0] := edtFDate.Date;
WDate[1] := edtEDate.Date;
if ((WDate[0] > 2)and(formatdatetime('yy/mm/dd',WDate[0]) > formatdatetime('yy/mm/dd',lcP^.DATE)))or
((WDate[1] > 2)and(formatdatetime('yy/mm/dd',WDate[1]) < formatdatetime('yy/mm/dd',lcP^.DATE)))then begin
Result := False;
Exit;
end;
if lcp^.is_account <> accStatus 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(edtMoldCode.Text)<>'') then
if not (dm_inventory.GetOrderNo(lcp^.ODR_RID) = trim(edtMoldCode.Text)) then begin
result := false;
exit;
end;
if (trim(edtPaperNo.Text)<>'') then
if not (trim(lcp^.Paperno) = trim(edtPaperNo.Text)) then begin
result := false;
exit;
end;
if (trim(edtInvoiceNo.Text)<>'') then
if not (trim(lcp^.invoice_no) = trim(edtInvoiceNo.Text)) then begin
result := false;
exit;
end;
if (trim(edtOrderCode.Text)<>'') then
if not (trim(lcp^.HAT_CODE) = trim(edtOrderCode.Text)) then begin
result := false;
exit;
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 TfrmInvoiceList.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 lcp^.is_account <> TabsCtrlAccount.TabIndex 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(edtPaperNo.Text)<>'') then
if not (trim(lcp^.Paperno) = trim(edtPaperNo.Text)) then begin
result := false;
exit;
end;
if (trim(edtInvoiceNo.Text)<>'') then
if not (trim(lcp^.invoice_no) = trim(edtInvoiceNo.Text)) then begin
result := false;
exit;
end;
if (trim(edtOrderCode.Text)<>'') then
if not (trim(lcp^.HAT_CODE) = trim(edtOrderCode.Text)) then begin
result := false;
exit;
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;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -