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

📄 debtbillsearchform.cs

📁 超市管理系统的完整版文档
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using SupDataBase;
using System.Data.SqlClient;
using System.Data;

namespace WindowsApplication1
{
	/// <summary>
	/// DebtBillSearchForm 的摘要说明。
	/// </summary>
	public class DebtBillSearchForm : System.Windows.Forms.Form
	{
		private System.Windows.Forms.GroupBox m_debtBillSearch;
		private System.Windows.Forms.DataGrid m_debtListGrid;
		private System.Windows.Forms.DataGrid m_debtGrid;
		private int pre_row_pos;
		private System.Windows.Forms.TextBox m_guestName;
		private System.Windows.Forms.TextBox m_startTime;
		private System.Windows.Forms.CheckBox m_chkbox;
		private System.Windows.Forms.Button m_clearDebt;
		private System.Windows.Forms.Button m_allDebt;
		private System.Windows.Forms.Button m_query;
		private System.Windows.Forms.CheckBox m_chkStartTime;
		private System.Windows.Forms.CheckBox m_chkEndDate;
		private System.Windows.Forms.TextBox m_endTime;
		private System.Windows.Forms.CheckBox m_chkGuestName;

		private System.Data.DataTable m_debtListDataTable;
		private System.Data.DataView m_debtListDataView;
        

		private System.Data.DataTable m_debtInfoDataTable;
		private System.Data.DataView m_debtInfoDataView;
		private int employeeId;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

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


			pre_row_pos = 0;
			employeeId =1;


           //debt list grid
            m_debtListDataTable = new System.Data.DataTable("debtListTalbe");
		
			m_debtListDataTable.Columns.Add(new System.Data.DataColumn("欠单号"));
			m_debtListDataTable.Columns.Add(new System.Data.DataColumn("客户"));
			m_debtListDataTable.Columns.Add(new System.Data.DataColumn("欠额(元)"));
			m_debtListDataTable.Columns.Add(new System.Data.DataColumn("结算标志"));
			m_debtListDataTable.Columns.Add(new System.Data.DataColumn("操作员"));
			m_debtListDataTable.Columns.Add(new System.Data.DataColumn("添加时间"));
			m_debtListDataTable.Columns.Add(new System.Data.DataColumn("结算时间"));
            
			m_debtListDataTable.Columns[0].MaxLength = 30;

            m_debtListDataView = new System.Data.DataView(m_debtListDataTable);
			m_debtListDataView.AllowNew = false;
			m_debtListDataView.AllowDelete = false;
			m_debtListDataView.AllowEdit = false;

			m_debtListGrid.DataSource = m_debtListDataView;

           
         //debt info grid
			m_debtInfoDataTable = new System.Data.DataTable("debtInfoTable");
			
			m_debtInfoDataTable.Columns.Add(new System.Data.DataColumn("商品条码"));
			m_debtInfoDataTable.Columns.Add(new System.Data.DataColumn("商品名称"));
			m_debtInfoDataTable.Columns.Add(new System.Data.DataColumn("单价(元)"));
			m_debtInfoDataTable.Columns.Add(new System.Data.DataColumn("数量"));
			m_debtInfoDataTable.Columns.Add(new System.Data.DataColumn("计量单位"));
			m_debtInfoDataTable.Columns.Add(new System.Data.DataColumn("小计"));

            m_debtInfoDataTable.Columns[0].MaxLength= 20;
			m_debtInfoDataTable.Columns[1].MaxLength = 20;


			m_debtInfoDataView = new System.Data.DataView(m_debtInfoDataTable);
			m_debtInfoDataView.AllowNew = false;
			m_debtInfoDataView.AllowDelete = false;
			m_debtInfoDataView.AllowEdit = false;

