📄 invhistory.pas
字号:
edtOrderSerial.ReadOnly := true;
edtMoldID.ReadOnly := true;
edtPartID.ReadOnly := true;
edtSuplierCode.ReadOnly := true;
edtMakerCode.ReadOnly := true;
edtMatOutID.ReadOnly := true;
edtRecEmpID.ReadOnly := true;
edtInputEmpID.ReadOnly := true;
edtInvoiceNo.ReadOnly := true;
edtIssPaper.ReadOnly := true;
edtHatCode.ReadOnly := true;
edtSequalNo.ReadOnly := true;
edtNote.ReadOnly := true;
btnReturnGoods.Enabled := false;
btnTune.Enabled := true;
btnCopy.Enabled := false;
btnDelete.Enabled := false;
end
else begin
case iKind of
0: begin
edtStkID.ReadOnly := iBool;
edtDate.ReadOnly := iBool;
edtPaperNo.ReadOnly := iBool;
edtCode.ReadOnly := iBool;
edtName.ReadOnly := iBool;
edtIssGuageID.ReadOnly := iBool;
edtUPrice.ReadOnly := iBool;
edtQuantity.ReadOnly := iBool;
edtMakePrice.ReadOnly := iBool;
edtUseGuageName.ReadOnly := true;
edtUseQuantity.ReadOnly := true;
edtOrderSerial.ReadOnly := iBool;
edtMoldID.ReadOnly := iBool;
edtPartID.ReadOnly := iBool;
edtSuplierCode.ReadOnly := iBool;
edtMakerCode.ReadOnly := iBool;
edtMatOutID.ReadOnly := iBool;
edtRecEmpID.ReadOnly := true;
edtInputEmpID.ReadOnly := iBool;
edtInvoiceNo.ReadOnly := iBool;
edtIssPaper.ReadOnly := iBool;
edtHatCode.ReadOnly := iBool;
edtSequalNo.ReadOnly := iBool;
edtNote.ReadOnly := iBool;
if (frmMain.FLoginUserPrivilege.rtnmana_func=1) then
begin
btnTune.Enabled := true;
btnCopy.Enabled := false;
btnDelete.Enabled := true;
btnReturnGoods.Enabled := true;
end
else begin
btnCopy.Enabled := false;
btnDelete.Enabled := false;
btnReturnGoods.Enabled := false;
btnTune.Enabled := false;
end;
end;
1: begin
edtStkID.ReadOnly := iBool;
edtDate.ReadOnly := iBool;
edtPaperNo.ReadOnly := iBool;
edtCode.ReadOnly := iBool;
edtName.ReadOnly := iBool;
edtIssGuageID.ReadOnly := iBool;
edtUPrice.ReadOnly := iBool;
edtQuantity.ReadOnly := iBool;
edtUseGuageName.ReadOnly := iBool;
edtUseQuantity.ReadOnly := iBool;
edtOrderSerial.ReadOnly := iBool;
edtMoldID.ReadOnly := iBool;
edtPartID.ReadOnly := iBool;
edtSuplierCode.ReadOnly := iBool;
edtMakerCode.ReadOnly := iBool;
edtMatOutID.ReadOnly := iBool;
edtRecEmpID.ReadOnly := iBool;
edtInputEmpID.ReadOnly := iBool;
edtInvoiceNo.ReadOnly := iBool;
edtIssPaper.ReadOnly := iBool;
edtHatCode.ReadOnly := iBool;
edtSequalNo.ReadOnly := iBool;
edtNote.ReadOnly := iBool;
if (frmMain.FLoginUserPrivilege.rtnmana_func=1) then
begin
btnCopy.Enabled := false;
btnDelete.Enabled := true;
btnReturnGoods.Enabled := false;
btnTune.Enabled := true;
end
else begin
btnCopy.Enabled := false;
btnDelete.Enabled := false;
btnReturnGoods.Enabled := false;
btnTune.Enabled := false;
end;
end;
2: begin
edtStkID.ReadOnly := iBool;
edtDate.ReadOnly := iBool;
edtPaperNo.ReadOnly := iBool;
edtCode.ReadOnly := iBool;
edtName.ReadOnly := iBool;
edtIssGuageID.ReadOnly := iBool;
edtUPrice.ReadOnly := iBool;
edtQuantity.ReadOnly := iBool;
edtMakePrice.ReadOnly := iBool;
edtUseGuageName.ReadOnly := true;
edtUseQuantity.ReadOnly := true;
edtOrderSerial.ReadOnly := iBool;
edtMoldID.ReadOnly := iBool;
edtPartID.ReadOnly := iBool;
edtSuplierCode.ReadOnly := iBool;
edtMakerCode.ReadOnly := iBool;
edtMatOutID.ReadOnly := iBool;
edtRecEmpID.ReadOnly := true;
edtInputEmpID.ReadOnly := iBool;
edtInvoiceNo.ReadOnly := iBool;
edtIssPaper.ReadOnly := iBool;
edtHatCode.ReadOnly := iBool;
edtSequalNo.ReadOnly := iBool;
edtNote.ReadOnly := iBool;
if (frmMain.FLoginUserPrivilege.rtnmana_func=1) then
begin
btnCopy.Enabled := false;
btnDelete.Enabled := true;
btnReturnGoods.Enabled := false;
btnTune.Enabled := true;
end
else begin
btnCopy.Enabled := false;
btnDelete.Enabled := false;
btnReturnGoods.Enabled := false;
btnTune.Enabled := false;
end;
end;
3: begin
edtStkID.ReadOnly := true;
edtDate.ReadOnly := true;
edtPaperNo.ReadOnly := true;
edtCode.ReadOnly := true;
edtName.ReadOnly := true;
edtIssGuageID.ReadOnly := true;
edtUPrice.ReadOnly := true;
edtQuantity.ReadOnly := true;
edtMakePrice.ReadOnly := true;
edtUseGuageName.ReadOnly := true;
edtUseQuantity.ReadOnly := true;
edtOrderSerial.ReadOnly := true;
edtMoldID.ReadOnly := true;
edtPartID.ReadOnly := true;
edtSuplierCode.ReadOnly := true;
edtMakerCode.ReadOnly := true;
edtMatOutID.ReadOnly := true;
edtRecEmpID.ReadOnly := true;
edtInputEmpID.ReadOnly := true;
edtInvoiceNo.ReadOnly := true;
edtIssPaper.ReadOnly := true;
edtHatCode.ReadOnly := true;
edtSequalNo.ReadOnly := true;
edtNote.ReadOnly := true;
if (frmMain.FLoginUserPrivilege.rtnmana_func=1) then
begin
btnCopy.Enabled := false;
btnDelete.Enabled := true;
btnReturnGoods.Enabled := false;
btnTune.Enabled := true;
end
else begin
btnCopy.Enabled := false;
btnDelete.Enabled := false;
btnReturnGoods.Enabled := false;
btnTune.Enabled := false;
end;
end;
4: begin
edtStkID.ReadOnly := iBool;
edtDate.ReadOnly := iBool;
edtPaperNo.ReadOnly := iBool;
edtCode.ReadOnly := iBool;
edtName.ReadOnly := iBool;
edtIssGuageID.ReadOnly := iBool;
edtUPrice.ReadOnly := iBool;
edtQuantity.ReadOnly := iBool;
edtMakePrice.ReadOnly := iBool;
edtUseGuageName.ReadOnly := true;
edtUseQuantity.ReadOnly := true;
edtOrderSerial.ReadOnly := iBool;
edtMoldID.ReadOnly := iBool;
edtPartID.ReadOnly := iBool;
edtSuplierCode.ReadOnly := iBool;
edtMakerCode.ReadOnly := iBool;
edtMatOutID.ReadOnly := true;
edtRecEmpID.ReadOnly := true;
edtInputEmpID.ReadOnly := iBool;
edtInvoiceNo.ReadOnly := iBool;
edtIssPaper.ReadOnly := iBool;
edtHatCode.ReadOnly := iBool;
edtSequalNo.ReadOnly := iBool;
edtNote.ReadOnly := iBool;
if (frmMain.FLoginUserPrivilege.rtnmana_func=1) then
begin
btnCopy.Enabled := false;
btnDelete.Enabled := true;
btnReturnGoods.Enabled := false;
btnTune.Enabled := true;
end
else begin
btnCopy.Enabled := false;
btnDelete.Enabled := false;
btnReturnGoods.Enabled := false;
btnTune.Enabled := false;
end;
end;
end;
end;
end;
//////////////////////////////////////////////////////
procedure TfrmInvHistory.ReViewProc;
begin
Screen.Cursor := crHourGlass;
dm_inventory.ReadInventory2(True, FList, tmpWdate[0],tmpWdate[1]);
//dm_inventory.ReadInventory(true, FList);
try
if SetListView(0, -1) > 0 then begin
ListView.TopItem.Selected := True;
SetData(ListView.Items.Item[0].Data);
end;
finally
Screen.Cursor := crDefault;
end;
end;
procedure TfrmInvHistory.ReReadProc(ReViewFlg: Boolean);
var i, j, Cnt: Integer;
lcP: PINVENTORY;
begin
if Delete_Cnt > 0 then begin
Cnt := Delete_Cnt;
for i:=FList.Count-1 downto 0 do begin
lcP := FList[i];
for j:=0 to Delete_Cnt-1 do begin
if lcP^.REC_ID = Delete_RID[j] then begin
Dispose(lcP);
FList.Delete(i);
Dec(Cnt);
Break;
end;
end;
if Cnt = 0 then Break;
end;
end;
// if ReRead_Cnt > 0 then dm_inventory.ReadInventory(False, FList);
if ReViewFlg then begin
tmpIniData.listdate[0] := formatdatetime('yyyy/mm/dd',Now-1)+' 00:00:00';
tmpIniData.listdate[1] := formatdatetime('yyyy/mm/dd',Now) +' 23:59:59';
ReViewProc;
end;
Delete_Cnt := 0;
SetLength(Delete_RID, Delete_Cnt);
ReRead_Cnt := 0;
SetLength(ReRead_RID, ReRead_Cnt);
dm_inventory.Delete_NullMaterial;
end;
procedure TfrmInvHistory.ListDelProc(RecID: LongInt);
var i: Integer;
lcP: PINVENTORY;
begin
for i := FList.Count-1 downto 0 do begin
lcP := FList[i];
if lcP^.REC_ID = RecID then begin
Dispose(lcP);
FList.Delete(i);
Break;
end;
end;
RecIdType := 0;
try dm_inventory.DeleteDatabase('inventory_sheet', RecID);
finally RecIdType := 1;
end;
end;
function TfrmInvHistory.SetInventoryCnt(RID,CD,GUAGE_ID: LongInt; STK_ID: string; DT: TDateTime; var Cnt: Double): Double;
var List: TList;
i: Integer;
lcP: PBalance;
begin
Cnt := 0;
Result := 0;
List := TList.Create;
SetBalanceList(RID, List, DT);
for i:=0 to List.Count-1 do begin
lcP := List[i];
if lcP^.CODE = CD then begin
Cnt := lcP^.QUANTITY;
Result := lcP^.U_PRICE;
Break;
end;
end;
for i:=0 to List.Count-1 do Dispose(List[i]);
List.Clear;
List.Free;
end;
procedure TfrmInvHistory.SetBalanceList(RID: LongInt; List: TList; DT: TDateTime);
var i, j, UPriceType: Integer;
STS: Boolean;
lcP: PINVENTORY;
lcBalP: PBALANCE;
begin
for i:=0 to List.Count-1 do Dispose(List[i]);
List.Clear;
UPriceType := StrToIntDef(frmMain.IniData.OutPrice, 0);
for i:=0 to FList.Count-1 do begin
lcP := FList[i];
if lcP^.REC_ID = RID then Continue;
if (DT>=strtodatetime(formatDatetime('yy/mm/dd',lcP^.DATE)+' 00:00'))and (lcP^.DATE > 2) then begin
STS := False;
for j:=0 to List.Count-1 do begin
lcBalP := List[j];
if ((lcp^.STK_ID=lcBalP^.STK_ID)and(lcP^.MAT_RID=lcBalP^.CODE)and(lcp^.GUAGE_ID=lcBalP^.GUAGE_ID)) then begin
lcBalP^.QUANTITY := lcBalP^.QUANTITY + lcP^.QUANTITY;
//-- get 4 mode unit_price
if (lcP^.KIND=0)and(UPriceType in [1, 2]) then begin
if UPriceType = 1 then STS := (lcBalP^.DATE < lcP^.DATE)
else STS := (lcBalP^.DATE > lcP^.DATE);
if STS then begin
lcBalP^.Date := lcP^.DATE;
lcBalP^.U_PRICE := lcP^.UNT_PRICE;
end;
end;
lcBalP^.T_PRICE := lcBalP^.T_PRICE + lcP^.TTL_PRICE;
//-- 判断当前存量是否小于安全存量
if lcBalP^.QUANTITY < dm_inventory.Get_MatGuageSafety(lcP^.MAT_RID,lcp^.GUAGE_ID) then
lcBalP^.IS_SAFETY := 0
else
lcBalP^.IS_SAFETY := 1;
STS := True;
Break;
end;
end;
if not(STS) then begin
New(lcBalP);
ZeroMemory(lcBalP, Sizeof(TBALANCE));
lcBalP^.STK_ID := lcp^.STK_ID;
lcBalP^.DATE := lcP^.DATE;
lcBalP^.CODE := lcP^.MAT_RID;
StrPCopy(lcBalP^.NAME, lcP^.MAT_NM);
lcBalP^.GUAGE_ID := lcp^.GUAGE_ID;
strPCopy(lcBalP^.GUAGE_NAME,dm_Inventory.Get_GuageName(lcP^.MAT_RID,lcp^.GUAGE_ID));
lcBalP^.QUANTITY := lcP^.QUANTITY;
lcBalP^.U_PRICE := lcP^.UNT_PRICE;
lcBalP^.T_PRICE := lcP^.TTL_PRICE;
if lcP^.QUANTITY < dm_inventory.Get_MatGuageSafety(lcP^.MAT_RID,lcp^.GUAGE_ID) then
lcBalP^.IS_SAFETY := 0
else
lcBalP^.IS_SAFETY := 1; //-- Default Normal
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -