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

📄 frmproductsales.cs

📁 本论文叙述了联机考试系统的现状以及C#语言的概况。重点介绍了联机考试系统的实现过程:包括系统分析、 系统调查、 数据流程分析、功能设计、 数据库设计、 系统物理配置方案、 系统实现、 系统测试和调试。
💻 CS
📖 第 1 页 / 共 3 页
字号:
			this.txtDiscount.Enabled = false;
			this.txtDiscount.Location = new System.Drawing.Point(300, 38);
			this.txtDiscount.Name = "txtDiscount";
			this.txtDiscount.Size = new System.Drawing.Size(140, 21);
			this.txtDiscount.TabIndex = 9;
			this.txtDiscount.Text = "";
			// 
			// lblDiscount
			// 
			this.lblDiscount.Location = new System.Drawing.Point(240, 42);
			this.lblDiscount.Name = "lblDiscount";
			this.lblDiscount.Size = new System.Drawing.Size(92, 18);
			this.lblDiscount.TabIndex = 8;
			this.lblDiscount.Text = "折扣";
			this.lblDiscount.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// txtStockPrice
			// 
			this.txtStockPrice.BackColor = System.Drawing.SystemColors.Menu;
			this.txtStockPrice.Enabled = false;
			this.txtStockPrice.Location = new System.Drawing.Point(98, 38);
			this.txtStockPrice.Name = "txtStockPrice";
			this.txtStockPrice.Size = new System.Drawing.Size(140, 21);
			this.txtStockPrice.TabIndex = 7;
			this.txtStockPrice.Text = "";
			// 
			// lblStockPrice
			// 
			this.lblStockPrice.Location = new System.Drawing.Point(6, 40);
			this.lblStockPrice.Name = "lblStockPrice";
			this.lblStockPrice.Size = new System.Drawing.Size(92, 18);
			this.lblStockPrice.TabIndex = 6;
			this.lblStockPrice.Text = "库存价格";
			this.lblStockPrice.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// txtQty
			// 
			this.txtQty.Location = new System.Drawing.Point(300, 8);
			this.txtQty.Name = "txtQty";
			this.txtQty.Size = new System.Drawing.Size(140, 21);
			this.txtQty.TabIndex = 3;
			this.txtQty.Text = "";
			this.txtQty.MouseHover += new System.EventHandler(this.txtQty_MouseHover);
			this.txtQty.Leave += new System.EventHandler(this.txtQty_Leave);
			// 
			// lblQty
			// 
			this.lblQty.Location = new System.Drawing.Point(240, 12);
			this.lblQty.Name = "lblQty";
			this.lblQty.Size = new System.Drawing.Size(92, 18);
			this.lblQty.TabIndex = 2;
			this.lblQty.Text = "数量";
			this.lblQty.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// txtProductName
			// 
			this.txtProductName.BackColor = System.Drawing.SystemColors.Menu;
			this.txtProductName.Enabled = false;
			this.txtProductName.Location = new System.Drawing.Point(542, 8);
			this.txtProductName.Name = "txtProductName";
			this.txtProductName.Size = new System.Drawing.Size(142, 21);
			this.txtProductName.TabIndex = 5;
			this.txtProductName.Text = "";
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(452, 12);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(92, 18);
			this.label5.TabIndex = 4;
			this.label5.Text = "产品名称";
			this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// lblProdNo
			// 
			this.lblProdNo.Location = new System.Drawing.Point(6, 10);
			this.lblProdNo.Name = "lblProdNo";
			this.lblProdNo.Size = new System.Drawing.Size(92, 18);
			this.lblProdNo.TabIndex = 0;
			this.lblProdNo.Text = "产品标识";
			this.lblProdNo.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// pnlTotal
			// 
			this.pnlTotal.Controls.Add(this.btnPreview);
			this.pnlTotal.Controls.Add(this.lblPaymentMode);
			this.pnlTotal.Controls.Add(this.cboPaymentMode);
			this.pnlTotal.Controls.Add(this.btnPrint);
			this.pnlTotal.Controls.Add(this.btnCancel);
			this.pnlTotal.Controls.Add(this.txtTotalBillAmt);
			this.pnlTotal.Controls.Add(this.lblTotalBillAmt);
			this.pnlTotal.Controls.Add(this.btnSave);
			this.pnlTotal.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.pnlTotal.Location = new System.Drawing.Point(0, 323);
			this.pnlTotal.Name = "pnlTotal";
			this.pnlTotal.Size = new System.Drawing.Size(698, 64);
			this.pnlTotal.TabIndex = 3;
			// 
			// btnPreview
			// 
			this.btnPreview.Enabled = false;
			this.btnPreview.Location = new System.Drawing.Point(272, 36);
			this.btnPreview.Name = "btnPreview";
			this.btnPreview.Size = new System.Drawing.Size(104, 23);
			this.btnPreview.TabIndex = 35;
			this.btnPreview.Text = "预览帐单(&R)";
			this.btnPreview.Click += new System.EventHandler(this.btnPreview_Click);
			// 
			// lblPaymentMode
			// 
			this.lblPaymentMode.Location = new System.Drawing.Point(10, 10);
			this.lblPaymentMode.Name = "lblPaymentMode";
			this.lblPaymentMode.Size = new System.Drawing.Size(78, 18);
			this.lblPaymentMode.TabIndex = 33;
			this.lblPaymentMode.Text = "付款方式";
			// 
			// cboPaymentMode
			// 
			this.cboPaymentMode.Items.AddRange(new object[] {
																"现金",
																"信用卡",
																"借记卡"});
			this.cboPaymentMode.Location = new System.Drawing.Point(96, 6);
			this.cboPaymentMode.Name = "cboPaymentMode";
			this.cboPaymentMode.Size = new System.Drawing.Size(140, 23);
			this.cboPaymentMode.TabIndex = 32;
			this.cboPaymentMode.Text = "现金";
			this.cboPaymentMode.MouseHover += new System.EventHandler(this.cboPaymentMode_MouseHover);
			// 
			// btnPrint
			// 
			this.btnPrint.Enabled = false;
			this.btnPrint.Location = new System.Drawing.Point(384, 36);
			this.btnPrint.Name = "btnPrint";
			this.btnPrint.Size = new System.Drawing.Size(110, 22);
			this.btnPrint.TabIndex = 31;
			this.btnPrint.Text = "打印帐单(&P)...";
			this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
			// 
			// btnCancel
			// 
			this.btnCancel.Location = new System.Drawing.Point(624, 36);
			this.btnCancel.Name = "btnCancel";
			this.btnCancel.Size = new System.Drawing.Size(70, 22);
			this.btnCancel.TabIndex = 30;
			this.btnCancel.Text = "取消(&C)";
			this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
			// 
			// txtTotalBillAmt
			// 
			this.txtTotalBillAmt.BackColor = System.Drawing.Color.Lavender;
			this.txtTotalBillAmt.Enabled = false;
			this.txtTotalBillAmt.Font = new System.Drawing.Font("Times New Roman", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.txtTotalBillAmt.Location = new System.Drawing.Point(342, 6);
			this.txtTotalBillAmt.Name = "txtTotalBillAmt";
			this.txtTotalBillAmt.Size = new System.Drawing.Size(140, 24);
			this.txtTotalBillAmt.TabIndex = 28;
			this.txtTotalBillAmt.Text = "0.00";
			// 
			// lblTotalBillAmt
			// 
			this.lblTotalBillAmt.Location = new System.Drawing.Point(248, 10);
			this.lblTotalBillAmt.Name = "lblTotalBillAmt";
			this.lblTotalBillAmt.Size = new System.Drawing.Size(92, 18);
			this.lblTotalBillAmt.TabIndex = 27;
			this.lblTotalBillAmt.Text = "帐单总额";
			// 
			// btnSave
			// 
			this.btnSave.Enabled = false;
			this.btnSave.Location = new System.Drawing.Point(504, 36);
			this.btnSave.Name = "btnSave";
			this.btnSave.Size = new System.Drawing.Size(110, 22);
			this.btnSave.TabIndex = 29;
			this.btnSave.Text = "保存帐单(&S)";
			this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
			this.btnSave.MouseHover += new System.EventHandler(this.btnSave_MouseHover);
			// 
			// lvwBillDetails
			// 
			this.lvwBillDetails.BackColor = System.Drawing.Color.PeachPuff;
			this.lvwBillDetails.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
																							 this.A,
																							 this.B,
																							 this.C,
																							 this.D});
			this.lvwBillDetails.Dock = System.Windows.Forms.DockStyle.Fill;
			this.lvwBillDetails.Font = new System.Drawing.Font("Times New Roman", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lvwBillDetails.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
			this.lvwBillDetails.Location = new System.Drawing.Point(0, 186);
			this.lvwBillDetails.Name = "lvwBillDetails";
			this.lvwBillDetails.Size = new System.Drawing.Size(698, 137);
			this.lvwBillDetails.TabIndex = 2;
			this.lvwBillDetails.View = System.Windows.Forms.View.Details;
			// 
			// A
			// 
			this.A.Text = "ProductName";
			this.A.Width = 205;
			// 
			// B
			// 
			this.B.Text = "Quantity";
			this.B.Width = 120;
			// 
			// C
			// 
			this.C.Text = "SalePrice";
			this.C.Width = 120;
			// 
			// D
			// 
			this.D.Text = "TotalPriceOfTheItem";
			this.D.Width = 120;
			// 
			// errProductSales
			// 
			this.errProductSales.ContainerControl = this;
			// 
			// tipProdSales
			// 
			this.tipProdSales.AutomaticDelay = 150;
			// 
			// pdlgBill
			// 
			this.pdlgBill.Document = this.pDocBill;
			this.pdlgBill.ShowHelp = true;
			// 
			// pDocBill
			// 
			this.pDocBill.OriginAtMargins = true;
			this.pDocBill.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.pDocBill_PrintPage);
			// 
			// ppdlgBill
			// 
			this.ppdlgBill.AutoScrollMargin = new System.Drawing.Size(0, 0);
			this.ppdlgBill.AutoScrollMinSize = new System.Drawing.Size(0, 0);
			this.ppdlgBill.ClientSize = new System.Drawing.Size(400, 300);
			this.ppdlgBill.Document = this.pDocBill;
			this.ppdlgBill.Enabled = true;
			this.ppdlgBill.Icon = ((System.Drawing.Icon)(resources.GetObject("ppdlgBill.Icon")));
			this.ppdlgBill.Location = new System.Drawing.Point(22, 22);
			this.ppdlgBill.MinimumSize = new System.Drawing.Size(375, 250);
			this.ppdlgBill.Name = "ppdlgBill";
			this.ppdlgBill.TransparencyKey = System.Drawing.Color.Empty;
			this.ppdlgBill.Visible = false;
			// 
			// frmProductSales
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
			this.ClientSize = new System.Drawing.Size(698, 387);
			this.Controls.Add(this.lvwBillDetails);
			this.Controls.Add(this.pnlTotal);
			this.Controls.Add(this.pnlPanel);
			this.Controls.Add(this.grpSales);
			this.Font = new System.Drawing.Font("Times New Roman", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Name = "frmProductSales";
			this.Text = "销售操作";
			this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
			this.Closing += new System.ComponentModel.CancelEventHandler(this.frmProductSales_Closing);
			this.Load += new System.EventHandler(this.frmProductSales_Load);
			this.grpSales.ResumeLayout(false);
			this.pnlPanel.ResumeLayout(false);
			this.pnlTotal.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void btnExit_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void frmProductSales_Load(object sender, System.EventArgs e)
		{
			txtUsrId.Text =this.userName ;
			
			try
			{
				DataConnection.commnd.CommandText  =
					"SELECT distinct a.productid FROM products AS a, "+
					"discount AS b, stock AS c WHERE a.productid=c.productid "+
					"and b.stockid=c.stockid order by a.productid";

				reader = DataConnection.commnd.ExecuteReader();
			
				while(reader.Read())
				{
					cboProductId.Items.Add (reader.GetString (0));
				
				}
				reader.Close ();
				
				DataConnection.commnd.CommandText  = "Select max(billno) from bills";
			
				billNo = (int)DataConnection.commnd.ExecuteScalar();

				++billNo;
			
				txtBillNo.Text = billNo.ToString ();
				reader.Close ();
				txtBillDate.Text = DateTime.Today.ToShortDateString ();
			}
			catch(Exception excep)
			{
				MessageBox.Show("发生错误  "+excep.Message.ToString ());
			} 
		}
	
		private void cboProductId_Leave(object sender, System.EventArgs e)
		{
			try
			{
				if (cboProductId.Text.Trim() != "")
				{
					bool validFlag = false;

					foreach(string item in this.cboProductId.Items)
					{
						if (item.Equals(this.cboProductId.Text))
						{
							validFlag = true;
							break;
						}
					}
					if (validFlag == false)
					{
						errorMsg = ("请输入一个有效的产品标识");
						this.errProductSales.SetError(this.cboProductId, errorMsg);
						this.cboProductId.Focus(); 
					}

					else
					{
						string str="SELECT a.productname, b.discount, b.validfrom, b.validto, c.purprice,a.qoh FROM products AS a, discount AS b, stock AS c WHERE a.productid=c.productid and b.stockid=c.stockid and a.productid='" + cboProductId.Text+"'";
						DataConnection.commnd.CommandText =str;
						reader = DataConnection.commnd.ExecuteReader(); 
						purPrice = 0;
								if (reader.Read())
						{
							txtProductName.Text = reader.GetString(0);
							this.discount = reader.GetInt16(1); 
							txtDiscount.Text = discount.ToString();
							txtStockPrice.Text = reader.GetDecimal(4).ToString();
							purPrice = reader.GetDecimal(4);
							validFrom = reader.GetDateTime (2);
							validTo = reader.GetDateTime (3);

⌨️ 快捷键说明

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