?? matbalain.pas
字號:
procedure TfrmMatBalaIn.SetKomoku(Item: Pointer);
begin
Selected := nil;
if Item <> nil then begin
SetData(Item);
Selected := Item;
end else SetNull;
end;
{**********************************************************************************}
{**********************************************************************************}
procedure TfrmMatBalaIn.btnNewClick(Sender: TObject);
begin
if Selected <> nil then
if ErrorCheck(Selected) = 0 then begin
UpdateCheck;
case MessageDlg(GetMultiLingalMsg(60106, 'confirm Copy Data to New Record!'),
mtConfirmation, mbYesNoCancel, 0) of
mrYes: SetCopy;
mrNo: SetNew(-1);
mrCancel: edtGuageID.SetFocus;
end;
end else edtGuageID.SetFocus;
end;
procedure TfrmMatBalaIn.ckbNewClick(Sender: TObject);
begin
inherited;
edtStkID.SetFocus;
end;
procedure TfrmMatBalaIn.btnSaveClick(Sender: TObject);
var UpdateListList, List: TList;
begin
UpdateListList := GetUpdateListList;
if (UpdateListList.Count>0)then begin
List := UpdateListList[0];
if (List.Count=0) then Exit;
if ErrorCheck(Selected) <> 0 then Exit;
UpdateProc(UpdateListList);
TabControl.Tabs.Clear;
SetNew(-1);
if TabControl.Tabs.Count > 0 then SelectTabIndex(0);
Read_IOChangedList;
end
else begin
TabControl.Tabs.Clear;
SetNew(-1);
if TabControl.Tabs.Count > 0 then SelectTabIndex(0);
Read_IOChangedList;
end;
end;
procedure TfrmMatBalaIn.btnDeleteClick(Sender: TObject);
var lcP: PINVENTORY;
begin
if Selected <> nil then begin
if MessageDlg(GetMultiLingalMsg(60107, 'You Selected one Record to Edit/Cancel Edit this Contonent!'),
mtConfirmation, [mbYes, mbNo], 0) = mrNo then begin
SetCtrlFocusFromIndex(0);
Exit;
end;
lcP := Selected;
if lcP^.REC_ID > 0 then dm_inventory.DeleteDatabase('inventory_sheet', lcP^.REC_ID);
FreeUpdateList(Selected);
DeleteTab(Selected, False);
if TabControl.TabIndex = -1 then Close;
end
else CLOSE;
end;
procedure TfrmMatBalaIn.btnExitClick(Sender: TObject);
begin
//inherited;
CLOSE;
end;
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
procedure TfrmMatBalaIn.Read_IOChangedList;
begin
dm_Inventory.Read_IOHistory(FMatIOList,trim(edtStkID.Text),4,sFDate,sEDate);
Set_QueryedList(FQueryList);
CreateTabs_ByGroup(rdoGroupBy.ItemIndex,FQueryList);
tabsGroupChange(Self);
end;
Function TfrmMatBalaIn.Set_QueryedList(sList: TList): TList;
function SetQryCheck(lcP: PINVENTORY): Boolean;
var i: Integer;
WDate: array[0..1] of TDateTime;
begin
Result := True;
//--
WDate[0] := strtodatetime(formatdatetime('yyyy/mm/dd 00:00',Now));
WDate[1] := strtodatetime(formatdatetime('yyyy/mm/dd 23:59',Now));
if ((WDate[0] > 2) and (WDate[0] > lcP^.DATE))or
((WDate[1] > 2) and (WDate[1] < lcP^.DATE))then begin
Result := False;
Exit;
end;
if (lcp^.KIND <> 4) then begin
result := false;
exit;
end;
end;
var
ix: integer;
lcpA: PINVENTORY;
begin
sList.Clear;
for ix := 0 to FMatIOList.Count - 1 do
begin
lcpA := FMatIOList[ix];
if not SetQryCheck(lcpA) then continue;
sList.Add(lcpA);
end;
result := sList
end;
procedure TfrmMatBalaIn.CreateTabs_ByGroup(rdoIndex: integer; sList: TList);
var tmpTabIndex: integer;
i,j: integer;
lcp: PINVENTORY;
tmpGroupTitle: variant;
iGroupFind: Boolean;
begin
tmpTabIndex := 0;
tabsGroup.Tabs.Clear;
for i := 0 to sList.Count - 1 do
begin
lcp := sList[i];
if lcp = nil then continue;
case rdoIndex of
0: tmpGroupTitle := strpas(lcp^.ISS_PAPERNO);
1: tmpGroupTitle := strPas(lcp^.paperno);
2: tmpGroupTitle := formatDatetime('yy/mm/dd',lcp^.DATE);
3: tmpGroupTitle := dm_inventory.GetMaterialCode(lcp^.MAT_RID);
4: tmpGroupTitle := dm_inventory.Get_EmpName(lcp^.INPUT_EMPID);
5: tmpGroupTitle := GetMultiLingalMsg(90249,'Balance Stock In');
6: tmpGroupTitle := 'ALL';
end;
//-- IF you find title information then iGroupFind := true
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 //-- if you do not find Title Group then New tabs
FGroupValue[tmpTabIndex] := tmpGroupTitle;
inc(tmpTabIndex);
tabsGroup.Tabs.Add(tmpGroupTitle);
end;
end;
//////////////////////////////////////////////
//-- tabsGroup.TabIndex value
if tmpTabIndex >0 then tabsGroup.TabIndex := 0
else tabsGroup.TabIndex := -1;
end;
procedure TfrmMatBalaIn.Set_QryList_FromTabs(iTab: integer; FGroupList: TList);
function SetQryCheck(lcP: PINVENTORY): Boolean;
var i: Integer;
WDate: array[0..1] of TDateTime;
begin
Result := True;
//--
WDate[0] := strtodatetime(formatdatetime('yyyy/mm/dd',Now)+' 00:00:00');
WDate[1] := strtodatetime(formatdatetime('yyyy/mm/dd',Now)+' 23:59:59');
if ((WDate[0] > 2)and(WDate[0] > lcP^.DATE))or
((WDate[1] > 2)and(WDate[1] < lcP^.DATE))then begin
Result := False;
Exit;
end;
if (lcp^.KIND <> 4) then begin
result := false;
exit;
end;
end;
var i,j: integer;
lcP,lcPA: PINVENTORY;
iView: Boolean;
iBool: Boolean;
begin
if FMatIOList = nil then exit;
if FMatIOList.Count = 0 then exit;
FQueryList.Clear;
for i := 0 to FMatIOList.Count-1 do begin
lcP := FMatIOList.Items[i];
if not SetQryCheck(lcp) then continue;
iView := CheckViewData(lcP, rdoGroupBy.ItemIndex, TabsGroup.TabIndex);
if not iView then Continue;
FQueryList.Add(lcP);
end;
end;
Function TfrmMatBalaIn.CheckViewData(lcPA: Pointer; rdoTitleIndex,TabIndex: integer): boolean;
var
TmpV: Variant;
lcp: PINVENTORY;
begin
Result := False;
if lcPA=Nil then Exit;
lcp := LcpA;
if (rdoTitleIndex<0) or (TabIndex<0) then Exit;
if rdoTitleIndex = 6 then
begin
Result:=True;
Exit;
end;
case rdoTitleIndex of
0: TmpV := strpas(lcp^.ISS_PAPERNO);
1: TmpV := strPas(lcp^.paperno);
2: TmpV := formatDatetime('yy/mm/dd',lcp^.DATE);
3: TmpV := dm_inventory.GetMaterialCode(lcp^.MAT_RID);
4: TmpV := dm_inventory.Get_EmpName(lcp^.INPUT_EMPID);
5: TmpV := GetMultiLingalMsg(90249,'Balance Stock In');
6: TmpV := 'ALL';
end;
try
if TmPV = FGroupValue[TabIndex] then Result:=True;
except
Result:=False;
end;
end;
procedure TfrmMatBalaIn.SetListView;
var i,j: Integer;
lcP: PINVENTORY;
Item: TListItem;
begin
Screen.Cursor := crHourGlass;
with ListViewMatIN.Items do begin
BeginUpdate;
Clear;
EndUpdate;
end;
SetListColumn(ListViewMatIN);
//--
ListViewMatIN.Items.BeginUpdate;
//FQueryList.Sort(TListSortCompare(@ListSortCompare));
FOnMakeItemCaption := True;
try
for i := 0 to FQueryList.Count-1 do begin
lcP := FQueryList.Items[i];
Item := ListViewMatIN.Items.Add;
for j := 0 to FColCnt-1 do Item.Subitems.Add('');
lcP^.ITEM := Item;
Item.Data := lcP;
MakeItemCaption(Item);
end;
finally
FOnMakeItemCaption := False;
ListViewMatIN.Items.EndUpdate;
if ListViewMatIN.Items.Count > 0 then ListViewMatIN.TopItem.Selected := True;
Screen.Cursor := crDefault;
end;
end;
function TfrmMatBalaIn.SetListColumn(sListView: TGradLineListView): Integer;
var
Column: TListColumn;
begin
sListView.Columns.Clear;
FColCnt := 0;
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 7;
Column.Caption := GetMultiLingalMsg(90027, 'Stock ID');
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 * 12;
Column.Caption := GetMultiLingalMsg(90029, 'Material Name');
Inc(FColCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 10;
Column.Caption := GetMultiLingalMsg(90089, 'Balance Guage Name');
Inc(FColCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 6;
Column.Caption := GetMultiLingalMsg(90032, 'Unit Name');
Inc(FColCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 7;
Column.Caption := GetMultiLingalMsg(90033, 'Unit Price');
Inc(FColCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 7;
Column.Caption := GetMultiLingalMsg(90250, 'Balance IN Quantity');
Inc(FColCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 9;
Column.Caption := GetMultiLingalMsg(90056, 'IN Amount');
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(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 * 8;
Column.Caption := GetMultiLingalMsg(90292, 'Balance In Date');
Inc(FColCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 12;
Column.Caption := GetMultiLingalMsg(90241,'by Out Paper NO');
Inc(FColCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 12;
Column.Caption := GetMultiLingalMsg(90236,'Issue Paper');
Inc(FColCnt);
//--
Column := sListView.Columns.Add;
Column.Width := sListView.Font.Size * 16;
Column.Caption := GetMultiLingalMsg(90065, 'Remarks');
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -