📄 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;
{-------------------------------------------------------------------------------}
{选择数量}
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: {不用凑整数} {}
rg_Round_Style.Visible := False;
end;
pgc_SeleInfo.ActivePageIndex := rg_Round.ItemIndex; {显示规格}
if not qry_DWFP.IsEmpty then
SetRounding; {凑包凑版调用}
end;
{-------------------------------------------------------------------------------}
{凑整类型的选择,和包装规格的变化导致分配数量的变化}
procedure TFrm_SY_CK_JYP_Add.rg_Round_StyleClick(Sender: TObject);
begin
SetRounding; {凑包凑版调用}
end;
{-------------------------------------------------------------------------------}
{凑版凑包规格的更新}
procedure TFrm_SY_CK_JYP_Add.qry_PPAfterScroll(DataSet: TDataSet);
begin
GetGG(qry_PP.FieldByName('PPDM').AsString); {取得凑整的规格}
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;
{-------------------------------------------------------------------------------}
{打开所选择的计划或者出库单的单位分配数}
procedure TFrm_SY_CK_JYP_Add.qry_CKXZAfterScroll(DataSet: TDataSet);
var
l_sql: string;
begin
{各单位的分配数量}
(* case rg_CKXZ.ItemIndex of
0: {按照分配计划} {}
begin
{对于不同的票品,依据计划也不同(普票,零枚用纪_计内_分配计划(零枚)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: {无依据} {}
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;
{-------------------------------------------------------------------------------}
{取得凑整的规格}
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;
{取得该票品的所有包装规格,资料包除外}
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;
{取得该票品的版的规格}
with qry_tmp do
begin
Close;
SQL.Text := l_sql;
Open;
VL_Ban_GG := Fields[0].AsInteger;
Close;
end;
*)
{*******杨俊******}
{包装规格去该套下的所有的包装规格,版规格去该套下的所有的版该版该图枚数}
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 + -