⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jm_data.pas

📁 省级集邮品管理ERP
💻 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 + -