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

📄 depositform.h

📁 宾馆酒店管理系统,建议在简体中文版Microsoft Windows Server 2003(SP1)/Microsoft Office 2003(SP2)/Microsoft SQL Server
💻 H
📖 第 1 页 / 共 2 页
字号:
			this->groupBox2->Controls->Add(this->label10);
			this->groupBox2->Location = System::Drawing::Point(282, 33);
			this->groupBox2->Name = L"groupBox2";
			this->groupBox2->Size = System::Drawing::Size(255, 135);
			this->groupBox2->TabIndex = 46;
			this->groupBox2->TabStop = false;
			this->groupBox2->Text = L"押金补交信息";
			// 
			// groupBox1
			// 
			this->groupBox1->Controls->Add(this->用餐费TextBox);
			this->groupBox1->Controls->Add(this->label6);
			this->groupBox1->Controls->Add(this->电话费TextBox);
			this->groupBox1->Controls->Add(this->label5);
			this->groupBox1->Controls->Add(this->住宿费TextBox);
			this->groupBox1->Controls->Add(this->label4);
			this->groupBox1->Controls->Add(this->店内消费TextBox);
			this->groupBox1->Controls->Add(this->label3);
			this->groupBox1->Location = System::Drawing::Point(10, 33);
			this->groupBox1->Name = L"groupBox1";
			this->groupBox1->Size = System::Drawing::Size(266, 135);
			this->groupBox1->TabIndex = 45;
			this->groupBox1->TabStop = false;
			this->groupBox1->Text = L"已经发生的费用";
			// 
			// 保存Button
			// 
			this->保存Button->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"保存Button.Image")));
			this->保存Button->Location = System::Drawing::Point(455, 5);
			this->保存Button->Name = L"保存Button";
			this->保存Button->Size = System::Drawing::Size(80, 25);
			this->保存Button->TabIndex = 44;
			this->保存Button->Text = L"保存";
			this->保存Button->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
			this->保存Button->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageBeforeText;
			this->保存Button->UseVisualStyleBackColor = true;
			this->保存Button->Click += gcnew System::EventHandler(this, &DepositForm::保存Button_Click);
			// 
			// 打印Button
			// 
			this->打印Button->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"打印Button.Image")));
			this->打印Button->Location = System::Drawing::Point(367, 5);
			this->打印Button->Name = L"打印Button";
			this->打印Button->Size = System::Drawing::Size(80, 25);
			this->打印Button->TabIndex = 43;
			this->打印Button->Text = L"打印";
			this->打印Button->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
			this->打印Button->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageBeforeText;
			this->打印Button->UseVisualStyleBackColor = true;
			this->打印Button->Click += gcnew System::EventHandler(this, &DepositForm::打印Button_Click);
			// 
			// 酒店房号ComboBox
			// 
			this->酒店房号ComboBox->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->酒店房号ComboBox->FormattingEnabled = true;
			this->酒店房号ComboBox->Location = System::Drawing::Point(79, 7);
			this->酒店房号ComboBox->Name = L"酒店房号ComboBox";
			this->酒店房号ComboBox->Size = System::Drawing::Size(93, 20);
			this->酒店房号ComboBox->TabIndex = 42;
			this->酒店房号ComboBox->SelectedIndexChanged += gcnew System::EventHandler(this, &DepositForm::酒店房号ComboBox_SelectedIndexChanged);
			// 
			// 旅客姓名ComboBox
			// 
			this->旅客姓名ComboBox->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->旅客姓名ComboBox->FormattingEnabled = true;
			this->旅客姓名ComboBox->Location = System::Drawing::Point(249, 7);
			this->旅客姓名ComboBox->Name = L"旅客姓名ComboBox";
			this->旅客姓名ComboBox->Size = System::Drawing::Size(108, 20);
			this->旅客姓名ComboBox->TabIndex = 41;
			this->旅客姓名ComboBox->SelectedIndexChanged += gcnew System::EventHandler(this, &DepositForm::旅客姓名ComboBox_SelectedIndexChanged);
			// 
			// label2
			// 
			this->label2->AutoSize = true;
			this->label2->Location = System::Drawing::Point(178, 12);
			this->label2->Name = L"label2";
			this->label2->Size = System::Drawing::Size(65, 12);
			this->label2->TabIndex = 40;
			this->label2->Text = L"旅客姓名:";
			// 
			// label1
			// 
			this->label1->AutoSize = true;
			this->label1->Location = System::Drawing::Point(8, 12);
			this->label1->Name = L"label1";
			this->label1->Size = System::Drawing::Size(65, 12);
			this->label1->TabIndex = 39;
			this->label1->Text = L"酒店房号:";
			// 
			// DepositForm
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->BackColor = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(0)), static_cast<System::Int32>(static_cast<System::Byte>(192)), 
				static_cast<System::Int32>(static_cast<System::Byte>(192)));
			this->ClientSize = System::Drawing::Size(542, 416);
			this->Controls->Add(this->客房入住单DataGridView);
			this->Controls->Add(this->groupBox2);
			this->Controls->Add(this->groupBox1);
			this->Controls->Add(this->保存Button);
			this->Controls->Add(this->打印Button);
			this->Controls->Add(this->酒店房号ComboBox);
			this->Controls->Add(this->旅客姓名ComboBox);
			this->Controls->Add(this->label2);
			this->Controls->Add(this->label1);
			this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::Fixed3D;
			this->MaximizeBox = false;
			this->MinimizeBox = false;
			this->Name = L"DepositForm";
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
			this->Text = L"登记旅客补交押金信息";
			this->Load += gcnew System::EventHandler(this, &DepositForm::DepositForm_Load);
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->客房入住单DataGridView))->EndInit();
			this->groupBox2->ResumeLayout(false);
			this->groupBox2->PerformLayout();
			this->groupBox1->ResumeLayout(false);
			this->groupBox1->PerformLayout();
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion
	public: String^ MyOperator;
	public: String^ MyCompany;
	private: String^ My入住编号;
	private: static double My累计补交押金=0;
	private: static double My店内消费 = 0;
	private: static double My电话费 = 0;
	private: static double My用餐费 = 0;
	private: static double My住宿费 = 0;
	private: static double My费用总额 = 0;
	private: static String^ MyHotelConnectionString= L"Data Source=.;Initial Catalog=MyHotel;Integrated Security=True;Pooling=False";	
	private: System::Void DepositForm_Load(System::Object^  sender, System::EventArgs^  e) {
		//获取酒店已入住房间信息
        this->酒店房号ComboBox->Items->Clear();
        String^ MySQLConnectionString = MyHotelConnectionString;
        SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
        MyConnection->Open();
		System::Data::DataTable^ MyRoomTable = gcnew System::Data::DataTable();            
        String^ MySQL = "Select * From 酒店房间 Where 已入住人数<>0 ";
        SqlDataAdapter^ MyAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
        MyAdapter->Fill(MyRoomTable);
        this->酒店房号ComboBox->DataSource = MyRoomTable;
        this->酒店房号ComboBox->DisplayMember = "房号";
        this->酒店房号ComboBox->ValueMember = "房号";
        if (MyConnection->State == ConnectionState::Open)
        {
            MyConnection->Close();
        }
	 }
	private: System::Void 酒店房号ComboBox_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
		//获取入住客人信息
        String^ MySQLConnectionString = MyHotelConnectionString;
        String^ MySQL = "Select 客人姓名,入住编号 From 客房入住单 Where 房号='" + this->酒店房号ComboBox->Text + "' AND 入住编号 NOT IN(Select 入住编号 FROM 客房结帐单)";            
        SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
        MyConnection->Open();
		System::Data::DataTable^ MyGuestTable = gcnew System::Data::DataTable();
        SqlDataAdapter^ MyAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
        MyAdapter->Fill(MyGuestTable);
        this->旅客姓名ComboBox->DataSource = MyGuestTable;
        this->旅客姓名ComboBox->DisplayMember = "客人姓名";
        this->旅客姓名ComboBox->ValueMember = "入住编号";
        if (MyConnection->State == ConnectionState::Open)
        {
           MyConnection->Close();
        } 
	 }
	private: System::Void 旅客姓名ComboBox_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
		My累计补交押金=0;
        My店内消费 = 0;
        My电话费 = 0;
        My用餐费 = 0;
        My住宿费 = 0;
        My费用总额 = 0;
        this->预收押金TextBox->Text = "";
        this->电话费TextBox->Text = "";
        this->用餐费TextBox->Text = "";
        this->店内消费TextBox->Text = "";
        this->住宿费TextBox->Text = "";
        this->补交押金TextBox->Text = "";
        this->费用总额TextBox->Text = "";
        this->My入住编号 = this->旅客姓名ComboBox->SelectedValue->ToString();
        String^ MySQLConnectionString = MyHotelConnectionString;
        SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
        MyConnection->Open();
        String^ MySQL = "Select SUM(预收押金) From 客房入住单 Where 入住编号='" + this->My入住编号 + "'";            
        SqlCommand^ MyCommand = gcnew SqlCommand(MySQL, MyConnection);
        this->预收押金TextBox->Text= MyCommand->ExecuteScalar()->ToString();
        MySQL = "Select SUM(金额) From 话费入帐 Where 入住编号='" + this->My入住编号 + "'";
        MyCommand = gcnew SqlCommand(MySQL, MyConnection);
        this->电话费TextBox->Text = MyCommand->ExecuteScalar()->ToString();
        MySQL = "Select SUM(金额) From 餐费入帐 Where 入住编号='" + this->My入住编号 + "'";
        MyCommand = gcnew SqlCommand(MySQL, MyConnection);
        this->用餐费TextBox->Text = MyCommand->ExecuteScalar()->ToString();
        MySQL = "Select SUM(数量*折扣价格) From 消费入帐 Where 入住编号='" + this->My入住编号 + "'";
        MyCommand = gcnew SqlCommand(MySQL, MyConnection);
        this->店内消费TextBox->Text = MyCommand->ExecuteScalar()->ToString();
        MySQL = "Select 折扣价格,入住日期,住宿人数 From 客房入住单 Where 入住编号='" + this->My入住编号 + "'";
		System::Data::DataTable^ MyNewTable = gcnew System::Data::DataTable();
        SqlDataAdapter^ MyAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
        MyAdapter->Fill(MyNewTable);
        String^ My折扣价格 = MyNewTable->Rows[0][0]->ToString();
        DateTime My入住日期 = (DateTime)MyNewTable->Rows[0][1];
		TimeSpan MySpan = DateTime::Now.Subtract(My入住日期);
        int My住宿人数 = Convert::ToInt16(MyNewTable->Rows[0][2]->ToString());
        My住宿费 = Convert::ToDouble(My折扣价格) * Math::Round(MySpan.TotalDays, 0) * My住宿人数;
        this->住宿费TextBox->Text = My住宿费.ToString();
        if (this->店内消费TextBox->Text->Length > 1)
            My店内消费 = Convert::ToDouble(this->店内消费TextBox->Text);
        if (this->电话费TextBox->Text->Length > 1)
            My电话费 = Convert::ToDouble(this->电话费TextBox->Text);
        if (this->用餐费TextBox->Text->Length > 1)
            My用餐费 = Convert::ToDouble(this->用餐费TextBox->Text);
        My费用总额 = My住宿费 + My电话费 + My用餐费 + My店内消费;
        this->费用总额TextBox->Text = My费用总额.ToString();
        double My补交押金 = My费用总额 - Convert::ToDouble(this->预收押金TextBox->Text);
        this->补交押金TextBox->Text = My补交押金.ToString();
        MySQL="Select * From 客房入住单 Where 入住编号='"+this->My入住编号 +"'";
		System::Data::DataTable^ MyGuestTable = gcnew System::Data::DataTable();
        SqlDataAdapter^ MyDataAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
        MyDataAdapter->Fill(MyGuestTable);
        this->客房入住单DataGridView->DataSource = MyGuestTable;            
        if (MyConnection->State == ConnectionState::Open)
        {
          MyConnection->Close();
        } 
	 }
	private: System::Void 打印Button_Click(System::Object^  sender, System::EventArgs^  e) {
		if (this->旅客姓名ComboBox->Text->Length < 1 || Convert::ToDouble(this->补交押金TextBox->Text) <=0 )
        {
           return;
        }
		if (MessageBox::Show("当您为旅客打印押金单后,您必须保存该项操作,是否继续?", "信息提示", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == System::Windows::Forms::DialogResult::No)
        {
          return;
        }
        this->printPreviewDialog1->Document = this->printDocument1;
        this->printPreviewDialog1->ShowDialog();
        this->补交押金TextBox->Enabled = false;
	 }
	private: System::Void printDocument1_PrintPage(System::Object^  sender, System::Drawing::Printing::PrintPageEventArgs^  e) {
        //打印费用押金单
        e->Graphics->DrawString(this->MyCompany + "押金费用单", gcnew System::Drawing::Font("宋体", 20), Brushes::Black, 220, 80);
        e->Graphics->DrawString("入住编号:" + this->My入住编号, gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 100, 150);
        e->Graphics->DrawString("操作员:" + this->MyOperator, gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 600, 150);
        e->Graphics->DrawLine(gcnew Pen(Color::Black, (float)3.00), 100, 185, 720, 185); 
        e->Graphics->DrawString("房号:" + this->酒店房号ComboBox->Text, gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 195);
        e->Graphics->DrawString("姓名:" + this->旅客姓名ComboBox->Text, gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 300, 195);
        My累计补交押金 = Convert::ToDouble(this->预收押金TextBox->Text) + Convert::ToDouble(this->补交押金TextBox->Text);
        e->Graphics->DrawString("累计补交押金:" + My累计补交押金.ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 530, 195);
        e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 215, 720, 215);
        e->Graphics->DrawString("         序号          费用类别           金额", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 220);
        e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 240, 720, 240);
        e->Graphics->DrawString("           1     店内消费               "+this->My店内消费.ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 245);
        e->Graphics->DrawString("           2     住宿费                " + this->My住宿费.ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 265);
        e->Graphics->DrawString("           3     电话费                " + this->My电话费.ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 285);
        e->Graphics->DrawString("           4     用餐费                " + this->My用餐费.ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 305);                       
        e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 325, 720, 325);
        e->Graphics->DrawString("                                     费用金额合计:" + this->My费用总额.ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 330);
        e->Graphics->DrawLine(gcnew Pen(Color::Black, (float)3.00), 100, 350, 720, 350);
		DateTime MyDate = DateTime::Now;
        e->Graphics->DrawString("打印日期:" + MyDate.ToLongDateString() + MyDate.ToLongTimeString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 450, 355);
        e->Graphics->DrawString("温馨提示:为了维护您及他人的合法权益,请不要带未经登记的人员进出您的房间。", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 100, 375);
        e->Graphics->DrawString("警察提示:请保管好您的物品,重要物品请寄存于酒店寄存处,免费寄存!", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 100, 395);
        e->Graphics->DrawString("谢谢合作!", gcnew System::Drawing::Font("宋体", 20), Brushes::Black, 550, 415);
	 }
	private: System::Void 保存Button_Click(System::Object^  sender, System::EventArgs^  e) {
		if (this->旅客姓名ComboBox->Text->Length < 1 || Convert::ToDouble(this->补交押金TextBox->Text) <= 0 ) 
        {
          return;
        }
        if (this->My累计补交押金 < 1)
        {
           return;
        }
        String^ MySQLConnectionString = MyHotelConnectionString;
        String^ MySQL = "Update 客房入住单 Set 预收押金=" + this->My累计补交押金.ToString() + " ,说明='"+this->说明TextBox->Text+"'WHERE 入住编号='" + this->My入住编号 + "'";
        SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
        MyConnection->Open();
        SqlCommand^ MyCommand = MyConnection->CreateCommand();
        MyCommand->CommandText = MySQL;
        MyCommand->ExecuteNonQuery();
        if (MyConnection->State == ConnectionState::Open)
        {
           MyConnection->Close();
        }
        this->My累计补交押金 = 0;
        this->补交押金TextBox->Enabled = true;
         旅客姓名ComboBox_SelectedIndexChanged(nullptr, nullptr);
	  }
   };
}

⌨️ 快捷键说明

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