?? sy_ck_lmp_add.pas
字號:
{*******************************************************}
{ }
{ 零枚出庫計劃單制定——選擇票品模塊 }
{ }
{ 中軟金馬公司版權所有。2002.06 }
{ }
{ 編制:侯華敏 }
{ }
{ }
{*******************************************************}
(*==============================================================================
程序說明:
1. 票品類別的選擇不可用,僅供查看,因為票品類別是從票品選擇模塊中傳來了參數,
如果選擇,直接調用票品選擇模塊;
2、僅取本年度的分配計劃或者本年度的分配單;
3、 零枚、普票的計劃從紀_計內_分配計劃(零枚)TY_JJNFPJH_LM中取
封片的計劃從紀_計內_分配計劃(封片)TY_JJNFPJH_FP中取 (需要與TB_YZPPXXB關聯,存在套或者圖的信息)
4、沒有依據的出庫也應該允許,即除分配計劃、出庫單外,在加上無依據
對無依據的處理結果是,分配的單位選擇TGS_GXDWSJB中,ZJXJ=1 AND TXYW=1
AND FHDX=1,分配數量默認為0
5、每次僅處理一個庫房的一中票品;
6. 本模塊在省級零枚票管理模塊 計劃管理部分 由單品種多去向出庫計劃單制定菜單調用的 零枚出庫計劃單制定模塊 調用
侯華敏 2002.06.
修改記錄
修改,結算價小數點后保留3位,qry_PP的JSJ.OnGetText由調用qry_PPMZGetText改為調用qry_PPJJGetText by jhshao 2003.05.07
===============================================================================*)
unit SY_CK_LMP_Add;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, Grids, DBGrids, ExtCtrls, ComCtrls, Db, DBTables,
FieldComboBox, sqlstrings;
type
TFrm_SY_CK_LMP_Add = class(TForm)
bbtn_Finish: TBitBtn;
bbtn_Cancel: TBitBtn;
pgc_Select: TPageControl;
tbs_PP: TTabSheet;
tbs_DW: TTabSheet;
rg_CKXZ: TRadioGroup;
dbg_CKXZ: TDBGrid;
dbg_DWFP: TDBGrid;
rg_Type: TRadioGroup;
bbtn_Prior: TBitBtn;
bbtn_Next: TBitBtn;
bbtn_Search: TBitBtn;
rg_Round: TRadioGroup;
rg_Round_Style: TRadioGroup;
lbl_BZGG: TLabel;
qry_PP: TQuery;
ds_PP: TDataSource;
qry_CKXZ: TQuery;
ds_CKXZ: TDataSource;
qry_DWFP: TQuery;
ds_DWFP: TDataSource;
qry_Tmp: TQuery;
fcb_BZGG: TFieldComboBox;
usql_DWFP: TUpdateSQL;
qry_PPKFDM: TStringField;
qry_PPKFMC: TStringField;
qry_PPTUDM: TStringField;
qry_PPPPMC: TStringField;
qry_PPZH: TStringField;
qry_PPMZ: TFloatField;
qry_PPSJ: TFloatField;
qry_PPKWH: TStringField;
qry_PPPPLB: TStringField;
qry_PPJSJ: TFloatField;
qry_PPZK: TFloatField;
qry_PPSL: TFloatField;
qry_PPTYPE: TStringField;
qry_DWFPDWDM: TStringField;
qry_DWFPSL: TFloatField;
qry_DWFPSL_OLD: TFloatField;
qry_DWFPDWMC: TStringField;
qry_PPJJ: TFloatField;
qry_PPXJ: TFloatField;
dbg_PP: TDBGrid;
procedure bbtn_SearchClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure bbtn_PriorClick(Sender: TObject);
procedure bbtn_NextClick(Sender: TObject);
procedure rg_TypeClick(Sender: TObject);
procedure rg_RoundClick(Sender: TObject);
procedure rg_CKXZClick(Sender: TObject);
procedure qry_CKXZAfterScroll(DataSet: TDataSet);
procedure dbg_PPDblClick(Sender: TObject);
procedure bbtn_FinishClick(Sender: TObject);
procedure rg_Round_StyleClick(Sender: TObject);
procedure qry_PPMZGetText(Sender: TField; var Text: String;
DisplayText: Boolean);
procedure qry_PPAfterScroll(DataSet: TDataSet);
procedure qry_PPJJGetText(Sender: TField; var Text: String;
DisplayText: Boolean);
private
procedure SetState(A_Style: Integer); {按步處理的界面顯示設置}
procedure SetRoundSL(A_Round, A_Round_Style, A_SingleDest: Integer); {分配數量的湊整處理}
function GetRoundNumber(A_source, A_SingleDest,
A_type: Integer): Integer; {返回湊整后的數據}
procedure SetRounding; {湊包湊版調用}
procedure GetGG(A_PPDM: string); {取得湊整的規格}
{ Private declarations }
public
{ Public declarations }
end;
var
Frm_SY_CK_LMP_Add: TFrm_SY_CK_LMP_Add;
implementation
{$R *.DFM}
uses
SearchPP;
var
VL_ND: string; {服務器年度}
VL_Type: Integer; {票品類型}
VL_Ban_GG: Integer; {取得該票品的版的規格}
{-------------------------------------------------------------------------------}
{初始化}
procedure TFrm_SY_CK_LMP_Add.FormCreate(Sender: TObject);
begin
SetState(0);
rg_RoundClick(nil);
{取服務器年度}
with qry_Tmp do
begin
Close;
SQL.Text := 'Select SysDate from Dual';
Open;
VL_ND := FormatDateTime('yyyy', FieldByName('SysDate').AsDateTime);
Close;
end;
end;
{-------------------------------------------------------------------------------}
{票品類別的選擇不可用,僅供查看,因為票品類別是從票品選擇模塊中傳來了參數,
如果選擇,直接調用票品選擇模塊;}
procedure TFrm_SY_CK_LMP_Add.rg_TypeClick(Sender: TObject);
begin
bbtn_SearchClick(nil);
end;
{-------------------------------------------------------------------------------}
{雙擊等于點擊下一步}
procedure TFrm_SY_CK_LMP_Add.dbg_PPDblClick(Sender: TObject);
begin
bbtn_NextClick(nil);
end;
{-------------------------------------------------------------------------------}
{出庫時選擇的依據:0、依據計劃,1、依據本年度出庫單}
procedure TFrm_SY_CK_LMP_Add.rg_CKXZClick(Sender: TObject);
var
l_sql: string;
begin
rg_Round.Enabled := True;
dbg_CKXZ.Columns[1].Visible := True;
dbg_CKXZ.Columns[1].Width := 120;
dbg_CKXZ.Columns[2].Visible := False; {圖序號}
case rg_CKXZ.ItemIndex of
0: {按照分配計劃} {}
begin
{對于不同的票品,依據計劃也不同(普票,零枚用紀_計內_分配計劃(零枚)TY_JJNFPJH_LM,
封片簡用紀_計內_分配計劃(封片)TY_JJNFPJH_FP)}
case rg_Type.ItemIndex of
0, 1: {普票、零枚} {}
begin
dbg_CKXZ.Columns[0].Title.Caption := '計劃號';
dbg_CKXZ.Columns[0].FieldName := 'JHH';
dbg_CKXZ.Columns[1].Width := 95;
dbg_CKXZ.Columns[2].Visible := True; {圖序號}
L_SQL := 'select distinct a.JHH, c.TUDM PPDM, a.PPMC, a.TX from TY_JJNFPJH_LM a, TB_YZPPTXXB b,TB_YZPPTUXXB c ' +
' where a.JHH =b.JHH and b.TDM= c.TDM and c.TXH = a.TX and a.ND =' + QuotedStr(VL_ND);
end;
2: {封片} {}
begin
dbg_CKXZ.Columns[1].Visible := False;
dbg_CKXZ.Columns[0].Title.Caption := '郵資類名稱';
dbg_CKXZ.Columns[0].FieldName := 'MC';
l_sql := ' select distinct a.YZLDM, b.MC, a.YZLDM PPDM ' +
' from TY_JJNFPJH_FP a, TG_YZPPLDMB b where a.YZLDM = b.YZLDM ' +
' and a.ND =' + QuotedStr(VL_ND);
end;
end;
end;
1: {按照出庫單} {}
begin
dbg_CKXZ.Columns[0].Title.Caption := '出庫計劃單號';
dbg_CKXZ.Columns[0].FieldName := 'JHH';
L_SQL := 'select distinct a.CKJHDH JHH, a.PPDM, a.PPMC ' +
' from TYS_TXCKJHDPPB a, TYS_TXPCKJHDB b ' +
' where a.CKJHDH = b.CKJHDH and a.CKJHDH like ''TX%'' and b.CKXZ =''10'' ' +
' and to_char(b.ZDRQ, ''YYYY'') = ' + QuotedStr(VL_ND);
end;
2: {無依據} {}
begin
{不能湊包版}
rg_Round.ItemIndex := 2;
rg_Round.Enabled := False;
qry_CKXZ.Close;
with qry_DWFP do
begin
Close;
SQL.Text := 'select DWDM, DWJC DWMC, 0 SL, 0 SL_OLD from TGS_GXDWSJB ' +
' where ZJXJ=''1'' and TXYW=''1'' and FHDX=''1'' order by PXM ';
Open;
end;
Exit;
end;
end;
with qry_CKXZ do
begin
Close;
SQL.Text := l_sql;
Open;
if IsEmpty then {為空時清空子表} {}
qry_CKXZAfterScroll(nil)
else if rg_Type.ItemIndex <> 2 then { 普票和零枚定位到上一步所選擇的票品 } {}
Locate('PPDM', qry_PP.FieldByName('TUDM').AsString, [])
else if rg_Type.ItemIndex = 2 then { 封片需要定位到上一步所選擇的票品的類別(前三位) } {}
Locate('PPDM', Copy(qry_PP.FieldByName('TUDM').AsString, 1, 3), []);
end;
end;
{-------------------------------------------------------------------------------}
{湊包湊版的選擇}
procedure TFrm_SY_CK_LMP_Add.rg_RoundClick(Sender: TObject);
begin
case rg_Round.ItemIndex of
0: {湊包} {}
begin
lbl_BZGG.Visible := True;
fcb_BZGG.Visible := True;
rg_Round_Style.Visible := True;
end;
1: {湊版} {}
begin
lbl_BZGG.Visible := False;
fcb_BZGG.Visible := False;
rg_Round_Style.Visible := True;
end;
2: {不用湊整數} {}
begin
lbl_BZGG.Visible := False;
fcb_BZGG.Visible := False;
rg_Round_Style.Visible := False;
end;
end;
if not qry_DWFP.IsEmpty then
SetRounding; {湊包湊版調用}
end;
{-------------------------------------------------------------------------------}
{湊整類型的選擇,和包裝規格的變化導致分配數量的變化}
procedure TFrm_SY_CK_LMP_Add.rg_Round_StyleClick(Sender: TObject);
begin
SetRounding; {湊包湊版調用}
end;
{-------------------------------------------------------------------------------}
{湊版湊包規格的更新}
procedure TFrm_SY_CK_LMP_Add.qry_PPAfterScroll(DataSet: TDataSet);
begin
GetGG(qry_PP.FieldByName('TUDM').AsString); {取得湊整的規格}
end;
{-------------------------------------------------------------------------------}
{打開所選擇的計劃或者出庫單的單位分配數}
procedure TFrm_SY_CK_LMP_Add.qry_CKXZAfterScroll(DataSet: TDataSet);
var
l_sql: string;
begin
{各單位的分配數量}
case rg_CKXZ.ItemIndex of
0: {按照分配計劃} {}
begin
{對于不同的票品,依據計劃也不同(普票,零枚用紀_計內_分配計劃(零枚)TY_JJNFPJH_LM,
封片簡用紀_計內_分配計劃(封片)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_LM 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) +
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -