?? blankoutinvoicepropertyfrm.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 + -