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

📄 stocktable.cs

📁 进销存管理系统 C#完整源码 内含SQl建库脚本等
💻 CS
📖 第 1 页 / 共 3 页
字号:
			// 
			this.tbarBtnDelete.ImageIndex = 1;
			this.tbarBtnDelete.ToolTipText = "删除数据";
			// 
			// tbarBtnPrint
			// 
			this.tbarBtnPrint.ImageIndex = 2;
			this.tbarBtnPrint.ToolTipText = "打印报表";
			// 
			// imageList1
			// 
			this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
			this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
			this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
			// 
			// 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.label8);
			this.groupBox2.Controls.Add(this.label9);
			this.groupBox2.Controls.Add(this.txt_NoTax);
			this.groupBox2.Controls.Add(this.label10);
			this.groupBox2.Controls.Add(this.txt_Tax);
			this.groupBox2.Location = new System.Drawing.Point(-4, 375);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(728, 81);
			this.groupBox2.TabIndex = 38;
			this.groupBox2.TabStop = false;
			// 
			// txt_TotalCount
			// 
			this.txt_TotalCount.Location = new System.Drawing.Point(127, 13);
			this.txt_TotalCount.Name = "txt_TotalCount";
			this.txt_TotalCount.TabIndex = 6;
			this.txt_TotalCount.Text = "0.00";
			this.txt_TotalCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// label8
			// 
			this.label8.Location = new System.Drawing.Point(63, 18);
			this.label8.Name = "label8";
			this.label8.Size = new System.Drawing.Size(64, 16);
			this.label8.TabIndex = 46;
			this.label8.Text = "合计金额:";
			// 
			// label9
			// 
			this.label9.Location = new System.Drawing.Point(287, 18);
			this.label9.Name = "label9";
			this.label9.Size = new System.Drawing.Size(72, 16);
			this.label9.TabIndex = 44;
			this.label9.Text = "不含税金额:";
			// 
			// txt_NoTax
			// 
			this.txt_NoTax.Location = new System.Drawing.Point(367, 13);
			this.txt_NoTax.Name = "txt_NoTax";
			this.txt_NoTax.TabIndex = 7;
			this.txt_NoTax.Text = "0.00";
			this.txt_NoTax.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// label10
			// 
			this.label10.Location = new System.Drawing.Point(519, 18);
			this.label10.Name = "label10";
			this.label10.Size = new System.Drawing.Size(40, 16);
			this.label10.TabIndex = 45;
			this.label10.Text = "税额:";
			// 
			// txt_Tax
			// 
			this.txt_Tax.Location = new System.Drawing.Point(566, 13);
			this.txt_Tax.Name = "txt_Tax";
			this.txt_Tax.TabIndex = 8;
			this.txt_Tax.Text = "0.00";
			this.txt_Tax.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// StockTable
			// 
			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_StockTable);
			this.Name = "StockTable";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "【进货单】";
			((System.ComponentModel.ISupportInitialize)(this.dgrd_StockTable)).EndInit();
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		//-------将双击选择得到的商品信息显示到进货单的表格中--------
		public void  setWareData()
		{
			dgrd_StockTable[dgrd_StockTable.CurrentCell.RowNumber,0] = inputDataGridArray[0];
			dgrd_StockTable[dgrd_StockTable.CurrentCell.RowNumber,4] = inputDataGridArray[1];
			dgrd_StockTable[dgrd_StockTable.CurrentCell.RowNumber,5] = inputDataGridArray[2];
			dgrd_StockTable[dgrd_StockTable.CurrentCell.RowNumber,7] = 17;
		}

		//-------将双击选择得到的供货商信息显示到窗体中--------
		private void setTextData()
		{
			this.cmb_StokerID.IntegralHeight = false;//使组合框不调整大小以显示其所有项
			this.cmb_StokerID.DroppedDown = false;//使组合框不显示其下拉部分
			this.cmb_StokerID.Items[0] = inputTextDataArray[0];
			this.cmb_StokerID.SelectedIndex = 0;
			this.txt_StokerName.Text = inputTextDataArray[1];
			this.cmb_StokerID.IntegralHeight = true;//恢复默认值
		}

		//-----设置【业务员】下拉列表框下拉选项------
		private void selectDataBase()
		{
			this.txt_StockDate.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),"数量*单价"); //运用DataTable的表达式自动运算
			newTable.Columns.Add("税率",typeof(decimal));
			newTable.Columns.Add("不含税额",typeof(decimal),"金额/1.17");
			newTable.Columns.Add("税额",typeof(decimal),"金额-不含税额");
			this.dgrd_StockTable.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 )//当鼠标单击首列时允许响应
				{
					aColumnTextColumn.TextBox.MouseDown += new MouseEventHandler(TextBoxMouseDownHandler);
				}
				if ( i == 4 )
				{
					aColumnTextColumn.Width = 160;
				}
				if ( i == 3 )//设置仓库下拉列表框
				{
					string sendStrSQL = "select distinct 仓库 from 库存库 order by 仓库 ASC";
					DataTable tempTable = this.link.SelectDataBase(sendStrSQL);
					DataGridComboBoxColumn aComboBoxColumn = new DataGridComboBoxColumn(tempTable,0,0);
					aComboBoxColumn.MappingName = newTable.Columns[i].ColumnName;
					aComboBoxColumn.HeaderText = newTable.Columns[i].ColumnName;
					aComboBoxColumn.NullText = "";
					ts.GridColumnStyles.Add(aComboBoxColumn);
				}
				else
				{
					aColumnTextColumn.MappingName = newTable.Columns[i].ColumnName;
					aColumnTextColumn.HeaderText = newTable.Columns[i].ColumnName;
					aColumnTextColumn.NullText = "";
					aColumnTextColumn.Format = "N";//设置为数字格式显示
					ts.GridColumnStyles.Add(aColumnTextColumn);
				}
			}
			this.dgrd_StockTable.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_StockTable.CurrentCell.RowNumber);
						this.controlCalculate();
					}
					//加入空行保证newTable中不为空,否则删除所有数据行后保存数据和MouseUp函数将引发异常出错
					if (newTable.Rows.Count-1 <= 0)
						newTable.Rows.Add(newTable.NewRow());
				}
				catch
				{
					return;
				}
			}

			else if (e.Button.ToolTipText == "打印报表")
			{
				clickedPrintIcon();
			}

		}

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

		//--------将所选供货商的相关数据读入窗体---------
		private void cmb_StokerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			this.txt_StokerName.Text = "";
			string strSearchWord = this.cmb_StokerID.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_StockTable_DoubleClick(object sender, System.EventArgs e)
		{

⌨️ 快捷键说明

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