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

📄 frmsaleorderform.cs

📁 制造业ERP系统搜集
💻 CS
📖 第 1 页 / 共 2 页
字号:
				| System.Windows.Forms.AnchorStyles.Right)));
			this.groupBox2.Controls.Add(this.groupBox4);
			this.groupBox2.Location = new System.Drawing.Point(0, 40);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(968, 224);
			this.groupBox2.TabIndex = 1;
			this.groupBox2.TabStop = false;
			// 
			// groupBox4
			// 
			this.groupBox4.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.groupBox4.Controls.Add(this.dataGrid1);
			this.groupBox4.Location = new System.Drawing.Point(0, 0);
			this.groupBox4.Name = "groupBox4";
			this.groupBox4.Size = new System.Drawing.Size(968, 224);
			this.groupBox4.TabIndex = 0;
			this.groupBox4.TabStop = false;
			this.groupBox4.Text = "销售定单(父)表";
			// 
			// dataGrid1
			// 
			this.dataGrid1.DataMember = "";
			this.dataGrid1.DataSource = this.dataView1;
			this.dataGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dataGrid1.Location = new System.Drawing.Point(3, 17);
			this.dataGrid1.Name = "dataGrid1";
			this.dataGrid1.ReadOnly = true;
			this.dataGrid1.Size = new System.Drawing.Size(962, 204);
			this.dataGrid1.TabIndex = 1;
			// 
			// groupBox3
			// 
			this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.groupBox3.Controls.Add(this.dataGrid2);
			this.groupBox3.Location = new System.Drawing.Point(0, 264);
			this.groupBox3.Name = "groupBox3";
			this.groupBox3.Size = new System.Drawing.Size(968, 160);
			this.groupBox3.TabIndex = 2;
			this.groupBox3.TabStop = false;
			this.groupBox3.Text = "明细(子)表";
			// 
			// dataGrid2
			// 
			this.dataGrid2.DataMember = "";
			this.dataGrid2.DataSource = this.dataView2;
			this.dataGrid2.Dock = System.Windows.Forms.DockStyle.Fill;
			this.dataGrid2.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dataGrid2.Location = new System.Drawing.Point(3, 17);
			this.dataGrid2.Name = "dataGrid2";
			this.dataGrid2.ReadOnly = true;
			this.dataGrid2.Size = new System.Drawing.Size(962, 140);
			this.dataGrid2.TabIndex = 3;
			// 
			// sqlDataAdapter1
			// 
			this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
			this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
																									  new System.Data.Common.DataTableMapping("Table", "销售定单历史", new System.Data.Common.DataColumnMapping[] {
																																																				new System.Data.Common.DataColumnMapping("定单编号", "定单编号"),
																																																				new System.Data.Common.DataColumnMapping("定单号", "定单号"),
																																																				new System.Data.Common.DataColumnMapping("客户编号", "客户编号"),
																																																				new System.Data.Common.DataColumnMapping("定货日期", "定货日期"),
																																																				new System.Data.Common.DataColumnMapping("业务员", "业务员"),
																																																				new System.Data.Common.DataColumnMapping("制单人", "制单人"),
																																																				new System.Data.Common.DataColumnMapping("税价合计", "税价合计"),
																																																				new System.Data.Common.DataColumnMapping("不含税价", "不含税价"),
																																																				new System.Data.Common.DataColumnMapping("税额", "税额"),
																																																				new System.Data.Common.DataColumnMapping("票号", "票号")})});
			// 
			// sqlSelectCommand1
			// 
			this.sqlSelectCommand1.CommandText = "SELECT 定单编号, 定单号, 客户编号, 定货日期, 业务员, 制单人, 税价合计, 不含税价, 税额, 票号 FROM 销售定单历史";
			this.sqlSelectCommand1.Connection = this.sqlConnection1;
			// 
			// sqlConnection1
			// 
			this.sqlConnection1.ConnectionString = "workstation id=WINDOWSXP;packet size=4096;user id=sa;data source=\".\";persist secu" +
				"rity info=False;initial catalog=jxcbook";
			// 
			// sqlDataAdapter2
			// 
			this.sqlDataAdapter2.SelectCommand = this.sqlSelectCommand2;
			this.sqlDataAdapter2.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
																									  new System.Data.Common.DataTableMapping("Table", "view_销售定单明细历史", new System.Data.Common.DataColumnMapping[] {
																																																					   new System.Data.Common.DataColumnMapping("定单编号", "定单编号"),
																																																					   new System.Data.Common.DataColumnMapping("产成品编号", "产成品编号"),
																																																					   new System.Data.Common.DataColumnMapping("拼音编码", "拼音编码"),
																																																					   new System.Data.Common.DataColumnMapping("产成品名", "产成品名"),
																																																					   new System.Data.Common.DataColumnMapping("规格", "规格"),
																																																					   new System.Data.Common.DataColumnMapping("单位", "单位"),
																																																					   new System.Data.Common.DataColumnMapping("类别", "类别"),
																																																					   new System.Data.Common.DataColumnMapping("定货数量", "定货数量"),
																																																					   new System.Data.Common.DataColumnMapping("税价合计", "税价合计"),
																																																					   new System.Data.Common.DataColumnMapping("扣率", "扣率"),
																																																					   new System.Data.Common.DataColumnMapping("税率", "税率"),
																																																					   new System.Data.Common.DataColumnMapping("不含税价", "不含税价"),
																																																					   new System.Data.Common.DataColumnMapping("税额", "税额")})});
			// 
			// sqlSelectCommand2
			// 
			this.sqlSelectCommand2.CommandText = "SELECT 定单编号, 产成品编号, 拼音编码, 产成品名, 规格, 单位, 类别, 定货数量, 税价合计, 扣率, 税率, 不含税价, 税额 FROM vie" +
				"w_销售定单明细历史";
			this.sqlSelectCommand2.Connection = this.sqlConnection1;
			// 
			// saleOrderDS11
			// 
			this.saleOrderDS11.DataSetName = "SaleOrderDS1";
			this.saleOrderDS11.Locale = new System.Globalization.CultureInfo("en-US");
			// 
			// dataView1
			// 
			this.dataView1.Table = this.saleOrderDS11.销售定单历史;
			// 
			// dataView2
			// 
			this.dataView2.Table = this.saleOrderDS11.view_销售定单明细历史;
			// 
			// FrmSaleOrderForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(968, 430);
			this.Controls.Add(this.groupBox3);
			this.Controls.Add(this.groupBox2);
			this.Controls.Add(this.groupBox1);
			this.Name = "FrmSaleOrderForm";
			this.Text = "销售定单明细查询";
			this.Load += new System.EventHandler(this.FrmSaleOrderForm_Load);
			this.Closed += new System.EventHandler(this.FrmSaleOrderForm_Closed);
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.groupBox4.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
			this.groupBox3.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.saleOrderDS11)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dataView1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dataView2)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		private void FrmSaleOrderForm_Load(object sender, System.EventArgs e)
		{
			try
			{
				this.Cursor = Cursors.WaitCursor;
				//填充数据集
				sqlDataAdapter1.Fill(saleOrderDS11);
				sqlDataAdapter2.Fill(saleOrderDS11);
				//显示时,首先显示第一个销售定单的明细
				dataView2.RowFilter="定单编号='"+dataGrid1[0,0].ToString().Trim()+"'";
				//明细数据根据选择的销售定单编号而变化
				dataGrid1.CurrentCellChanged+=new EventHandler(dataGrid1_CurrentCellChanged);
			}
			catch(Exception Err)
			{
				MessageBox.Show("查询数据集记录为空:"+Err.Message,"信息提示",
					MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
			finally
			{
				this.Cursor = Cursors.Default;
			}

		}

		//-------------显示销售定单历史明细明细----------------
		private void dataGrid1_CurrentCellChanged(object sender, EventArgs e)
		{
			int i=dataGrid1.CurrentRowIndex;
			dataView2.RowFilter="定单编号='"+dataGrid1[i,0].ToString().Trim()+"'";
		}

		private void FrmSaleOrderForm_Closed(object sender, System.EventArgs e)
		{
			if(this.sqlConnection1.State==ConnectionState.Open)
			{
				this.sqlConnection1.Close();
			}
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			try
			{
				this.Cursor = Cursors.WaitCursor;
				string filter="";
				if(textBox2.Text.Trim()!="")
				{
					filter+="定单号 like '"+textBox2.Text.Trim()+"%' AND ";
				}
				if(textBox1.Text.Trim()!="")
				{
					filter+="客户编号 like '"+textBox1.Text.Trim()+"%' AND ";
				}
				if(textBox3.Text.Trim()!="")
				{
					filter+="票号 like '"+textBox3.Text.Trim()+"%' AND ";
				}
				if(textBox4.Text.Trim()!="")
				{
					filter+="定货日期 like '"+textBox4.Text.Trim()+"%' AND ";
				}
				if(textBox5.Text.Trim()!="")
				{
					filter+="业务员 like '"+textBox5.Text.Trim()+"%' AND ";
				}
				int length=filter.Length;
				if(length>0)
				{
					filter=filter.Substring(0,length-5);
				}
				dataView1.RowFilter=filter;
				if(dataView1.Count>0)//有确定的定单数据再显示明细
				{				
					dataView2.RowFilter="定单编号='"+dataGrid1[0,0].ToString().Trim()+"'";
				}

			}
			catch(Exception Err)
			{
				MessageBox.Show("查询数据集记录操作失败:"+Err.Message,"信息提示",
					MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
			finally
			{
				this.Cursor = Cursors.Default;
				this.sqlConnection1.Close();
			}
		}
		
	}
}

⌨️ 快捷键说明

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