コード例 #1
0
        private void GetTotal(string poNo, string m, string TrueLiRun, string allItemTotal)
        {
            var     list  = orderSer.GetOrder_ToInvoice_1(string.Format(" PONo='{0}'", poNo));
            decimal total = 0;

            if (list.Count > 0)
            {
                total = list[0].POTotal - list[0].TuiTotal;
                lblCurrentPOTotal.Text = total.ToString();
            }
            if (string.IsNullOrEmpty(lblDaoKuanTotal.Text))
            {
                lblDaoKuanTotal.Text = "0";
            }
            var DaoKuanTotal = Convert.ToDecimal(lblDaoKuanTotal.Text);

            //项目未到到款金额:XX=项目总金额-到款总额
            lblPoWeiDaoTotal.Text = (total - DaoKuanTotal).ToString();
            //已开票未到款:YY=发票总额-到款总额
            lblInvoiceNoDao.Text = (Convert.ToDecimal(m) - DaoKuanTotal).ToString();
            //未开票金额:ZZZ=项目总金额-发票总金额
            lblWeiKaiPiao.Text = (total - Convert.ToDecimal(m)).ToString();
            //扣管理费后利润率 PP=(实际利润-管理费总额)/项目总金额 以百分数表示。
            if (total != 0)
            {
                lblPP.Text = string.Format("{0:f2}", (((Convert.ToDecimal(TrueLiRun) - Convert.ToDecimal(allItemTotal)) / total)) * 100) + "%";
            }
        }
コード例 #2
0
        protected void gvMain_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "select")
            {
                var pono = DBHelp.ExeScalar("select pono from Sell_OrderFP where id=" + e.CommandArgument);
                CG_POOrderService orderSer = new CG_POOrderService();

                string sql = string.Format("select sum(Total) from Sell_OrderFP where pono='{0}' and Status='通过'", pono);
                try
                {
                    lblTotal.Text = DBHelp.ExeScalar(sql).ToString();
                }
                catch (Exception)
                {
                    lblTotal.Text = "0";
                }
                var list = orderSer.GetOrder_ToInvoice_1(string.Format(" PONo='{0}'", pono));
                if (list.Count > 0)
                {
                    lblPOTotal.Text = "项目(" + pono + ")---" + (list[0].POTotal - list[0].TuiTotal).ToString();
                }
                else
                {
                    lblPOTotal.Text = "0";
                }

                List <Sell_OrderFPs> orders = ordersSer.GetListArray(" 1=1 and Sell_OrderFPs.id=" + e.CommandArgument);

                ViewState["Orders"] = orders;
                gvList.DataSource   = orders;
                gvList.DataBind();
            }
            else if (e.CommandName == "ReEdit")
            {
                //是否是此单据的申请人
                var model = POSer.GetModel(Convert.ToInt32(e.CommandArgument));

                if (Session["currentUserId"].ToString() != model.CreateUserId.ToString())
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('必须由原单据申请人 重新发起,其他人不能重新提交编辑!');</script>");
                    return;
                }

                //首先单子要先通过

                if (model != null && model.Status == "执行中")
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此单据还在执行中不能编辑!');</script>");
                    return;
                }



                //string check = string.Format("select  count(*) from Sell_OrderFPBack  where FPNo in ( select FPNo from Sell_OrderFP where id={0})", model.Id);
                //if (Convert.ToInt32(DBHelp.ExeScalar(check)) > 0)
                //{
                //    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('发票签回单需要删除!');</script>");
                //    return;
                //}

                // check = string.Format("select count(*) from TB_ToInvoice  where FPId={0}", model.Id);
                //if (Convert.ToInt32(DBHelp.ExeScalar(check)) > 0)
                //{
                //    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此单据已经被用款单使用!');</script>");
                //    return;
                //}
                string type = "销售发票";
                if (model.NowGuid != "")
                {
                    type = "销售发票修改";
                }
                string sql = string.Format("select pro_Id from A_ProInfo where pro_Type='{0}'", type);

                string efromId = string.Format("select id from tb_EForm where alle_id={0} and proId=(select pro_Id from A_ProInfo where pro_Type='{1}')", e.CommandArgument, type);
                string url     = "~/JXC/WFSell_OrderFP.aspx?ProId=" + DBHelp.ExeScalar(sql) + "&allE_id=" + e.CommandArgument + "&EForm_Id=" + DBHelp.ExeScalar(efromId) + "&&ReAudit=true";
                Response.Redirect(url);
            }
            else if (e.CommandName == "Del")
            {
                //是否是此单据的申请人
                var model = POSer.GetModel(Convert.ToInt32(e.CommandArgument));

                if (Session["currentUserId"].ToString() != model.CreateUserId.ToString())
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('必须由原单据申请人 重新发起,其他人不能重新提交编辑!');</script>");
                    return;
                }

                //首先单子要先通过

                if (model != null && model.Status == "执行中")
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此单据还在执行中不能编辑!');</script>");
                    return;
                }
                string check = string.Format("select count(*) from TB_ToInvoice  where FPId={0}  AND State<>'不通过'", model.Id);
                if (Convert.ToInt32(DBHelp.ExeScalar(check)) > 0)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('有到款记录,请先删除到款!');</script>");
                    return;
                }

                check = string.Format(" select count(*) from TB_ToInvoice where FPNo = '{0}'  AND State<>'不通过'", model.FPNo);
                if (Convert.ToInt32(DBHelp.ExeScalar(check)) > 0)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('有到款记录,请先删除到款!');</script>");
                    return;
                }

                //string check = string.Format("select  count(*) from Sell_OrderFPBack  where FPNo in ( select FPNo from Sell_OrderFP where id={0})", model.Id);
                //if (Convert.ToInt32(DBHelp.ExeScalar(check)) > 0)
                //{
                //    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('发票签回单需要删除!');</script>");
                //    return;
                //}

                // check = string.Format("select count(*) from TB_ToInvoice  where FPId={0}", model.Id);
                //if (Convert.ToInt32(DBHelp.ExeScalar(check)) > 0)
                //{
                //    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此单据已经被用款单使用!');</script>");
                //    return;
                //}
                string type = "销售发票";
                if (model.NowGuid != "")
                {
                    type = "销售发票修改";
                }
                string sql     = string.Format("select pro_Id from A_ProInfo where pro_Type='{0}'", type);
                string efromId = string.Format("select id from tb_EForm where alle_id={0} and proId=(select pro_Id from A_ProInfo where pro_Type='{1}')", e.CommandArgument, type);
                var    id      = DBHelp.ExeScalar(efromId).ToString();
                var    aa      = DBHelp.ExeScalar(string.Format("select top 1 id from tb_EForm where allE_id={0} and proId=37", model.Id));
                if (aa != null && aa != DBNull.Value)
                {
                    id = aa.ToString();
                }
                string url = "~/JXC/WFSell_OrderFP.aspx?ProId=37&allE_id=" + e.CommandArgument + "&EForm_Id=" + id + "&&IsDelete=true";
                Response.Redirect(url);
            }
        }
