Ejemplo n.º 1
0
        private void ShowData()
        {
            CAI_OrderChecksService   checksSer = new CAI_OrderChecksService();
            List <CAI_OrderChecks>   allChecks = checksSer.GetListArrayPOOrderChecks_Cai_POOrderInHouse_ListView(string.Format(" 1=1 and ProNo='{0}' and PONo='{1}' and SupplierName='{2}'", txtChcekProNo.Text, txtPONo.Text, txtSupplier.Text));
            List <CAI_OrderInHouses> POOrders  = new List <CAI_OrderInHouses>();// Session["Orders"] as List<CAI_OrderInHouses>;

            foreach (var model in allChecks)
            {
                CAI_OrderInHouses houseModel = new CAI_OrderInHouses();
                houseModel.Good_Model     = model.Good_Model;
                houseModel.GoodName       = model.GoodName;
                houseModel.GoodNo         = model.GoodNo;
                houseModel.GoodNum        = model.CheckNum;
                houseModel.GoodPrice      = model.CheckPrice;
                houseModel.GoodSpec       = model.GoodSpec;
                houseModel.GoodTypeSmName = model.GoodTypeSmName;
                houseModel.GoodUnit       = model.GoodUnit;
                houseModel.GooId          = model.CheckGoodId;
                houseModel.Total          = model.Total;
                houseModel.OrderCheckIds  = model.Ids;
                houseModel.QingGouPer     = model.QingGou;
                POOrders.Add(houseModel);
            }
            Session["Orders"] = POOrders;
            gvList.DataSource = POOrders;
            gvList.DataBind();
        }
Ejemplo n.º 2
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='';");

                CAI_OrderInHouses model = e.Row.DataItem as CAI_OrderInHouses;
                SumOrders.GoodNum += model.GoodNum;
                SumOrders.Total   += model.Total;
            }
            ImageButton btnEdit = e.Row.FindControl("btnEdit") as ImageButton;

            if (btnEdit != null)
            {
                string val = string.Format("javascript:window.showModalDialog('CG_Orders.aspx?index={0}',null,'dialogWidth:500px;dialogHeight:450px;help:no;status:no')", e.Row.DataItemIndex);
                btnEdit.Attributes.Add("onclick", val);
            }


            // 合计
            if (e.Row.RowType == DataControlRowType.Footer)
            {
                setValue(e.Row.FindControl("lblGoodName") as Label, "合计");                    //合计
                setValue(e.Row.FindControl("lblNum") as Label, SumOrders.GoodNum.ToString()); //数量
                setValue(e.Row.FindControl("lblTotal") as Label, SumOrders.Total.ToString()); //成本总额
            }
        }
Ejemplo n.º 3
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='';");

                CAI_OrderInHouses model = e.Row.DataItem as CAI_OrderInHouses;

                SumOrders.Total += model.Total;


                if (CAIInfo_HanShui.ContainsKey(model.Ids))
                {
                    bool hanShui = CAIInfo_HanShui[model.Ids];
                    System.Web.UI.WebControls.Label lblIsHanShui = e.Row.FindControl("lblIsHanShui") as System.Web.UI.WebControls.Label;
                    if (lblIsHanShui != null)
                    {
                        lblIsHanShui.Text = hanShui ? "含税" : "不含税";
                    }
                    if (hanShui == false)
                    {
                        e.Row.BackColor = System.Drawing.Color.LightGray;
                    }
                }
            }



            // 合计
            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()); //成本总额
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取所有入库尚未退货的子信息集合
        /// </summary>
        public List <VAN_OA.Model.JXC.CAI_OrderInHouses> GetListArrayCai_POOrderInHouse_Cai_POOrderOutHouse_ListView(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select   ");
            strSql.Append(" Ids,id,GooId,GoodNum,GoodPrice,GoodRemark,GoodNo,GoodName,GoodSpec,GoodModel,GoodUnit,GoodTypeSmName,OrderCheckIds,totalOrderNum,QingGouPer");
            strSql.Append(" from Cai_POOrderInHouse_Cai_POOrderOutHouse_ListView");


            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List <VAN_OA.Model.JXC.CAI_OrderInHouses> list = new List <VAN_OA.Model.JXC.CAI_OrderInHouses>();

            using (SqlConnection conn = DBHelp.getConn())
            {
                conn.Open();
                SqlCommand objCommand = new SqlCommand(strSql.ToString(), conn);
                using (SqlDataReader dataReader = objCommand.ExecuteReader())
                {
                    while (dataReader.Read())
                    {
                        CAI_OrderInHouses model = ReaderBind(dataReader);
                        object            ojb;
                        ojb = dataReader["totalOrderNum"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.GoodNum = model.GoodNum - Convert.ToDecimal(ojb);
                        }
                        list.Add(model);
                    }
                }
            }
            return(list);
        }
