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

📄 hotelleaves.h

📁 我新买的书 光盘里有一个很好的教务管理系统的VC.net的按例
💻 H
📖 第 1 页 / 共 2 页
字号:
			this->dgrdConsume->Name = S"dgrdConsume";
			this->dgrdConsume->Size = System::Drawing::Size(760, 176);
			this->dgrdConsume->TabIndex = 2;
			// 
			// groupBox2
			// 
			this->groupBox2->Controls->Add(this->btnPay);
			this->groupBox2->Controls->Add(this->btnCalculate);
			this->groupBox2->Controls->Add(this->cmbPayment);
			this->groupBox2->Controls->Add(this->tBoxMoney);
			this->groupBox2->Controls->Add(this->label12);
			this->groupBox2->Controls->Add(this->label6);
			this->groupBox2->Dock = System::Windows::Forms::DockStyle::Bottom;
			this->groupBox2->Location = System::Drawing::Point(0, 365);
			this->groupBox2->Name = S"groupBox2";
			this->groupBox2->Size = System::Drawing::Size(760, 96);
			this->groupBox2->TabIndex = 3;
			this->groupBox2->TabStop = false;
			// 
			// btnPay
			// 
			this->btnPay->Location = System::Drawing::Point(512, 36);
			this->btnPay->Name = S"btnPay";
			this->btnPay->Size = System::Drawing::Size(120, 24);
			this->btnPay->TabIndex = 63;
			this->btnPay->Text = S"结帐";
			this->btnPay->Click += new System::EventHandler(this, btnPay_Click);
			// 
			// btnCalculate
			// 
			this->btnCalculate->Location = System::Drawing::Point(64, 40);
			this->btnCalculate->Name = S"btnCalculate";
			this->btnCalculate->Size = System::Drawing::Size(120, 24);
			this->btnCalculate->TabIndex = 62;
			this->btnCalculate->Text = S"计算应付款";
			this->btnCalculate->Click += new System::EventHandler(this, btnCalculate_Click);
			// 
			// cmbPayment
			// 
			System::Object* __mcTemp__2[] = new System::Object*[4];
			__mcTemp__2[0] = S"现金";
			__mcTemp__2[1] = S"支票";
			__mcTemp__2[2] = S"信用卡";
			__mcTemp__2[3] = S"其它";
			this->cmbPayment->Items->AddRange(__mcTemp__2);
			this->cmbPayment->Location = System::Drawing::Point(368, 40);
			this->cmbPayment->Name = S"cmbPayment";
			this->cmbPayment->Size = System::Drawing::Size(120, 20);
			this->cmbPayment->TabIndex = 61;
			// 
			// tBoxMoney
			// 
			this->tBoxMoney->Location = System::Drawing::Point(208, 40);
			this->tBoxMoney->Name = S"tBoxMoney";
			this->tBoxMoney->Size = System::Drawing::Size(136, 21);
			this->tBoxMoney->TabIndex = 59;
			this->tBoxMoney->Text = S"";
			// 
			// label12
			// 
			this->label12->Location = System::Drawing::Point(208, 24);
			this->label12->Name = S"label12";
			this->label12->Size = System::Drawing::Size(56, 11);
			this->label12->TabIndex = 58;
			this->label12->Text = S"结帐金额";
			// 
			// label6
			// 
			this->label6->Location = System::Drawing::Point(368, 24);
			this->label6->Name = S"label6";
			this->label6->Size = System::Drawing::Size(56, 11);
			this->label6->TabIndex = 5;
			this->label6->Text = S"支付方式";
			// 
			// dgrdRoom
			// 
			this->dgrdRoom->DataMember = S"";
			this->dgrdRoom->Dock = System::Windows::Forms::DockStyle::Fill;
			this->dgrdRoom->HeaderForeColor = System::Drawing::SystemColors::ControlText;
			this->dgrdRoom->Location = System::Drawing::Point(0, 120);
			this->dgrdRoom->Name = S"dgrdRoom";
			this->dgrdRoom->Size = System::Drawing::Size(760, 69);
			this->dgrdRoom->TabIndex = 4;
			this->dgrdRoom->CurrentCellChanged += new System::EventHandler(this, dgrdRoom_CurrentCellChanged);
			// 
			// HotelLeaves
			// 
			this->AutoScaleBaseSize = System::Drawing::Size(6, 14);
			this->ClientSize = System::Drawing::Size(760, 461);
			this->Controls->Add(this->dgrdRoom);
			this->Controls->Add(this->dgrdConsume);
			this->Controls->Add(this->groupBox2);
			this->Controls->Add(this->groupBox1);
			this->Controls->Add(this->toolBar1);
			this->Name = S"HotelLeaves";
			this->Text = S"离店管理";
			this->groupBox1->ResumeLayout(false);
			(__try_cast<System::ComponentModel::ISupportInitialize *  >(this->dgrdConsume))->EndInit();
			this->groupBox2->ResumeLayout(false);
			(__try_cast<System::ComponentModel::ISupportInitialize *  >(this->dgrdRoom))->EndInit();
			this->ResumeLayout(false);

		}		
	private:
		//-----------------------设置表格各列的属性-----------------------
		void DataGridStateControl()
		{
			DataGridTableStyle* ts = new DataGridTableStyle();			
			ts->MappingName = this->ds->Tables->Item[S"入住单"]->TableName;
			
			DataGridNoActiveCellColumn* aTextColumn;
			ts->AllowSorting = false;
			ts->AlternatingBackColor = Color::LightGray;

			int numCols = this->ds->Tables->Item[S"入住单"]->Columns->Count;
			for(int i = 0;i < numCols;i++)
			{
				aTextColumn = new DataGridNoActiveCellColumn();
				aTextColumn->get_TextBox()->Enabled = false;
				aTextColumn->MappingName = this->ds->Tables->Item[S"入住单"]->Columns->Item[i]->ColumnName;
				aTextColumn->HeaderText = this->ds->Tables->Item[S"入住单"]->Columns->Item[i]->ColumnName;
				aTextColumn->NullText = S"";
				aTextColumn->Format = S"D";
				ts->GridColumnStyles->Add(aTextColumn);
			}

			this->dgrdRoom->TableStyles->Add(ts);

			ts = new DataGridTableStyle();			
			ts->MappingName = this->ds->Tables->Item[S"帐单明细"]->TableName;
			
			ts->AllowSorting = false;
			ts->AlternatingBackColor = Color::LightGray;

			numCols = this->ds->Tables->Item[S"帐单明细"]->Columns->Count;
			for(int i = 0;i < numCols;i++)
			{
				aTextColumn = new DataGridNoActiveCellColumn();
				aTextColumn->get_TextBox()->Enabled = false;
				aTextColumn->MappingName = this->ds->Tables->Item[S"帐单明细"]->Columns->Item[i]->ColumnName;
				aTextColumn->HeaderText = this->ds->Tables->Item[S"帐单明细"]->Columns->Item[i]->ColumnName;
				aTextColumn->NullText = S"";
				aTextColumn->Format = S"D";
				ts->GridColumnStyles->Add(aTextColumn);
			}

			this->dgrdConsume->TableStyles->Add(ts);
  		 }
		//-----------------------工具栏按钮-----------------------
	private:System::Void toolBar1_ButtonClick(System::Object *  sender, System::Windows::Forms::ToolBarButtonClickEventArgs *  e)
		 {
			 if(String::Compare(e->Button->ToolTipText,S"首记录") == 0)
			 {
				 this->dgrdRoom->UnSelect(this->cmRoom->Position);
				 this->cmRoom->Position = 0;
				 this->dgrdRoom->Select(this->cmRoom->Position);
				 this->dgrdRoom->CurrentRowIndex = this->cmRoom->Position;
			 }
			 else if(String::Compare(e->Button->ToolTipText,S"上一记录") == 0)
			 {
				 if(this->cmRoom->Position > 0)
				 {
					 this->dgrdRoom->UnSelect(this->cmRoom->Position);
					 this->cmRoom->Position--;
					 this->dgrdRoom->Select(this->cmRoom->Position);
					 this->dgrdRoom->CurrentRowIndex = this->cmRoom->Position;
				 }
			 }
			 else if(String::Compare(e->Button->ToolTipText,S"下一记录") == 0)
			 {
				 if(this->cmRoom->Position < this->cmRoom->Count)
				 {
					 this->dgrdRoom->UnSelect(this->cmRoom->Position);
					 this->cmRoom->Position++;
					 this->dgrdRoom->Select(this->cmRoom->Position);
					 this->dgrdRoom->CurrentRowIndex = this->cmRoom->Position;
				 }
			 }
			 else if(String::Compare(e->Button->ToolTipText,S"尾记录") == 0)
			 {
				 this->dgrdRoom->UnSelect(this->cmRoom->Position);
				 this->cmRoom->Position = this->cmRoom->Count;
				 this->dgrdRoom->Select(this->cmRoom->Position);
				 this->dgrdRoom->CurrentRowIndex = this->cmRoom->Position;
			 }
		 }
		 //按条件查询
