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

📄 ar_enter_accountaging.pas

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

Interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Base_Outer, Menus, ExtPrintReport, Db, ActnList, AdODB, Grids, DBGridEh,
  StdCtrls, ExtCtrls, ComCtrls, ToolWin, jpeg;

Type
  TFrm_Ar_Enter_AccountAging = Class(TFrm_Base_Outer)
    AdoQry_MainOrdinalNo: TIntegerField;
    AdoQry_MainDays: TIntegerField;
    AdoQry_MainAgingDESCription: TStringField;
    procedure Act_DeleteExecute(Sender: TObject);
  private
    { Private declarations }
  public
    procedure InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);Override;  
    { Public declarations }
  end;

var
  Frm_Ar_Enter_AccountAging: TFrm_Ar_Enter_AccountAging;

implementation

uses Ar_Enter_AccountAging_D, Sys_Global;

{$R *.DFM}

{ TFrm_Ar_Enter_AccountAging }

procedure TFrm_Ar_Enter_AccountAging.InitForm(AdOConnection: TAdOConnection;
  ReadOnly: Boolean);
begin
  inherited;
  SelectFromSql:='Select OrdinalNo,Days,AgingDESCription From Ar_AccountAging ';
  OrderByFields:=' OrdinalNo ';
  GetData;
  Frm_Sys_Detail:=TFrm_Ar_Enter_AccountAging_D.Create(Application);
end;

procedure TFrm_Ar_Enter_AccountAging.Act_DeleteExecute(Sender: TObject);
var
  SqlText:String;
begin
//  inherited;
  if DispInfo('是否删除这条记录?',2)='y' then
  begin
    SqlText:=' Select * From Ar_AccountAging '
            +' Where OrdinalNo=(Select Max(OrdinalNo) From Ar_AccountAging) '
            +'       And OrdinalNo='''+AdoQry_Main.fieldbyname('OrdinalNo').AsString+''' ';
    AdoQry_Tmp.Close;
    AdoQry_Tmp.SQL.clear;
    AdoQry_Tmp.SQL.Text := SqlText;
    AdoQry_Tmp.Open;
    If AdoQry_Tmp.Eof then
    begin
      DispInfo('不是最后一条记录不能删除!',1);
      Abort;
    end
    else
    begin
      try
        Dbconnect.beginTrans ;
        SqlText:= ' Insert into Ar_AccountAgingHistory '
                  +' (OrdinalNo,Days,AgingDESCription ) '
                  +' Values('
                  +''''+AdoQry_Main.fieldbyname('OrdinalNo').AsString+''''
                  +','''+AdoQry_Main.fieldbyname('Days').AsString+''''
                  +','''+AdoQry_Main.fieldbyname('AgingDESCription').AsString+''''
                  +')';
        AdoQry_Tmp.Close;
        AdoQry_Tmp.SQL.clear;
        AdoQry_Tmp.SQL.Text := SqlText;
        AdoQry_Tmp.ExecSQL ;

        SqlText:=' Delete Ar_AccountAging '
              +' Where OrdinalNo=(Select Max(OrdinalNo) From Ar_AccountAging) '
              +'       And OrdinalNo='''+AdoQry_Main.fieldbyname('OrdinalNo').AsString+''' ';
        AdoQry_Tmp.Close;
        AdoQry_Tmp.SQL.clear;
        AdoQry_Tmp.SQL.Text := SqlText;
        AdoQry_Tmp.ExecSQL ;
        AdoQry_Main.Delete;
        DbConnect.CommitTrans;
      except
        DbConnect.RollBackTrans;
        Abort;
      end;
    end;
  end;


end;

end.

⌨️ 快捷键说明

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