?? jm_data.pas
字號:
{*******************************************************}
{ }
{ 數據模塊 }
{ }
{ 中軟金馬公司版權所有。2002.12前 }
{ }
{ 編制:中軟金馬郵資票品項目開發組 }
{ }
{ }
{*******************************************************}
(*
本模塊在地市集郵票管理,地市集郵品管理,地市市場購入票里面調用。
*)
unit JM_data;
interface
uses
SysUtils, Windows, Messages, Classes, stdctrls,Graphics, Controls, Forms,
Dialogs, DBTables, DB;
type
Tfrm_Data = class(TDataModule)
spr_dh: TStoredProc;
qrytmp: TQuery;
spr_jz: TStoredProc;
SPr_TJD_JZ: TStoredProc;
SPr_QT_RKD_JZ: TStoredProc;
Spr_TPD_JZ: TStoredProc;
SPr_ms_xs: TStoredProc;
Spr_HT_RKD_JZ: TStoredProc;
Qry_super: TQuery;
Qry_send: TQuery;
Qry_zc: TQuery;
DS_zc: TDataSource;
Qry_mz: TQuery;
DS_mz: TDataSource;
Qry_xtjy1: TQuery;
Upd_xtjy1: TUpdateSQL;
DS_xtjy1: TDataSource;
Qry_xtjywy: TQuery;
DS_xtjywy1: TDataSource;
Upd_tgpyjy1: TUpdateSQL;
Qry_tgpyjy1: TQuery;
DS_tgpyjy1: TDataSource;
Qry_tgpyjywy1: TQuery;
DS_tgpyjywy1: TDataSource;
Qry_yljhdhfl: TQuery;
DS_yljhdhfl: TDataSource;
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
function DoJZ(JZType: Integer; Value: string): boolean; //記帳存儲過程
function ZHLocate(const ACaption,APrompt:string;var Value:string): Boolean;
type
TQH_TYPE = (is_Q, is_H);
var
frm_Data: Tfrm_Data;
implementation
uses datas, pub;
{$R *.DFM}
procedure Tfrm_Data.DataModuleCreate(Sender: TObject);
var
i: integer;
begin
for i := 0 to ComponentCount - 1 do
begin
if Components[i] is TDBDataSet then
TDBDataSet(Components[i]).DataBaseName := data.dm.DatabaseName;
end;
{ i:=0;
while DBa_JM.Connected<> true do
begin
try
i:=i+1;
DBa_JM.Connected := True;
except
if i>3 then
begin
CHQMsgBox('您對該系統的權限已經被更改,請與系統管理員聯系。');
halt;
end;
end;
end;}
end;
function DoJZ(JZType: Integer; Value: string): boolean; //記帳存儲過程
{JZType:
1:前臺入庫復核時調用
2:前臺生成退繳單,后臺復核計帳時調用
3:后臺生成調配單,前臺在復核時調用(必須在第二個人復核后)
4:后臺入庫復核時調用
5:前臺銷售記帳
}
begin
result := true;
with frm_Data do
begin
case JZType of
1:
begin
SPr_QT_RKD_JZ.ParamByName('pc_fhdh').AsString := Value;
SPr_QT_RKD_JZ.ParamByName('pc_userid').AsString := VG_UserID;
SPr_QT_RKD_JZ.ExecProc;
Result := SPr_QT_RKD_JZ.Params[0].asinteger = 0;
Exit;
end;
2:
begin
SPr_TJD_JZ.ParamByName('pc_tjdh').AsString := Value;
SPr_TJD_JZ.ParamByName('pc_userid').AsString := VG_UserID;
SPr_TJD_JZ.ExecProc;
Result := SPr_TJD_JZ.Params[0].asinteger = 0;
Exit;
end;
3:
begin
SPr_TPD_JZ.ParamByName('pc_tpdh').AsString := Value;
SPr_TPD_JZ.ParamByName('pc_userid').AsString := VG_UserID;
SPr_TPD_JZ.ExecProc;
Result := SPr_TPD_JZ.Params[0].asinteger = 0;
Exit;
end;
4:
begin
SPr_HT_RKD_JZ.ParamByName('pc_rkdh').AsString := Value;
SPr_HT_RKD_JZ.ParamByName('pc_userid').AsString := VG_UserID;
SPr_HT_RKD_JZ.ExecProc;
Result := SPr_HT_RKD_JZ.Params[0].asinteger = 0;
Exit;
end;
5:
begin
SPr_ms_xs.ParamByName('pc_jylsh').AsString := Value;
SPr_ms_xs.ParamByName('pc_userid').AsString := VG_UserID;
SPr_ms_xs.ExecProc;
Result := SPr_ms_xs.Params[0].asinteger = 0;
Exit;
end;
end;
end;
end;
{-------------------------------------------------------------------------------}
function ZHLocate(const ACaption,APrompt:string;var Value:string): Boolean;
var
Form: TForm;
Prompt: TLabel;
Edit: TEdit;
DialogUnits: TPoint;
ButtonTop, ButtonWidth, ButtonHeight: Integer;
function GetAveCharSize(Canvas: TCanvas): TPoint;
var
I: Integer;
Buffer: array[0..51] of Char;
begin
for I := 0 to 25 do Buffer[I] := Chr(I + Ord('A'));
for I := 0 to 25 do Buffer[I + 26] := Chr(I + Ord('a'));
GetTextExtentPoint(Canvas.Handle, Buffer, 52, TSize(Result));
Result.X := Result.X div 52;
end;
begin
Result := False;
Form := TForm.Create(Application);
with Form do
try
Canvas.Font.Name := '宋體';
Canvas.Font.Size :=9;
DialogUnits := GetAveCharSize(Canvas);
BorderStyle := bsDialog;
Caption := ACaption;
ClientWidth := MulDiv(180, DialogUnits.X, 4);
ClientHeight := MulDiv(63, DialogUnits.Y, 8);
Position := poScreenCenter;
Prompt := TLabel.Create(Form);
with Prompt do
begin
Parent := Form;
font.Name :='宋體';
Font.Size :=9;
AutoSize := True;
Left := MulDiv(8, DialogUnits.X, 4);
Top := MulDiv(8, DialogUnits.Y, 8);
Caption := APrompt;
end;
Edit := TEdit.Create(Form);
with Edit do
begin
Parent := Form;
font.Name :='宋體';
Font.Size :=9;
Left := Prompt.Left;
Top := MulDiv(19, DialogUnits.Y, 8);
Width := MulDiv(164, DialogUnits.X, 4);
MaxLength := 255;
Text := Value;
SelectAll;
end;
ButtonTop := MulDiv(41, DialogUnits.Y, 8);
ButtonWidth := MulDiv(50, DialogUnits.X, 4);
ButtonHeight := MulDiv(14, DialogUnits.Y, 8);
with TButton.Create(Form) do
begin
Parent := Form;
font.Name :='宋體';
Font.Size :=9;
Caption := '確定';
ModalResult := mrOk;
Default := True;
SetBounds(MulDiv(38, DialogUnits.X, 4), ButtonTop, ButtonWidth,
ButtonHeight);
end;
with TButton.Create(Form) do
begin
Parent := Form;
font.Name :='宋體';
Font.Size :=9;
Caption := '取消';
ModalResult := mrCancel;
Cancel := True;
SetBounds(MulDiv(92, DialogUnits.X, 4), ButtonTop, ButtonWidth,
ButtonHeight);
end;
if ShowModal = mrOk then
begin
Value := Edit.Text;
Result := True;
end;
finally
Form.Free;
end;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -