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

📄 ap_enter_nopayinvoice.pas

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

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_Ap_Enter_NoPayInvoice = Class(TFrm_Base_Outer)
    AdoQry_MainApInvOICEID: TFloatField;
    AdoQry_MainApInvOICENO: TStringField;
    AdoQry_MainApInvOICEDATE: TDateTimeField;
    AdoQry_MaInvendorCode: TStringField;
    AdoQry_MainCURRENCYCode: TStringField;
    AdoQry_MainEmployeeCode: TStringField;
    AdoQry_MainApInvOICEINPUTDATE: TDateTimeField;
    AdoQry_MainApInvOICEAmount: TFloatField;
    AdoQry_MainApInvOICETAX: TFloatField;
    AdoQry_MainApPayedAmount: TFloatField;
    AdoQry_MainApPayFlag: TIntegerField;
    AdoQry_MainApInvoiceRemArk: TStringField;
    AdoQry_MainEmployeeName: TStringField;
    AdoQry_MainExchRate: TFloatField;
    AdoQry_MaInvendorName: TStringField;
    AdoQry_MainCurrencyName: TStringField;
    AdoQry_MainApInvoiceType: TIntegerField;
    AdoQry_MainApInvoiceAmountC: TFloatField;
    AdoQry_MainApInvoiceTaxC: TFloatField;
    AdoQry_MainApPayedAmountC: TFloatField;
    AdoQry_MainISCredence: TIntegerField;
    procedure FormDestroy(Sender: TObject);
    procedure Act_ModifyExecute(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
    Function SelectStArtMonthAp:string;          //应付模块启用月份;
    Function IsStArt:string;                     //0:为未启用;1:为启用;    
  public
    { Public declarations }
    procedure initform(AdOConnection:TAdOConnection;ReadOnly:boolean);Override;
    function SetDeleteSql:String;Override;
    procedure refreshall;                                            //从服务器中更新修改后的数据
  end;

var
  Frm_Ap_Enter_NoPayInvoice: TFrm_Ap_Enter_NoPayInvoice;

implementation

uses Sys_Global, Ap_Enter_NoPayInvoice_D;

{$R *.DFM}

{ TFrm_Ap_Enter_NoPayInvoice }

function TFrm_Ap_Enter_NoPayInvoice.SetDeleteSql: String;
begin
  Result:='delete ApInvoice where ApInvoiceNo='''+AdoQry_Main.fieldbyname('ApInvoiceNo').asstring+'''' ;
end;

procedure TFrm_Ap_Enter_NoPayInvoice.FormDestroy(Sender: TObject);
begin
  inherited;
  Frm_Ap_Enter_NoPayInvoice:=nil;
end;

procedure TFrm_Ap_Enter_NoPayInvoice.Act_ModifyExecute(Sender: TObject);
begin
  if AdoQry_Main.RecordCount=0 then
  begin
    DispInfo('没有记录可修改',3);
    abort;
  end;
  inherited;
end;

procedure TFrm_Ap_Enter_NoPayInvoice.initform(
  AdOConnection: TAdOConnection; ReadOnly: boolean);
begin
  inherited;
  if (IsStArt='1')  then
  begin
    DispInfo('未匹配采购发票只可在应付模块没有启用前写操作',3);
    Act_New.Enabled :=False;
    act_New.Visible :=False;
    Act_Modify.Enabled :=False;
    Act_Modify.Visible :=False;
    Act_Delete.Enabled :=False;
    Act_Delete.Visible :=False;
    //Close;
  end;
  refreshall;
  Frm_Sys_Detail:=TFrm_Ap_Enter_NoPayInvoice_D.Create(self);
end;

function  TFrm_Ap_Enter_NoPayInvoice.SelectStArtMonthAp:string;
begin
  Result:='';
  Executesql(AdoQry_tmp,' select ApParamValueC from ApParam '
                       +' where ApParamCode=''StartUseAp'' and ApParamName=''应付模块启用'''
                       +' and ApParamValuen=1',0);
 if  AdoQry_tmp.RecordCount>0   then
  Result:=AdoQry_tmp.fieldbyname('ApParamValueC').asstring;
end;

procedure TFrm_Ap_Enter_NoPayInvoice.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  //inherited;
  if Frm_Sys_Condition<>nil then
    Frm_Sys_Condition.Release;
  if Frm_Sys_Detail<>nil then
    Frm_Sys_Detail.Release;
  if Frm_Sys_SortOrder<>nil then
    Frm_Sys_SortOrder.Release;
  if Frm_Sys_QuickLocate<>nil then
    Frm_Sys_QuickLocate.Release;
  if Frm_Sys_SetColumn<>nil then
    Frm_Sys_SetColumn.Release;
  Action:=CaFree;
end;

procedure TFrm_Ap_Enter_NoPayInvoice.refreshall;
begin
  SelectFromSQL:='select  ApInvoice.*,'+
                       {' ApInvoiceNo,'+
                       ' ApInvoiceDate,'+
                       ' VendorCode,'+
                       ' CurrencyCode,'+
                       '  EmployeeCode,'+
                       '  ApInvoiceInputDate,'+
                       '  ApInvoiceAmount,'+
                       '  ApInvoiceAmountC, ' +
                       '  ApInvoiceTax,'+
                       '  ApPayedAmount,'+
                       '  ApPayFlag,'+
                       '  ApInvoiceType,'+
                       '  ApInvoiceRemArk,'+}
                       ' Employee.EmployeeName ,Vendor.VendorName,Currency.CurrencyName '+
                 ' from ApInvoice '+
                 ' left join Employee on Employee.EmployeeCode=ApInvoice.EmployeeCode '+
                 ' left join Vendor on ApInvoice.VendorCode=Vendor.VendorCode'+
                 ' left join Currency on ApInvoice.CurrencyCode=Currency.CurrencyCode';
  ConditionUserDefine :=' ApInvoice.ApInvoiceid not in (select ApInvoiceid from ApInvoiceline)';
                       //+' and ApInvoice.ApInvoiceRemArk like ''历史未匹配入库单%''';
  if SelectStArtMonthAp<>'' then
  ConditionUserDefine :=ConditionUserDefine+' And substring( convert(varchAr(10),ApInvOICEINPUTDATE,102),1,7)<'+SelectStArtMonthAp;
  OrderByFields:='VendorCode,ApInvoiceDate,ApInvoiceNo';
  GetData;
end;

function TFrm_Ap_Enter_NoPayInvoice.IsStArt: string;
begin
  Result:='0';
  Executesql(AdoQry_tmp,' select ApParamValueN from ApParam '
                       +' where ApParamCode=''StartUseAp'' and ApParamName=''应付模块启用''',0);
 if   AdoQry_tmp.RecordCount>0   then
   Result:=AdoQry_tmp.fieldbyname('ApParamValueN').asstring;
end;

end.

⌨️ 快捷键说明

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