コード例 #3
0
        protected void gvMain_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "select")
            {
                var pono = DBHelp.ExeScalar("select pono from Sell_OrderFP where id=" + e.CommandArgument);
                CG_POOrderService orderSer = new CG_POOrderService();
                string            sql      = string.Format("select sum(Total) from Sell_OrderFP where pono='{0}' and Status='通过'", pono);
                try
                {
                    lblTotal.Text = DBHelp.ExeScalar(sql).ToString();
                }
                catch (Exception)
                {
                    lblTotal.Text = "0";
                }

                var list = orderSer.GetOrder_ToInvoice_1(string.Format(" PONo='{0}'", pono));
                if (list.Count > 0)
                {
                    lblPOTotal.Text = "项目(" + pono + ")---" + (list[0].POTotal - list[0].TuiTotal).ToString();
                }
                else
                {
                    lblPOTotal.Text = "0";
                }


                List <Sell_OrderFPs> orders = ordersSer.GetListArray(" 1=1 and Sell_OrderFPs.id=" + e.CommandArgument);

                ViewState["Orders"] = orders;
                gvList.DataSource   = orders;
                gvList.DataBind();
            }
            else if (e.CommandName == "ReEdit")
            {
                //是否是此单据的申请人
                var model = POSer.GetModel(Convert.ToInt32(e.CommandArgument));

                if (Session["currentUserId"].ToString() != model.CreateUserId.ToString())
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('必须由原单据申请人 重新发起,其他人不能重新提交编辑!');</script>");
                    return;
                }

                //首先单子要先通过

                if (model != null && model.Status == "通过")
                {
                }
                else
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此单据必须已经审批通过才能重新编辑!');</script>");
                    return;
                }

                string check = string.Format("select count(*) from TB_ToInvoice  where FPId={0}", model.Id);
                if (Convert.ToInt32(DBHelp.ExeScalar(check)) > 0)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此单据已经被用款单使用!');</script>");
                    return;
                }

                string sql = "select pro_Id from A_ProInfo where pro_Type='销售发票'";

                string efromId = string.Format("select id from tb_EForm where alle_id={0} and proId=(select pro_Id from A_ProInfo where pro_Type='销售发票')", e.CommandArgument);
                string url     = "~/JXC/WFSell_OrderFP.aspx?ProId=" + DBHelp.ExeScalar(sql) + "&allE_id=" + e.CommandArgument + "&EForm_Id=" + DBHelp.ExeScalar(efromId) + "&&ReAudit=true&Tui=true";
                Response.Redirect(url);


                //没有做过检验单
            }
        }
