Esempio n. 1
0
        protected void BindData()
        {
            Model.Sale       ml_sa = bll_sale.GetModel(Convert.ToInt32(Request.QueryString["Sale_ID"]));
            Model.StoreHouse ml_sh = new BLL.StoreHouse().GetModel(Convert.ToInt32(ml_sa.StoreHouse_ID));
            Model.Customer   ml_cu = new BLL.Customer().GetModel(Convert.ToInt32(ml_sa.Customer));
            DataSet          ds    = new BLL.Sale_Detail().GetDetailAll(Convert.ToInt32(Request.QueryString["Sale_ID"]));

            this.GridView1.DataSource = ds;
            this.GridView1.DataBind();
            decimal AllTot = 0;

            foreach (GridViewRow gvr in GridView1.Rows)
            {
                decimal price  = Convert.ToDecimal(gvr.Cells[5].Text);
                decimal qty    = Convert.ToDecimal(gvr.Cells[4].Text);
                decimal RowTot = price * qty;
                gvr.Cells[6].Text = Math.Round(RowTot, 3).ToString();
                AllTot           += RowTot;
            }
            this.Label1.Text = Math.Round(AllTot, 3).ToString();
            this.Label2.Text = Maticsoft.Common.Rmb.CmycurD(AllTot);
            string OldId    = "";
            string OldPrice = "";
            string OldQty   = "";

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                OldId    += ds.Tables[0].Rows[i]["Product_ID"] + "|";
                OldPrice += ds.Tables[0].Rows[i]["Price"] + "|";
                OldQty   += ds.Tables[0].Rows[i]["Quantity"] + "|";
            }
            this.oldId.Value    = OldId.ToString();
            this.oldPrice.Value = OldPrice.ToString();
            this.oldQty.Value   = OldQty.ToString();
            this.newId.Value    = OldId.ToString();
            this.newPrice.Value = OldPrice.ToString();
            this.newQty.Value   = OldQty.ToString();

            this.DropDownList1.SelectedValue = ml_sa.StoreHouse_ID.ToString();
            this.DropDownList2.SelectedValue = ml_sa.Dept_ID.ToString();
            this.DropDownList5.SelectedValue = ml_sa.Customer.ToString();
            this.DropDownList4.Text          = ml_sa.Account;
            this.DropDownList6.Text          = ml_sa.GatheringWay;
            this.TextBox1.Text = ml_sa.Address;
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params["Sale_ID"] != null && Request.Params["Sale_ID"].Trim() != "")
            {
                Model.Sale ml_sa = new BLL.Sale().GetModel(Convert.ToInt32(Request.Params["Sale_ID"]));
                this.Label10.Text = ml_sa.SaleDate.ToString("yyyy-M-d H:mm:ss");
                this.Label11.Text = ml_sa.TradeNo.ToString();
                Model.StoreHouse ml_sh = new BLL.StoreHouse().GetModel(Convert.ToInt32(ml_sa.StoreHouse_ID));
                this.Label12.Text = ml_sh.Address;

                this.Label13.Text = "100";
                this.Label14.Text = ml_sa.GatheringWay;
                this.Label15.Text = ml_sa.Account;
                this.Label16.Text = "";
                this.Label17.Text = ml_sa.Address;
                Model.Customer ml_cu = new BLL.Customer().GetModel(Convert.ToInt32(ml_sa.Customer));
                this.Label18.Text = ml_cu.Name;
                this.Label19.Text = new BLL.Employee().GetModel(ml_sa.Employee_ID).Name;
                //Label1.Text = Request.Params["Sale_ID"].Trim();
                DataSet ds = new BLL.Sale_Detail().GetDetailAll(Convert.ToInt32(Request.Params["Sale_ID"]));
                Repeater1.DataSource = ds;
                Repeater1.DataBind();
            }
            decimal TotalPrice = 0;

            foreach (RepeaterItem item in Repeater1.Items)
            {
                Label LB1 = (Label)item.FindControl("Label5"); //单价
                Label LB2 = (Label)item.FindControl("Label4"); //数量
                Label LB3 = (Label)item.FindControl("Label6"); //合计
                LB3.Text    = Math.Round((Convert.ToDecimal(LB1.Text) * Convert.ToDecimal(LB2.Text)), 3).ToString();
                TotalPrice += Convert.ToDecimal(LB3.Text);
            }
            this.TotalPrice.Text = Math.Round((Convert.ToDecimal(TotalPrice)), 3).ToString();
            Label9.Text          = Maticsoft.Common.Rmb.CmycurD(TotalPrice);
        }