protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["ElectronicInvoice"] != null)
                {
                    var model = Session["ElectronicInvoice"] as ElectronicInvoice;
                    txtCompanyName.Text      = model.Company;
                    txtRightCompanyName.Text = model.Company;

                    txtSupplierName.Text        = model.SupplierName;
                    txtRightSupplierName.Text   = model.SupplierName;
                    txtSupplierCardNo.Text      = model.SupplierBrandNo;
                    txtRightSupplierCardNo.Text = model.SupplierBrandNo;
                    txtBrandName.Text           = model.SupplierBrandName;
                    txtRightBrandName.Text      = model.SupplierBrandName;
                    txtNum.Text     = "¥" + model.ActPay.ToString("f2").Replace(".", "");
                    txtDaTotal.Text = RMBCapitalization.RMBAmount(Convert.ToDouble(model.ActPay));
                    txtUse.Text     = model.ProNo;
                    txtTotal.Text   = "¥" + string.Format("{0:n2}", model.ActPay);

                    TB_CompanyService companySer = new TB_CompanyService();
                    var companyModel             = companySer.GetListArray(string.Format(" ComName='{0}'", model.Company))[0];
                    txtCardNo.Text             = companyModel.KaHao;
                    txtRightCompanyCardNo.Text = companyModel.KaHao;

                    TB_SupplierInfoService supplierSer = new TB_SupplierInfoService();
                    var list = supplierSer.GetListArray(string.Format(" SupplierName='{0}'", model.SupplierName));
                    if (list.Count > 0)
                    {
                        var supplierModel = list[0];
                        txtBrandAddress.Text = (string.IsNullOrEmpty(supplierModel.Province) ? "        " : supplierModel.Province)
                                               + "  " + supplierModel.City;
                        txtRightBrandAddress.Text = (string.IsNullOrEmpty(supplierModel.Province) ? "        " : supplierModel.Province)
                                                    + "  " + supplierModel.City;
                    }
                    else
                    {
                        txtBrandAddress.Text      = "";
                        txtRightBrandAddress.Text = "";
                    }

                    if (!string.IsNullOrEmpty(model.Person))
                    {
                        var person = new Invoice_PersonService().GetListArray(string.Format(" name='{0}'", model.Person))[0];
                        txtId.Text         = person.CardNo;
                        txtRightPhone.Text = person.Phone;
                        txtPhone.Text      = person.Phone;
                    }
                }
            }
        }
Example #2
0
        protected void txtSupplierName_TextChanged(object sender, EventArgs e)
        {
            if (txtSupplierName.Text != "")
            {
                TB_SupplierInfoService supplierSer = new TB_SupplierInfoService();

                var supplierList = supplierSer.GetListArray(string.Format(" SupplierName='{0}' and Status='通过'  and IsUse=1 ", txtSupplierName.Text));
                if (supplierList.Count > 0)
                {
                    
                    var supplierModel = supplierList[0];
                    txtBandName.Text = supplierModel.SupplierBrandName;
                    txtBrandNo.Text = supplierModel.SupplierBrandNo;
                    txtCity.Text = supplierModel.City;
                    txtProvice.Text = supplierModel.Province;
                    hfSimpName.Value = supplierModel.SupplieSimpeName;
                    if (supplierModel.City.Contains("苏州") || supplierModel.City.Contains("太仓") || supplierModel.City.Contains("相城")
                   || supplierModel.City.Contains("吴中") || supplierModel.City.Contains("张家港")
                   || supplierModel.City.Contains("常熟") || supplierModel.City.Contains("昆山"))
                    {
                        foreach (ListItem item in dllBillType.Items)
                        {
                            if (item.Text == "支票")
                            {
                                dllBillType.Text = item.Value;
                                break;
                            }
                        }

                    }
                    else
                    {
                        foreach (ListItem item in dllBillType.Items)
                        {
                            if (item.Text == "银行申请单")
                            {
                                dllBillType.Text = item.Value;
                                break;
                            }
                        }
                    }
                }
                
              
            }
        }