private: System::Void btnSearch_Click(System::Object *  sender, System::EventArgs *  e)
		 {
			 String* strArrivalID = this->tBoxArrivalID->Text->Trim();
			 String* strRoomID = this->tBoxRoomID->Text->Trim();
			 String* Filter = S"";
			 if(String::Compare(strArrivalID,String::Empty) != 0)
			 {
				 Filter = String::Format(S"{0} AND (入住单号 LIKE '%{1}%')",Filter,strArrivalID);
			 }
			 if(String::Compare(strRoomID,String::Empty) != 0)
			 {
				 Filter = String::Format(S"{0} AND (客房编号 LIKE '%{1}%')",Filter,strRoomID);
			 }
			
			 this->ds->Tables->Item[S"入住单"]->Clear();

			 if(String::Compare(Filter,String::Empty) != 0)
			 {
				 Filter = Filter->Substring(5,Filter->Length - 5);
				 //查询入住单				 
				 this->strSQL = String::Format(S"Select * from 入住单 where {0}",Filter);
				 this->strTableName = S"入住单";
				 this->MyDataBase->SelectDataBase(this->ConsumeAdapter,this->ds,this->strSQL,this->strTableName);           
			 }
			 else
			 {
				 //查询帐单明细
				 this->strSQL = S"Select * from 入住单";
				 this->strTableName = S"入住单";
				 this->MyDataBase->SelectDataBase(this->ConsumeAdapter,this->ds,this->strSQL,this->strTableName);            
			 }
		 }	
		 //计算应付款
