?? sy_ck_jyp_add.pas
字號:
if IsEmpty then {為空時清空子表} {}
qry_CKXZAfterScroll(nil)
else
Locate('PPDM', qry_PP.FieldByName('PPDM').AsString, []);
end;
end;
{-------------------------------------------------------------------------------}
{選擇}
procedure TFrm_SY_CK_JYP_Add.chk_YDClick(Sender: TObject);
begin
SetChooseSL;
end;
{-------------------------------------------------------------------------------}
procedure TFrm_SY_CK_JYP_Add.ce_BLExit(Sender: TObject);
begin
SetChooseSL;
end;
{-------------------------------------------------------------------------------}
{回車,輳}
procedure TFrm_SY_CK_JYP_Add.ce_BLKeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then
SetChooseSL;
end;
{-------------------------------------------------------------------------------}
{選擇數(shù)量}
procedure TFrm_SY_CK_JYP_Add.SetChooseSL;
var
l_Mark: TBookMark;
l_tmpSL: Double;
begin
{表是空的,不用處理}
if qry_DWFP.IsEmpty then
Exit;
if rg_CKXZ.ItemIndex <> 0 then
Exit;
with qry_DWFP do
try
DisableControls;
l_Mark := GetBookmark;
First;
while not Eof do
begin
l_tmpSL := 0;
if chk_YD.Checked then
l_tmpSL := l_tmpSL + FieldByName('YDTS').AsFloat;
if chk_LS.Checked then
l_tmpSL := l_tmpSL + FieldByName('LSTS').AsFloat;
if chk_NC.Checked then
l_tmpSL := l_tmpSL + FieldByName('NCTS').AsFloat;
if chk_YP.Checked then
l_tmpSL := l_tmpSL + FieldByName('YPTS').AsFloat;
Edit;
FieldByName('SL').AsInteger := Trunc(l_tmpSL * ce_BL.Value / 100);
FieldByName('SL_Old').AsInteger := Trunc(l_tmpSL * ce_BL.Value / 100);
Post;
Next;
end;
finally
GotoBookMark(l_Mark);
FreeBookMark(l_Mark);
EnableControls;
end;
{輳包}
SetRounding;
end;
{-------------------------------------------------------------------------------}
{湊包湊版的選擇}
procedure TFrm_SY_CK_JYP_Add.rg_RoundClick(Sender: TObject);
begin
case rg_Round.ItemIndex of
0: {湊包} {}
rg_Round_Style.Visible := True;
1: {湊版} {}
rg_Round_Style.Visible := True;
2: {不用湊整數(shù)} {}
rg_Round_Style.Visible := False;
end;
pgc_SeleInfo.ActivePageIndex := rg_Round.ItemIndex; {顯示規(guī)格}
if not qry_DWFP.IsEmpty then
SetRounding; {湊包湊版調用}
end;
{-------------------------------------------------------------------------------}
{湊整類型的選擇,和包裝規(guī)格的變化導致分配數(shù)量的變化}
procedure TFrm_SY_CK_JYP_Add.rg_Round_StyleClick(Sender: TObject);
begin
SetRounding; {湊包湊版調用}
end;
{-------------------------------------------------------------------------------}
{湊版湊包規(guī)格的更新}
procedure TFrm_SY_CK_JYP_Add.qry_PPAfterScroll(DataSet: TDataSet);
begin
GetGG(qry_PP.FieldByName('PPDM').AsString); {取得湊整的規(guī)格}
with qry_Tmp do
begin
Close;
SQL.Text := 'select ND from TB_YZPPTXXB where TDM =' + QuotedStr(qry_PP.FieldByName('PPDM').AsString);
Open;
if not IsEmpty then
VL_ND := Fields[0].AsString
else
VL_ND := '';
end;
end;
{-------------------------------------------------------------------------------}
{打開所選擇的計劃或者出庫單的單位分配數(shù)}
procedure TFrm_SY_CK_JYP_Add.qry_CKXZAfterScroll(DataSet: TDataSet);
var
l_sql: string;
begin
{各單位的分配數(shù)量}
(* case rg_CKXZ.ItemIndex of
0: {按照分配計劃} {}
begin
{對于不同的票品,依據(jù)計劃也不同(普票,零枚用紀_計內_分配計劃(零枚)TY_JJNFPJH_JY,
封片簡用紀_計內_分配計劃(封片)TY_JJNFPJH_FP)}
case rg_Type.ItemIndex of
0, 1: {普票、零枚} {}
// l_sql := 'select a.JHH, c.TUDM PPDM, a.PPMC, a.DWDM, a.JHFPZTS SL_OLD, a.JHFPZTS SL, d.DWMC ' +
l_sql := 'select a.DWDM, a.JHFPZTS SL_OLD, a.JHFPZTS SL, d.DWJC DWMC' +
' from TY_JJNFPJH_JY a, TB_YZPPTXXB b,TB_YZPPTUXXB c, TGS_GXDWSJB d ' +
' where a.JHH =b.JHH and b.TDM= c.TDM and c.TXH = a.TX and a.DWDM = d.DWDM ' +
' and a.ND =' + QuotedStr(VL_ND) +
' and c.TUDM =' + QuotedStr(qry_CKXZ.FieldByName('PPDM').AsString) +
' order by d.PXM ';
2: {封片} {}
l_sql := ' select a.DWDM, a.JHFPZTS SL_OLD, a.JHFPZTS SL, d.DWJC DWMC ' +
' from TY_JJNFPJH_FP a, TG_YZPPLDMB c, TGS_GXDWSJB d ' +
' where a.YZLDM = c.YZLDM and a.DWDM = d.DWDM ' +
' and a.ND =' + QuotedStr(VL_ND) +
' and a.YZLDM = ' + QuotedStr(qry_CKXZ.FieldByName('YZLDM').AsString) +
' order by d.PXM ';
end;
end;
1: {按照出庫單} {}
begin
L_SQL := 'select a.DWDM, a.FPSL SL_OLD, a.FPSL SL, b.DWJC DWMC ' +
' from TYS_TXCKJHDPPB a, TGS_GXDWSJB b, TYS_TXPCKJHDB c where a.DWDM = b.DWDM ' +
' and a.CKJHDH = c.CKJHDH and to_char(c.ZDRQ, ''YYYY'') = ' + QuotedStr(VL_ND) +
' and a.CKJHDH =' + QuotedStr(qry_CKXZ.FieldByName('JHH').AsString) +
' and a.PPDM =' + QuotedStr(qry_CKXZ.FieldByName('PPDM').AsString) +
' order by b.PXM ';
end;
2: {無依據(jù)} {}
Exit;
end;
with qry_DWFP do
begin
Close;
SQL.Text := l_sql;
Open;
end;
SetRounding; {湊包湊版調用}
*)
case rg_CKXZ.ItemIndex of
0:
begin
{l_sql := 'select a.DWDM, a.JHFPZTS SL_OLD, a.JHFPZTS SL, d.DWJC DWMC,a.YDTS, a.LSTS, a.NCTS, a.YPTS' +}
l_sql := 'select a.DWDM, 0 SL_OLD,0 SL, d.DWJC DWMC,a.YDTS, a.LSTS, a.NCTS, a.YPTS' +
' from TY_JJNFPJH a,TB_YZPPTXXB b,TGS_GXDWSJB d ' +
' where a.JHH=b.JHH and a.DWDM = d.DWDM ' +
' and a.ND =' + QuotedStr(VL_ND) +
' and b.TDM =' + QuotedStr(qry_CKXZ.FieldByName('PPDM').AsString) +
' order by d.PXM ';
{JHFPZTS, YDTS, LSTS, NCTS, YPTS, KCTS}
end;
1:
begin
L_SQL := 'select a.DWDM, a.FPSL SL_OLD, a.FPSL SL, b.DWJC DWMC ,0 YDTS, 0 LSTS, 0 NCTS, 0 YPTS ' +
' from TYS_JYCKJHDPPB a, TGS_GXDWSJB b, TYS_JYCKJHDB c where a.DWDM = b.DWDM ' +
' and a.CKJHDH = c.CKJHDH and to_char(c.ZDRQ, ''YYYY'') = ' + QuotedStr(VL_ND) +
' and a.CKJHDH =' + QuotedStr(qry_CKXZ.FieldByName('JHH').AsString) +
' and a.PPDM =' + QuotedStr(qry_CKXZ.FieldByName('PPDM').AsString) +
' order by b.PXM ';
end;
2: exit;
end;
with qry_DWFP do
begin
Close;
SQL.Text := l_sql;
Open;
end;
if rg_CKXZ.ItemIndex = 0 then
SetChooseSL;
SetRounding; {湊包湊版調用}
end;
{-------------------------------------------------------------------------------}
{取得湊整的規(guī)格}
procedure TFrm_SY_CK_JYP_Add.GetGG(A_PPDM: string);
var
l_sql: string;
i: Integer;
begin
(* case rg_Type.ItemIndex of
0, 1: {普票、零枚} {}
l_sql := 'select a.BZLSH, A.BJC, sum(c.GBGTMS * e.GBGBBS) BZSL ' +
' from TB_BZSJB A, TB_YZPPTUXXB b,TB_BTGXB c, TB_BSJB d, TB_BBGXB e ' +
' where a.BZLSH = e.BZLSH and b.TUDM = c.TUDM and c.BLSH = d.BLSH and d.BLSH = e.BLSH ' +
' and (e.GBGBBS is not NULL) and c.TUDM= ' + QuotedStr(A_PPDM) +
' group by a.BZLSH, a.BJC order by a.BZLSH ';
2: {封片} {}
with qry_tmp do
begin
Close;
SQL.Text := 'select BZFS from TB_YZPPTXXB where TDM = ' + QuotedStr(A_PPDM);
Open;
if Fields[0].AsString = '1' then {按套包裝}
l_sql := 'select a.BZLSH, A.BJC, a.ZXTS BZSL ' +
' from TB_BZSJB A where a.BZBBJ <>''2'' and a.TDM = ' + QuotedStr(A_PPDM) +
' order by a.BZLSH '
else
l_sql := 'select a.BZLSH, A.BJC, sum(c.GBGTMS * e.GBGBBS) BZSL ' +
' from TB_BZSJB A, TB_YZPPTUXXB b,TB_BTGXB c, TB_BSJB d, TB_BBGXB e ' +
' where a.BZLSH = e.BZLSH and b.TUDM = c.TUDM and c.BLSH = d.BLSH and d.BLSH = e.BLSH ' +
' and (e.GBGBBS is not NULL) and a.TDM = ' + QuotedStr(A_PPDM) +
' group by a.BZLSH, a.BJC order by a.BZLSH ';
Close;
end;
end;
{取得該票品的所有包裝規(guī)格,資料包除外}
fcb_BZGG.ClearAll;
with qry_tmp do
begin
Close;
SQL.Text := l_sql;
Open;
while not eof do
begin
fcb_BZGG.Items.Add(FieldByName('BJC').AsString);
fcb_BZGG.FieldItems.Add(FieldByName('BZSL').AsString);
Next;
end;
if not IsEmpty then
fcb_BZGG.ItemIndex := 0;
Close;
end;
case rg_Type.ItemIndex of
0, 1: {普票、零枚} {}
l_sql := 'select b.GBGTMS from TB_YZPPTUXXB a,TB_BTGXB b where a.TUDM = b.TUDM ' +
' and a.TUDM= ' + QuotedStr(A_PPDM);
2: {封片} {}
l_sql := 'select b.GBGTMS from TB_YZPPTUXXB a,TB_BTGXB b where a.TUDM = b.TUDM ' +
' and substr(a.TUDM, 1, 11) = ' + QuotedStr(Copy(A_PPDM, 1, 11));
end;
{取得該票品的版的規(guī)格}
with qry_tmp do
begin
Close;
SQL.Text := l_sql;
Open;
VL_Ban_GG := Fields[0].AsInteger;
Close;
end;
*)
{*******楊俊******}
{包裝規(guī)格去該套下的所有的包裝規(guī)格,版規(guī)格去該套下的所有的版該版該圖枚數(shù)}
cb_BGG.Clear;
cb_BZGG.Clear;
VL_ZXTS.Clear;
with qry_Tmp do
begin
Close;
SQL.Text := 'select distinct BZGG,ZXTS from TB_BZSJB where BZBBJ<>2 and TDM =' + QuotedStr(A_PPDM);
Open;
while not Eof do
begin
cb_BZGG.Items.Add(Trim(FieldByName('BZGG').AsString));
VL_ZXTS.Add(FieldByName('ZXTS').AsString);
Next;
end;
{去除空的items}
{ for i := cb_BZGG.Items.Count - 1 downto 0 do
begin
if cb_BZGG.Items.Strings[i] = '' then
cb_BZGG.Items.Delete(i);
end;}
if cb_BZGG.Items.Count > 0 then
cb_BZGG.ItemIndex := 0;
Close;
SQL.Text := 'select distinct GBGTMS from TB_BTGXB where TUDM like' + QuotedStr(Copy(A_PPDM, 1, 11) + '%') + ' order by GBGTMS ';
Open;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -