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

📄 printform.h

📁 宾馆酒店管理系统,建议在简体中文版Microsoft Windows Server 2003(SP1)/Microsoft Office 2003(SP2)/Microsoft SQL Server
💻 H
📖 第 1 页 / 共 2 页
字号:
			// 
			this->label3->AutoSize = true;
			this->label3->Location = System::Drawing::Point(290, 12);
			this->label3->Name = L"label3";
			this->label3->Size = System::Drawing::Size(65, 12);
			this->label3->TabIndex = 13;
			this->label3->Text = L"客人姓名:";
			// 
			// 帐单类型ComboBox
			// 
			this->帐单类型ComboBox->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->帐单类型ComboBox->FormattingEnabled = true;
			this->帐单类型ComboBox->Items->AddRange(gcnew cli::array< System::Object^  >(2) {L"旅客入住单", L"旅客结帐单"});
			this->帐单类型ComboBox->Location = System::Drawing::Point(66, 8);
			this->帐单类型ComboBox->Name = L"帐单类型ComboBox";
			this->帐单类型ComboBox->Size = System::Drawing::Size(96, 20);
			this->帐单类型ComboBox->TabIndex = 12;
			// 
			// printPreviewDialog1
			// 
			this->printPreviewDialog1->AutoScrollMargin = System::Drawing::Size(0, 0);
			this->printPreviewDialog1->AutoScrollMinSize = System::Drawing::Size(0, 0);
			this->printPreviewDialog1->ClientSize = System::Drawing::Size(400, 300);
			this->printPreviewDialog1->Enabled = true;
			this->printPreviewDialog1->Icon = (cli::safe_cast<System::Drawing::Icon^  >(resources->GetObject(L"printPreviewDialog1.Icon")));
			this->printPreviewDialog1->Name = L"printPreviewDialog1";
			this->printPreviewDialog1->Visible = false;
			// 
			// label1
			// 
			this->label1->AutoSize = true;
			this->label1->Location = System::Drawing::Point(2, 12);
			this->label1->Name = L"label1";
			this->label1->Size = System::Drawing::Size(65, 12);
			this->label1->TabIndex = 11;
			this->label1->Text = L"帐单类型:";
			// 
			// printDocument1
			// 
			this->printDocument1->PrintPage += gcnew System::Drawing::Printing::PrintPageEventHandler(this, &PrintForm::printDocument1_PrintPage);
			// 
			// PrintForm
			// 
			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->帐单GroupBox);
			this->Controls->Add(this->查询Button);
			this->Controls->Add(this->打印Button);
			this->Controls->Add(this->label4);
			this->Controls->Add(this->酒店房号TextBox);
			this->Controls->Add(this->客人姓名TextBox);
			this->Controls->Add(this->label3);
			this->Controls->Add(this->帐单类型ComboBox);
			this->Controls->Add(this->label1);
			this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::Fixed3D;
			this->MaximizeBox = false;
			this->MinimizeBox = false;
			this->Name = L"PrintForm";
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
			this->Text = L"补打帐单";
			this->帐单GroupBox->ResumeLayout(false);
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->帐单DataGridView))->EndInit();
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion
		public: String^ MyOperator;
		public: String^ MyCompany;
        private: static String^ MyHotelConnectionString= L"Data Source=.;Initial Catalog=MyHotel;Integrated Security=True;Pooling=False";
		private: System::Void 查询Button_Click(System::Object^  sender, System::EventArgs^  e) {
			this->帐单GroupBox->Text = this->帐单类型ComboBox->Text;
            String^ MySQLConnectionString =MyHotelConnectionString;
            SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
            MyConnection->Open();
			System::Data::DataTable^ MyTable = gcnew System::Data::DataTable();
            String^ MySQL = "Select * From 客房入住单 WHERE  房号 LIKE '%"+this->酒店房号TextBox->Text+"%' OR 客人姓名 LIKE '%"+this->客人姓名TextBox->Text+"%'";
            if (this->帐单类型ComboBox->Text == "旅客结帐单")
            {
                MySQL = "Select 自编号,入住编号,结帐编号,房号,客人姓名,入住日期,结帐日期,店内消费,住宿费,电话费,用餐费,店内消费+住宿费+电话费+用餐费 as 费用金额合计,预收押金,结帐金额,操作人员,说明 From 客房结帐单 WHERE  房号 LIKE '%" + this->酒店房号TextBox->Text + "%' OR 客人姓名 LIKE '%" + this->客人姓名TextBox->Text + "%'";
            }
            SqlDataAdapter^ MyAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
            MyAdapter->Fill(MyTable);
            this->帐单DataGridView->DataSource = MyTable;
			if (MyConnection->State == ConnectionState::Open)
            {
                MyConnection->Close();
            }
		}
		private: System::Void 打印Button_Click(System::Object^  sender, System::EventArgs^  e) {
		    this->printPreviewDialog1->Document = this->printDocument1;
            this->printPreviewDialog1->ShowDialog();	 
		}
		private: System::Void printDocument1_PrintPage(System::Object^  sender, System::Drawing::Printing::PrintPageEventArgs^  e) {
			if (this->帐单类型ComboBox->Text == "旅客结帐单")
            {
                double MyAmount =Convert::ToDouble(this->帐单DataGridView->CurrentRow->Cells[11]->Value->ToString()) -Convert::ToDouble(this->帐单DataGridView->CurrentRow->Cells[12]->Value->ToString());
                String^ MyAmountInfo = "实收金额:" + MyAmount.ToString();
                if (MyAmount < 0)
                {
                    MyAmountInfo = "实补金额:" + MyAmount.ToString()->Remove(0, 1);
                }
                this->帐单DataGridView->CurrentRow->Cells[2]->Value->ToString();
                //打印旅客结帐单
                e->Graphics->DrawString(this->MyCompany + "旅客结帐单", gcnew System::Drawing::Font("宋体", 20), Brushes::Black, 220, 80);
                e->Graphics->DrawString("结帐编号:" + this->帐单DataGridView->CurrentRow->Cells[2]->Value->ToString(), 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->帐单DataGridView->CurrentRow->Cells[3]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 195);
                e->Graphics->DrawString("姓名:" + this->帐单DataGridView->CurrentRow->Cells[4]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 300, 195);
                e->Graphics->DrawString("入住编号:" + this->帐单DataGridView->CurrentRow->Cells[1]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 500, 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->帐单DataGridView->CurrentRow->Cells[7]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 245);
                e->Graphics->DrawString("           2     住宿费                " + this->帐单DataGridView->CurrentRow->Cells[8]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 265);
                e->Graphics->DrawString("           3     电话费                " + this->帐单DataGridView->CurrentRow->Cells[9]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 285);
                e->Graphics->DrawString("           4     用餐费                " + this->帐单DataGridView->CurrentRow->Cells[10]->Value->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->帐单DataGridView->CurrentRow->Cells[11]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 330);
                e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 350, 720, 350);
                e->Graphics->DrawString("入住日期:" + this->帐单DataGridView->CurrentRow->Cells[5]->Value->ToString() + "         结帐日期:" + this->帐单DataGridView->CurrentRow->Cells[6]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 355);
                e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 375, 720, 375);
                e->Graphics->DrawString("预收押金:" + this->帐单DataGridView->CurrentRow->Cells[12]->Value->ToString() + "                           " + MyAmountInfo, gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 380);
                e->Graphics->DrawLine(gcnew Pen(Color::Black, (float)3.00), 100, 400, 720, 400);
				DateTime MyDate = DateTime::Now;
                e->Graphics->DrawString("打印日期:" + MyDate.ToLongDateString() + MyDate.ToLongTimeString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 450, 405);
                e->Graphics->DrawString("温馨提示:为了维护您及他人的合法权益,请不要带未经登记的人员进出您的房间。", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 100, 425);
                e->Graphics->DrawString("警察提示:请保管好您的物品,重要物品请寄存于酒店寄存处,免费寄存!", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 100, 445);
                e->Graphics->DrawString("谢谢合作!", gcnew System::Drawing::Font("宋体", 20), Brushes::Black, 550, 465);
            }
            else
            {           
                e->Graphics->DrawString(this->MyCompany + "旅客入住单", gcnew System::Drawing::Font("宋体", 20), Brushes::Black, 220, 80);
                e->Graphics->DrawString("入住编号:" + this->帐单DataGridView->CurrentRow->Cells[0]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 100, 150);
				DateTime MyPrintTime = DateTime::Now;
                e->Graphics->DrawString("打印日期:" + MyPrintTime.ToLongDateString() + MyPrintTime.ToLongTimeString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 450, 150);
                e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 180, 720, 180);
                e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 220, 720, 220);
                e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 260, 720, 260);
                e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 300, 720, 300);
                e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 340, 720, 340);
                e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 180, 100, 340);
                e->Graphics->DrawLine(gcnew Pen(Color::Black), 220, 180, 220, 340);
                e->Graphics->DrawLine(gcnew Pen(Color::Black), 400, 180, 400, 340);
                e->Graphics->DrawLine(gcnew Pen(Color::Black), 720, 180, 720, 340);
                e->Graphics->DrawString("房号:" + this->帐单DataGridView->CurrentRow->Cells[1]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 105, 190);
                e->Graphics->DrawString("姓名:" + this->帐单DataGridView->CurrentRow->Cells[6]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 105, 230);
                e->Graphics->DrawString("性别:" + this->帐单DataGridView->CurrentRow->Cells[11]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 105, 270);
                e->Graphics->DrawString("人数:" + this->帐单DataGridView->CurrentRow->Cells[10]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 105, 310);
                e->Graphics->DrawString("折扣价格:" + this->帐单DataGridView->CurrentRow->Cells[2]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 225, 190);
                e->Graphics->DrawString("预收押金:" + this->帐单DataGridView->CurrentRow->Cells[3]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 225, 230);
                e->Graphics->DrawString("入住日期:" + this->帐单DataGridView->CurrentRow->Cells[4]->Value->ToString()->Remove(10), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 225, 270);
                e->Graphics->DrawString("离开日期:" + this->帐单DataGridView->CurrentRow->Cells[5]->Value->ToString()->Remove(10), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 225, 310);
                e->Graphics->DrawString("证件名称:" + this->帐单DataGridView->CurrentRow->Cells[7]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 405, 190);
                e->Graphics->DrawString("证件编号:" + this->帐单DataGridView->CurrentRow->Cells[8]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 405, 230);
                e->Graphics->DrawString("证件地址:" + this->帐单DataGridView->CurrentRow->Cells[9]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 405, 270);
                e->Graphics->DrawString("联系电话:" + this->帐单DataGridView->CurrentRow->Cells[12]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 405, 310);
                e->Graphics->DrawString("操作员:" + this->MyOperator, gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 600, 350);
                e->Graphics->DrawString("温馨提示:为了维护您及他人的合法权益,请不要带未经登记的人员进出您的房间。", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 100, 380);
                e->Graphics->DrawString("警察提示:请保管好您的物品,重要物品请寄存于酒店寄存处,免费寄存!", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 100, 400);
                e->Graphics->DrawString("谢谢合作!", gcnew System::Drawing::Font("宋体", 20), Brushes::Black, 550, 420);
            }
		 }
	};
}

⌨️ 快捷键说明

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