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

📄 tsdj.cs

📁 c#语音酒店管理的毕业设计 适合于初级水平的学习
💻 CS
📖 第 1 页 / 共 2 页
字号:
			// 
			// textBox11
			// 
			this.textBox11.Location = new System.Drawing.Point(88, 160);
			this.textBox11.Name = "textBox11";
			this.textBox11.TabIndex = 26;
			this.textBox11.Text = "textBox11";
			// 
			// label14
			// 
			this.label14.Location = new System.Drawing.Point(208, 168);
			this.label14.Name = "label14";
			this.label14.Size = new System.Drawing.Size(56, 16);
			this.label14.TabIndex = 27;
			this.label14.Text = "其它费用";
			// 
			// textBox12
			// 
			this.textBox12.Location = new System.Drawing.Point(264, 160);
			this.textBox12.Name = "textBox12";
			this.textBox12.TabIndex = 28;
			this.textBox12.Text = "textBox12";
			// 
			// label15
			// 
			this.label15.Location = new System.Drawing.Point(376, 168);
			this.label15.Name = "label15";
			this.label15.Size = new System.Drawing.Size(56, 16);
			this.label15.TabIndex = 29;
			this.label15.Text = "退宿日期";
			// 
			// dateTimePicker1
			// 
			this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Short;
			this.dateTimePicker1.Location = new System.Drawing.Point(432, 160);
			this.dateTimePicker1.Name = "dateTimePicker1";
			this.dateTimePicker1.Size = new System.Drawing.Size(96, 21);
			this.dateTimePicker1.TabIndex = 30;
			// 
			// label17
			// 
			this.label17.Location = new System.Drawing.Point(24, 200);
			this.label17.Name = "label17";
			this.label17.Size = new System.Drawing.Size(32, 16);
			this.label17.TabIndex = 33;
			this.label17.Text = "备注";
			// 
			// richTextBox1
			// 
			this.richTextBox1.Location = new System.Drawing.Point(80, 192);
			this.richTextBox1.Name = "richTextBox1";
			this.richTextBox1.Size = new System.Drawing.Size(400, 48);
			this.richTextBox1.TabIndex = 34;
			this.richTextBox1.Text = "richTextBox1";
			// 
			// label18
			// 
			this.label18.Location = new System.Drawing.Point(440, 248);
			this.label18.Name = "label18";
			this.label18.Size = new System.Drawing.Size(48, 16);
			this.label18.TabIndex = 35;
			this.label18.Text = "操作员";
			// 
			// textBox14
			// 
			this.textBox14.Enabled = false;
			this.textBox14.Location = new System.Drawing.Point(496, 248);
			this.textBox14.Name = "textBox14";
			this.textBox14.TabIndex = 36;
			this.textBox14.Text = "textBox14";
			// 
			// button1
			// 
			this.button1.Enabled = false;
			this.button1.Location = new System.Drawing.Point(504, 208);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(152, 32);
			this.button1.TabIndex = 37;
			this.button1.Text = "确认退宿";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// label19
			// 
			this.label19.Location = new System.Drawing.Point(32, 248);
			this.label19.Name = "label19";
			this.label19.Size = new System.Drawing.Size(64, 16);
			this.label19.TabIndex = 38;
			this.label19.Text = "应收宿费";
			// 
			// textBox15
			// 
			this.textBox15.Enabled = false;
			this.textBox15.Location = new System.Drawing.Point(96, 248);
			this.textBox15.Name = "textBox15";
			this.textBox15.TabIndex = 39;
			this.textBox15.Text = "textBox15";
			// 
			// label20
			// 
			this.label20.Location = new System.Drawing.Point(232, 256);
			this.label20.Name = "label20";
			this.label20.Size = new System.Drawing.Size(64, 16);
			this.label20.TabIndex = 40;
			this.label20.Text = "金额总计";
			// 
			// textBox16
			// 
			this.textBox16.Enabled = false;
			this.textBox16.Location = new System.Drawing.Point(312, 248);
			this.textBox16.Name = "textBox16";
			this.textBox16.TabIndex = 41;
			this.textBox16.Text = "textBox16";
			// 
			// dgrd_StockerData
			// 
			this.dgrd_StockerData.AlternatingBackColor = System.Drawing.Color.GhostWhite;
			this.dgrd_StockerData.BackColor = System.Drawing.Color.GhostWhite;
			this.dgrd_StockerData.BackgroundColor = System.Drawing.Color.Lavender;
			this.dgrd_StockerData.BorderStyle = System.Windows.Forms.BorderStyle.None;
			this.dgrd_StockerData.CaptionBackColor = System.Drawing.Color.RoyalBlue;
			this.dgrd_StockerData.CaptionForeColor = System.Drawing.Color.White;
			this.dgrd_StockerData.DataMember = "";
			this.dgrd_StockerData.FlatMode = true;
			this.dgrd_StockerData.Font = new System.Drawing.Font("Tahoma", 8F);
			this.dgrd_StockerData.ForeColor = System.Drawing.Color.MidnightBlue;
			this.dgrd_StockerData.GridLineColor = System.Drawing.Color.RoyalBlue;
			this.dgrd_StockerData.HeaderBackColor = System.Drawing.Color.MidnightBlue;
			this.dgrd_StockerData.HeaderFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
			this.dgrd_StockerData.HeaderForeColor = System.Drawing.Color.Lavender;
			this.dgrd_StockerData.LinkColor = System.Drawing.Color.Teal;
			this.dgrd_StockerData.Location = new System.Drawing.Point(16, 280);
			this.dgrd_StockerData.Name = "dgrd_StockerData";
			this.dgrd_StockerData.ParentRowsBackColor = System.Drawing.Color.Lavender;
			this.dgrd_StockerData.ParentRowsForeColor = System.Drawing.Color.MidnightBlue;
			this.dgrd_StockerData.SelectionBackColor = System.Drawing.Color.Teal;
			this.dgrd_StockerData.SelectionForeColor = System.Drawing.Color.PaleGreen;
			this.dgrd_StockerData.Size = new System.Drawing.Size(688, 128);
			this.dgrd_StockerData.TabIndex = 42;
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(200, 48);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(48, 23);
			this.button2.TabIndex = 43;
			this.button2.Text = "确定";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// tsdj
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(720, 421);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.dgrd_StockerData);
			this.Controls.Add(this.textBox16);
			this.Controls.Add(this.textBox15);
			this.Controls.Add(this.textBox14);
			this.Controls.Add(this.textBox12);
			this.Controls.Add(this.textBox11);
			this.Controls.Add(this.textBox10);
			this.Controls.Add(this.textBox9);
			this.Controls.Add(this.textBox8);
			this.Controls.Add(this.textBox7);
			this.Controls.Add(this.textBox6);
			this.Controls.Add(this.textBox5);
			this.Controls.Add(this.textBox4);
			this.Controls.Add(this.textBox3);
			this.Controls.Add(this.textBox2);
			this.Controls.Add(this.textBox1);
			this.Controls.Add(this.label20);
			this.Controls.Add(this.label19);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.label18);
			this.Controls.Add(this.richTextBox1);
			this.Controls.Add(this.label17);
			this.Controls.Add(this.dateTimePicker1);
			this.Controls.Add(this.label15);
			this.Controls.Add(this.label14);
			this.Controls.Add(this.label13);
			this.Controls.Add(this.label12);
			this.Controls.Add(this.label11);
			this.Controls.Add(this.label10);
			this.Controls.Add(this.toolBar1);
			this.Controls.Add(this.label9);
			this.Controls.Add(this.label8);
			this.Controls.Add(this.label7);
			this.Controls.Add(this.comboBox2);
			this.Controls.Add(this.label6);
			this.Controls.Add(this.label5);
			this.Controls.Add(this.label4);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.comboBox1);
			this.Controls.Add(this.label1);
			this.Name = "tsdj";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "【退宿登记】";
			this.Load += new System.EventHandler(this.tsdj_Load);
			((System.ComponentModel.ISupportInitialize)(this.dgrd_StockerData)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		private void tsdj_Load(object sender, System.EventArgs e)
		{
		    chushi();
			if (LoginFrm.strUser=="")
			{  this.textBox7.Text="未知";}
			else
			{this.textBox14.Text=LoginFrm.strUser;}
			scfjh();
		}
		private void chushi()
		{
           textBox7.Text=textBox4.Text=textBox5.Text=textBox8.Text=textBox9.Text=textBox10.Text=textBox11.Text=textBox12.Text="0";
           textBox15.Text=textBox16.Text=richTextBox1.Text="";
		}
		private void scfjh() //生成房间号
		{
			string sendTableName = "jud_kfxx";
			string kong="入住";
			string sendStrSQL ="select fjh from jud_kfxx where ft='"+kong+"'";
			this.ds = this.link.SelectDataBase(sendStrSQL,sendTableName);
			comboBox1.DataSource = ds.Tables[sendTableName];
			comboBox1.DisplayMember = "fjh";
		}

		private void button2_Click(object sender, System.EventArgs e)
		{
			string sendTableName = "jud_djb";
			string kong=comboBox1.Text;
			string sendStrSQL ="select xm,zsrq,yj,sj from jud_djb where fjh='"+kong+"'";
			this.ds2 = this.link2.SelectDataBase(sendStrSQL,sendTableName);
			textBox1.DataBindings.Add("Text",ds2,"jud_djb.xm");
            textBox2.DataBindings.Add("Text",ds2,"jud_djb.zsrq");
            textBox3.DataBindings.Add("Text",ds2,"jud_djb.sj");
            textBox6.DataBindings.Add("Text",ds2,"jud_djb.yj");
            button1.Enabled = true;
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
            double sj = double.Parse(textBox4.Text);
			double zk = double.Parse(textBox5.Text);
			double th = double.Parse(textBox8.Text);
			double yj = sj-(sj*zk)*0.1-th;
            double zj = yj-double.Parse(textBox6.Text)+double.Parse(textBox9.Text)+double.Parse(textBox10.Text)+double.Parse(textBox11.Text)+double.Parse(textBox12.Text);
			textBox15.Text= yj.ToString();
            textBox16.Text=zj.ToString();
			DateTime dt = DateTime.Now;
			DataTable ordersTable = ds1.Tables["jud_ts"];
			DataRow workRow = ds1.Tables["jud_ts"].NewRow();
			int yue =dt.Month;
			string yue1;
			if (yue<10)
			{ yue1="0"+yue.ToString();}
			else{yue1=yue.ToString();}
			int day =dt.Day;
			string day1;
			if (day<10)
			{day1="0"+day.ToString();}
			else{day1=day.ToString();}
			int hour=dt.Hour;
			int min=dt.Minute;
			int sec=dt.Second;
			string hour1;
			string min1;
			string sec1;
			if (hour<10)
			{hour1="0"+hour.ToString();}
			else{hour1=hour.ToString();}
			if (min<10)
			{min1="0"+min.ToString();}
			else{min1=min.ToString();}
			if (sec<10)
			{sec1="0"+sec.ToString();}
			else{sec1=sec.ToString();}
			string pz ="TS"+dt.Year.ToString()+yue1+day1+hour1+min1+sec1; 
			workRow[0] = pz;
			workRow[1] = textBox1.Text;
			workRow[2] = comboBox1.Text;
			workRow[3] = textBox2.Text;
			workRow[4] = textBox3.Text;
			workRow[5] = double.Parse(textBox4.Text);
			workRow[6] = comboBox2.Text;
			workRow[7] = double.Parse(textBox5.Text);
			workRow[8] = textBox15.Text;
			workRow[9] = textBox16.Text;
			workRow[10] = textBox6.Text;
			workRow[11] = textBox7.Text;
            workRow[12] = textBox8.Text;
            workRow[13] = textBox9.Text;
            workRow[14] = textBox10.Text;
            workRow[15] = textBox11.Text;
            workRow[16] = textBox12.Text;
            workRow[17] = dateTimePicker1.Text;
			workRow[18] = hour1+":"+min1+":"+sec1;
			workRow[19] = richTextBox1.Text;
	        workRow[20] = textBox14.Text;
			ds1.Tables["jud_ts"].Rows.Add(workRow);
			
			chushi();
			
		}
		private void fangtai(string ft,string fjh)
		{
			//修改房屋状态
			string sendTableName = "jud_kfxx";
			
			string sendStrSQL ="update jud_kfxx set ft='"+ft+"' where fjh='"+fjh+"'";
			this.ds = this.link.SelectDataBase(sendStrSQL,sendTableName);
			comboBox1.DataSource = ds.Tables[sendTableName];
			comboBox1.DisplayMember = "fjh";

		}
		private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
			DateTime dt = DateTime.Now;
			string shijian = dt.Year.ToString()+"-"+dt.Month.ToString()+"-"+dt.Day.ToString();
			string sendTableName="jud_ts";
			if (e.Button.ToolTipText == "保存修改")
			{
				try
				{
					int row = this.dgrd_StockerData.CurrentCell.RowNumber;
					//将当前所在行往下移动一行,为便于实现同步保存
					//(否则会出现修改的最后一行无法保存,因为它还处于编辑状态)
					this.dgrd_StockerData.CurrentCell = new DataGridCell(row+1,0); 
					if (this.ds1.HasChanges())
					{
						this.link1.UpdateDataBase(this.ds1.GetChanges(),sendTableName);

						MessageBox.Show("数据修改成功!","信息");
						
						string tempStrSQL ="select pzhm as '凭证号码',xm as '姓名',fjh as '房间号',zsrq as '住宿日期',zssj as '住宿时间',sjsf as '实际宿费',jkfs as '结款方式',zk as '折扣',yssf as '应收总额',jezj as '金额总计',yj as '押金',zsts as '住宿天数',thsf as '退还宿费',jsf as '酒水费',dhf as '电话费',psf as '赔偿费',qtfy as '其它费用',tsrq as '退宿日期',tssj '退宿时间',bz'备注',czy as '操作员' from jud_ts  where tsrq='"+shijian+"'";			
			
						this.link1.SelectDataBase(tempStrSQL,sendTableName);
						fangtai("空房",comboBox1.Text);
						scfjh();
					}
					else
					{
						MessageBox.Show("没有修改的数据!");
						return;
					}

				}
				catch(Exception ex)
				{
					MessageBox.Show("数据保存失败,请确认所有信息输入完整且正确!"+ex,"提示");
					return;
				}
			}

			if (e.Button.ToolTipText == "删除数据")
			{
				if (MessageBox.Show("确实要删除这条记录吗?","询问",MessageBoxButtons.YesNo) == DialogResult.Yes)
				{
					int intRowNumber = this.dgrd_StockerData.CurrentCell.RowNumber;
					try
					{
						DataRow workrow=this.ds1.Tables[0].Rows[intRowNumber];
						string fjh = workrow[2].ToString();
						this.ds1.Tables[0].Rows[intRowNumber].Delete();
						this.link1.UpdateDataBase(this.ds1.GetChanges(),sendTableName);
						MessageBox.Show("数据删除成功!","信息");
						string tempStrSQL ="select pzhm as '凭证号码',xm as '姓名',fjh as '房间号',zsrq as '住宿日期',zssj as '住宿时间',sjsf as '实际宿费',jkfs as '结款方式',zk as '折扣',yssf as '应收总额',jezj as '金额总计',yj as '押金',zsts as '住宿天数',thsf as '退还宿费',jsf as '酒水费',dhf as '电话费',psf as '赔偿费',qtfy as '其它费用',tsrq as '退宿日期',tssj '退宿时间',bz'备注',czy as '操作员' from jud_ts  where tsrq='"+shijian+"'";			
			
						this.link1.SelectDataBase(tempStrSQL,sendTableName);
						fangtai("入住",fjh);
						scfjh();
					}
					catch(Exception ex)
					{
						MessageBox.Show("该数据不能删除!"+ex,"提示");
						string tempStrSQL ="select pzhm as '凭证号码',xm as '姓名',fjh as '房间号',zsrq as '住宿日期',zssj as '住宿时间',sjsf as '实际宿费',jkfs as '结款方式',zk as '折扣',yssf as '应收总额',jezj as '金额总计',yj as '押金',zsts as '住宿天数',thsf as '退还宿费',jsf as '酒水费',dhf as '电话费',psf as '赔偿费',qtfy as '其它费用',tsrq as '退宿日期',tssj '退宿时间',bz'备注',czy as '操作员' from jud_ts  where tsrq='"+shijian+"'";			
			
						this.link1.SelectDataBase(tempStrSQL,sendTableName);
						return;
					}
				}
			}
		}

		
	}
}

⌨️ 快捷键说明

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