private void FormBrowseRetailCustomer_Load(object sender, EventArgs e)
        {
            formRetailOperation = (FormRetailSaleOrderBill)this.Owner;
            ControlBindDataSource cbds = new ControlBindDataSource();

            cbds.ComboBoxBindDataSource(cbxProvinceCode, "ProvinceCode", "ProvinceName", "Select * From Province", "Province");
            cbds.DataGridViewComboBoxColumnBindDataSource(ProvinceCode, "ProvinceCode", "ProvinceName", "Select * From Province", "Province");
            cbds.DataGridViewComboBoxColumnBindDataSource(CustomerType, "CustomerType", "Remark", "Select * From SysCustomerType", "SysCustomerType");
            cbxProvinceCode.SelectedIndex = -1;
        }
        private void FormBrowseRetailSaleOrderBill_Load(object sender, EventArgs e)
        {
            if (this.Owner.GetType() == typeof(FormRetailSaleTradeBillInput))
            {
                formRetailSaleTradeBillInput = (FormRetailSaleTradeBillInput)this.Owner;
                chbIsTrade.Visible           = true;
                strJoinTag = "Inner";
            }
            if (this.Owner.GetType() == typeof(FormRetailSaleOrderBill))
            {
                lbSaleBillNo.Visible    = true;
                txtSaleBillNo.Visible   = true;
                formRetailSaleOrderBill = (FormRetailSaleOrderBill)this.Owner;
                strJoinTag = "Left";
                this.Text  = "用户和订单信息";
            }
            if (this.Owner.GetType() == typeof(FormRetailSaleConsignBillInput))
            {
                chbConsign.Visible             = true;
                formRetailSaleConsignBillInput = (FormRetailSaleConsignBillInput)this.Owner;
                strJoinTag = "Inner";
            }
            if (this.Owner.GetType() == typeof(FormRetailUntreadBaseBillInput))
            {
                txtSaleBillNo.Visible          = true;
                lbSaleBillNo.Visible           = true;
                formRetailUntreadBaseBillInput = (FormRetailUntreadBaseBillInput)this.Owner;
                strJoinTag = "Inner";
            }
            if (this.Owner.GetType() == typeof(FormRetailBarterBaseBillInput))
            {
                formRetailBarterBaseBillInput = (FormRetailBarterBaseBillInput)this.Owner;
                strJoinTag = "Left";
                this.Text  = "用户和订单信息";
            }


            ControlBindDataSource cbds = new ControlBindDataSource();

            cbds.ComboBoxBindDataSource(cbxProvinceCode, "ProvinceCode", "ProvinceName", "Select * From Province", "Province");
            cbds.DataGridViewComboBoxColumnBindDataSource(GoodsTypeCode, "GoodsTypeCode", "GoodsTypeName", "Select * From GoodsType", "GoodsType");
            cbds.DataGridViewComboBoxColumnBindDataSource(GoodsSeriesCode, "GoodsSeriesCode", "GoodsSeriesName", "Select * From GoodsSeries", "GoodsSeries");
            cbds.DataGridViewComboBoxColumnBindDataSource(EmployeeCode, "EmployeeCode", "EmployeeName", "Select * From Employee", "Employee");
            cbxProvinceCode.SelectedIndex = -1;
        }
        private void FormRetailSaleOrderBillInput_Load(object sender, EventArgs e)
        {
            ControlBindDataSource cbds = new ControlBindDataSource();

            cbds.ComboBoxBindDataSource(cbxGoodsTypeCode, "GoodsTypeCode", "GoodsTypeName", "Select * From GoodsType", "GoodsType");
            cbds.ComboBoxBindDataSource(cbxGoodsSeriesCode, "GoodsSeriesCode", "GoodsSeriesName", "Select * From GoodsSeries", "GoodsSeries");
            cbds.ComboBoxBindDataSource(cbxEmployeeCode, "EmployeeCode", "EmployeeName", "Select * From Employee", "Employee");
            formRetailSaleOrderBill = (FormRetailSaleOrderBill)this.Owner;
            if (formRetailSaleOrderBill.chbIsAgent.Checked)
            {
                txtCustomerName.Text = formRetailSaleOrderBill.cbxCustomerId.Text;
            }
            else
            {
                txtCustomerName.Text = formRetailSaleOrderBill.txtCustomerName.Text;
            }
            txtPhoneNumber.Text = formRetailSaleOrderBill.txtPhoneNumber.Text;
            txtPostalCode.Text  = formRetailSaleOrderBill.txtPostalCode.Text;
            txtAddress.Text     = formRetailSaleOrderBill.txtAddress.Text;
            if (this.Tag.ToString() == "Add")
            {
                dtpBillDate.Value = GlobalProperty.DBTime;
                dtpSignDate.Value = GlobalProperty.DBTime;
                cbxGoodsTypeCode.SelectedIndex   = -1;
                cbxGoodsSeriesCode.SelectedIndex = -1;
                cbxEmployeeCode.SelectedIndex    = -1;
                txtDiscount.Text   = "1"; //若是代理商的话,默认值为代理的折扣系数。
                txtSaleBillNo.Text = useful.BuildCode("SaleOrderBill", "Where OperatorCode = '" + GlobalProperty.OperatorCode + "'", "SaleBillNo", "XS" + GlobalProperty.DBTime.Year.ToString(), 7);
            }
            if (this.Tag.ToString() == "Edit")
            {
                if (GlobalProperty.OperatorCode != formRetailSaleOrderBill.dgvSaleOrderBill.CurrentRow.Cells["OperatorCode"].Value.ToString())
                {
                    btnSave.Enabled = false; //非本人录入的记录,不允许修改。
                }
                //chbIsAmendBillNo.Enabled = false;
                txtSaleBillNo.Text               = formRetailSaleOrderBill.dgvSaleOrderBill.CurrentRow.Cells["SaleBillNo"].Value.ToString();
                dtpBillDate.Value                = Convert.ToDateTime(formRetailSaleOrderBill.dgvSaleOrderBill.CurrentRow.Cells["BillDate"].Value);
                cbxGoodsTypeCode.SelectedValue   = formRetailSaleOrderBill.dgvSaleOrderBill.CurrentRow.Cells["GoodsTypeCode"].Value;
                cbxGoodsSeriesCode.SelectedValue = formRetailSaleOrderBill.dgvSaleOrderBill.CurrentRow.Cells["GoodsSeriesCode"].Value;
                txtUnitPrice.Text                = formRetailSaleOrderBill.dgvSaleOrderBill.CurrentRow.Cells["UnitPrice"].Value.ToString();
                txtDiscount.Text = formRetailSaleOrderBill.dgvSaleOrderBill.CurrentRow.Cells["Discount"].Value.ToString();
                txtQuantity.Text = formRetailSaleOrderBill.dgvSaleOrderBill.CurrentRow.Cells["Quantity"].Value.ToString();
                if (formRetailSaleOrderBill.dgvSaleOrderBill.CurrentRow.Cells["IsNeedInvoice"].Value.ToString() == "1")  //需要发票
                {
                    rbIsNeedInvoice1.Checked = true;
                    if (formRetailSaleOrderBill.dgvSaleOrderBill.CurrentRow.Cells["WriteOffType"].Value.ToString() == "1")  //个人
                    {
                        chbWriteOffType1.Checked   = true;
                        txtWriteOffName1.Text      = formRetailSaleOrderBill.dgvSaleOrderBill.CurrentRow.Cells["WriteOffName"].Value.ToString();
                        txtCertificateNumber1.Text = formRetailSaleOrderBill.dgvSaleOrderBill.CurrentRow.Cells["CertificateNumber"].Value.ToString();
                    }
                    else  //单位
                    {
                        chbWriteOffType2.Checked   = true;
                        txtWriteOffName2.Text      = formRetailSaleOrderBill.dgvSaleOrderBill.CurrentRow.Cells["WriteOffName"].Value.ToString();
                        txtCertificateNumber2.Text = formRetailSaleOrderBill.dgvSaleOrderBill.CurrentRow.Cells["CertificateNumber"].Value.ToString();
                    }
                }
                else  //不需要发票
                {
                    rbIsNeedInvoice0.Checked = true;
                }
                cbxEmployeeCode.SelectedValue = formRetailSaleOrderBill.dgvSaleOrderBill.CurrentRow.Cells["EmployeeCode"].Value;

                if (formRetailSaleOrderBill.dgvSaleOrderBill.CurrentRow.Cells["SignDate"].Value == DBNull.Value)
                {
                    dtpSignDate.Checked = false;
                }
                else
                {
                    dtpSignDate.Value = Convert.ToDateTime(formRetailSaleOrderBill.dgvSaleOrderBill.CurrentRow.Cells["SignDate"].Value);
                }
                txtRemark.Text = formRetailSaleOrderBill.dgvSaleOrderBill.CurrentRow.Cells["Remark"].Value.ToString();
            }
        }