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

📄 stocktable.cs

📁 100%原创 进销存管理系统 .net vs2003开发。下载后请保留作者版权: danis 2007年11月28日 版权所有
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace 进销存管理系统
{
	/// <summary>
	/// StockTable 的摘要说明。
	/// </summary>
	public class StockTable : System.Windows.Forms.Form
	{
		private	LinkDataBase link = new LinkDataBase();	
		private DataTable newTable;
		public static string [] inputDataGridArray = new string [] {null,null,null};
		public static string [] inputTextDataArray = new string [] {"",""};
		private DateTime gridMouseDownTime; //记录点击DataGrid时的时间

		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.DataGrid dgrd_StockTable;
		private System.Windows.Forms.TextBox txt_StockDate;
		private System.Windows.Forms.TextBox txt_Maker;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.Label label8;
		private System.Windows.Forms.Label label9;
		private System.Windows.Forms.Label label10;
		private System.Windows.Forms.TextBox txt_NoTax;
		private System.Windows.Forms.TextBox txt_Tax;
		private System.Windows.Forms.ComboBox cmb_StokerID;
		private System.Windows.Forms.TextBox txt_StokerName;
		private System.Windows.Forms.TextBox txt_TotalCount;
		private System.Windows.Forms.ComboBox cmb_Oprater;
		private System.Windows.Forms.Button btnDel;
		private System.Windows.Forms.Button btnSave;
		private System.ComponentModel.IContainer components;

		public StockTable()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
			this.selectDataBase();
			this.DataGridStateControl();
			this.cmb_StokerID.Items.Add("");
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.dgrd_StockTable = new System.Windows.Forms.DataGrid();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.cmb_Oprater = new System.Windows.Forms.ComboBox();
			this.cmb_StokerID = new System.Windows.Forms.ComboBox();
			this.txt_StockDate = new System.Windows.Forms.TextBox();
			this.txt_Maker = new System.Windows.Forms.TextBox();
			this.label4 = new System.Windows.Forms.Label();
			this.txt_StokerName = new System.Windows.Forms.TextBox();
			this.label5 = new System.Windows.Forms.Label();
			this.label6 = new System.Windows.Forms.Label();
			this.label7 = new System.Windows.Forms.Label();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.txt_TotalCount = new System.Windows.Forms.TextBox();
			this.label8 = new System.Windows.Forms.Label();
			this.label9 = new System.Windows.Forms.Label();
			this.txt_NoTax = new System.Windows.Forms.TextBox();
			this.label10 = new System.Windows.Forms.Label();
			this.txt_Tax = new System.Windows.Forms.TextBox();
			this.btnDel = new System.Windows.Forms.Button();
			this.btnSave = new System.Windows.Forms.Button();
			((System.ComponentModel.ISupportInitialize)(this.dgrd_StockTable)).BeginInit();
			this.groupBox1.SuspendLayout();
			this.groupBox2.SuspendLayout();
			this.SuspendLayout();
			// 
			// dgrd_StockTable
			// 
			this.dgrd_StockTable.AllowSorting = false;
			this.dgrd_StockTable.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.dgrd_StockTable.CaptionVisible = false;
			this.dgrd_StockTable.DataMember = "";
			this.dgrd_StockTable.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dgrd_StockTable.Location = new System.Drawing.Point(0, 88);
			this.dgrd_StockTable.Name = "dgrd_StockTable";
			this.dgrd_StockTable.Size = new System.Drawing.Size(720, 280);
			this.dgrd_StockTable.TabIndex = 5;
			this.dgrd_StockTable.MouseDown += new System.Windows.Forms.MouseEventHandler(this.dgrd_StockTable_MouseDown);
			this.dgrd_StockTable.DoubleClick += new System.EventHandler(this.dgrd_StockTable_DoubleClick);
			this.dgrd_StockTable.CurrentCellChanged += new System.EventHandler(this.dgrd_StockTable_CurrentCellChanged);
			// 
			// groupBox1
			// 
			this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.groupBox1.Controls.Add(this.btnDel);
			this.groupBox1.Controls.Add(this.btnSave);
			this.groupBox1.Controls.Add(this.cmb_Oprater);
			this.groupBox1.Controls.Add(this.cmb_StokerID);
			this.groupBox1.Controls.Add(this.txt_StockDate);
			this.groupBox1.Controls.Add(this.txt_Maker);
			this.groupBox1.Controls.Add(this.label4);
			this.groupBox1.Controls.Add(this.txt_StokerName);
			this.groupBox1.Controls.Add(this.label5);
			this.groupBox1.Controls.Add(this.label6);
			this.groupBox1.Controls.Add(this.label7);
			this.groupBox1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.groupBox1.Location = new System.Drawing.Point(0, 0);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(720, 82);
			this.groupBox1.TabIndex = 0;
			this.groupBox1.TabStop = false;
			// 
			// cmb_Oprater
			// 
			this.cmb_Oprater.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cmb_Oprater.ItemHeight = 12;
			this.cmb_Oprater.Location = new System.Drawing.Point(524, 16);
			this.cmb_Oprater.Name = "cmb_Oprater";
			this.cmb_Oprater.Size = new System.Drawing.Size(121, 20);
			this.cmb_Oprater.Sorted = true;
			this.cmb_Oprater.TabIndex = 3;
			// 
			// cmb_StokerID
			// 
			this.cmb_StokerID.Location = new System.Drawing.Point(140, 51);
			this.cmb_StokerID.MaxDropDownItems = 1;
			this.cmb_StokerID.Name = "cmb_StokerID";
			this.cmb_StokerID.Size = new System.Drawing.Size(128, 20);
			this.cmb_StokerID.Sorted = true;
			this.cmb_StokerID.TabIndex = 4;
			this.cmb_StokerID.DropDown += new System.EventHandler(this.cmb_Stoker_DropDown);
			this.cmb_StokerID.KeyUp += new System.Windows.Forms.KeyEventHandler(this.cmb_StokerID_KeyUp);
			// 
			// txt_StockDate
			// 
			this.txt_StockDate.Location = new System.Drawing.Point(140, 16);
			this.txt_StockDate.Name = "txt_StockDate";
			this.txt_StockDate.Size = new System.Drawing.Size(128, 21);
			this.txt_StockDate.TabIndex = 1;
			this.txt_StockDate.Text = "";
			// 
			// txt_Maker
			// 
			this.txt_Maker.Location = new System.Drawing.Point(343, 16);
			this.txt_Maker.Name = "txt_Maker";
			this.txt_Maker.TabIndex = 2;
			this.txt_Maker.Text = "sys";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(75, 55);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(60, 16);
			this.label4.TabIndex = 19;
			this.label4.Text = "供货商号:";
			// 
			// txt_StokerName
			// 
			this.txt_StokerName.Location = new System.Drawing.Point(295, 51);
			this.txt_StokerName.Name = "txt_StokerName";
			this.txt_StokerName.ReadOnly = true;
			this.txt_StokerName.Size = new System.Drawing.Size(350, 21);
			this.txt_StokerName.TabIndex = 9;
			this.txt_StokerName.TabStop = false;
			this.txt_StokerName.Text = "";
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(290, 22);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(42, 16);
			this.label5.TabIndex = 17;
			this.label5.Text = "制单人:";
			// 
			// label6
			// 
			this.label6.Location = new System.Drawing.Point(468, 22);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(48, 16);
			this.label6.TabIndex = 18;
			this.label6.Text = "业务员:";
			// 
			// label7
			// 
			this.label7.Location = new System.Drawing.Point(75, 22);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(60, 16);
			this.label7.TabIndex = 16;
			this.label7.Text = "进货日期:";
			// 
			// 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;
			// 
			// btnDel
			// 
			this.btnDel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
			this.btnDel.Location = new System.Drawing.Point(656, 48);
			this.btnDel.Name = "btnDel";
			this.btnDel.Size = new System.Drawing.Size(48, 23);
			this.btnDel.TabIndex = 21;
			this.btnDel.Text = "删除";
			this.btnDel.Click += new System.EventHandler(this.btnDel_Click);
			// 
			// btnSave
			// 
			this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
			this.btnSave.Location = new System.Drawing.Point(656, 16);
			this.btnSave.Name = "btnSave";
			this.btnSave.Size = new System.Drawing.Size(48, 23);
			this.btnSave.TabIndex = 20;
			this.btnSave.Text = "保存";
			this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
			// 
			// 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.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;
		}

		//将双击选择得到的供货商信息显示到窗体中

⌨️ 快捷键说明

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