Ejemplo n.º 5
0
        public bool updateTran(VAN_OA.Model.JXC.CAI_OrderCheck model, VAN_OA.Model.EFrom.tb_EForm eform, tb_EForms forms, List <CAI_OrderChecks> orders, string IDS)
        {
            using (SqlConnection conn = DBHelp.getConn())
            {
                conn.Open();
                SqlTransaction tan        = conn.BeginTransaction();
                SqlCommand     objCommand = conn.CreateCommand();
                objCommand.Transaction = tan;

                CG_POOrdersService OrdersSer = new CG_POOrdersService();
                CG_POCaiService    CaiSer    = new CG_POCaiService();
                try
                {
                    objCommand.Parameters.Clear();

                    model.Status = eform.state;
                    Update(model, objCommand);
                    tb_EFormService eformSer = new tb_EFormService();
                    eformSer.Update(eform, objCommand);
                    tb_EFormsService eformsSer = new tb_EFormsService();
                    eformsSer.Add(forms, objCommand);

                    CAI_OrderChecksService myOrderChecks = new CAI_OrderChecksService();
                    for (int i = 0; i < orders.Count; i++)
                    {
                        // orders[i].CheckId = model.Id;
                        //if (orders[i].IfUpdate == true && orders[i].Ids != 0)
                        //{

                        myOrderChecks.Update(orders[i], objCommand);

                        //}
                        //else if (orders[i].Ids == 0)
                        //{
                        //    OrdersSer.Add(orders[i], objCommand);

                        //}
                    }

                    //入库
                    if (eform.state == "通过")
                    {
                        tb_EForm eformMain = new tb_EForm();
                        int      proId     = 0;
                        string   sql       = "select Pro_Id from A_ProInfo where pro_Type='采购入库'";
                        objCommand.CommandText = sql;

                        proId = Convert.ToInt32(objCommand.ExecuteScalar());

                        eformMain.appPer     = eform.appPer;
                        eformMain.appTime    = DateTime.Now;
                        eformMain.createPer  = eform.appPer;
                        eformMain.createTime = DateTime.Now;
                        eformMain.proId      = proId;
                        eformMain.state      = "通过";
                        eformMain.toPer      = 0;
                        eformMain.toProsId   = 0;

                        CAI_OrderInHouseService orderInHouse = new CAI_OrderInHouseService();
                        sql = "select top 1 id from TB_HouseInfo where ifdefault=1 ";
                        objCommand.CommandText = sql;
                        int objhouseId = Convert.ToInt32(objCommand.ExecuteScalar());
                        CAI_OrderInHouse orderInModel = new CAI_OrderInHouse()
                        {
                            ChcekProNo   = model.ProNo,
                            CreateTime   = DateTime.Now,
                            CreateUserId = eform.appPer,
                            GuestName    = orders[0].GuestName,
                            HouseID      = objhouseId,
                            POName       = orders[0].POName,
                            PONo         = orders[0].PONo,
                            RuTime       = DateTime.Now,
                            Status       = "通过",
                            Supplier     = orders[0].SupplierName,
                            DoPer        = orders[0].CaiGouPer,
                            DaiLi        = orders[0].CaiGouPer,
                            FPNo         = "",
                            Remark       = ""
                        };
                        List <CAI_OrderInHouses> ordersInHouses = new List <CAI_OrderInHouses>();
                        foreach (var m in orders)
                        {
                            CAI_OrderInHouses orderM = new CAI_OrderInHouses()
                            {
                                GooId            = m.CheckGoodId,
                                GoodNum          = m.CheckNum,
                                GoodPrice        = m.CheckPrice,
                                OrderCheckIds    = m.Ids,
                                QingGouPer       = m.QingGou,
                                CaiLastTruePrice = m.CheckLastTruePrice
                            };
                            ordersInHouses.Add(orderM);
                        }

                        orderInHouse.addTran(orderInModel, eformMain, ordersInHouses, objCommand);
                    }
                    tan.Commit();
                }
                catch (Exception)
                {
                    tan.Rollback();
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 6
0
        public int addTran(VAN_OA.Model.JXC.CAI_OrderCheck model, VAN_OA.Model.EFrom.tb_EForm eform, List <CAI_OrderChecks> orders, out int MainId, List <string> ids = null)
        {
            int id = 0;

            MainId = 0;
            using (SqlConnection conn = DBHelp.getConn())
            {
                conn.Open();
                SqlTransaction tan        = conn.BeginTransaction();
                SqlCommand     objCommand = conn.CreateCommand();
                objCommand.Transaction = tan;
                CAI_OrderChecksService OrdersSer = new CAI_OrderChecksService();


                try
                {
                    objCommand.Parameters.Clear();
                    tb_EFormService eformSer = new tb_EFormService();
                    string          proNo    = eformSer.GetAllE_No("CAI_OrderCheck", objCommand);
                    model.ProNo = proNo;
                    eform.E_No  = proNo;

                    model.Status = eform.state;
                    id           = Add(model, objCommand);
                    model.Id     = id;
                    MainId       = id;

                    eform.allE_id = id;
                    eformSer.Add(eform, objCommand);
                    for (int i = 0; i < orders.Count; i++)
                    {
                        orders[i].CheckId = id;
                        orders[i].Ids     = OrdersSer.Add(orders[i], objCommand);
                    }

                    //入库
                    if (eform.state == "通过")
                    {
                        tb_EForm eformMain = new tb_EForm();
                        int      proId     = 0;
                        string   sql       = "select Pro_Id from A_ProInfo where pro_Type='采购入库'";
                        objCommand.CommandText = sql;

                        proId = Convert.ToInt32(objCommand.ExecuteScalar());

                        eformMain.appPer     = eform.appPer;
                        eformMain.appTime    = DateTime.Now.AddSeconds(1);
                        eformMain.createPer  = eform.appPer;
                        eformMain.createTime = DateTime.Now.AddSeconds(1);
                        eformMain.proId      = proId;
                        eformMain.state      = "通过";
                        eformMain.toPer      = 0;
                        eformMain.toProsId   = 0;
                        eform.E_LastTime     = DateTime.Now.AddSeconds(1);
                        CAI_OrderInHouseService orderInHouse = new CAI_OrderInHouseService();
                        sql = "select top 1 id from TB_HouseInfo where ifdefault=1 ";
                        objCommand.CommandText = sql;
                        int objhouseId = Convert.ToInt32(objCommand.ExecuteScalar());
                        CAI_OrderInHouse orderInModel = new CAI_OrderInHouse()
                        {
                            ChcekProNo   = model.ProNo,
                            CreateTime   = DateTime.Now.AddSeconds(1),
                            CreateUserId = eform.appPer,
                            GuestName    = orders[0].GuestName,
                            HouseID      = objhouseId,
                            POName       = orders[0].POName,
                            PONo         = orders[0].PONo,
                            RuTime       = DateTime.Now.AddSeconds(1),
                            Status       = "通过",
                            Supplier     = orders[0].SupplierName,
                            DoPer        = orders[0].CaiGouPer,
                            DaiLi        = orders[0].CaiGouPer,
                            FPNo         = "",
                            Remark       = ""
                        };
                        List <CAI_OrderInHouses> ordersInHouses = new List <CAI_OrderInHouses>();
                        foreach (var m in orders)
                        {
                            CAI_OrderInHouses orderM = new CAI_OrderInHouses()
                            {
                                GooId            = m.CheckGoodId,
                                GoodNum          = m.CheckNum,
                                GoodPrice        = m.CheckPrice,
                                OrderCheckIds    = m.Ids,
                                QingGouPer       = m.QingGou,
                                CaiLastTruePrice = m.CheckLastTruePrice
                            };
                            ordersInHouses.Add(orderM);
                        }
                        orderInHouse.addTran(orderInModel, eformMain, ordersInHouses, objCommand);
                        if (ids != null)
                        {
                            foreach (var ordersIn in ordersInHouses)
                            {
                                ids.Add(ordersIn.Ids.ToString());
                            }
                        }
                    }

                    tan.Commit();
                }
                catch (Exception)
                {
                    tan.Rollback();
                    return(0);
                }
                return(id);
            }
        }