?? invdm.~pas
字號:
//--
lcp^.REC_ID := Fields[0].AsInteger;
lcp^.SIGEN_CD := Fields[1].AsInteger;
strPCopy(lcp^.SIGEN_NM, Fields[2].AsString);
lcp^.DEPART_CD := Fields[3].AsInteger;
Next;
FEmpList.Add(lcp);
end;
finally
Close;
end;
end;
end;
function Tdm_Inventory.Get_EmpName(shigen_CD: string): string;
var IX: Integer;
lcP: PShigen;
begin
Result := '';
for IX:=0 to FEmpList.Count-1 do begin
lcp := FEmpList[IX];
if (IntToStr(lcp^.SIGEN_CD) = shigen_CD) then begin
Result := strpas(lcP^.SIGEN_NM);
Exit;
end;
end;
end;
function Tdm_Inventory.Get_EmpDepartID(shigen_CD: string): Integer;
var IX: Integer;
lcP: PShigen;
begin
Result := 0;
for IX:=0 to FEmpList.Count-1 do begin
lcp := FEmpList[IX];
if (IntToStr(lcp^.SIGEN_CD) = shigen_CD) then begin
Result := lcP^.DEPART_CD;
Exit;
end;
end;
end;
function Tdm_Inventory.GetDepartName_fromEmpID(Sigen_CD: string): String;
var
IX: Integer;
lcP: PSHIGEN;
iDepart: integer;
begin
Result := '';
iDepart := dm_inventory.Get_EmpDepartID(Sigen_CD);
result := dm_inventory.GetDepartName(iDepart);
end;
function Tdm_Inventory.Emp_IDProc(scode: string; var edt: TEdit): Boolean;
var WStr: string;
begin
Result := True;
WStr := dm_Inventory.Get_EmpName(scode);
if (scode<>'')and(WStr='') then
if MessageDlg('該編碼不存在/確定使用不存在的該編碼?', mtWarning, [mbOk], 0) = mrOK then begin
Result := False;
Exit;
end;
edt.Text := WStr;
end;
{**********************************************************************************}
{**********************************************************************************}
function Tdm_Inventory.InsertShizai(lcP: PSHIZAI): Integer;
var
Sqls: string;
Sep: string[2];
begin
Result := 0;
lcP^.REC_ID := dm_Inventory.GetRecid1;
Sqls := 'INSERT INTO shizai ' +
'(rec_id, flag, code, name, unit_price, maker_cd, shiire_cd, ' +
'unit_type, standard) '+
'VALUES(';
Sep := ', ';
Sqls := Sqls + IntToStr(lcP^.REC_ID) + Sep + '1, ' +
QuotedStr(StrPas(lcP^.SHIZAI_CD)) + Sep +
QuotedStr(StrPas(lcP^.SHIZAI_NM)) + Sep +
Format('%8.4f',[lcP^.UNT_PRICE]) + Sep +
IntToStr(lcP^.MAKER_CD) + Sep +
IntToStr(lcP^.SHIIRE_CD) + Sep +
IntToStr(lcP^.UNT_TYPE) + Sep +
QuotedStr(StrPas(lcP^.STANDARD)) + ')';
if not(dm_Inventory.ExecuteQuery(Sqls)) then Result := -99;
end;
function Tdm_Inventory.InsertInventory(lcP: PINVENTORY): Integer;
var
Sqls: string;
Sep: string[2];
begin
Result := 0;
lcP^.REC_ID := dm_Inventory.GetRecid7;
Sqls := 'INSERT INTO inventory_sheet ' +
'(rec_id, kind, stk_id, date, material_rec_id, material_name, guage_id,' +
' supplier_code,maker_code,maker_price,'+
' unit_price, quantity, total_price, use_guage, use_quantity,use_amount,'+
' order_rec_id, parts_rec_id,sequal_no,order_no,order_code,'+
'paperno,iss_paperno,inout_id, recieve_empid,input_empid,invoice_no,is_account,is_close,note) '+
'VALUES(';
Sep := ', ';
Sqls := Sqls + IntToStr(lcP^.REC_ID) + Sep +
IntToStr(lcP^.KIND) + Sep +
QuotedStr(StrPas(lcP^.STK_ID)) + Sep +
QuotedStr(FormatDateTime('yyyy/mm/dd hh:mm:ss', lcP^.DATE))+Sep+
IntToStr(lcP^.MAT_RID) + Sep +
QuotedStr(StrPas(lcP^.MAT_NM)) + Sep +
IntToStr(lcP^.GUAGE_ID) + Sep +
IntToStr(lcP^.SUP_CD) + Sep +
IntToStr(lcP^.MAK_CD) + Sep +
Format('%8.4f',[lcP^.MAK_PRICE]) + Sep +
Format('%8.4f',[lcP^.UNT_PRICE]) + Sep +
Format('%8.4f',[lcP^.QUANTITY]) + Sep +
Format('%8.4f',[lcP^.TTL_PRICE]) + Sep +
QuotedStr(strpas(lcP^.USE_GUAGE)) + Sep +
Format('%8.4f',[lcP^.USE_QUANTITY]) + Sep +
Format('%8.4f',[lcP^.USE_AMOUNT]) + Sep +
IntToStr(lcP^.ODR_RID) + Sep +
IntToStr(lcP^.PAT_RID) + Sep +
QuotedStr(lcp^.SEQUAL_NO) + Sep +
IntToStr(lcP^.HAT_RID) + Sep +
QuotedStr(lcp^.HAT_CODE) + Sep +
QuotedStr(lcp^.PAPERNO) + Sep +
QuotedStr(lcp^.ISS_PAPERNO) + Sep +
QuotedStr(lcp^.Inout_id) + Sep +
QuotedStr(lcp^.recieve_EmpID) + Sep +
QuotedStr(lcp^.input_empid) + Sep +
QuotedStr(lcp^.invoice_no) + Sep +
IntToStr(lcp^.is_account) + Sep +
IntToStr(lcp^.IS_CLOSE) + Sep +
QuotedStr(lcp^.NOTE) +
')';
if not(dm_Inventory.ExecuteQuery(Sqls)) then Result := -99;
end;
{************************************************************************************}
{************************************************************************************}
function Tdm_Inventory.UpdateProcess_jkcd(InvValue: TINVENTORY_VALUE): Integer;
var
Sqls: string;
begin
Result := 0;
if InvValue.order_rec_id = -1 then begin
Sqls := 'DELETE FROM kotei '
+ 'WHERE (flag2=' + IntToStr(InvValue.inv_rec_id) + ')';
Sqls := Sqls+ 'UPDATE buhin set bup_flag=3 '
+ 'where rec_id=' + InttoStr(InvValue.part_rec_id)
+ ' and tehai_kubun in (2,3)'+' '+
'UPDATE kotei SET '
+ 'hiyo_kubun_rec_id=' + IntToStr(InvValue.hiyo_kubun_rec_id) + ','
+ 'jk_cd=' + IntToStr(3) + ','
+ 'flag2=' + IntToStr(InvValue.inv_rec_id) + ' '
+ 'WHERE (rec_id=' + IntToStr(InvValue.process_rec_id) + ')';
end
else
if (InvValue.order_rec_id <> -1) and (InvValue.part_rec_id = -1) then begin
Sqls := 'DELETE FROM kotei '
+ 'WHERE (flag2=' + IntToStr(InvValue.inv_rec_id) + ')';
Sqls := Sqls+ 'UPDATE buhin set bup_flag=3 '
+ 'where rec_id=' + InttoStr(InvValue.part_rec_id)
+ ' and tehai_kubun in (2,3)'+' '+
'UPDATE kotei SET '
+ 'hiyo_kubun_rec_id=' + IntToStr(InvValue.hiyo_kubun_rec_id) + ','
+ 'jk_cd=' + IntToStr(3) + ','
+ 'flag2=' + IntToStr(InvValue.inv_rec_id) + ' '
+ 'WHERE (rec_id=' + IntToStr(InvValue.process_rec_id) + ')';
end
else
if (InvValue.order_no > 0) then begin
Sqls := 'UPDATE buhin set bup_flag=3 '
+ 'where rec_id=' + InttoStr(InvValue.part_rec_id)
+ ' and tehai_kubun in (2,3)'+' '+
'UPDATE kotei SET '
+ 'hiyo_kubun_rec_id=' + IntToStr(InvValue.hiyo_kubun_rec_id) + ','
+ 'jk_cd=' + IntToStr(3) + ','
+ 'flag2=' + IntToStr(InvValue.inv_rec_id) + ' '
+ 'WHERE (rec_id=' + IntToStr(InvValue.process_rec_id) + ')';
end
else begin
Sqls := 'UPDATE kotei SET '
+ 'hiyo_kubun_rec_id=' + IntToStr(InvValue.hiyo_kubun_rec_id) + ','
+ 'jk_cd=' + IntToStr(3) + ' '
+ 'WHERE (flag2=' + IntToStr(InvValue.inv_rec_id) + ')';
end;
if not(ExecuteQuery(Sqls)) then Result := -99;
end;
{************************************************************************************}
function Tdm_Inventory.UpdateProcess_flag2(InvValue: TINVENTORY_VALUE): Integer;
var
Sqls: string;
begin
Sqls := ' UPDATE kotei SET ' +
' flag2= '+ IntToStr(InvValue.inv_rec_id)+
' WHERE (rec_id=' + IntToStr(InvValue.process_rec_id) + ')';
if not(ExecuteQuery(Sqls)) then Result := -99;
end;
{************************************************************************************}
function Tdm_Inventory.UpdateProcessLog_jkcd_kakojokyo(ihatchu_id: Integer): Integer;
var
Sqls: string;
begin
Sqls := ' update kotei set ' +
' jk_cd= '+ IntToStr(1)+
' where (hatchu_bango=' + IntToStr(ihatchu_id) + ')'+
' and visible>0 ' +
' update log set '+
' kako_jokyo=1,jk_cd=1 '+
' where (hatchu_bango='+ IntToStr(ihatchu_id) + ')'+
' and visible>0 ';
if not(ExecuteQuery(Sqls)) then Result := -99;
end;
{************************************************************************************}
function Tdm_Inventory.UpdateProcess(InvValue: TINVENTORY_VALUE): Integer;
var
Sqls: string;
begin
Result := 0;
if InvValue.order_rec_id = -1 then begin
Sqls := 'DELETE FROM kotei '
+ 'WHERE (flag2=' + IntToStr(InvValue.inv_rec_id) + ')';
Sqls := Sqls+ 'UPDATE buhin set bup_flag=3 '
+ 'where rec_id=' + InttoStr(InvValue.part_rec_id)
+ ' and tehai_kubun in (2,3)'+' '+
'UPDATE kotei SET '
+ 'hiyo_kubun_rec_id=' + IntToStr(InvValue.hiyo_kubun_rec_id) + ','
+ 'shizai_rec_id=' + IntToStr(InvValue.material_rec_id) + ','
+ 'suryo=' + FloatToStr(InvValue.quantity) + ','
+ 'tanka=' + FloatToStr(InvValue.unit_price) + ','
+ 'kingaku=' + FloatToStr(InvValue.total_price) + ','
+ 'jk_cd=' + IntToStr(3) + ','
+ 'flag2=' + IntToStr(InvValue.inv_rec_id) + ' '
+ 'WHERE (rec_id=' + IntToStr(InvValue.process_rec_id) + ')';
end
else
if (InvValue.order_rec_id <> -1) and (InvValue.part_rec_id = -1) then begin
Sqls := 'DELETE FROM kotei '
+ 'WHERE (flag2=' + IntToStr(InvValue.inv_rec_id) + ')';
Sqls := Sqls+ 'UPDATE buhin set bup_flag=3 '
+ 'where rec_id=' + InttoStr(InvValue.part_rec_id)
+ ' and tehai_kubun in (2,3)'+' '+
'UPDATE kotei SET '
+ 'hiyo_kubun_rec_id=' + IntToStr(InvValue.hiyo_kubun_rec_id) + ','
+ 'shizai_rec_id=' + IntToStr(InvValue.material_rec_id) + ','
+ 'suryo=' + FloatToStr(InvValue.quantity) + ','
+ 'tanka=' + FloatToStr(InvValue.unit_price) + ','
+ 'kingaku=' + FloatToStr(InvValue.total_price) + ','
+ 'jk_cd=' + IntToStr(3) + ','
+ 'flag2=' + IntToStr(InvValue.inv_rec_id) + ' '
+ 'WHERE (rec_id=' + IntToStr(InvValue.process_rec_id) + ')';
end
else
if (InvValue.order_no > 0) then begin
Sqls := 'UPDATE buhin set bup_flag=3 '
+ 'where rec_id=' + InttoStr(InvValue.part_rec_id)
+ ' and tehai_kubun in (2,3)'+' '+
'UPDATE kotei SET '
+ 'hiyo_kubun_rec_id=' + IntToStr(InvValue.hiyo_kubun_rec_id) + ','
+ 'shizai_rec_id=' + IntToStr(InvValue.material_rec_id) + ','
+ 'suryo=' + FloatToStr(InvValue.quantity) + ','
+ 'tanka=' + FloatToStr(InvValue.unit_price) + ','
+ 'kingaku=' + FloatToStr(InvValue.total_price) + ','
+ 'jk_cd=' + IntToStr(3) + ','
+ 'flag2=' + IntToStr(InvValue.inv_rec_id) + ' '
+ 'WHERE (rec_id=' + IntToStr(InvValue.process_rec_id) + ')';
end
else begin
Sqls := 'UPDATE kotei SET '
+ 'hiyo_kubun_rec_id=' + IntToStr(InvValue.hiyo_kubun_rec_id) + ','
+ 'shizai_rec_id=' + IntToStr(InvValue.material_rec_id) + ','
+ 'suryo=' + FloatToStr(InvValue.quantity) + ','
+ 'tanka=' + FloatToStr(InvValue.unit_price) + ','
+ 'kingaku=' + FloatToStr(InvValue.total_price) + ','
+ 'jk_cd=' + IntToStr(3) + ' '
+ 'WHERE (flag2=' + IntToStr(InvValue.inv_rec_id) + ')';
end;
if not(ExecuteQuery(Sqls)) then Result := -99;
end;
{************************************************************************************}
function Tdm_Inventory.UpdateLog_jkcd(InvValue: TINVENTORY_VALUE): Integer;
var
Sqls: string;
begin
Result := 0;
if InvValue.order_rec_id = -1 then begin
Sqls := 'DELETE FROM log '
+ 'WHERE (flag2=' + IntToStr(InvValue.inv_rec_id) + ')';
Sqls := Sqls+'UPDATE log SET '
+ 'hiyo_kubun_rec_id=' + IntToStr(InvValue.hiyo_kubun_rec_id) + ','
+ 'jk_cd=' + IntToStr(3) + ','
+ 'kako_jokyo=' + IntToStr(8) + ','
+ 'flag2=' + IntToStr(InvValue.inv_rec_id) + ' '
+ 'WHERE (kotei_rec_id=' + IntToStr(InvValue.process_rec_id) + ')';
end
else
if (InvValue.order_rec_id <> -1) and (InvValue.part_rec_id = -1) then begin
Sqls := 'DELETE FROM log '
+ 'WHERE (flag2=' + IntToStr(InvValue.inv_rec_id) + ')';
Sqls := Sqls+'UPDATE log SET '
+ 'hiyo_kubun_rec_id=' + IntToStr(InvValue.hiyo_kubun_rec_id) + ','
+ 'jk_cd=' + IntToStr(3) + ','
+ 'kako_jokyo=' + IntToStr(8) + ','
+ 'flag2=' + IntToStr(InvValue.inv_rec_id) + ' '
+ 'WHERE (kotei_rec_id=' + IntToStr(InvValue.process_rec_id) + ')';
end
else
if (InvValue.order_no > 0) then begin
Sqls := 'UPDATE log SET '
+ 'hiyo_kubun_rec_id=' + IntToStr(InvValue.hiyo_kubun_rec_id) + ','
+ 'jk_cd=' + IntToStr(3) + ','
+ 'kako_jokyo=' + IntToStr(8) + ','
+ 'flag2=' + IntToStr(InvValue.inv_rec_id) + ' '
+ 'WHERE (kotei_rec_id=' + IntToStr(InvValue.process_rec_id) + ')';
end
else begin
Sqls := 'UPDATE log SET '
+ 'hiyo_kubun_rec_id=' + IntToStr(InvValue.hiyo_kubun_rec_id) + ','
+ 'jk_cd=' + IntToStr(3) + ','
+ 'kako_jokyo=' + IntToStr(8) + ' '
+ 'WHERE (flag2=' + IntToStr(InvValue.inv_rec_id) + ')';
end;
if not(ExecuteQuery(Sqls)) then Result := -99;
end;
{************************************************************************************}
function Tdm_Inventory.UpdateLog(InvValue: TINVENTORY_VALUE): Integer;
var
Sqls: string;
begin
Result := 0;
if InvValue.order_rec_id = -1 then begin
Sqls := 'DELETE FROM log '
+ 'WHERE (flag2=' + IntToStr(InvValue.inv_rec_id) + ')';
Sqls := Sqls+'UPDATE log SET '
+ 'hiyo_kubun_rec_id=' + IntToStr(InvValue.hiyo_kubun_rec_id) + ','
+ 'shizai_rec_id=' + IntToStr(InvValue.material_rec_id) + ','
+ 'suryo=' + FloatToStr(InvValue.quantity) + ','
+ 'tanka=' + FloatToStr(InvValue.unit_price) + ','
+ 'kingaku=' + FloatToStr(InvValue.total_price) + ','
+ 'jk_cd=' + IntToStr(3) + ','
+ 'kako_jokyo=' + IntToStr(8) + ','
+ 'flag2=' + IntToStr(InvValue.inv_rec_id) + ' '
+ 'WHERE (kotei_rec_id=' + IntToStr(InvValue.process_rec_id) + ')';
end
else
if (InvValue.order_rec_id <> -1) and (InvValue.part_rec_id = -1) then begin
Sqls := 'DELETE FROM log '
+ 'WHERE (flag2=' + IntToStr(InvValue.inv_rec_id) + ')';
Sqls := Sqls+'UPDATE log SET '
+ 'hiyo_kubun_rec_id=' + IntToStr(InvValue.hiyo_kubun_rec_id) + ','
+ 'shizai_rec_id=' + IntToStr(InvValue.material_rec_id) + ','
+ 'suryo=' + FloatToStr(InvValue.quantity) + ','
+ 'tanka=' + FloatToStr(InvValue.unit_price) + ','
+ 'kingaku=' + FloatToStr(InvValue.total_price) + ','
+ 'jk_cd=' + IntToStr(3) + ','
+ 'kako_jokyo=' + IntToStr(8) + ','
+ 'flag2=' + IntToStr(InvValue.inv_rec_id) + ' '
+ 'WHERE (kotei_rec_id=' + IntToStr(InvValue.process_rec_id) + ')';
end
else
if (InvValue.order_no > 0) then begin
Sqls := 'UPDATE log SET '
+ 'hiyo_kubun_rec_id=' + IntToStr(InvValue.hiyo_kubun_rec_id) + ','
+ 'shizai_rec_id=' + IntToStr(InvValue.material_rec_id) + ','
+ 'suryo=' + FloatToStr(InvValue.quantity) + ','
+ 'tanka=' + FloatToStr(InvValue.unit_price) + ','
+ 'kingaku=' + FloatToStr(InvValue.total_price) + ','
+ 'jk_cd=' + IntT
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -