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

📄 sy_jz.pas

📁 省级集邮品管理ERP
💻 PAS
字号:
{*******************************************************}
{                                                       }
{                     月末节转                          }
{                                                       }
{            中软金马公司版权所有。2002.12前            }
{                                                       }
{            编制:中软金马邮资票品项目开发组           }
{                                                       }
{                                                       }
{*******************************************************}
(*
省级集邮品,省级集邮票,省级零枚票管理,省级市场购入票
地市集邮品,地市集邮票,地市市场购入票

*)
{
有关表:
  初始化杂表、零枚票进销存表
  关系单位数据表、零枚票库存、零枚票常用面值表
数据来源:
功能:
算法:
  1.设初始化杂表为已经初始化完成,
  2.通过零枚票库存对'面值、SUM(数量) AS 结存数量、SUM(数量*面值) AS 结存金额'进行GROUP BY得数据集'A'
    并且面值要在零枚票常用面值表中存在
    取得关系单位数据表
    零枚票进销存表
      单位代码:关系单位数据表.单位代码
      年度:系统启用时间的年度
      月份:系统启用时间的月份
      面值:A.面值
      上期库存数量:A.结存数量
      上期库存金额:A.结存金额
更新有关表:
备注:
  初始化未完成时,不能进行其它操作

  初始化完成:
  集邮票明细分类帐余额表
  集邮票总帐余额表
  集邮票明细分类帐(库管员)
  集邮票月盘存表
  集邮票品库存(库管)
  集邮票进发存明细帐余额表
}
unit Sy_JZ;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  FormBase, StdCtrls, Buttons, Db, DBTables, Spin, Grids, DBGrids, SQLStrings;

type
  Tfrm_JZ = class(TFFormBase)
    BitBtn1: TBitBtn;
    StoredProc1: TStoredProc;
    BitBtn5: TBitBtn;
    Label1: TLabel;
    StoredProc2: TStoredProc;
    StoredProc3: TStoredProc;
    StoredProc4: TStoredProc;
    Query1: TQuery;
    lbl1: TLabel;
    lbl2: TLabel;
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
    Lookup_dm: string;
    FStoredProc: TStoredProc;
    JZ_IO_TYPE: TIO_TYPE;
  public
    { Public declarations }
  end;

function SHOWJZ(FType: TIO_TYPE; const SenderTag: integer): Boolean;
var
  frm_JZ: Tfrm_JZ;

implementation

uses datas,pub;
{$R *.DFM}

