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

📄 unt_cancelbook.pas

📁 本软件为宾馆管理系统软件
💻 PAS
字号:
unit unt_CancelBook;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, ADODB, StdCtrls, Buttons, Grids, DBGrids;

type
  TCancelbookForm = class(TForm)
    ADOTable1: TADOTable;
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Edit2: TEdit;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  CancelbookForm: TCancelbookForm;

implementation
uses Main, unt_CheckUser, unt_CancelBookRep;
{$R *.dfm}

procedure TCancelbookForm.BitBtn2Click(Sender: TObject);
begin
  CancelbookForm.Close;
end;

procedure TCancelbookForm.BitBtn1Click(Sender: TObject);
var
  sSql,factMoney: String;
begin
  factMoney := IntToStr(StrToInt(edit1.text) - DBGrid1.Fields[19].AsInteger);
  sSql := 'update bookroomhistory set accountday=#' + FormatDateTime('yyyy-mm-dd',Now)
        + '#,note1=''' + Edit2.Text + ''',operator=''' + Main.username + ''' where bookno='''
        + DBGrid1.Fields[0].AsString + '''';
  mainForm.exeSql(mainForm.query1,sSql,'2');

  sSql := 'delete from zjqstable where roomno=''' + DBGrid1.Fields[15].AsString + '''';
  mainForm.exeSql(mainForm.query1,sSql,'2');

  sSql := 'update room_manager set use_id=0 where roomno=''' + DBGrid1.Fields[15].AsString + '''';
  mainForm.exeSql(mainForm.query1,sSql,'2');

  sSql := 'insert into zjmxtable(bookno,roomno,name,certi_no,deposit,'
        + 'dayfee,precount,note1,registerday,accountday,operator) values('''
        + DBGrid1.Fields[0].AsString + ''',''' + DBGrid1.Fields[15].AsString + ''',''' + DBGrid1.Fields[1].AsString
        + ''',''' + DBGrid1.Fields[3].AsString + ''',' + factMoney + ',' + DBGrid1.Fields[17].AsString
        + ',' + DBGrid1.Fields[14].AsString + ',''' + '退订客房,退还住房押金,收取手续费'
        + '#' + DBGrid1.Fields[13].AsString + '#,#'
        + FormatDateTime('yyyy-mm-dd',Now) + '#,''' + Main.username + ''')';
  mainForm.exeSql(mainForm.query1,sSql,'2');

  sSql := 'insert into dtsztable(bookno,roomno,name,certi_no,factfee,note1,oper_date,operator) values('''
        + DBGrid1.Fields[0].AsString + ''',''' + DBGrid1.Fields[15].AsString + ''',''' + DBGrid1.Fields[1].AsString
        + ''',''' + DBGrid1.Fields[3].AsString + ''',' + factMoney + ',''' + '退订客房,退还住房押金,收取手续费' + ''',#'
        + FormatDateTime('yyyy-mm-dd',Now) + '#,''' + Main.username + ''')';
  mainForm.exeSql(mainForm.query1,sSql,'2');

  sSql := 'insert into Szhistorytable(bookno,roomno,name,certi_no,factfee,note1,oper_date,operator) values('''
        + DBGrid1.Fields[0].AsString + ''',''' + DBGrid1.Fields[15].AsString + ''',''' + DBGrid1.Fields[1].AsString
        + ''',''' + DBGrid1.Fields[3].AsString + ''',' + factMoney + ',''' + '退订客房,退还住房押金,收取手续费' + ''',#'
        + FormatDateTime('yyyy-mm-dd',Now) + '#,''' + Main.username + ''')';
  mainForm.exeSql(mainForm.query1,sSql,'2');

  if application.MessageBox('是否打印退订单(Yes/No)','提示信息',mb_yesno)=IDYes then
  begin
    sSql := 'select * from bookroom where bookno=''' + DBGrid1.Fields[0].AsString + '''';
    mainForm.exeSql(mainForm.query1,sSql,'1');
    CancelBookRep.QRDBText1.DataField := 'bookno';
    CancelBookRep.QRDBText2.DataField := 'roomno';
    CancelBookRep.QRDBText3.DataField := 'name';
    CancelBookRep.QRDBText4.DataField := 'registerday';
    CancelBookRep.QRDBText7.DataField := 'Operator';
    CancelBookRep.QRLabel10.Caption := Edit1.Text;
    CancelBookRep.QRLabel12.Caption := factMoney;
    CancelBookRep.QRLabel2.Caption := DateToStr(now);
    CancelBookRep.QuickRep1.Preview;
  end;


  sSql := 'delete from bookroom where bookno=''' + DBGrid1.Fields[0].AsString + '''';
  mainForm.exeSql(mainForm.query1,sSql,'2');

  Edit1.Text := '';
  Edit2.Text := '';
  ADOTable1.Active := False;
  ADOTable1.Active := True;
end;

procedure TCancelbookForm.FormShow(Sender: TObject);
begin
  ADOTable1.Active := True;
end;

end.

⌨️ 快捷键说明

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