private: System::Void btnCalculate_Click(System::Object *  sender, System::EventArgs *  e)
		 {
			 int Position = this->dgrdRoom->CurrentRowIndex;
			 String* tempSQL = String::Format(S"exec sf_计算应收帐款 '{0}'",this->ds->Tables->Item[S"入住单"]->Rows->Item[Position]->Item[S"入住单号"]->ToString());
			 this->MyDataBase->SQLOperate(tempSQL);
			 //查询帐单明细
			 this->ds->Tables->Item[S"帐单明细"]->Clear();

			this->strSQL = S"Select * from 帐单明细";
			this->strTableName = S"帐单明细";
			this->MyDataBase->SelectDataBase(this->ConsumeAdapter,this->ds,this->strSQL,this->strTableName);			


			 this->ds->Tables->Item[S"入住单"]->Clear();
			//查询帐单明细
			this->strSQL = S"Select * from 入住单";
			this->strTableName = S"入住单";
			this->MyDataBase->SelectDataBase(this->ConsumeAdapter,this->ds,this->strSQL,this->strTableName);    
			this->dgrdRoom->DataSource = this->ds->Tables->Item[S"入住单"];
		 }

private: System::Void btnPay_Click(System::Object *  sender, System::EventArgs *  e)
		 {
			 if(String::Compare(this->cmbPayment->Text,String::Empty) == 0)
			 {
				 return;
			 }
			 int Position = this->cmRoom->Position;
			 String* tempSQL = String::Format(S"exec sf_收银退房 '{0}','{1}'",this->ds->Tables->Item[S"入住单"]->Rows->Item[Position]->Item[S"入住单号"]->ToString(),this->cmbPayment->Text);
			 this->MyDataBase->SQLOperate(tempSQL);
			 //查询帐单明细
			  this->ds->Tables->Item[S"帐单明细"]->Clear();
			this->strSQL = S"Select * from 帐单明细";
			this->strTableName = S"帐单明细";
			this->MyDataBase->SelectDataBase(this->ConsumeAdapter,this->ds,this->strSQL,this->strTableName);			

			 this->ds->Tables->Item[S"入住单"]->Clear();
			//查询帐单明细
			this->strSQL = S"Select * from 入住单";
			this->strTableName = S"入住单";
			this->MyDataBase->SelectDataBase(this->ConsumeAdapter,this->ds,this->strSQL,this->strTableName);    
			this->dgrdRoom->DataSource = this->ds->Tables->Item[S"入住单"];
		 }

private: System::Void dgrdRoom_CurrentCellChanged(System::Object *  sender, System::EventArgs *  e)
		 {
			 int row = this->dgrdRoom->CurrentRowIndex;
			 if(row < this->ds->Tables->Item[S"入住单"]->Rows->Count)
				 this->ConsumeView->RowFilter = String::Format(S"入住单号 = '{0}'",this->ds->Tables->Item[S"入住单"]->Rows->Item[row]->Item[S"入住单号"]->ToString());
		 }

};
}

⌨️ 快捷键说明

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