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

📄 blankoutinvoicepropertyfrm.pas

📁 供水营销打印程序源码
💻 PAS
字号:
unit BlankoutInvoicePropertyFrm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, SJCustomProperty, cxLookAndFeelPainters, PropStorageEh,
  StdCtrls, cxButtons, ExtCtrls, cxControls, cxContainer, cxEdit,
  cxTextEdit, cxMaskEdit, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit,
  cxDBLookupComboBox, ComCtrls, Grids, DBGridEh;

type
  TfrmPropertyBlankoutInvoice = class(TSJCustomPropertyForm)
    Image1: TImage;
    Label1: TLabel;
    Label2: TLabel;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    DBGridEh1: TDBGridEh;
    edtLocate: TcxLookupComboBox;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure edtLocatePropertiesInitPopup(Sender: TObject);
    procedure edtLocatePropertiesChange(Sender: TObject);
    procedure btnOKClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmPropertyBlankoutInvoice: TfrmPropertyBlankoutInvoice;

implementation

uses InvPrintDM, SJInvPrintGlobal;

{$R *.dfm}

procedure TfrmPropertyBlankoutInvoice.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  inherited;
  dmInvPrint.AqryPaiedWaterfee.Close;
end;

procedure TfrmPropertyBlankoutInvoice.edtLocatePropertiesInitPopup(
  Sender: TObject);
begin
  inherited;
  Screen.Cursor := crHourGlass;
  try
    with dmInvPrint.AqryPaiedWaterfee do
    try
      if not Active then
        Open;
    except
      ShowMessage('打开客户缴费资料时失败,请稍后再试 。');
    end;
  finally
    Screen.Cursor := crDefault;
  end;

end;

procedure TfrmPropertyBlankoutInvoice.edtLocatePropertiesChange(
  Sender: TObject);
// 查找对应的发票
begin
  inherited;
  with dmInvPrint.AqryPaiedWaterfee do
  begin
    if not Active then
      Exit;
    if not Locate('WRID', edtLocate.EditValue, []) then
      ShowMessage('不存在此发票号或发票号码无效,请确认后再试 。');
  end;
end;

procedure TfrmPropertyBlankoutInvoice.btnOKClick(Sender: TObject);
// 作废发票
  function BlankoutInvoice(Aid: Integer): Boolean;
  begin
    Result := False;
    with dmInvPrint.AqryTmp do
    try
      Close;
      SQL.Clear;
      SQL.Add('Update Waterfee set Blankoutflag=:Blankoutflag, Blankoutdate=:Blankoutdate, Modifier=:Modifier, Modifydate=:Modifydate where WRID=:WRID');
      Parameters.ParamByName('Blankoutflag').Value := True;
      Parameters.ParamByName('Blankoutdate').Value := Date;
      Parameters.ParamByName('Modifier').Value     := GUserID;
      Parameters.ParamByName('Modifydate').Value   := Date;
      Parameters.ParamByName('WRID').Value         := Aid;
      try
        ExecSQL;
      except
        Exit;
      end;
      Result := True;
    finally
      Close;
    end;
  end;

const
  ReportTitle = '作废广东省商品销售统一发票';
var
  Astr: string;
  ARepfile: string;
begin
  inherited;
  Astr := Format('你真的要作废号码为:%s 的发票吗?', [edtLocate.Text]);
  if Application.MessageBox(Pchar(Astr), Pchar('提示'), MB_YESNO) = IDNO then
    Exit;

  ARepfile := ExtractFilePath(Application.ExeName) + 'Report\' + ReportTitle + '.rmf';
  if not FileExists(ARepfile) then
  begin
    ShowMessage('发票格式文件丢失,请与系统开发商联系 。');
    Exit;
  end;

  Screen.Cursor := crHourGlass;
  with dmInvPrint do
  try
    if not BlankoutInvoice(edtLocate.EditValue) then
    begin
      ShowMessage('作废发票失败,请稍后再试 。');
      Exit;
    end;
    RMReport.FileName := ARepfile;
    RMReport.Title    := ReportTitle;
    RMReport.LoadFromFile(ARepfile);
    RMReport.PrepareReport;
    RMReport.PrintPreparedReportDlg;
    AqryPaiedWaterfee.Close;
  finally
    Screen.Cursor := crDefault;
  end;
  
end;

end.

⌨️ 快捷键说明

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