function SHOWJZ(FType: TIO_TYPE; const SenderTag: integer): Boolean;
begin
  Result := false;
  Application.CreateForm(Tfrm_JZ, frm_JZ); {}
  with frm_JZ do 
  try
    Tag := SenderTag;
    if CheckRight(frm_JZ, [BitBtn1]) then
    begin
      JZ_IO_TYPE := FType;
      Caption := '邮资票品管理信息系统';
      case FType of
        io_jyp:
          begin
            FStoredProc := StoredProc1;
            bitbtn1.Caption := '集邮票结转';
            Lookup_dm := 'jyp_jyny';
          end;
        io_txp:
          begin
            FStoredProc := StoredProc2;
            bitbtn1.Caption := '零枚票结转';
            Lookup_dm := 'txp_jyny';
          end;
        io_yp:
          begin
            FStoredProc := StoredProc3;
            bitbtn1.Caption := '集邮品结转';
            Lookup_dm := 'yp_jyny';
          end;
        io_grp:
          begin
            FStoredProc := StoredProc4;
            bitbtn1.Caption := '购入票结转';
            Lookup_dm := 'grp_jyny';
          end;
      end;
      GetData('SELECT ZFXZ FROM TGS_ZB WHERE DM = ''' + Lookup_dm + '''');
      with data.qrytmp do
      begin
        lbl1.Caption := Copy(FieldByName('ZFXZ').Asstring, 1, 4);
        lbl2.Caption := Copy(FieldByName('ZFXZ').Asstring, 5, 2);
      end;
      result := ShowModal = MB_OK;
    end;
  finally
    Free;
  end;
end;

procedure Tfrm_JZ.BitBtn1Click(Sender: TObject);

  function UnCheckedCRKD: boolean;
  const
    unchkRCKD = 'SELECT 1, count(*) FROM %s WHERE JZY is null and substr(RKDH, 2, 6) = ''%s'' union ' +
      'SELECT 2, count(*) FROM %s WHERE HDR is null and JSZT<>''1'' and substr(FHDH, 2, 6) = ''%s'' ORDER BY 1';
  var
    v_s_msg: string;
  begin
    Result := false;
    case JZ_IO_TYPE of
      io_jyp:
        AssignSQLstr(Query1, format(unchkRCKD, ['TKS_JYRKD', lbl1.Caption + lbl2.Caption, 'TKS_JYFHD', lbl1.Caption + lbl2.Caption]));
      io_txp:
        AssignSQLstr(Query1, format(unchkRCKD, ['TKS_TXRKD', lbl1.Caption + lbl2.Caption, 'TKS_TXFHD', lbl1.Caption + lbl2.Caption]));
      io_yp:
        AssignSQLstr(Query1, format(unchkRCKD, ['TKS_YPRKD', lbl1.Caption + lbl2.Caption, 'TKS_YPFHD', lbl1.Caption + lbl2.Caption]));
      io_grp:
        AssignSQLstr(Query1, format(unchkRCKD, ['TKS_GRPRKD', lbl1.Caption + lbl2.Caption, 'TKS_GRPFHD', lbl1.Caption + lbl2.Caption]));
    end;
    Query1.Open;
    if Query1.Fields[1].AsFloat > 0 then
      v_s_msg := '有' + Query1.Fields[1].AsString + '笔未复核的入库单'#13#10;
    Query1.Next;
    if Query1.Fields[1].AsFloat > 0 then
      v_s_msg := v_s_msg + '      有' + Query1.Fields[1].AsString + '笔未复核的发货单';
    if length(v_s_msg) > 0 then
    begin
      CHQMsgBox('提示:' + v_s_msg + ',不能进行月结!');
      Result := true;
    end;
  end;

  function BeforJZRQ: boolean;
  var
    v_s_sql, v_s_sql1, v_s_yjr: string;
  begin
    Result := false;
    case JZ_IO_TYPE of
      io_jyp:
        v_s_sql := 'jyp_yjrq';
      io_txp:
        v_s_sql := 'txp_yjrq';
      io_yp:
        v_s_sql := 'yp_yjrq';
      io_grp:
        v_s_sql := 'grp_yjrq';
    end;
    v_s_sql := 'select ZFXZ from TGS_ZB where DM=''' + v_s_sql + '''';
    AssignSQLstr(Query1, v_s_sql);
    Query1.Open;
    if Query1.Fields[0].IsNull then
    begin
      Result := true;
      CHQMsgBox('请先设置月结日,再进行月结!');
      exit;
    end;
    v_s_yjr := Query1.Fields[0].AsString;
    v_s_sql := Query1.Fields[0].AsString;

    case JZ_IO_TYPE of
      io_jyp:
        v_s_sql1 := 'jyp_jyny';
      io_txp:
        v_s_sql1 := 'txp_jyny';
      io_yp:
        v_s_sql1 := 'yp_jyny';
      io_grp:
        v_s_sql1 := 'grp_jyny';
    end;
    v_s_sql1 := 'select ZFXZ, to_char(sysdate,''YYYYMMDD'')-to_char(ZFXZ||''' + v_s_sql + ''') from TGS_ZB where DM=''' + v_s_sql1 + '''';
    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.Add(v_s_sql1);
    Query1.Open;
    if Query1.Fields[1].AsFloat < 0 then
      if CHQMsgBox('提示:尚未到月结日期(每月月结日:' + v_s_yjr + '),是否继续月结?', 2) = IDNo then
        Result := true;
  end;
begin
  if BeforJZRQ then
    exit;
  if UnCheckedCRKD then
    exit;

  with FStoredProc do
    if FStoredProc <> nil then
    begin
      Params[1].Asstring := lbl1.Caption;
      Params[2].Asstring := lbl2.Caption;
      ExecProc;
      case Params[0].AsInteger of
        0: CHQMsgBox('数据结转成功!OK...');
        - 1: CHQMsgBox('数据已经过,不能再执行此操作!');
        1: CHQMsgBox('数据结转失败!请与软件开发商联系。');
      end;
    end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -