Exemplo n.º 1
0
        protected void gvAdvancePayment_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='';");
                SupplierToInvoiceView model = e.Row.DataItem as SupplierToInvoiceView;
                if (model != null)
                {
                    YuTotal          += model.LastTotal;
                    Yu_ResultTotal   += model.ResultTotal;
                    Yu_ShengYuZhiJia += model.ShengYuZhiJia;

                    //(采购数量)*采购单价-之前所有支付单金额<=0
                    if (model.IfRuKu || (model.LastTotal - model.SupplierInvoiceTotal) <= 0)
                    {
                        CheckBox cb = (e.Row.FindControl("chkSelect")) as CheckBox;
                        cb.Visible = false;
                    }
                    else
                    {
                        if (ViewState["idsAdvancePayment"] != null && ViewState["idsAdvancePayment"].ToString().Contains("," + model.Ids + ","))
                        {
                            CheckBox cb = (e.Row.FindControl("chkSelect")) as CheckBox;
                            cb.Checked = true;
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 protected void gvMain_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='';");
         SupplierToInvoiceView model = e.Row.DataItem as SupplierToInvoiceView;
         if (model != null)
         {
             TotalZhi      += model.LastTotal;
             ResultTotal   += model.ResultTotal;
             ShengYuZhiJia += model.ShengYuZhiJia;
             //(入库数量)*入库单价-之前所有支付单金额+之前所有负数支付单金额-本次支付单金额<=0
             //var result = model.GoodNum * model.GoodPrice - model.SupplierInvoiceTotal;
             if (model.ResultTotal <= 0)
             {
                 CheckBox cb = (e.Row.FindControl("chkSelect")) as CheckBox;
                 cb.Visible = false;
             }
             else
             {
                 if (ViewState["ids"] != null && ViewState["ids"].ToString().Contains("," + model.Ids + ","))
                 {
                     CheckBox cb = (e.Row.FindControl("chkSelect")) as CheckBox;
                     cb.Checked = true;
                 }
             }
         }
     }
 }
        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='';");
                SupplierToInvoiceView model = e.Row.DataItem as SupplierToInvoiceView;
                SumOrders.SupplierInvoiceTotal += model.SupplierInvoiceTotal;
                SumOrders.LastTotal            += model.LastTotal;
            }

            // 合计
            if (e.Row.RowType == DataControlRowType.Footer)
            {
                setValue(e.Row.FindControl("lblSupplierInvoiceTotal") as Label, SumOrders.SupplierInvoiceTotal.ToString()); //数量
                setValue(e.Row.FindControl("lblLastTotal") as Label, SumOrders.LastTotal.ToString());                       //数量
            }
        }
 protected void gvMain_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='';");
         SupplierToInvoiceView           model        = e.Row.DataItem as SupplierToInvoiceView;
         System.Web.UI.WebControls.Label lblIsHanShui = e.Row.FindControl("lblIsHanShui") as System.Web.UI.WebControls.Label;
         if (lblIsHanShui != null)
         {
             lblIsHanShui.Text = model.Good_IsHanShui == 1 ? "含税" : "不含税";
         }
         if (model.Good_IsHanShui == 0)
         {
             e.Row.BackColor = System.Drawing.Color.LightGray;
         }
     }
 }
Exemplo n.º 5
0
 protected void gvMain_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         SupplierToInvoiceView model = e.Row.DataItem as SupplierToInvoiceView;
         if (model.IsHanShui == false)
         {
             var edit = e.Row.FindControl("lbtnReEdit") as LinkButton;
             if (edit != null)
             {
                 edit.Visible = false;
             }
         }
         if (model != null)
         {
             total        += model.SupplierInvoiceTotal;
             lblTotal.Text = total.ToString();
         }
         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='';");
     }
 }