			m_debtGrid.DataSource = m_debtInfoDataView;

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <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.m_debtListGrid = new System.Windows.Forms.DataGrid();
			this.m_debtGrid = new System.Windows.Forms.DataGrid();
			this.m_debtBillSearch = new System.Windows.Forms.GroupBox();
			this.m_clearDebt = new System.Windows.Forms.Button();
			this.m_allDebt = new System.Windows.Forms.Button();
			this.m_query = new System.Windows.Forms.Button();
			this.m_chkbox = new System.Windows.Forms.CheckBox();
			this.m_startTime = new System.Windows.Forms.TextBox();
			this.m_guestName = new System.Windows.Forms.TextBox();
			this.m_chkStartTime = new System.Windows.Forms.CheckBox();
			this.m_chkEndDate = new System.Windows.Forms.CheckBox();
			this.m_endTime = new System.Windows.Forms.TextBox();
			this.m_chkGuestName = new System.Windows.Forms.CheckBox();
			((System.ComponentModel.ISupportInitialize)(this.m_debtListGrid)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.m_debtGrid)).BeginInit();
			this.m_debtBillSearch.SuspendLayout();
			this.SuspendLayout();
			// 
			// m_debtListGrid
			// 
			this.m_debtListGrid.AllowSorting = false;
			this.m_debtListGrid.CaptionBackColor = System.Drawing.SystemColors.ControlLight;
			this.m_debtListGrid.CaptionForeColor = System.Drawing.SystemColors.ControlText;
			this.m_debtListGrid.CaptionText = "欠单列表";
			this.m_debtListGrid.DataMember = "";
			this.m_debtListGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.m_debtListGrid.Location = new System.Drawing.Point(16, 16);
			this.m_debtListGrid.Name = "m_debtListGrid";
			this.m_debtListGrid.Size = new System.Drawing.Size(856, 160);
			this.m_debtListGrid.TabIndex = 0;
			this.m_debtListGrid.Navigate += new System.Windows.Forms.NavigateEventHandler(this.m_debtListGrid_Navigate);
			this.m_debtListGrid.CurrentCellChanged += new System.EventHandler(this.m_debtListGrid_CurrentCellChanged);
			// 
			// m_debtGrid
			// 
			this.m_debtGrid.CaptionBackColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.m_debtGrid.CaptionForeColor = System.Drawing.SystemColors.ControlText;
			this.m_debtGrid.CaptionText = "欠单信息";
			this.m_debtGrid.DataMember = "";
			this.m_debtGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.m_debtGrid.Location = new System.Drawing.Point(16, 208);
			this.m_debtGrid.Name = "m_debtGrid";
			this.m_debtGrid.Size = new System.Drawing.Size(856, 152);
			this.m_debtGrid.TabIndex = 1;
			// 
			// m_debtBillSearch
			// 
			this.m_debtBillSearch.Controls.Add(this.m_chkGuestName);
			this.m_debtBillSearch.Controls.Add(this.m_endTime);
			this.m_debtBillSearch.Controls.Add(this.m_chkEndDate);
			this.m_debtBillSearch.Controls.Add(this.m_chkStartTime);
			this.m_debtBillSearch.Controls.Add(this.m_clearDebt);
			this.m_debtBillSearch.Controls.Add(this.m_allDebt);
			this.m_debtBillSearch.Controls.Add(this.m_query);
			this.m_debtBillSearch.Controls.Add(this.m_chkbox);
			this.m_debtBillSearch.Controls.Add(this.m_startTime);
			this.m_debtBillSearch.Controls.Add(this.m_guestName);
			this.m_debtBillSearch.Location = new System.Drawing.Point(16, 376);
			this.m_debtBillSearch.Name = "m_debtBillSearch";
			this.m_debtBillSearch.Size = new System.Drawing.Size(856, 144);
			this.m_debtBillSearch.TabIndex = 2;
			this.m_debtBillSearch.TabStop = false;
			this.m_debtBillSearch.Text = "欠单查询";
			// 
			// m_clearDebt
			// 
			this.m_clearDebt.Location = new System.Drawing.Point(256, 96);
			this.m_clearDebt.Name = "m_clearDebt";
			this.m_clearDebt.Size = new System.Drawing.Size(40, 23);
			this.m_clearDebt.TabIndex = 7;
			this.m_clearDebt.Text = "结算";
			this.m_clearDebt.Click += new System.EventHandler(this.m_clearDebt_Click);
			// 
			// m_allDebt
			// 
			this.m_allDebt.Location = new System.Drawing.Point(160, 96);
			this.m_allDebt.Name = "m_allDebt";
			this.m_allDebt.TabIndex = 6;
			this.m_allDebt.Text = "全部帐单";
			this.m_allDebt.Click += new System.EventHandler(this.m_allDebt_Click);
			// 
			// m_query
			// 
			this.m_query.Location = new System.Drawing.Point(72, 96);
			this.m_query.Name = "m_query";
			this.m_query.Size = new System.Drawing.Size(64, 23);
			this.m_query.TabIndex = 5;
			this.m_query.Text = "查询";
			this.m_query.Click += new System.EventHandler(this.m_query_Click);
			// 
			// m_chkbox
			// 
			this.m_chkbox.Location = new System.Drawing.Point(48, 64);
			this.m_chkbox.Name = "m_chkbox";
			this.m_chkbox.Size = new System.Drawing.Size(112, 24);
			this.m_chkbox.TabIndex = 4;
			this.m_chkbox.Text = "包括已结算欠单";
			// 
			// m_startTime
			// 
			this.m_startTime.Enabled = false;
			this.m_startTime.Location = new System.Drawing.Point(336, 32);
			this.m_startTime.Name = "m_startTime";
			this.m_startTime.TabIndex = 3;
			this.m_startTime.Text = "";
			this.m_startTime.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.m_startTime_KeyPress);
			// 
			// m_guestName
			// 
			this.m_guestName.Location = new System.Drawing.Point(120, 32);
			this.m_guestName.Name = "m_guestName";
			this.m_guestName.TabIndex = 1;
			this.m_guestName.Text = "";
			// 
			// m_chkStartTime
			// 
			this.m_chkStartTime.Location = new System.Drawing.Point(248, 32);
			this.m_chkStartTime.Name = "m_chkStartTime";
			this.m_chkStartTime.Size = new System.Drawing.Size(80, 24);
			this.m_chkStartTime.TabIndex = 8;
			this.m_chkStartTime.Text = "起始时间";
			this.m_chkStartTime.CheckedChanged += new System.EventHandler(this.m_chkStartTime_CheckedChanged);
			// 
			// m_chkEndDate
			// 
			this.m_chkEndDate.Location = new System.Drawing.Point(248, 64);
			this.m_chkEndDate.Name = "m_chkEndDate";
			this.m_chkEndDate.Size = new System.Drawing.Size(80, 24);
			this.m_chkEndDate.TabIndex = 9;
			this.m_chkEndDate.Text = "结束时间";
			this.m_chkEndDate.CheckedChanged += new System.EventHandler(this.m_chkEndDate_CheckedChanged);
			// 
			// m_endTime
			// 
			this.m_endTime.Enabled = false;
			this.m_endTime.Location = new System.Drawing.Point(336, 64);
			this.m_endTime.Name = "m_endTime";
			this.m_endTime.TabIndex = 10;
			this.m_endTime.Text = "";
			this.m_endTime.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.m_endTime_KeyPress);
			// 
			// m_chkGuestName
			// 
			this.m_chkGuestName.Checked = true;
			this.m_chkGuestName.CheckState = System.Windows.Forms.CheckState.Checked;
			this.m_chkGuestName.Location = new System.Drawing.Point(48, 32);
			this.m_chkGuestName.Name = "m_chkGuestName";
			this.m_chkGuestName.Size = new System.Drawing.Size(64, 24);
			this.m_chkGuestName.TabIndex = 11;
			this.m_chkGuestName.Text = "客户名";
			this.m_chkGuestName.CheckedChanged += new System.EventHandler(this.m_chkGuestName_CheckedChanged);
			// 
			// DebtBillSearchForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(904, 534);
			this.Controls.Add(this.m_debtBillSearch);
			this.Controls.Add(this.m_debtGrid);
			this.Controls.Add(this.m_debtListGrid);
			this.Name = "DebtBillSearchForm";
			this.Text = "欠单查询";
			this.Load += new System.EventHandler(this.DebtBillSearchForm_Load);
			((System.ComponentModel.ISupportInitialize)(this.m_debtListGrid)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.m_debtGrid)).EndInit();
			this.m_debtBillSearch.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion


		private void DebtBillQuery(string guestname, string startdate, string enddate, bool clearflag)
		{  
			//generate sqlcmd
           string sql = "select SaleNo,Guest.GuestName,LackMoney,ClearFlag,OperatorID,AddTime,ClearTime, Employee.UserName"+ 
				         " from DebtBill, Guest, Employee"+
				         " where DebtBill.GuestID=Guest.GuestID and DebtBill.OperatorID=Employee.EmployeeID";
           
			if(!clearflag)
			{
				sql = sql + " and ClearFlag='0'";
			}

			if(guestname != "")
			{
			   sql = sql + "  and GuestName='" + guestname+"'";
			}

			if(startdate != "")
			{
			   sql = sql + "  and AddTime>='"+startdate+"'";

⌨️ 快捷键说明

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