Esempio n. 1
0
        protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#EAF1FD',this.style.fontWeight='';");
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor,this.style.fontWeight='';");

                Sell_OrderOutHouses model = e.Row.DataItem as Sell_OrderOutHouses;

                SumOrders.Total += model.Total;
                SumOrders.GoodSellPriceTotal += model.GoodSellPriceTotal;
            }



            // 合计
            if (e.Row.RowType == DataControlRowType.Footer)
            {
                setValue(e.Row.FindControl("lblGoodName") as System.Web.UI.WebControls.Label, "合计");                                  //合计
                setValue(e.Row.FindControl("lblTotal") as System.Web.UI.WebControls.Label, SumOrders.Total.ToString());               //成本总额
                setValue(e.Row.FindControl("lblTotal1") as System.Web.UI.WebControls.Label, SumOrders.GoodSellPriceTotal.ToString()); //成本总额
                lblTotal.Text      = SumOrders.Total.ToString();
                lblPriceTotal.Text = SumOrders.GoodSellPriceTotal.ToString();
            }
        }
Esempio n. 2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            List <Sell_OrderOutHouses> selectedList = Session["DioSellWFHouseGoods"] as List <Sell_OrderOutHouses>;

            if (selectedList == null)
            {
                selectedList = new List <Sell_OrderOutHouses>();
            }

            for (int i = 0; i < this.gvList.Rows.Count; i++)
            {
                CheckBox cb = (gvList.Rows[i].FindControl("chkSelect")) as CheckBox;
                if (cb.Checked)
                {
                    Sell_OrderOutHouses model = new Sell_OrderOutHouses();


                    Label lblGoodName = (gvList.Rows[i].FindControl("lblGoodName")) as Label;

                    if (lblGoodName != null)
                    {
                        model.GoodName = lblGoodName.Text;
                    }
                    Label GoodAreaNumber = (gvList.Rows[i].FindControl("GoodAreaNumber")) as Label;

                    if (GoodAreaNumber != null)
                    {
                        model.GoodAreaNumber = GoodAreaNumber.Text;
                    }


                    Label GoodTypeSmName = (gvList.Rows[i].FindControl("GoodTypeSmName")) as Label;

                    if (GoodTypeSmName != null)
                    {
                        model.GoodTypeSmName = GoodTypeSmName.Text;
                    }


                    Label GoodSpec = (gvList.Rows[i].FindControl("GoodSpec")) as Label;

                    if (GoodSpec != null)
                    {
                        model.GoodSpec = GoodSpec.Text;
                    }


                    Label Good_Model = (gvList.Rows[i].FindControl("Good_Model")) as Label;

                    if (Good_Model != null)
                    {
                        model.Good_Model = Good_Model.Text;
                    }

                    Label GoodUnit = (gvList.Rows[i].FindControl("GoodUnit")) as Label;

                    if (lblGoodName != null)
                    {
                        model.GoodUnit = GoodUnit.Text;
                    }



                    Label lblCheckPrice = (gvList.Rows[i].FindControl("lblCheckPrice")) as Label;

                    if (lblCheckPrice != null)
                    {
                        model.GoodPrice = Convert.ToDecimal(lblCheckPrice.Text);
                    }

                    Label GoodId = (gvList.Rows[i].FindControl("GoodId")) as Label;

                    if (GoodId != null)
                    {
                        model.GooId = Convert.ToInt32(GoodId.Text);
                    }


                    Label HouseId = (gvList.Rows[i].FindControl("HouseId")) as Label;

                    if (HouseId != null)
                    {
                        model.HouseID = Convert.ToInt32(HouseId.Text);
                    }

                    Label HouseName = (gvList.Rows[i].FindControl("HouseName")) as Label;

                    if (HouseName != null)
                    {
                        model.HouseName = HouseName.Text;
                    }

                    Label GoodNo = (gvList.Rows[i].FindControl("GoodNo")) as Label;

                    if (HouseName != null)
                    {
                        model.GoodNo = GoodNo.Text;
                    }

                    Label lblLastNum = (gvList.Rows[i].FindControl("lblLastNum")) as Label;

                    if (lblLastNum != null)
                    {
                        model.GoodNum     = Convert.ToDecimal(lblLastNum.Text);
                        model.Total       = model.GoodNum * model.GoodPrice;
                        model.LastSellNum = model.GoodNum;
                    }

                    Label lblCaiNum = (gvList.Rows[i].FindControl("lblCaiNum")) as Label;

                    if (lblCaiNum != null)
                    {
                        model.LastCaiNum = Convert.ToDecimal(lblCaiNum.Text);
                    }
                    #region MyRegion
                    Label lblPOGoodPrice = (gvList.Rows[i].FindControl("lblPOGoodPrice")) as Label;

                    if (lblPOGoodPrice != null)
                    {
                        model.GoodSellPrice    = Convert.ToDecimal(lblPOGoodPrice.Text);
                        model.GoodOriSellPrice = model.GoodSellPrice;
                    }
                    Label lblPONum = (gvList.Rows[i].FindControl("lblPONum")) as Label;

                    if (lblPONum != null)
                    {
                        var pONum = Convert.ToDecimal(lblPONum.Text);
                        model.PONum       = pONum;
                        model.POGoodTotal = pONum * model.GoodSellPrice;
                        if (pONum < model.LastSellNum)
                        {
                            model.GoodNum = pONum;
                        }
                        model.GoodSellPriceTotal = model.GoodSellPrice * model.GoodNum;
                    }
                    #endregion

                    selectedList.Add(model);
                }
            }

            Session["DioSellWFHouseGoods"] = selectedList;
            gvSelectedWares.DataSource     = selectedList;
            gvSelectedWares.DataBind();
        }