Beispiel #1
0
        public void GetUntreadGatherBillInfo(string strUntreadBillNo)
        {
            string    strSql = null;
            DataTable dt     = null;

            strSql = "Select UntreadGatherBill.* From UntreadGatherBill Where UntreadBillNo = '" + strUntreadBillNo + "'";
            dt     = rugb.GetDataTable(strSql);
            if (dt.Rows.Count > 0)
            {
                if (this.Tag.ToString() == "Add")
                {
                    useful.SetControlsState(groupBox3, false);
                    btnSave.Enabled = false;
                }
                if (dt.Rows[0]["IsComplete"].ToString() == "0")
                {
                    rbIsComplete0.Checked = true;
                }
                else
                {
                    rbIsComplete1.Checked = true;
                }
                if (dt.Rows[0]["IsReturnInvoice"].ToString() == "0")
                {
                    rbIsReturnInvoice0.Checked = true;
                }
                else
                {
                    rbIsReturnInvoice1.Checked = true;
                }
                if (dt.Rows[0]["IsShatter"].ToString() == "0")
                {
                    rbIsShatter0.Checked = true;
                }
                else
                {
                    rbIsShatter1.Checked = true;
                }
                txtRemark2.Text = dt.Rows[0]["Remark2"].ToString();
                cbxEmployeeCode2.SelectedValue = dt.Rows[0]["EmployeeCode2"];
                dtpSignDate2.Value             = Convert.ToDateTime(dt.Rows[0]["SignDate2"]);
            }
            else
            {
                useful.SetControlsState(groupBox3, true);
                btnSave.Enabled = true;
            }
        }
        private void btnQuery_Click(object sender, EventArgs e)
        {
            RetailUntreadGatherBill rugb = new RetailUntreadGatherBill();
            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 (!String.IsNullOrEmpty(txtUntreadBillNo.Text.Trim()))
                {
                    strSql += " and UntreadGatherBill.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 (dtpSignDate2.Checked)
                {
                    strSql += " and UntreadGatherBill.SignDate2 = '" + dtpSignDate2.Value.Date + "'";
                }
                if (dtpAppendDate.Checked)
                {
                    strSql += " and UntreadGatherBill.AppendDate = '" + dtpAppendDate.Value.Date + "'";
                }
                strSql = rugb.UntreadGatherBillSql + strSql;
            }
            if (chbIsCDNo.Checked) //选中光盘号查询
            {
                if (String.IsNullOrEmpty(txtCDNo.Text.Trim()))
                {
                    MessageBox.Show("请输入光盘号!", "软件提示");
                    txtCDNo.Focus();
                    return;
                }
                strSql = rugb.UntreadGatherBill_CDNo_Sql + " and UntreadCDRecord.CDNo = '" + txtCDNo.Text.Trim() + "'";
            }
            formRetailUntreadGatherBill.bsUntreadGatherBill.DataSource  = rugb.GetDataTable(strSql);
            formRetailUntreadGatherBill.dgvUntreadGatherBill.DataSource = formRetailUntreadGatherBill.bsUntreadGatherBill;
            this.Close();
        }