Exemplo n.º 6
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            List <int> ruids = new List <int>();

            ruids.Add(9917);
            //ruids.Add(14294);
            //ruids.Add(14312);
            using (SqlConnection conn = DBHelp.getConn())
            {
                conn.Open();

                foreach (var ids in ruids)
                {
                    var selectInfo = string.Format(@"select avg(SupplierInvoiceNum) as avgSupplierInvoiceNum, sum(SupplierInvoiceTotal) as sumSupplierInvoiceTotal from TB_SupplierInvoices 
left join TB_SupplierInvoice on TB_SupplierInvoice.id=TB_SupplierInvoices.id
where RuIds={0} and SupplierInvoiceTotal>0 and ((status='通过' and IsYuFu=0) or (Status<>'不通过' and IsYuFu=1)) ", ids);

                    SqlCommand objCommand = conn.CreateCommand();
                    objCommand.CommandText = selectInfo;
                    decimal avgSupplierInvoiceNum   = 0;
                    decimal sumSupplierInvoiceTotal = 0;
                    using (var reader = objCommand.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            object ojb;
                            ojb = reader["avgSupplierInvoiceNum"];
                            if (ojb != null && ojb != DBNull.Value)
                            {
                                avgSupplierInvoiceNum = Convert.ToDecimal(ojb);
                            }
                            ojb = reader["sumSupplierInvoiceTotal"];
                            if (ojb != null && ojb != DBNull.Value)
                            {
                                sumSupplierInvoiceTotal = Convert.ToDecimal(ojb);
                            }
                        }
                        reader.Close();
                    }

                    TB_SupplierInvoice model = new TB_SupplierInvoice();
                    model.Status       = "通过";
                    model.CreteTime    = DateTime.Now;
                    model.CreateName   = "姚世中";
                    model.CaiTuiProNo  = "";
                    model.LastSupplier = "易佳通";
                    model.Remark       = "全部退货";
                    var eform = new tb_EForm();
                    eform.appPer     = 117;
                    eform.appTime    = DateTime.Now;
                    eform.createPer  = 117;
                    eform.createTime = DateTime.Now;
                    eform.proId      = 31;
                    eform.state      = "通过";
                    eform.toPer      = 0;
                    eform.toProsId   = 0;
                    var orders       = new List <SupplierToInvoiceView>();
                    var invoiceModel = new SupplierToInvoiceView();
                    invoiceModel.Ids = ids;

                    //invoiceModel.IsYuFu = true;
                    invoiceModel.SupplierFPNo        = "";
                    invoiceModel.SupplierInvoiceDate = DateTime.Now;
                    var AvgSupplierInvoicePrice = -(sumSupplierInvoiceTotal / avgSupplierInvoiceNum);
                    invoiceModel.SupplierInvoicePrice = AvgSupplierInvoicePrice;
                    invoiceModel.lastGoodNum          = avgSupplierInvoiceNum;
                    invoiceModel.SupplierInvoiceTotal = -sumSupplierInvoiceTotal;

                    invoiceModel.FuShuTotal = invoiceModel.SupplierInvoiceTotal;
                    invoiceModel.ActPay     = invoiceModel.SupplierInvoiceTotal;

                    invoiceModel.GuestName = "易佳通";
                    //invoiceModel.CaiTuiProNo = caiTuiProNo;
                    invoiceModel.RePayClear  = 2;
                    invoiceModel.IsPayStatus = 0;//未支付
                    invoiceModel.IsHeBing    = 1;
                    orders.Add(invoiceModel);
                    int mainId = 0;
                    new TB_SupplierInvoiceService().addTran(model, eform, orders, out mainId);
                }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public SupplierToInvoiceView ReaderBind(IDataReader dataReader)
        {
            SupplierToInvoiceView model = new SupplierToInvoiceView();
            object ojb;

            model.ProNo = dataReader["ProNo"].ToString();
            ojb         = dataReader["RuTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.RuTime = (DateTime)ojb;
            }
            model.GuestName      = dataReader["Supplier"].ToString();
            model.houseName      = dataReader["houseName"].ToString();
            model.PONo           = dataReader["PONo"].ToString();
            model.POName         = dataReader["POName"].ToString();
            model.GoodNo         = dataReader["GoodNo"].ToString();
            model.GoodName       = dataReader["GoodName"].ToString();
            model.GoodTypeSmName = dataReader["GoodTypeSmName"].ToString();
            model.GoodSpec       = dataReader["GoodSpec"].ToString();
            model.GoodUnit       = dataReader["GoodUnit"].ToString();
            ojb = dataReader["GoodNum"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.GoodNum = (decimal)ojb;
            }
            ojb = dataReader["Ids"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Ids = (int)ojb;
            }
            ojb = dataReader["supplierTuiGoodNum"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.supplierTuiGoodNum = (decimal)ojb;
            }
            ojb = dataReader["SupplierInvoiceTotal"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SupplierInvoiceTotal = (decimal)ojb;
            }

            decimal GoodNum            = model.GoodNum ?? 0;
            decimal supplierTuiGoodNum = model.supplierTuiGoodNum ?? 0;

            model.lastGoodNum = GoodNum - supplierTuiGoodNum;

            ojb = dataReader["GoodPrice"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.GoodPrice = (decimal)ojb;
            }
            model.LastTotal = model.GoodPrice * model.lastGoodNum;

            model.DoPer        = dataReader["DoPer"].ToString();
            model.SupplierFPNo = dataReader["SupplierFPNo"].ToString();
            model.ChcekProNo   = dataReader["ChcekProNo"].ToString();
            model.Status       = dataReader["Status"].ToString();
            //ojb = dataReader["SupplierInvoiceStatues"];
            //if (ojb != null && ojb != DBNull.Value)
            //{
            //    model.SupplierInvoiceStatues = (int)ojb;
            //}
            ojb = dataReader["SupplierInvoiceDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SupplierInvoiceDate = (DateTime)ojb;
            }
            ojb = dataReader["SupplierInvoiceNum"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SupplierInvoiceNum = Convert.ToDecimal(ojb);
            }
            ojb = dataReader["SupplierInvoicePrice"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SupplierInvoicePrice = Convert.ToDecimal(ojb);
            }
            model.payIds        = Convert.ToInt32(dataReader["PayIds"]);
            model.SupplierProNo = Convert.ToString(dataReader["SupplierProNo"]);

            //ojb = dataReader["PayStatus"];
            //if (ojb != null && ojb != DBNull.Value)
            //{
            //    model.SupplierInvoiceStatues = (int)ojb;
            //    if (model.SupplierInvoiceStatues.Value == 0)
            //    {
            //        model.isZhiFu = "未支付";
            //    }
            //    if (model.SupplierInvoiceStatues.Value == 1)
            //    {
            //        model.isZhiFu = "拟支付";
            //    }
            //    if (model.SupplierInvoiceStatues.Value == 2)
            //    {
            //        model.isZhiFu = "已支付";
            //    }
            //}
            //else
            //{
            //    model.isZhiFu = "未支付";
            //}

            ojb = dataReader["AE"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.POAE = ojb.ToString();
            }
            ojb = dataReader["GuestName"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.POGuestName = ojb.ToString();
            }
            return(model);
        }