コード例 #4
0
        protected void gvList_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "ReEdit")
            {
                //是否是此单据的申请人
                var model = toInvoSerSer.GetModel(Convert.ToInt32(e.CommandArgument));

                //首先单子要先通过

                if (model != null && model.State == "通过")
                {
                }
                else
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此单据必须已经审批通过才能重新编辑!');</script>");
                    return;
                }
                string sql = "select pro_Id from A_ProInfo where pro_Type='到款单'";

                string efromId = string.Format("select id from tb_EForm where alle_id={0} and proId=(select pro_Id from A_ProInfo where pro_Type='到款单')", e.CommandArgument);
                string url     = "~/EFrom/WFToInvoice.aspx?ProId=" + DBHelp.ExeScalar(sql) + "&allE_id=" + e.CommandArgument + "&EForm_Id=" + DBHelp.ExeScalar(efromId) + "&&ReAudit=true";
                Response.Redirect(url);
                //没有做过检验单
            }
            if (e.CommandName == "select")
            {
                string[]          PONo_Id  = e.CommandArgument.ToString().Split('_');
                CG_POOrderService orderSer = new CG_POOrderService();
                var list = orderSer.GetOrder_ToInvoice_1(string.Format(" PONo='{0}'", PONo_Id[0]));
                if (list.Count > 0)
                {
                    lblPOTotal.Text  = "项目(" + PONo_Id[0] + ")---" + string.Format("{0:n2}", list[0].POTotal - list[0].TuiTotal);
                    lblWeiTotal.Text = string.Format("{0:n2}", list[0].WeiTotal);
                    lblMess.Text     = string.Format("{0:n2}", list[0].sumTotal);

                    string sqlKaiPiao = "select isnull(sum(total),0) from Sell_OrderFP where Status='通过' and pono='" + PONo_Id[0] + "'";
                    lblKaiPiaoTotal.Text = string.Format("{0:n2}", DBHelp.ExeScalar(sqlKaiPiao));

                    if (list[0].POTotal - list[0].TuiTotal != 0)
                    {
                        lblWeiTotalBiLi.Text = string.Format("{0:n2}", list[0].WeiTotal / (list[0].POTotal - list[0].TuiTotal) * 100);
                    }
                    else
                    {
                        lblWeiTotalBiLi.Text = "0";
                    }

                    string fpSQL  = string.Format(" SELECT FPNo,RuTime,Total FROM Sell_OrderFP where Status='通过' and pono='{0}'", PONo_Id[0]);
                    var    fpList = DBHelp.getDataTable(fpSQL);


                    //System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    //int i = 1;
                    //foreach (DataRow dr in fpList.Rows)
                    //{
                    //    sb.AppendFormat("{0} :{1}      ", dr[0], dr[1]);
                    //    if (i % 5 == 0)
                    //    {
                    //        sb.Append(System.Environment.NewLine);
                    //    }
                    //    i++;
                    //}
                    //lblFPDetail.Text = sb.ToString();
                    ViewState["fpList"] = fpList;
                }
                else
                {
                    lblPOTotal.Text      = "0";
                    lblWeiTotal.Text     = "0";
                    lblMess.Text         = "0";
                    lblKaiPiaoTotal.Text = "0";
                    lblWeiTotalBiLi.Text = "0";
                }
                string sql = "select PoNo,CreateUser,AppleDate,ZhangQi,Remark from TB_ToInvoice where id=" + PONo_Id[1];
                gvDetail.DataSource = DBHelp.getDataTable(sql);
                gvDetail.DataBind();
                //this.gvList.DataKeys[e.].Value.ToString()
            }


            if (e.CommandName == "Del")
            {
                //是否是此单据的申请人
                var model = toInvoSerSer.GetModel(Convert.ToInt32(e.CommandArgument));

                //if (Session["currentUserId"].ToString() != model.CreateUserId.ToString())
                //{

                //    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('必须由原单据申请人 重新发起,其他人不能重新提交编辑!');</script>");
                //    return;
                //}

                //首先单子要先通过
                if (model != null && model.State == "执行中")
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此单据还在执行中不能删除!');</script>");
                    return;
                }
                string type    = "到款单";
                string sql     = string.Format("select pro_Id from A_ProInfo where pro_Type='{0}'", type);
                string efromId = string.Format("select id from tb_EForm where alle_id={0} and proId=(select pro_Id from A_ProInfo where pro_Type='{1}')", e.CommandArgument, type);
                var    id      = DBHelp.ExeScalar(efromId).ToString();
                var    aa      = DBHelp.ExeScalar(string.Format("select top 1 id from tb_EForm where allE_id={0} and proId=37", model.Id));
                if (aa != null && aa != DBNull.Value)
                {
                    id = aa.ToString();
                }
                string url = "~/EFrom/WFToInvoice.aspx?ProId=38&allE_id=" + e.CommandArgument + "&EForm_Id=" + id + "&&IsDelete=true";
                Response.Redirect(url);
            }
        }