📄 inv_undeliveryontime.pas
字号:
finally
FOnMakeItemCaption := False;
ListView.Items.EndUpdate;
if ListView.Items.Count > 0 then ListView.TopItem.Selected := True;
stsBarCnt.Panels[0].Text := '符合条件的记录有:'+ IntToStr(ListView.Items.Count)+' 条';
Screen.Cursor := crDefault;
end;
end;
function TfrmUnDelivery.SetListColumn(sListView: TGradLineListView): Integer;
var
Column: TListColumn;
begin
sListView.Columns.Clear;
FColCnt := 0;
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 9;
Column.Caption := GetMultiLingalMsg(90124,'SerialNum');
Inc(FColCnt);
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90063,'Mold Code');
Inc(FColCnt);
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90064,'Part Code');
Inc(FColCnt);
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 12;
Column.Caption := GetMultiLingalMsg(90028,'Material Code');
Inc(FColCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90029,'Material Name');
Inc(FColCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90031,'Guage Name');
Inc(FColCnt);
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 8;
Column.Caption := GetMultiLingalMsg(90125,'Ordered Man');
Inc(FColCnt);
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 8;
Column.Caption := GetMultiLingalMsg(90126,'Relation Man');
Inc(FColCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 8;
Column.Caption := GetMultiLingalMsg(90057,'Suplier');
Inc(FColCnt);
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 8;
Column.Caption := GetMultiLingalMsg(90058,'Maker');
Inc(FColCnt);
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90127,'Ordered Date');
Inc(FColCnt);
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90120,'Scheduled Delivery');
Inc(FColCnt);
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90033,'Unit Price');
Inc(FColCnt);
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90128,'Ordered Quantity');
Inc(FColCnt);
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90283,'ordered weight');
Inc(FColCnt);
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90129,'Ordered Amount');
Inc(FColCnt);
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90130,'Delivery Quantity');
Inc(FColCnt);
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90131,'Delivery Amount');
Inc(FColCnt);
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90132,'Start Delivery Date');
Inc(FColCnt);
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90133,'End Delivery Date');
Inc(FColCnt);
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90134,'Un-Delivery Quantity');
Inc(FColCnt);
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90284,'Un-Delivery Weight');
Inc(FColCnt);
end;
procedure TfrmUnDelivery.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: PUnDeliveryOnTime;
begin
if Item = nil then Exit;
if Item.Data = nil then Exit;
lcP := Item.Data;
Item.Caption := IntTostr(lcp^.hatchu_id);
Item.SubItems[00] := dm_inventory.GetOrderNo(lcp^.seihin_rec_id);
Item.SubItems[01] := dm_inventory.GetPartCode(lcp^.seihin_rec_id, lcp^.buhin_rec_id);
Item.SubItems[02] := dm_inventory.GetMaterialCode(lcp^.shizai_rec_id);
Item.SubItems[03] := lcp^.shizai_meisho;
Item.SubItems[04] := lcp^.kikaku;
Item.SubItems[05] := IntToStr(lcp^.hatchu_sha);
Item.SubItems[06] := IntToStr(lcp^.irai_sha);
Item.SubItems[07] := IntToStr(lcp^.hatchu_saki);
Item.SubItems[08] := IntToStr(lcp^.maker);
Item.SubItems[09] := formatDatetime('yy/mm/dd',lcp^.tks_shitei);
Item.SubItems[10] := formatDatetime('yy/mm/dd',lcp^.knr_shitei);
Item.SubItems[11] := formatFloat('#,##0.00',lcp^.tanka);
Item.SubItems[12] := formatFloat('#,##0.00',lcp^.suryo);
Item.SubItems[13] := formatFloat('#,##0.00',lcp^.weight);
Item.SubItems[14] := formatFloat('#,##0.00',lcp^.kingaku);
Item.SubItems[15] := formatFloat('#,##0.00',lcp^.deliveried_suryo);
Item.SubItems[16] := formatFloat('#,##0.00',lcp^.deliveried_kingaku);
Item.SubItems[17] := formatDatetime('yy/mm/dd',lcp^.chakushu_bi);
Item.SubItems[18] := formatDatetime('yy/mm/dd',lcp^.kanryo_bi);
Item.SubItems[19] := formatFloat('#,##0.00',lcp^.un_deliveried_suryo);
Item.SubItems[20] := formatFloat('#,##0.00',lcp^.un_deliveried_weight);
end;
//////////////////////////////////////////////////////////////////////////////////
procedure TfrmUnDelivery.tabsGroupChange(Sender: TObject);
var tmpf,tmpe: string;
begin
tmpf := '2000/01/01 00:00:00';
tmpe := formatdatetime('yyyy/mm/dd',edtEDate.Date)+' 23:59:59';
dm_Inventory.Read_UnDeliveryOnTimeInfo(FUnDeliveryList,tmpf,tmpe);
Set_QueryedList(FQueryList);
Set_QryList_FromTabs(rdoGroupBy.ItemIndex, FQueryList);
SetListView;
if ListView.Items.Count>0 then begin
ListView.ToPItem.Selected := False;
ListView.ToPItem.Selected := True;
end;
end;
procedure TfrmUnDelivery.rdoGroupByClick(Sender: TObject);
begin
Read_UnDeliveryInfoList;
end;
procedure TfrmUnDelivery.btnQueryClick(Sender: TObject);
begin
Read_UnDeliveryInfoList;
end;
procedure TfrmUnDelivery.cbxSuplierDropDown(Sender: TObject);
begin
dm_Inventory.Read_SupplyMake_ToCbx(cbxSuplier);
end;
procedure TfrmUnDelivery.cbxSuplierChange(Sender: TObject);
begin
edtSulier.Text := Get_PosBeforeStr(cbxSuplier.Text,'_');
edtSuplierName.Text := Get_PosAfterStr(cbxSuplier.Text,'_');
edtSulier.SetFocus;
end;
procedure TfrmUnDelivery.cbxMatClassDropDown(Sender: TObject);
begin
dm_inventory.Read_shizai_kubunTocbx(cbxMatClass);
end;
procedure TfrmUnDelivery.cbxMatClassChange(Sender: TObject);
begin
edtMatClass.Text := Get_PosBeforeStr(cbxMatClass.Text,'_');
edtMatClassName.Text := Get_PosAfterStr(cbxMatClass.Text,'_');
edtMatClass.SetFocus;
iShiZaiKubun := dm_inventory.GetShiZaiKubunID(trim(edtMatClass.Text));
end;
procedure TfrmUnDelivery.btnCloseClick(Sender: TObject);
begin
close;
end;
procedure TfrmUnDelivery.btnExcelClick(Sender: TObject);
begin
if ListView.Items.Count > 0 then PrintProc;
end;
//////////////////////////////////////////////////////////////////////////////////////
procedure TfrmUnDelivery.PrintProc;
var V: OleVariant;
RecCnt, ColCnt: Integer;
i: Integer;
S: string;
begin
try
V := CreateOleObject('Excel.Application');
except
MessageDlg('Excel Application is Created Error!', mtError, [mbOk], 0);
Exit;
end;
V.Visible := True;
V.WorkBooks.Add;
V.WorkBooks[1].Activate;
V.WorkSheets[1].Activate;
RecCnt := 0; ColCnt := 0;
ClipBoard.asText := CopyToClipBoard(RecCnt, ColCnt);
V.ActiveSheet.PageSetUp.Orientation := xlLandscape; //--
V.ActiveSheet.PageSetUp.PrintTitleRows := '$1:$3'; //--
V.ActiveSheet.PageSetUp.RightHeader := //--
'&9 '+FormatDateTime('yyyy/mm/dd hh:nn', Now) + ' ' + 'Print Date';
V.ActiveSheet.PageSetUp.CenterFooter := '&9&P/&N Page'; //--
V.ActiveSheet.PageSetUp.Order := xlOverThenDown; //--
//--
V.ActiveSheet.PageSetUp.LeftMargin := V.InchesToPoints(15/25.4); // 15mm
V.ActiveSheet.PageSetUp.RightMargin := V.InchesToPoints(15/25.4); // 15mm
V.ActiveSheet.PageSetUp.TopMargin := V.InchesToPoints(15/25.4); // 15mm
V.ActiveSheet.PageSetUp.BottomMargin := V.InchesToPoints(15/25.4); // 15mm
V.ActiveSheet.PageSetUp.HeaderMargin := V.InchesToPoints(10/25.4); // 10mm
V.ActiveSheet.PageSetUp.FooterMargin := V.InchesToPoints(10/25.4); // 10mm
//--
V.ActiveSheet.Cells.Font.Size := 9;
V.ActiveSheet.Cells[1, 1].HorizontalAlignment := xlLeft;
V.ActiveSheet.Cells[1, 1].Font.Size := 20;
V.ActiveSheet.Cells[1, 1].Font.Bold := True;
V.ActiveSheet.Cells[1, 1].Font.Italic := True;
V.ActiveSheet.Rows[3].HorizontalAlignment := xlCenter;
V.ActiveSheet.Rows[3].Font.Size := 11;
V.ActiveSheet.Rows[3].Font.Bold := True;
//--
V.ActiveSheet.Columns[2].NumberFormatLocal := 'yyyy/mm/dd'; //--
V.ActiveSheet.Columns[7].NumberFormatLocal := '#,##0.00'; //--
V.ActiveSheet.Columns[8].NumberFormatLocal := '#,##0.00'; //--
V.ActiveSheet.Columns[9].NumberFormatLocal := '#,##0.00';
//--
S := 'A3:'+Chr(Ord('A')+(ColCnt-1))+IntToStr(RecCnt+3);
V.ActiveSheet.Range[S].Borders[xlDiagonalDown].LineStyle := xlNone;
V.ActiveSheet.Range[S].Borders[xlDiagonalUp].LineStyle := xlNone;
V.ActiveSheet.Range[S].Borders[xlEdgeLeft].LineStyle := xlContinuous;
V.ActiveSheet.Range[S].Borders[xlEdgeLeft].Weight := xlThin;
V.ActiveSheet.Range[S].Borders[xlEdgeLeft].ColorIndex := xlAutomatic;
V.ActiveSheet.Range[S].Borders[xlEdgeTop].LineStyle := xlContinuous;
V.ActiveSheet.Range[S].Borders[xlEdgeTop].Weight := xlThin;
V.ActiveSheet.Range[S].Borders[xlEdgeTop].ColorIndex := xlAutomatic;
V.ActiveSheet.Range[S].Borders[xlEdgeBottom].LineStyle := xlContinuous;
V.ActiveSheet.Range[S].Borders[xlEdgeBottom].Weight := xlThin;
V.ActiveSheet.Range[S].Borders[xlEdgeBottom].ColorIndex := xlAutomatic;
V.ActiveSheet.Range[S].Borders[xlEdgeRight].LineStyle := xlContinuous;
V.ActiveSheet.Range[S].Borders[xlEdgeRight].Weight := xlThin;
V.ActiveSheet.Range[S].Borders[xlEdgeRight].ColorIndex := xlAutomatic;
V.ActiveSheet.Range[S].Borders[xlInsideVertical].LineStyle := xlDot;
V.ActiveSheet.Range[S].Borders[xlInsideVertical].Weight := xlThin;
V.ActiveSheet.Range[S].Borders[xlInsideVertical].ColorIndex := xlAutomatic;
V.ActiveSheet.Range[S].Borders[xlInsideHorizontal].LineStyle := xlDot;
V.ActiveSheet.Range[S].Borders[xlInsideHorizontal].Weight := xlThin;
V.ActiveSheet.Range[S].Borders[xlInsideHorizontal].ColorIndex := xlAutomatic;
S := 'A3:'+Chr(Ord('A')+(ColCnt-1))+'3';
V.ActiveSheet.Range[S].Borders[xlDiagonalDown].LineStyle := xlNone;
V.ActiveSheet.Range[S].Borders[xlDiagonalUp].LineStyle := xlNone;
V.ActiveSheet.Range[S].Borders[xlEdgeLeft].LineStyle := xlContinuous;
V.ActiveSheet.Range[S].Borders[xlEdgeLeft].Weight := xlThin;
V.ActiveSheet.Range[S].Borders[xlEdgeLeft].ColorIndex := xlAutomatic;
V.ActiveSheet.Range[S].Borders[xlEdgeTop].LineStyle := xlContinuous;
V.ActiveSheet.Range[S].Borders[xlEdgeTop].Weight := xlThin;
V.ActiveSheet.Range[S].Borders[xlEdgeTop].ColorIndex := xlAutomatic;
V.ActiveSheet.Range[S].Borders[xlEdgeBottom].LineStyle := xlContinuous;
V.ActiveSheet.Range[S].Borders[xlEdgeBottom].Weight := xlThin;
V.ActiveSheet.Range[S].Borders[xlEdgeBottom].ColorIndex := xlAutomatic;
V.ActiveSheet.Range[S].Borders[xlEdgeRight].LineStyle := xlContinuous;
V.ActiveSheet.Range[S].Borders[xlEdgeRight].Weight := xlThin;
V.ActiveSheet.Range[S].Borders[xlEdgeRight].ColorIndex := xlAutomatic;
//--
V.ActiveSheet.Cells[3, 1].PasteSpecial;
V.ActiveSheet.Cells[3, 1].Select;
//--
V.ActiveSheet.Columns['A:'+Chr(Ord('A')+(ColCnt-1))].EntireColumn.AutoFit;
for i:=1 to ColCnt do
V.ActiveSheet.Columns[i].ColumnWidth :=
V.ActiveSheet.Columns[i].ColumnWidth + 2;
//--
V.ActiveSheet.Cells[1, 1].Value := ' ' + 'report List';
if frmMain.IniData.isExcelPrint then V.Print;
end;
function TfrmUnDelivery.CopyToClipBoard(var RecCnt,ColCnt: Integer): string;
var i, j: Integer;
Buf: string;
begin
RecCnt := 0; ColCnt := 0;
Buf := '';
for i:=0 to FColCnt-1 do begin
Buf := Buf + ListView.Column[i].Caption + #9;
Inc(ColCnt);
end;
Buf := Buf + #13#10;
for i:=0 to ListView.Items.Count-1 do begin
for j:=0 to FColCnt-1 do
if j = 0 then Buf := Buf + Trim(ListView.Items[i].Caption) + #9
else Buf := Buf + Trim(ListView.Items[i].SubItems[j-1]) + #9;
Buf := Buf + #13#10;
Inc(RecCnt);
end;
Result := Buf;
end;
procedure TfrmUnDelivery.SetMultilingual;
begin
self.Caption := GetMultiLingalMsg(90163,'Ordered Un-Delivery List');
rdoGroupBy.Caption := GetMultiLingalMsg(90070,'Group By');
rdoGroupBy.Items[0] := GetMultiLingalMsg(90071,'by Suplier');
rdoGroupBy.Items[1] := GetMultiLingalMsg(90072,'by Mold Code');
rdoGroupBy.Items[2] := GetMultiLingalMsg(90120,'Schedule Delivery');
rdoGroupBy.Items[3] := GetMultiLingalMsg(90075,'by Material Code');
rdoGroupBy.Items[4] := GetMultiLingalMsg(90079,'ALL');
edtSulier.EditLabel.Caption := GetMultiLingalMsg(90057,'Suplier')+' ';
edtMatClass.EditLabel.Caption := GetMultiLingalMsg(90123,'Material Class')+' ';
edtMoldID.EditLabel.Caption := GetMultiLingalMsg(90063,'Mold Code')+' ';
edtMatCode.EditLabel.Caption := GetMultiLingalMsg(90028,'Material Code')+' ';
lblFDate.Caption := GetMultiLingalMsg(90120,'Schedule Delivery')+' ';
btnQuery.Caption := GetMultiLingalMsg(90115,'Filter Query');
btnClose.Caption := GetMultiLingalMsg(90025,'Exit');
end;
procedure TfrmUnDelivery.edtSulierChange(Sender: TObject);
begin
edtSuplierName.Text := dm_inventory.GetShigenName(StrToIntDef(trim(edtSulier.Text),0));
end;
procedure TfrmUnDelivery.edtMatClassChange(Sender: TObject);
begin
edtMatClassName.Text := dm_inventory.Get_Shizai_KubunName2(trim(edtMatClass.Text))
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -