📄 mylib.pas
字号:
strState := 'V';
blnStopScroll := True;
ShowModal;
Free;
end;
Screen.Cursor := crDefault;
end;
//'销售提货过程'
procedure OpenXsThgc(ZBID: Variant);
begin
Screen.Cursor := crHourGlass;
with Data.XsThgc do
begin
Close;
CommandText :=
'select Z.DJBH, Z.RQ, H.BH, H.PM, H.DW, M.SL, M.DJ, M.NSL, M.SL * M.DJ * (1 + M.NSL / 100) as JE ' +
'from XSKDZB Z, XSKD M, HP H ' +
'where Z.ID = M.ZBID and M.HPID = H.ID and M.DDID = ' + Float2Str(ZBID);
Open;
end;
frmXsThgc := TfrmXsThgc.Create(Application);
with frmXsThgc do
begin
strState := 'V';
blnStopScroll := True;
ShowModal;
Free;
end;
Screen.Cursor := crDefault;
end;
//'采购付款过程'
procedure OpenCgFkgc(ZBID: Variant);
begin
Screen.Cursor := crHourGlass;
with Data.CgFkgc do
begin
Close;
CommandText :=
'select Z.DJBH, Z.RQ, Z.JE as ZJE, M.JE as BCJE ' +
'from CGFKZB Z, CGFK M ' +
'where Z.ID=M.ZBID and M.JE <> 0 and M.DDID = ' + Float2Str(ZBID) + ' ' +
'order by Z.DJBH';
Open;
end;
frmCgFkgc := TfrmCgFkgc.Create(Application);
with frmCgFkgc do
begin
strState := 'V';
blnStopScroll := True;
ShowModal;
Free;
end;
Screen.Cursor := crDefault;
end;
//'领料'
procedure OpenLl(ZBID: Variant);
begin
Screen.Cursor := crHourGlass;
with Data.Llzb do
begin
Close;
CommandText :=
'select Z.*, ' +
'C.MC as aCKMC ' +
'from LLZB Z, CK C, ' +
'Z inner join C on Z.CKID = C.ID where Z.ID = ' + Float2Str(ZBID) + ' ' +
'order by Z.DJBH';
Open;
end;
frmLl := TfrmLl.Create(Application);
with frmLl do
begin
strState := 'V';
blnStopScroll := True;
ShowModal;
Free;
end;
Screen.Cursor := crDefault;
end;
//'退料'
procedure OpenTl(ZBID: Variant);
begin
Screen.Cursor := crHourGlass;
with Data.Llzb do
begin
Close;
CommandText :=
'select Z.*, ' +
'C.MC as aCKMC ' +
'from TLZB Z, CK C, ' +
'Z inner join C on Z.CKID = C.ID where Z.ID = ' + Float2Str(ZBID) + ' ' +
'order by Z.DJBH';
Open;
end;
frmLl := TfrmLl.Create(Application);
with frmLl do
begin
strState := 'V';
blnStopScroll := True;
ShowModal;
Free;
end;
Screen.Cursor := crDefault;
end;
//'产品进仓'
procedure OpenCpjc(ZBID: Variant);
begin
Screen.Cursor := crHourGlass;
with Data.Cpjczb do
begin
Close;
CommandText :=
'select Z.*, ' +
'C.MC as aCKMC ' +
'from CPJCZB Z, CK C, ' +
'Z inner join C on Z.CKID = C.ID where Z.ID = ' + Float2Str(ZBID) + ' ' +
'order by Z.DJBH';
Open;
end;
frmCpjc := TfrmCpjc.Create(Application);
with frmCpjc do
begin
strState := 'V';
blnStopScroll := True;
ShowModal;
Free;
end;
Screen.Cursor := crDefault;
end;
//'库存盘点'
procedure OpenKcpd(ZBID: Variant);
begin
Screen.Cursor := crHourGlass;
with Data.Kcpdzb do
begin
Close;
CommandText :=
'select Z.*, ' +
'C.MC as aCKMC ' +
'from KCPDZB Z, CK C, ' +
'Z inner join C on Z.CKID = C.ID where Z.ID = ' + Float2Str(ZBID) + ' ' +
'order by Z.DJBH';
Open;
end;
frmKcpd := TfrmKcpd.Create(Application);
with frmKcpd do
begin
strState := 'V';
blnStopScroll := True;
ShowModal;
Free;
end;
Screen.Cursor := crDefault;
end;
//'仓库调拨' '仓库调入' '仓库调出'
procedure OpenCkdb(ZBID: Variant);
begin
Screen.Cursor := crHourGlass;
with Data.Ckdbzb do
begin
Close;
CommandText :=
'select Z.*, ' +
'DC.MC as aDCCMC, ' +
'DR.MC as aDRCMC ' +
'from CKDBZB Z,CK DC,CK DR, ' +
'Z inner join DC on Z.DCCID = DC.ID, ' +
'Z inner join DR on Z.DRCID = DR.ID where Z.ID = ' + Float2Str(ZBID) + ' ' +
'order by Z.DJBH';
Open;
end;
frmCkdb := TfrmCkdb.Create(Application);
with frmCkdb do
begin
strState := 'V';
blnStopScroll := True;
ShowModal;
Free;
end;
Screen.Cursor := crDefault;
end;
//'库存变动' '其它库存变动-减少' '其它库存变动-增加'
procedure OpenQtkcbd(ZBID: Variant);
begin
Screen.Cursor := crHourGlass;
with Data.Qtkcbdzb do
begin
Close;
CommandText :=
'select Z.*, ' +
'C.MC as aCKMC, ' +
'L.MC as aQTKCBDLXMC, ' +
'iif(L.RKL,''入库类(增加库存)'', ''出库类(减少库存)'') as aCRLX, ' +
'iif(L.THBZ,''需要'', ''不需要'') as aTH ' +
'from QTKCBDZB Z, CK C, QTKCBDLX L, ' +
'Z inner join C on Z.CKID = C.ID, ' +
'Z inner join L on Z.QTKCBDLXID = L.ID where Z.ID = ' + Float2Str(ZBID) + ' ' +
'order by Z.DJBH';
Open;
end;
frmQtkcbd := TfrmQtkcbd.Create(Application);
with frmQtkcbd do
begin
strState := 'V';
blnStopScroll := True;
ShowModal;
Free;
end;
Screen.Cursor := crDefault;
end;
//'退还过程' '其它库存变动-退还增加' '其它库存变动-退还减少'
procedure OpenThgc(ZBID: Variant);
begin
Screen.Cursor := crHourGlass;
with Data.Qtkcbdzb do
begin
Close;
CommandText :=
'select Z.*, ' +
'C.MC as aCKMC, ' +
'L.MC as aQTKCBDLXMC, ' +
'iif(L.RKL,''入库类(增加库存)'', ''出库类(减少库存)'') as aCRLX, ' +
'iif(L.THBZ,''需要'', ''不需要'') as aTH ' +
'from QTKCBDZB Z, CK C, QTKCBDLX L, ' +
'Z inner join C on Z.CKID = C.ID, ' +
'Z inner join L on Z.QTKCBDLXID = L.ID where Z.ID = ' + Float2Str(ZBID) + ' ' +
'order by Z.DJBH';
Open;
end;
frmThgc := TfrmThgc.Create(Application);
with frmThgc do
begin
strState := 'V';
blnStopScroll := True;
ShowModal;
Free;
end;
Screen.Cursor := crDefault;
end;
//'费用开支'
procedure OpenFykz(ZBID: Variant);
begin
Screen.Cursor := crHourGlass;
with Data.Fykzzb do
begin
Close;
CommandText :=
'select Z.*, ' +
'S.MC as aSFKFSMC, H.MC as aZHMC ' +
'from FYKZZB Z, SFKFS S, ZH H, ' +
'Z left join S on Z.SFKFSID = S.ID, ' +
'Z left join H on Z.ZHID = H.ID where Z.ID = ' + Float2Str(ZBID) + ' ' +
'order by Z.DJBH';
Open;
end;
frmFykz := TfrmFykz.Create(Application);
with frmFykz do
begin
strState := 'V';
blnStopScroll := True;
ShowModal;
Free;
end;
Screen.Cursor := crDefault;
end;
//'其它收入'
procedure OpenQtsr(ZBID: Variant);
begin
Screen.Cursor := crHourGlass;
with Data.Qtsrzb do
begin
Close;
CommandText :=
'select Z.*, ' +
'S.MC as aSFKFSMC, H.MC as aZHMC ' +
'from QTSRZB Z, SFKFS S, ZH H, ' +
'Z left join S on Z.SFKFSID = S.ID, ' +
'Z left join H on Z.ZHID = H.ID where Z.ID = ' + Float2Str(ZBID) + ' ' +
'order by Z.DJBH';
Open;
end;
frmQtsr := TfrmQtsr.Create(Application);
with frmQtsr do
begin
strState := 'V';
blnStopScroll := True;
ShowModal;
Free;
end;
Screen.Cursor := crDefault;
end;
//'帐户转入' '帐户转出'
procedure OpenYhckqk(ZBID: Variant);
begin
Screen.Cursor := crHourGlass;
frmYhckqkCk := TfrmYhckqkCk.Create(Application);
with frmYhckqkCk do
begin
intID := ZBID;
ShowModal;
Free;
end;
Screen.Cursor := crDefault;
end;
//CGSH + CGTH (CHTH.SL -> -CGTH.SL)
function GetSqlHpqc(CKID, HPID: integer): string;
var
sWhere, sSqlQC, sSqlHP: string;
begin
sWhere := '';
if CKID <> 0 then
sWhere := 'CKID = ' + Float2Str(CKID);
if HPID <> 0 then
if sWhere <> '' then
sWhere := sWhere + ' and HPID = ' + Float2Str(HPID)
else
sWhere := 'HPID = ' + Float2Str(HPID);
if sWhere <> '' then
sWhere := 'where ' + sWhere;
sSqlQC :=
'select HPID, sum(QCS) as QCS1 ' +
'from HPKC ' + sWhere + ' ' +
'group by HPID';
sSqlHP :=
'select H.ID, H.BH, H.PM, H.DW, K.QCS1, K.QCS1 * H.QCJQJ as QCJE1 ' +
'from HP H, (' + sSqlQC + ') K ' +
'where K.HPID = H.ID';
Result := sSqlHP;
end;
//All JC CC
function GetSqlJcmx(RQA, RQB: TDate; CKID, HPID: integer): string;
var
sCGSH, sCGTH, sXSKD, sXSTH, sLL, sTL, sCPJC, sKCPD, sDR, sDC, sQBJX, sQBZJ,
sTHJX, sTHZJ, sWhere: string;
begin
//Common Where
if RQA = 0 then
sWhere := 'Z.RQ <= #' + FormatDateTime('yyyy-mm-dd', RQB) + '#'
else
sWhere := 'Z.RQ between #' + FormatDateTime('yyyy-mm-dd', RQA) + '# and ' +
'#' + FormatDateTime('yyyy-mm-dd', RQB) + '#';
if CKID > 0 then
sWhere := sWhere + ' and Z.CKID = ' + IntToStr(CKID);
if HPID > 0 then
sWhere := sWhere + ' and M.HPID = ' + IntToStr(HPID);
//Set SQL (JCLX 1,进仓 2,出仓)
sCGSH :=
'select 1 as JCLX, M.CKID, M.HPID, M.ZBID, ' +
'iif(Z.CGLX=1, ''现金采购'', ''挂帐采购'') as LX, Z.RQ, Z.DJBH, K.MC as MC1, ' +
'+ M.SL as SL1, M.DJ as DJ1, val(Format(M.SL * M.DJ, ''0.00'')) as JE1 ' +
'from CGSHZB Z, CGSH M, GYS K ' +
'where M.ZBID = Z.ID and Z.GYSID = K.ID and ' + sWhere;
sCGTH :=
'select 1 as JCLX, M.CKID, M.HPID, M.ZBID, ' +
'''采购退货'' as LX, Z.RQ, Z.DJBH, K.MC as MC1, ' +
'- M.SL as SL1, M.DJ as DJ1, val(Format(M.SL * M.DJ, ''0.00'')) as JE1 ' +
'from CGTHZB Z, CGTH M, GYS K ' +
'where M.ZBID = Z.ID and Z.GYSID = K.ID and ' + sWhere;
sXSKD :=
'select 2 as JCLX, M.CKID, M.HPID, M.ZBID, ' +
'iif(Z.XSLX=1, ''现金销售'', ''挂帐销售'') as LX, Z.RQ, Z.DJBH, K.MC as MC1, ' +
'- M.SL as SL1, M.DJ as DJ1, val(Format(M.SL * M.DJ, ''0.00'')) as JE1 ' +
'from XSKDZB Z, XSKD M, KH K ' +
'where M.ZBID = Z.ID and Z.KHID = K.ID and ' + sWhere;
sXSTH :=
'select 2 as JCLX, M.CKID, M.HPID, M.ZBID, ' +
'''销售退货'' as LX, Z.RQ, Z.DJBH, K.MC as MC1, ' +
'+ M.SL as SL1, M.DJ as DJ1, val(Format(M.SL * M.DJ, ''0.00'')) as JE1 ' +
'from XSTHZB Z, XSTH M, KH K ' +
'where M.ZBID = Z.ID and Z.KHID = K.ID and ' + sWhere;
sLL :=
'select 2 as JCLX, M.CKID, M.HPID, M.ZBID, ' +
'''领料'' as LX, Z.RQ, Z.DJBH, K.MC as MC1, ' +
'- M.SL as SL1, M.DJ as DJ1, val(Format(M.SL * M.DJ, ''0.00'')) as JE1 ' +
'from LLZB Z, LL M, CK K ' +
'where M.ZBID = Z.ID and Z.CKID = K.ID and ' + sWhere;
sTL :=
'select 1 as JCLX, M.CKID, M.HPID, M.ZBID, ' +
'''退料'' as LX, Z.RQ, Z.DJBH, K.MC as MC1, ' +
'+ M.SL as SL1, M.DJ as DJ1, val(Format(M.SL * M.DJ, ''0.00'')) as JE1 ' +
'from TLZB Z, TL M, CK K ' +
'where M.ZBID = Z.ID and Z.CKID = K.ID and ' + sWhere;
sCPJC :=
'select 1 as JCLX, M.CKID, M.HPID, M.ZBID, ' +
'''产品进仓'' as LX, Z.RQ, Z.DJBH, K.MC as MC1, ' +
'+ M.SL as SL1, M.DJ as DJ1, val(Format(M.SL * M.DJ, ''0.00'')) as JE1 ' +
'from CPJCZB Z, CPJC M, CK K ' +
'where M.ZBID = Z.ID and Z.CKID = K.ID and ' + sWhere;
sKCPD :=
'select 1 as JCLX, M.CKID, M.HPID, M.ZBID, ' +
'''库存调整'' as LX, Z.RQ, Z.DJBH, K.MC as MC1, ' +
'+ M.SL as SL1, M.DJ as DJ1, val(Format(M.SL * M.DJ, ''0.00'')) as JE1 ' +
'from KCPDZB Z, KCPD M, CK K ' +
'where M.ZBID = Z.ID and Z.CKID = K.ID and ' + sWhere;
sDR :=
'select 2 as JCLX, M.DCCID as CKID, M.HPID, M.ZBID, ' +
'''仓库调出'' as LX, Z.RQ, Z.DJBH, K.MC as MC1, ' +
'- M.SL as SL1, M.DJ as DJ1, val(Format(M.SL * M.DJ, ''0.00'')) as JE1 ' +
'from CKDBZB Z, CKDB M, CK K ' +
'where M.ZBID = Z.ID and Z.DCCID = K.ID and ' + StringReplace(sWhere, 'Z.CKID', 'Z.DCCID', [rfReplaceAll]);
sDC :=
'select 1 as JCLX, M.DRCID as CKID, M.HPID, M.ZBID, ' +
'''仓库调入'' as LX, Z.RQ, Z.DJBH, K.MC as MC1, ' +
'+ M.SL as SL1, M.DJ as DJ1, val(Format(M.SL * M.DJ, ''0.00'')) as JE1 ' +
'from CKDBZB Z, CKDB M, CK K ' +
'where M.ZBID = Z.ID and Z.DRCID = K.ID and ' + StringReplace(sWhere, 'Z.CKID', 'Z.DRCID', [rfReplaceAll]);
sQBJX :=
'select 2 as JCLX, M.CKID, M.HPID, M.ZBID, ' +
'''其它库存变动-减少'' as LX, Z.RQ, Z.DJBH, K.MC as MC1, ' +
'- M.SL as SL1, M.DJ as DJ1, val(Format(M.SL * M.DJ, ''0.00'')) as JE1 ' +
'from QTKCBDZB Z, QTKCBD M, CK K ' +
'where M.ZBID = Z.ID and Z.CKID = K.ID and Z.CRLX = 1 and ' + sWhere;
sQBZJ :=
'select 1 as JCLX, M.CKID, M.HPID, M.ZBID, ' +
'''其它库存变动-增加'' as LX, Z.RQ, Z.DJBH, K.MC as MC1, ' +
'+ M.SL as SL1, M.DJ as DJ1, val(Format(M.SL * M.DJ, ''0.00'')) as JE1 ' +
'from QTKCBDZB Z, QTKCBD M, CK K ' +
'where M.ZBID = Z.ID and Z.CKID = K.ID and Z.CRLX = 2 and ' + sWhere;
sTHJX :=
'select 1 as JCLX, Z.CKID, M.HPID, M.ZBID, ' +
'''其它库存变动-退还增加'' as LX, Z.RQ, Z.DJBH, K.MC as MC1, ' +
'+ M.SL as SL1, M.DJ as DJ1, val(Format(M.SL * M.DJ, ''0.00'')) as JE1 ' +
'from QTKCBDZB Z, THGC M, CK K ' +
'where M.ZBID = Z.ID and Z.CKID = K.ID and Z.CRLX = 1 and ' + sWhere;
sTHZJ :=
'select 2 as JCLX, Z.CKID, M.HPID, M.ZBID, ' +
'''其它库存变动-退还减少'' as LX, Z.RQ, Z.DJBH, K.MC as MC1, ' +
'- M.SL as SL1, M.DJ as DJ1, val(Format(M.SL * M.DJ, ''0.00'')) as JE1 ' +
'from QTKCBDZB Z, THGC M, CK K ' +
'where M.ZBID = Z.ID and Z.CKID = K.ID and Z.CRLX = 2 and ' + sWhere;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -