Exemplo n.º 1
0
        /// <summary>
        /// 加载子项数据
        /// </summary>
        /// <param name="paymentID"></param>
        private void LoadPamentDetial(string paymentID)
        {
            To_PaymentDetailManager pm = new To_PaymentDetailManager();

            this.RpList.DataSource = pm.GetOrderPayDetail(" paymentID ='" + paymentID + "'");
            this.RpList.DataBind();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 更新订单付款的实际信息的
        /// </summary>
        /// <param name="jobflowid"></param>
        public void updateOrderPayDetail(int jobflowid)
        {
            To_PaymentDetailManager manager = new To_PaymentDetailManager();
            //得到该条付款申请的明细数据
            DataTable dt = manager.GetOrderPayDetail(" jobFlowID =" + jobflowid);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string orderPayId   = dt.Rows[i]["orderPayId"].ToString();                                               //得到付款明细所引用的订单付款明细数据的id
                double hasAmount    = manager.GetRealityHasAmount(orderPayId);                                           //得到实际付过款的金额
                double shouldAmount = Convert.IsDBNull(dt.Rows[i]["money"]) ? Convert.ToDouble(dt.Rows[i]["money"]) : 0; //应付金额
                string getStatus    = "";
                if (hasAmount == 0)
                {
                    getStatus = "未付款";
                }
                else if (shouldAmount > hasAmount)
                {
                    getStatus = "部分付款";
                }
                else
                {
                    getStatus = "完成付款";
                }
                To_OrderPayDetialManager.updateDetialStatusAndMoney(orderPayId, getStatus, hasAmount.ToString());
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 加载支付明细数据
        /// </summary>
        /// <param name="paymentID"></param>
        private void LoadPaymentDetail(string paymentID)
        {
            To_PaymentDetailManager bPaymentDetail = new To_PaymentDetailManager();

            RpPaymentDetail.DataSource = bPaymentDetail.GetList(" paymentid ='" + paymentID + "'");
            RpPaymentDetail.DataBind();
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到已经支付的金额
        /// </summary>
        /// <param name="collecId"></param>
        /// <returns></returns>
        protected string GetHasAmount(object paydetailID)
        {
            To_PaymentDetailManager tpdm = new To_PaymentDetailManager();

            double hasAmount = tpdm.GetHasAmount(paydetailID.ToString());

            return(hasAmount.ToString("F2"));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 加载付款明细
        /// </summary>
        /// <param name="paymentID"></param>
        private void LoadPaymentDetail(string paymentID)
        {
            To_PaymentDetailManager bPaymentDetail = new To_PaymentDetailManager();

            RpPaymentDetail.DataSource = bPaymentDetail.GetList(" paymentid ='" + paymentID + "'");
            RpPaymentDetail.DataBind();

            sumBox.InnerText = bPaymentDetail.GetSumByPaymentId(paymentID).ToString("F2");
        }
Exemplo n.º 6
0
        /// <summary>
        /// 添加付款详细信息
        /// </summary>
        /// <param name="paymentID"></param>
        private void SavePaymentDetail(string paymentID)
        {
            To_PaymentDetailManager bPaymentDetail = new To_PaymentDetailManager();
            To_PaymentDetail        mPaymentDetail = new To_PaymentDetail();
            IList <string>          payids         = new List <string>();

            mPaymentDetail.PaymentID = paymentID;

            if (hidPayDetail.Value.Trim().TrimEnd('@') != string.Empty)
            {
                IEnumerable <string> detailList = hidPayDetail.Value.Trim().TrimEnd('@').Split('@').Where(x => x.Trim() != string.Empty);

                if (detailList.Count() > 0)
                {
                    foreach (string detail in detailList)
                    {
                        string[] detailItem = detail.Split('$');
                        mPaymentDetail.OrderPayId = int.Parse(detailItem[0].Trim()); //订单付款信息明细表id
                        if (!payids.Contains(detailItem[0].Trim()))
                        {
                            payids.Add(detailItem[0].Trim());
                        }
                        mPaymentDetail.OrderNum  = detailItem[1].Trim();               //订单编号
                        mPaymentDetail.ShouldPay = double.Parse(detailItem[2].Trim()); //应付金额
                        mPaymentDetail.PayAmount = double.Parse(detailItem[3].Trim()); //本次支付金额

                        bPaymentDetail.Add(mPaymentDetail);
                    }
                }

                //更新付款信息明细表的付款状态和实际付款金额
                for (int i = 0; i < payids.Count; i++)
                {
                    if (payids[i] != "")
                    {
                        double hasAmount    = bPaymentDetail.GetHasAmount(payids[i].Trim());                                 //得到付过款的金额
                        double shouldAmount = To_OrderPayDetialManager.getTo_OrderPayDetialById(int.Parse(payids[i])).Money; //得到应付金额
                        string getstatus    = "";
                        if (hasAmount == 0)
                        {
                            getstatus = "未付款";
                        }
                        else if (shouldAmount > hasAmount)
                        {
                            getstatus = "部分付款";
                        }
                        else
                        {
                            getstatus = "完成付款";
                        }
                        To_OrderPayDetialManager.updateDetialStatusAndMoney(payids[i], getstatus, hasAmount.ToString());
                    }
                }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 得到已经支付的付款明细数据
        /// </summary>
        /// <param name="detailId"></param>
        /// <returns></returns>
        public string getHasPayDetail(object detailId, object item)
        {
            StringBuilder str = new StringBuilder();

            switch (item.ToString())
            {
            case "0":
                str.Append("<table border='1'>");
                str.Append("<tr><th width='70px'>财务登记</th><th width='80px'>支付日期</th><th width='200px'>支付单位</th><th width='70px'>应付金额</th><th width='70px'>支付金额</th><th width='70px'>总金额</th><th width='80px'>支付方式</th><th width='180px'>备注</th></tr>");
                DataTable dt = new To_PaymentDetailManager().GetPayDetail(" orderPayId =" + detailId);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    double money     = Convert.IsDBNull(dt.Rows[i]["shouldPay"]) ? 0.0 : Convert.ToDouble(dt.Rows[i]["shouldPay"]);
                    double hasAmount = Convert.IsDBNull(dt.Rows[i]["payAmount"]) ? 0.0 : Convert.ToDouble(dt.Rows[i]["payAmount"]);
                    str.Append(dt.Rows[i]["regType"].ToString() == "1" ? "<tr><td>已登记" : "<tr><td>未登记" + "</td>"); //财务登记
                    str.Append("<td>" + paymentDate(dt.Rows[i]["paymentDate"], dt.Rows[i]["regType"]) + "</td>");  //支付日期
                    str.Append("<td>" + dt.Rows[i]["payerName"].ToString() + "</td>");                             //支付单位
                    str.Append("<td>" + money.ToString("F2") + "</td>");                                           //应付金额
                    str.Append("<td>" + hasAmount.ToString("F2") + "</td>");                                       //支付金额
                    str.Append("<td>" + Convert.ToDouble(dt.Rows[i]["totalAmount"]).ToString("F2") + "</td>");     //总金额
                    str.Append("<td>" + dt.Rows[i]["payType"].ToString() + "</td>");                               //支付方式
                    str.Append("<td>" + dt.Rows[i]["payRemark"].ToString() + "</td></tr>");                        //支付备注
                }
                str.Append("</table>");
                break;

            case "1":
                str.Append("<table border='1'>");
                str.Append("<tr><th width='70px'>财务登记</th><th width='80px'>退款日期</th><th width='200px'>退款单位</th><th width='70px'>应退金额</th><th width='70px'>已退金额</th><th width='70px'>总金额</th><th width='80px'>支付方式</th><th width='180px'>备注</th></tr>");
                DataTable dt1 = To_PaymentReturnManager.GetReturnDetail(" orderRetID =" + detailId);
                for (int i = 0; i < dt1.Rows.Count; i++)
                {
                    double money     = Convert.IsDBNull(dt1.Rows[i]["shouldReturn"])?0.0:Convert.ToDouble(dt1.Rows[i]["shouldReturn"]);
                    double hasAmount = Convert.IsDBNull(dt1.Rows[i]["returnAmount"]) ? 0.0 : Convert.ToDouble(dt1.Rows[i]["returnAmount"]);
                    str.Append(dt1.Rows[i]["regType"].ToString() == "1" ? "<tr><td>已登记" : "<tr><td>未登记" + "</td>"); //财务登记
                    str.Append("<td>" + paymentDate(dt1.Rows[i]["paymentDate"], dt1.Rows[i]["regType"]) + "</td>"); //支付日期
                    str.Append("<td>" + dt1.Rows[i]["payerName"].ToString() + "</td>");                             //支付单位
                    str.Append("<td>" + money.ToString("F2") + "</td>");                                            //应付金额
                    str.Append("<td>" + hasAmount.ToString("F2") + "</td>");                                        //支付金额
                    str.Append("<td>" + Convert.ToDouble(dt1.Rows[i]["totalAmount"]).ToString("F2") + "</td>");     //总金额
                    str.Append("<td>" + dt1.Rows[i]["payType"].ToString() + "</td>");                               //支付方式
                    str.Append("<td>" + dt1.Rows[i]["payRemark"].ToString() + "</td></tr>");                        //支付备注
                }
                str.Append("</table>");
                break;
            }

            return(str.ToString());
        }
Exemplo n.º 8
0
        /// <summary>
        /// 得到可支付金额
        /// </summary>
        /// <param name="money"></param>
        /// <param name="collecId"></param>
        /// <param name="CusId"></param>
        /// <returns></returns>
        protected string GetCanAmount(object money, object paydetailID)
        {
            To_PaymentDetailManager tpdm = new To_PaymentDetailManager();
            double hasAmount             = tpdm.GetHasAmount(paydetailID.ToString());
            double Amount = double.Parse(money.ToString());

            if (Amount != 0)
            {
                return((Amount - hasAmount).ToString("F2"));
            }
            else
            {
                return(Amount.ToString());
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 得到付款单位的确认,支付状态,支付金额等信息
        /// </summary>
        /// <param name="orderId"></param>
        /// <param name="factid"></param>
        /// <param name="payType"></param>
        /// <param name="money"></param>
        /// <returns></returns>
        private string[] GetPayStatusAndMoney(string orderPayId, string money)
        {
            string[] result = new string[3]; //0,可否修改;1,支付状态;2,支付金额
            To_PaymentDetailManager paymentDetailManager = new To_PaymentDetailManager();
            DataTable dt        = paymentDetailManager.GetOrderPayDetail("orderPayId=" + orderPayId);
            double    shouldpay = double.Parse(money);
            double    haspay    = 0;
            double    ispay     = 0;

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["regType"].ToString() == "1") //表示该付款申请已登记
                    {
                        double.TryParse(dt.Rows[i]["payAmount"].ToString(), out ispay);
                        haspay += ispay;
                    }
                }

                result[0] = "有"; //表示这张付款信息做过付款申请,不能再在订单中修改应付金额

                if (haspay == 0)
                {
                    result[1] = "未支付";
                }
                else if (shouldpay > haspay)
                {
                    result[1] = "部分支付";
                }
                else
                {
                    result[1] = "完成支付";
                }

                result[2] = haspay.ToString("F2");
            }
            else
            {
                result[0] = "无";
                result[1] = "未支付";
                result[2] = haspay.ToString("F2");
            }

            return(result);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 得到付款状态
        /// </summary>
        /// <param name="orderpayid"></param>
        /// <param name="money"></param>
        /// <returns></returns>
        public string getPayStatus(string orderpayid, string money)
        {
            double hasAmount    = new To_PaymentDetailManager().GetRealityHasAmount(orderpayid);
            double shouldAmount = 0;

            double.TryParse(money, out shouldAmount);
            if (hasAmount == 0)
            {
                return("0");
            }
            else
            {
                if (shouldAmount > hasAmount)
                {
                    return("1");
                }
                else
                {
                    return("2");
                }
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// 添加付费信息
        /// </summary>
        /// <returns>GUID主键</returns>
        private string UpdatePayment(int workflowID)
        {
            To_PaymentManager bPayment = new To_PaymentManager();

            string     paymentID = Request.QueryString["payid"].ToString();
            To_Payment mPayment  = bPayment.GetModel(paymentID);

            if (mPayment == null)
            {
                return("");
            }

            #region To_Payment实体
            mPayment.approvalOpinion = "";

            mPayment.jobFlowID = workflowID;

            mPayment.payerID   = int.Parse(hidPayerID.Value.Trim());
            mPayment.payerName = txtPayerName.Text.Trim();


            mPayment.paymentType = txtPayType.Text.Trim(); //付款类别
            mPayment.requestDate = DateTime.Parse(txtRequestDate.Text.Trim());

            mPayment.totalAmount = decimal.Parse(txtSumAmount.Text.Trim());

            #endregion

            bPayment.Update(mPayment);

            To_PaymentDetailManager bPaymentDetail = new To_PaymentDetailManager();
            bPaymentDetail.DeleteByPayment(mPayment.id);
            To_PaymentReturnManager.DeleteByPayment(mPayment.id);
            SavePaymentDetail(mPayment.id);
            SavePaymentReturn(mPayment.id);
            return(mPayment.id);
        }
Exemplo n.º 12
0
        protected void RpPaymentList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            object objArg  = e.CommandArgument;
            string cmdName = e.CommandName;

            if (cmdName == "DELETE")//删除
            {
                string[] arrArg    = objArg.ToString().Split(',');
                string   paymentID = arrArg[0];
                string   jobflowID = arrArg[1];

                JobFlow jobFlow = JobFlowManager.GetModel(Convert.ToInt32(jobflowID));


                if (jobFlow.auditstatus != "01" || jobFlow.savestatus == "已提交")
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "delete", "alert('该申请已通过或者是正在审核,不能删除');", true);
                }
                else
                {
                    //string paymentID = objArg.ToString();
                    string resultMsg             = DeletePayment(paymentID);
                    To_PaymentDetailManager pcdm = new To_PaymentDetailManager();
                    pcdm.DeleteByPayment(paymentID);
                    ClientScript.RegisterClientScriptBlock(Page.GetType(), "delete", string.Format("alert(\"{0}\");", resultMsg), true);
                }
            }

            if (cmdName == "EDIT")//编辑
            {
                string[] arrArg    = objArg.ToString().Split(',');
                string   paymentID = arrArg[0];
                string   jobflowID = arrArg[1];
                JobFlow  jobFlow   = JobFlowManager.GetModel(Convert.ToInt32(jobflowID));
                if (jobFlow.auditstatus == "01" && jobFlow.savestatus == "草稿")
                {
                    Response.Redirect("PaymentEdit.aspx?payid=" + paymentID + "&jobflowid=" + jobflowID);
                }
                else
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "edit", "alert('该申请已通过或者是正在审核,不能编辑');", true);
                }
                return;
            }

            if (cmdName == "APPROVAL")//送审
            {
                string[] arrArg    = objArg.ToString().Split(',');
                int      jobflowID = int.Parse(arrArg[0]);
                string   paymentID = arrArg[1];
                string   serialNum = arrArg[2];

                JobFlow jobFlow = JobFlowManager.GetModel(jobflowID);
                if (jobFlow.savestatus == "草稿" && jobFlow.auditstatus == "01")
                {
                    jobFlow.savestatus  = "已提交";
                    jobFlow.auditstatus = "01";
                    JobFlowManager.Update(jobFlow);

                    int ruleID = jobFlow.ruleid;
                    CreateApproval(ruleID, jobflowID);

                    SendMessage(ruleID, serialNum);

                    ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('送审成功');", true);
                }
                else
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('该申请已送审,无需再次送审');", true);
                }
            }

            if (cmdName == "RECOVER")
            {
                int jobflowID = Convert.ToInt32(objArg);
                Recover(jobflowID);
            }

            if (cmdName == "PRINT")
            {
                string[] args = objArg.ToString().Split(',');
                if (args[1].Trim() != "04")
                {
                    ClientScript.RegisterClientScriptBlock(Page.GetType(), "aa", "alert('未通过审核申请不能打印')", true);
                }
                else
                {
                    Print(args[0].Trim());
                }

                return;
            }

            BindPaymentList();
        }