private void FormRetailUntreadBaseBill_Load(object sender, EventArgs e) { ControlBindDataSource cbds = new ControlBindDataSource(); cbds.DataGridViewComboBoxColumnBindDataSource(GoodsSeriesCode, "GoodsSeriesCode", "GoodsSeriesName", "Select * From GoodsSeries", "GoodsSeries"); cbds.DataGridViewComboBoxColumnBindDataSource(GoodsTypeCode, "GoodsTypeCode", "GoodsTypeName", "Select * From GoodsType", "GoodsType"); cbds.DataGridViewComboBoxColumnBindDataSource(EmployeeCode1, "EmployeeCode", "EmployeeName", "Select * From Employee", "Employee"); cbds.DataGridViewComboBoxColumnBindDataSource(OperatorCode, "OperatorCode", "OperatorName", "Select * From Operator", "Operator"); bsUntreadBaseBill.DataSource = rubb.GetDataTable("UntreadBaseBill", "Where UntreadBillNo is null"); dgvUntreadBaseBill.DataSource = bsUntreadBaseBill; toolStrip1.Tag = ""; }
private void RetrieveUntreadBaseBillInfo(string strUntreadBillNo) { RetailUntreadBaseBill rurb = new RetailUntreadBaseBill(); String strSql = "Select UntreadBaseBill.*,SaleOrderBill.*,Customer.* From UntreadBaseBill,SaleOrderBill,Customer "; strSql += "Where UntreadBaseBill.SaleBillNo = SaleOrderBill.SaleBillNo and UntreadBaseBill.CustomerId = Customer.CustomerId and UntreadBaseBill.UntreadBillNo = '" + strUntreadBillNo + "'"; DataTable dt = rurb.GetDataTable(strSql); if (dt.Rows.Count > 0) { SetUntreadBaseBillInfo(dt.Rows[0]); } else { MessageBox.Show("该退货单不存在!", "软件提示"); txtUntreadBillNo.Focus(); return; } }
private void btnQuery_Click(object sender, EventArgs e) { RetailUntreadBaseBill rubb = new RetailUntreadBaseBill(); string strSql = null; if (!chbIsCDNo.Checked) //没有选中光盘号查询 { if (!String.IsNullOrEmpty(txtCustomerName.Text.Trim())) { strSql += " and CustomerName like '%" + txtCustomerName.Text.Trim() + "%'"; } if (!(cbxProvinceCode.SelectedValue == null)) { strSql += " and ProvinceCode = '" + cbxProvinceCode.SelectedValue.ToString() + "'"; } if (!String.IsNullOrEmpty(txtAddress.Text.Trim())) { strSql += " and Address like '%" + txtAddress.Text.Trim() + "%'"; } if (!String.IsNullOrEmpty(txtPhoneNumber.Text.Trim())) { strSql += " and PhoneNumber like '%" + txtPhoneNumber.Text.Trim() + "%'"; } if (!(cbxGoodsTypeCode.SelectedValue == null)) { strSql += " and UntreadBaseBill.GoodsTypeCode = '" + cbxGoodsTypeCode.SelectedValue.ToString() + "'"; } if (!(cbxGoodsSeriesCode.SelectedValue == null)) { strSql += " and UntreadBaseBill.GoodsSeriesCode = '" + cbxGoodsSeriesCode.SelectedValue.ToString() + "'"; } if (dtpUntreadBillDate.Checked) { strSql += " and UntreadBillDate = '" + dtpUntreadBillDate.Value.Date + "'"; } if (chbIsGather.Visible) { if (chbIsGather.Checked) { strSql += " and UntreadBaseBill.UntreadBillNo not in(Select UntreadGatherBill.UntreadBillNo From UntreadGatherBill) "; //是否可以改进 } } if (chbIsRefund.Visible) { if (chbIsRefund.Checked) { strSql += " and UntreadBaseBill.UntreadBillNo not in(Select UntreadRefundBill.UntreadBillNo From UntreadRefundBill) "; //是否可以改进 } } strSql = rubb.UntreadBaseBillSql + strSql; } if (chbIsCDNo.Checked) //选中光盘号查询 { if (String.IsNullOrEmpty(txtCDNo.Text.Trim())) { MessageBox.Show("请输入光盘号!", "软件提示"); txtCDNo.Focus(); return; } strSql = rubb.UntreadBaseBill_CDNo_Sql + " and UntreadCDRecord.CDNo = '" + txtCDNo.Text.Trim() + "'"; } //设置DataTable主键,并为dgvRetailSaleOrderBill设置数据源 DataTable dt = rubb.GetDataTable(strSql); dt.PrimaryKey = new DataColumn[] { dt.Columns["UntreadBillNo"] }; dgvUntreadBaseBill.DataSource = dt; }
private void btnQuery_Click(object sender, EventArgs e) { RetailUntreadBaseBill rubb = new RetailUntreadBaseBill(); string strSql = null; if (!chbIsCDNo.Checked) //没有选中光盘号查询 { strSql = "Select UntreadBaseBill.* From UntreadBaseBill,Customer " + "Where UntreadBaseBill.CustomerId = Customer.CustomerId "; if (!String.IsNullOrEmpty(txtCustomerName.Text.Trim())) { strSql += " and CustomerName like '%" + txtCustomerName.Text.Trim() + "%'"; } if (!(cbxProvinceCode.SelectedValue == null)) { strSql += " and ProvinceCode = '" + cbxProvinceCode.SelectedValue.ToString() + "'"; } if (!String.IsNullOrEmpty(txtAddress.Text.Trim())) { strSql += " and Address like '%" + txtAddress.Text.Trim() + "%'"; } if (!String.IsNullOrEmpty(txtPhoneNumber.Text.Trim())) { strSql += " and PhoneNumber like '%" + txtPhoneNumber.Text.Trim() + "%'"; } if (!String.IsNullOrEmpty(txtUntreadBillNo.Text.Trim())) { strSql += " and UntreadBillNo like '%" + txtUntreadBillNo.Text.Trim() + "%'"; } if (!(cbxGoodsTypeCode.SelectedValue == null)) { strSql += " and GoodsTypeCode = '" + cbxGoodsTypeCode.SelectedValue.ToString() + "'"; } if (!(cbxGoodsSeriesCode.SelectedValue == null)) { strSql += " and GoodsSeriesCode = '" + cbxGoodsSeriesCode.SelectedValue.ToString() + "'"; } if (dtpUntreadBillDate.Checked) { strSql += " and UntreadBillDate = '" + dtpUntreadBillDate.Value.Date + "'"; } if (dtpAppendDate.Checked) { strSql += " and UntreadBaseBill.AppendDate = '" + dtpAppendDate.Value.Date + "'"; } } if (chbIsCDNo.Checked) //选中光盘号查询 { if (String.IsNullOrEmpty(txtCDNo.Text.Trim())) { MessageBox.Show("请输入光盘号!", "软件提示"); txtCDNo.Focus(); return; } strSql = "Select UntreadBaseBill.* From UntreadCDRecord, UntreadBaseBill,Customer " + "Where UntreadCDRecord.UntreadBillNo = UntreadBaseBill.UntreadBillNo and UntreadBaseBill.CustomerId = Customer.CustomerId "; } formRetailUntreadBaseBill.bsUntreadBaseBill.DataSource = rubb.GetDataTable(strSql); formRetailUntreadBaseBill.dgvUntreadBaseBill.DataSource = formRetailUntreadBaseBill.bsUntreadBaseBill; this.Close(); }
public void GetUntreadBillInfo(string strSaleBillNo) { string strSql = null; DataTable dt = null; strSql = "Select UntreadBaseBill.* From UntreadBaseBill Where SaleBillNo = '" + strSaleBillNo + "'"; dt = ubb.GetDataTable(strSql); if (dt.Rows.Count > 0) { if (this.Tag.ToString() == "Add") { useful.SetControlsState(groupBox1, false); txtSaleBillNo.ReadOnly = false; txtSaleBillNo.Enabled = true; btnSave.Enabled = false; } txtUnitPrice.Text = dt.Rows[0]["UnitPrice"].ToString(); txtQuantity.Text = dt.Rows[0]["Quantity"].ToString(); if (cbxBankCode.Visible) { cbxBankCode.SelectedValue = dt.Rows[0]["BankCode"]; //个人银行代码 } if (txtOpenAccBankName.Visible) { txtOpenAccBankName.Text = dt.Rows[0]["OpenAccBankName"].ToString(); //单位使用银行名称 } txtAccountNumber.Text = dt.Rows[0]["AccountNumber"].ToString(); txtRemark1.Text = dt.Rows[0]["Remark1"].ToString(); cbxEmployeeCode1.SelectedValue = dt.Rows[0]["EmployeeCode1"]; if (Convert.IsDBNull(dt.Rows[0]["SignDate1"])) { dtpSignDate1.Checked = false; } else { dtpSignDate1.Value = Convert.ToDateTime(dt.Rows[0]["SignDate1"]); } } else { txtUnitPrice.ReadOnly = false; txtUnitPrice.Enabled = true; // txtQuantity.ReadOnly = false; txtQuantity.Enabled = true; // txtOpenAccBankName.ReadOnly = false; txtOpenAccBankName.Enabled = true; // txtAccountNumber.ReadOnly = false; txtAccountNumber.Enabled = true; // cbxEmployeeCode1.Enabled = true; dtpSignDate1.Enabled = true; dtpUntreadBillDate.Enabled = true; cbxBankCode.Enabled = true; // txtRemark1.ReadOnly = false; txtRemark1.Enabled = true; // btnSave.Enabled = true; } }