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

📄 ar_enter_monthcheck.pas

📁 一个MRPII系统源代码版本
💻 PAS
字号:
unit Ar_Enter_MonthCheck;

Interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Base_Dialog, Db, AdODB, StdCtrls, Mask;

Type
  TFrm_Ar_Enter_MonthCheck = Class(TFrm_Base_Dialog)
    Medt_LastMonth: TMaskEdit;
    MEdt_ThisMonth: TMaskEdit;
    Label1: TLabel;
    Label2: TLabel;
    Btn_CancelMonthCheck: TButton;
    procedure btn_CancelClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure btn_okClick(Sender: TObject);
    procedure Btn_CancelMonthCheckClick(Sender: TObject);
  private
    IsFirstCheck : Integer;
    StartUseAr : Boolean;
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Frm_Ar_Enter_MonthCheck: TFrm_Ar_Enter_MonthCheck;

implementation
uses Sys_Global;
{$R *.DFM}

procedure TFrm_Ar_Enter_MonthCheck.btn_CancelClick(Sender: TObject);
begin
  inherited;
  Close;
end;

procedure TFrm_Ar_Enter_MonthCheck.FormActivate(Sender: TObject);
var yy,mm,dd : Word;
begin
  inherited;
  StartUseAr := True;
  ExecuteSql(AdoQry_Tmp,' select * from Ar_Param '
                       +'  where ParamCode=''ClsPeriod'' ',0 );
  If AdoQry_Tmp.RecordCount>0 then 
  begin
    yy := StrToInt(Copy(AdoQry_tmp.fieldbyname('ParamValueC').AsString,1,4));
    mm := StrToInt(Copy(AdoQry_tmp.fieldbyname('ParamValueC').AsString,6,2));
    dd := 1;
    MEdt_LastMonth.Text := FormatDateTime('yyyy.mm',EnCodeDate(yy,mm,dd));
    DeCodeDate(IncMonth(EnCodeDate(yy,mm,dd),1),yy,mm,dd);
    MEdt_ThisMonth.Text := FormatDateTime('yyyy.mm',EnCodeDate(yy,mm,dd));
    IsFirstCheck := 0;
    Exit;
  end;
  ExecuteSql(AdoQry_Tmp,' select * from Ar_Param '
                       +'  where ParamCode=''StartUseAr'' ',0 );
  IF AdoQry_Tmp.RecordCount>0 then 
  begin
    yy := StrToInt(Copy(AdoQry_tmp.fieldbyname('ParamValueC').AsString,1,4));
    mm := StrToInt(Copy(AdoQry_tmp.fieldbyname('ParamValueC').AsString,6,2));
    dd := 1;
    MEdt_ThisMonth.Text := FormatDateTime('yyyy.mm',EnCodeDate(yy,mm,dd));
    Medt_LastMonth.Text := '';
    IsFirstCheck := 1;
  end
  else StartUseAr := False;
end;

procedure TFrm_Ar_Enter_MonthCheck.btn_okClick(Sender: TObject);
var Month : String;
begin
  inherited;
  If Not StartUseAr then
  begin
    DispInfo('模块未启用,不能月结!',1);
    Abort;
  end;
  Month := MEdt_ThisMonth.Text ;
  If DispInfo('确认要月结吗?',2)<>'y' then Exit;
  try
    ExecuteSQl(AdoQry_Tmp,'exec Usp_ArMonthCheck '
                         +Copy(Month,1,4)+','
                         +Copy(Month,6,2)+','
                         +IntToStr(IsFirstCheck)+','
                         +'0',1);
    DispInfo('月结完毕!',3);
    btn_Ok.Enabled := False;
  except
    DispInfo('月结失败,请重试!',3);
    Btn_Ok.Enabled := True;
    Abort;
  end;
end;

procedure TFrm_Ar_Enter_MonthCheck.Btn_CancelMonthCheckClick(
  Sender: TObject);
var Month : String;
begin
  inherited;
  If Not StartUseAr then
  begin
    DispInfo('模块未启用,不能取消月结!',1);
    Abort;
  end;
  ExecuteSql(AdoQry_Tmp,'select * from Ar_Param '
                       +' where ParamCode=''ClsPeriod'' ',0);
  If AdoQry_Tmp.RecordCount = 0 then 
  begin
    DispInfo('还未月结过,不能取消月结!',1);
    Abort;
  end;
  Month := AdoQry_Tmp.fieldbyname('ParamValueC').AsString;
  If DispInfo('确认要取消月结吗?',2)<>'y' then Exit;
  try
    ExecuteSQl(AdoQry_Tmp,'exec Usp_ArMonthCheck '
                         +Copy(Month,1,4)+','
                         +Copy(Month,6,2)+','
                         +'0,'
                         +'1',1);
    DispInfo('取消月结完毕!',3);
    btn_CancelMonthCheck.Enabled := False;
    Btn_Ok.Enabled := False;
  except
    DispInfo('取消月结失败,请重试!',3);
    Btn_CancelMonthCheck.Enabled := True;
    Btn_Ok.Enabled := True;
    Abort;
  end;
end;

end.

⌨️ 快捷键说明

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