?? sy_ck_jyp_add.pas
字號:
while not Eof do
begin
cb_BGG.Items.Add(Trim(FieldByName('GBGTMS').AsString));
Next;
end;
{去除包含空的記錄}
for i := cb_BGG.Items.Count - 1 downto 0 do
begin
if cb_BGG.Items.Strings[i] = '' then
cb_BGG.Items.Delete(i);
end;
if cb_BGG.Items.Count > 0 then
begin
cb_BGG.ItemIndex := cb_BGG.Items.Count - 1;
VL_Ban_GG := StrToInt(cb_BGG.Text);
end;
end;
end;
{-------------------------------------------------------------------------------}
{面值,售價,結算價以元顯示}
procedure TFrm_SY_CK_JYP_Add.qry_PPMZGetText(Sender: TField;
var Text: String; DisplayText: Boolean);
begin
if Trim(Sender.AsString) = '' then
Exit;
try
if Sender.AsInteger <> 0 then
Text := FormatFloat('¥#,##0.00', Sender.AsFloat / 100);
except
end;
end;
{-------------------------------------------------------------------------------}
{調用選擇票品模塊}
procedure TFrm_SY_CK_JYP_Add.bbtn_SearchClick(Sender: TObject);
var
l_ModalResult: Integer;
begin
(* rg_Type.OnClick := nil;
qry_PP.AfterScroll := nil;
with TFrm_SY_CK_JYP_SearchPP.Create(Application) do
try
Lios_Type := io_txp;
L_index := rg_Type.ItemIndex;
FB_ShowZero := false;
fcb_PPDLB.ItemIndex := rg_Type.ItemIndex;
fcb_PPDLBChange(nil); {刷新小類}
l_ModalResult := ShowModal;
if l_ModalResult = mrOK then
begin
VL_Type := fcb_PPDLB.ItemIndex;
with qry_PP do
begin
Close;
SQL.Text := GetSQL; {由選擇票品模塊生成的SQL語句}
Open;
end;
end;
finally
Free;
end;
qry_PP.AfterScroll := qry_PPAfterScroll;
rg_Type.ItemIndex := VL_Type;
rg_Type.OnClick := rg_TypeClick;
if l_ModalResult = mrOK then
GetGG(qry_PP.FieldByName('TUDM').AsString); {取得湊整的規格}
*)
with TFrm_SearchPP.Create(Application) do
try
Lios_Type := io_jyp;
// L_index := rg_Type.ItemIndex;
FB_ShowZero := false;
// fcb_PPDLB.ItemIndex := rg_Type.ItemIndex;
fcb_PPDLBChange(nil); {刷新小類}
l_ModalResult := ShowModal;
if l_ModalResult = mrOK then
begin
VL_Type := fcb_PPDLB.ItemIndex;
with qry_PP do
begin
Close;
SQL.Text := GetSQL(True); {由選擇票品模塊生成的SQL語句}
Open;
end;
end;
finally
Free;
end;
end;
{-------------------------------------------------------------------------------}
{上一步}
procedure TFrm_SY_CK_JYP_Add.bbtn_PriorClick(Sender: TObject);
begin
SetState(0);
end;
{-------------------------------------------------------------------------------}
{下一步}
procedure TFrm_SY_CK_JYP_Add.bbtn_NextClick(Sender: TObject);
begin
if qry_PP.IsEmpty then
begin
Application.MessageBox('必須存在一種票品,才能進行下一步的操作!', '提示', MB_OK + MB_IconInformation);
Exit;
end;
SetState(1); {界面刷新}
rg_CKXZClick(nil); {取分配計劃或者分配單}
end;
{-------------------------------------------------------------------------------}
{完成新制定的計劃分配單}
procedure TFrm_SY_CK_JYP_Add.bbtn_FinishClick(Sender: TObject);
begin
if qry_DWFP.IsEmpty then
begin
Application.MessageBox('必須根據一種票品的分配方案,才能進行完成分配單的制定!!', '提示', MB_OK + MB_IconInformation);
Exit;
end;
ModalResult := mrOK;
end;
{-------------------------------------------------------------------------------}
{按步處理的界面顯示設置}
procedure TFrm_SY_CK_JYP_Add.SetState(A_Style: Integer);
begin
pgc_Select.ActivePageIndex := A_Style;
case a_Style of
0:
begin
bbtn_Search.Visible := True;
bbtn_Prior.Enabled := False;
bbtn_Next.Enabled := True;
bbtn_Finish.Visible := False;
end;
1:
begin
bbtn_Search.Visible := False;
bbtn_Prior.Enabled := True;
bbtn_Next.Enabled := False;
bbtn_Finish.Visible := True;
end;
end;
end;
{-------------------------------------------------------------------------------}
{湊包湊版調用}
procedure TFrm_SY_CK_JYP_Add.SetRounding;
var
l_Dest: Integer;
begin
l_Dest := 0;
case rg_Round.ItemIndex of
0: {湊包} {}
begin
if cb_BZGG.Items.Count = 0 then
begin
Application.MessageBox('包裝規格可能不完整,無法按包進行湊整!', '提示', MB_OK + MB_IconInformation);
rg_Round.ItemIndex := 2; {默認為不湊}
Exit;
end;
l_Dest := StrToInt(VL_ZXTS[cb_BZGG.ItemIndex]);
end;
1: {湊版} {}
l_Dest := VL_Ban_GG;
2: {不用湊整數} {}
l_Dest := 0;
end;
SetRoundSL(rg_Round.ItemIndex, rg_Round_Style.ItemIndex, L_Dest); {分配數量的湊整處理}
end;
{-------------------------------------------------------------------------------}
{分配數量的湊整處理}
procedure TFrm_SY_CK_JYP_Add.SetRoundSL(A_Round, A_Round_Style, A_SingleDest: Integer);
{參數說明:湊包方式、湊整的方式(向上、向下)、湊整時的單包或者單版包裝規格}
var
l_dbgPlace: TBookMark;
begin
{湊整}
with qry_DWFP do
begin
DisableControls;
First;
l_dbgPlace := GetBookMark;
while not Eof do
begin
Edit;
if A_Round = 2 then {不湊} {}
FieldByName('SL').AsInteger := FieldByName('SL_OLD').AsInteger
else
FieldByName('SL').AsInteger :=
GetRoundNumber(FieldByName('SL_OLD').AsInteger, A_SingleDest, A_Round_Style); {返回湊整后的數據}
Post;
Next;
end;
GotoBookMark(l_dbgPlace);
FreeBookMark(l_dbgPlace);
EnableControls;
end;
end;
{-------------------------------------------------------------------------------}
{返回湊整后的數據}
function TFrm_SY_CK_JYP_Add.GetRoundNumber(A_source, A_SingleDest, A_type: Integer): Integer;
var
l_Mod, l_Div: Integer;
begin
Result := 0;
if A_SingleDest <= 0 then {為0或者小于0時直接返回}
begin
Result := A_Source;
Exit;
end;
l_Mod := A_Source Mod A_SingleDest; {求余數,為0時整除}
if (l_Mod = 0) and (A_Source >= A_SingleDest) then {恰好為整包或整版}
begin
Result := A_Source;
Exit;
end;
l_Div := A_Source Div A_SingleDest; {}
case A_type of
0: {向上} {}
Result := (l_Div + 1) * A_SingleDest;
1: {向下} {}
begin
Result := l_Div * A_SingleDest;
end;
end;
if Result < 0 then {向下取整時為負數時返回0}
Result := 0;
end;
{-------------------------------------------------------------------------------}
procedure TFrm_SY_CK_JYP_Add.cb_BGGChange(Sender: TObject);
begin
VL_Ban_GG := StrToInt(cb_BGG.Text);
SetRounding; {湊包湊版調用}
end;
{-------------------------------------------------------------------------------}
{湊包湊辦}
procedure TFrm_SY_CK_JYP_Add.cb_BZGGChange(Sender: TObject);
begin
SetRounding; {湊包湊版調用}
end;
procedure TFrm_SY_CK_JYP_Add.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
VL_ZXTS.Free;
end;
procedure TFrm_SY_CK_JYP_Add.qry_PPSJGetText(Sender: TField;
var Text: String; DisplayText: Boolean);
begin
if Trim(Sender.AsString) = '' then
Exit;
try
if Sender.AsInteger <> 0 then
Text := FormatFloat('¥#,##0.000', Sender.AsFloat / 100);
except
end;
end;
procedure TFrm_SY_CK_JYP_Add.qry_PPSLGetText(Sender: TField;
var Text: String; DisplayText: Boolean);
begin
if Trim(Sender.AsString) = '' then
Exit;
try
if Sender.AsInteger <> 0 then
Text := FormatFloat('#,##0', Sender.AsFloat);
except
end;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -