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

📄 selltable.cs

📁 进销存管理系统
💻 CS
📖 第 1 页 / 共 3 页
字号:
            this.tbarBtnDelete.ToolTipText = "删除数据";
            // 
            // tbarTrash
            // 
            this.tbarTrash.ImageIndex = 2;
            this.tbarTrash.Name = "tbarTrash";
            this.tbarTrash.ToolTipText = "存入历史";
            // 
            // imageList1
            // 
            this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
            this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
            this.imageList1.Images.SetKeyName(0, "");
            this.imageList1.Images.SetKeyName(1, "");
            this.imageList1.Images.SetKeyName(2, "");
            // 
            // groupBox2
            // 
            this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.groupBox2.Controls.Add(this.txt_TotalCount);
            this.groupBox2.Controls.Add(this.label1);
            this.groupBox2.Controls.Add(this.label2);
            this.groupBox2.Controls.Add(this.txt_NoTax);
            this.groupBox2.Controls.Add(this.label3);
            this.groupBox2.Controls.Add(this.txt_Tax);
            this.groupBox2.Location = new System.Drawing.Point(0, 374);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(720, 46);
            this.groupBox2.TabIndex = 9;
            this.groupBox2.TabStop = false;
            // 
            // txt_TotalCount
            // 
            this.txt_TotalCount.Location = new System.Drawing.Point(123, 13);
            this.txt_TotalCount.Name = "txt_TotalCount";
            this.txt_TotalCount.Size = new System.Drawing.Size(100, 21);
            this.txt_TotalCount.TabIndex = 6;
            this.txt_TotalCount.Text = "0.00";
            this.txt_TotalCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            // 
            // label1
            // 
            this.label1.Location = new System.Drawing.Point(59, 18);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(64, 16);
            this.label1.TabIndex = 46;
            this.label1.Text = "合计金额:";
            // 
            // label2
            // 
            this.label2.Location = new System.Drawing.Point(283, 18);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(72, 16);
            this.label2.TabIndex = 44;
            this.label2.Text = "不含税金额:";
            // 
            // txt_NoTax
            // 
            this.txt_NoTax.Location = new System.Drawing.Point(363, 13);
            this.txt_NoTax.Name = "txt_NoTax";
            this.txt_NoTax.Size = new System.Drawing.Size(100, 21);
            this.txt_NoTax.TabIndex = 7;
            this.txt_NoTax.Text = "0.00";
            this.txt_NoTax.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            // 
            // label3
            // 
            this.label3.Location = new System.Drawing.Point(515, 18);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(40, 16);
            this.label3.TabIndex = 45;
            this.label3.Text = "税额:";
            // 
            // txt_Tax
            // 
            this.txt_Tax.Location = new System.Drawing.Point(562, 13);
            this.txt_Tax.Name = "txt_Tax";
            this.txt_Tax.Size = new System.Drawing.Size(100, 21);
            this.txt_Tax.TabIndex = 8;
            this.txt_Tax.Text = "0.00";
            this.txt_Tax.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            // 
            // SellTable
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
            this.ClientSize = new System.Drawing.Size(720, 421);
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.toolBar1);
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.dgrd_SellTable);
            this.Name = "SellTable";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "【销售单】";
            this.Load += new System.EventHandler(this.SellTable_Load);
            ((System.ComponentModel.ISupportInitialize)(this.dgrd_SellTable)).EndInit();
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.groupBox2.ResumeLayout(false);
            this.groupBox2.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

		}
		#endregion

		//---------在表格中填入所选商品名称,税率等信息---------
		public void setWareData()
		{
			dgrd_SellTable[dgrd_SellTable.CurrentCell.RowNumber,0] = inputDataGridArray[0];
			dgrd_SellTable[dgrd_SellTable.CurrentCell.RowNumber,4] = inputDataGridArray[1];
			dgrd_SellTable[dgrd_SellTable.CurrentCell.RowNumber,5] = inputDataGridArray[2];
			dgrd_SellTable[dgrd_SellTable.CurrentCell.RowNumber,7] = 17;
		}

		//----------在表格中填入仓库信息------
		public void setStorageData()
		{
			dgrd_SellTable[dgrd_SellTable.CurrentCell.RowNumber,3] = inputDataGridArray[3];
		}

		//---------------设置客户编号和客户名称--------------
		private void setTextData()
		{
			this.cmb_ClientID.IntegralHeight = false;//使组合框不调整大小以显示其所有项
			this.cmb_ClientID.DroppedDown = false;//使组合框不显示其下拉部分
			this.cmb_ClientID.Items[0] = inputTextDataArray[0];
			this.cmb_ClientID.SelectedIndex = 0;
			this.txt_Company.Text = inputTextDataArray[1];
			this.cmb_ClientID.IntegralHeight = true;//恢复默认值
		}

		//------------向【业务员】下拉列表框中添加下拉选项------------
		private void selectDataBase()
		{
			this.txt_SellDate.Text = System.DateTime.Today.ToShortDateString();
			string tempStrSQL = "select distinct 姓名 from 用户清单 ";
			DataTable tempDataTable = link.SelectDataBase(tempStrSQL);
			for (int i=0;i<tempDataTable.Rows.Count;i++)
				this.cmb_Oprater.Items.Add(tempDataTable.Rows[i][0]);
			this.cmb_Oprater.SelectedIndex = 0;
		}
				
		//----------绑定数据并设置明细表格各列的属性----------
		private void DataGridStateControl()
		{
			newTable = new DataTable();
			newTable.Columns.Add("货号(双击)",typeof(string));
			newTable.Columns.Add("数量",typeof(decimal));
			newTable.Columns.Add("单价",typeof(decimal));
			newTable.Columns.Add("仓库(双击)",typeof(string));
			newTable.Columns.Add("品名",typeof(string));
			newTable.Columns.Add("单位",typeof(string));
			newTable.Columns.Add("金额",typeof(decimal),"数量*单价");
			newTable.Columns.Add("税率",typeof(decimal));
			newTable.Columns.Add("不含税额",typeof(decimal),"金额/1.17");
			newTable.Columns.Add("税额",typeof(decimal),"金额-不含税额");
			this.dgrd_SellTable.DataSource = newTable;
			newTable.Rows.Add(newTable.NewRow()); //向表中添加一行

			DataGridTableStyle ts = new DataGridTableStyle();
			DataGridTextBoxColumn aColumnTextColumn;
			ts.AllowSorting = false;
			ts.AlternatingBackColor = Color.LightGray;
			ts.MappingName = newTable.TableName;
			int numCols = newTable.Columns.Count;
			for (int i = 0;i< numCols;i++)
			{
				aColumnTextColumn = new DataGridTextBoxColumn();
				if( i!=0 && i!=1 && i!=2 && i!=3)//表中只允许编辑【数量】和【单价】两个字段
				{
					aColumnTextColumn.ReadOnly=true;
				}
				if ( i == 0 || i == 3 )//当鼠标单击第0列和第3列时,允许响应
				{
					aColumnTextColumn.TextBox.MouseDown += new MouseEventHandler(TextBoxMouseDownHandler);
				}
				if ( i == 4 )
				{
					aColumnTextColumn.Width = 160;
				}
				aColumnTextColumn.MappingName = newTable.Columns[i].ColumnName;
				aColumnTextColumn.HeaderText = newTable.Columns[i].ColumnName;
				aColumnTextColumn.NullText = "";
				aColumnTextColumn.Format = "N"; //设置为数字格式显示
				ts.GridColumnStyles.Add(aColumnTextColumn);
			}
			this.dgrd_SellTable.TableStyles.Add(ts);
		}

		//-----------处理保存修改,删除和存入历史等功能---------
		private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
			if (e.Button.ToolTipText == "保存修改")
			{
				clickedSaveIcon();
			}

			else if(e.Button.ToolTipText == "删除数据")
			{
				try
				{
					if (newTable.Rows.Count > 0)
					{
						this.newTable.Rows.RemoveAt(this.dgrd_SellTable.CurrentCell.RowNumber);
						this.controlCalculate();
					}
					//加入空行保证newTable中不为空,否则删除所有数据行后保存数据和MouseUp函数将引发异常出错
					if (newTable.Rows.Count-1 <= 0)
						newTable.Rows.Add(newTable.NewRow());
				}
				catch
				{
					return;
				}
			}

			else if (e.Button.ToolTipText == "存入历史")
			{
				clickedTrashIcon();
			}
		}

		//----------创建窗体,共用户选择客户----------
		private void cmb_Client_DropDown(object sender, System.EventArgs e)
		{
			ClientDataManage newFrm = new ClientDataManage(false);
			newFrm.setDataGridReadOnly();
			newFrm.ShowDialog();
			setTextData();
			SendKeys.Send("{Tab}");//向活动应用程序发送Tab键,跳到下一控件
		}

		//--------将所选客户的相关数据读入窗体---------
		private void cmb_Client_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			this.txt_Company.Text = "";
			string strSearchWord = this.cmb_ClientID.Text;
			string sendSQL = "select 客户编号,名称 from 客户清单 where 客户编号 = '" + strSearchWord + "'";
			DataTable tempDataTable = this.link.SelectDataBase(sendSQL);		
			if (tempDataTable.Rows.Count>0)
			{
				inputTextDataArray[0] = tempDataTable.Rows[0][0].ToString().Trim();
				inputTextDataArray[1] = tempDataTable.Rows[0][1].ToString().Trim();
				this.setTextData();
				SendKeys.Send("{Tab}");//向活动应用程序发送Tab键,跳到下一控件
			}
		}

		private void dgrd_SellTable_DoubleClick(object sender, System.EventArgs e)
		{

⌨️ 快捷键说明

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