/// <summary> /// 加载退款信息 /// </summary> /// <param name="paymentID"></param> private void LoadPaymentReturn(string paymentID) { RpReturnList.DataSource = To_PaymentReturnManager.GetList(" paymentID='" + paymentID + "'"); RpReturnList.DataBind(); returnsumBox.InnerText = To_PaymentReturnManager.GetSumByPaymentId(paymentID).ToString("F2"); }
/// <summary> /// 更新订单退款的实际信息 /// </summary> /// <param name="jobflowid"></param> public void updateOrderRetDetail(int jobflowid) { DataTable dt = To_PaymentReturnManager.GetOrderReturnDetail(" jobFlowID =" + jobflowid); for (int i = 0; i < dt.Rows.Count; i++) { string orderRetID = dt.Rows[i]["orderRetID"].ToString(); //得到退款明细所引用的订单退款明细数据的id double hasAmount = To_PaymentReturnManager.GetRealityHasAmount(orderRetID); 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_OrderRefunDetialManager.updateDetialStatusAndMoney(orderRetID, getStatus, hasAmount.ToString()); } }
/// <summary> /// 保存退款信息 /// </summary> /// <param name="paymentId"></param> private void SavePaymentReturn(string paymentId) { IList <string> returnIDs = new List <string>(); To_PaymentReturn paymentReturn = new To_PaymentReturn(); paymentReturn.PaymentID = paymentId; if (hidPayReturn.Value.Trim().TrimEnd('@') != string.Empty) { IEnumerable <string> returnList = hidPayReturn.Value.Trim().TrimEnd('@').Split('@').Where(x => x.Trim() != string.Empty); if (returnList.Count() > 0) { foreach (string list in returnList) { string[] item = list.Split('$'); paymentReturn.orderRetID = int.Parse(item[0].Trim()); //订单退款信息明细表id if (!returnIDs.Contains(item[0].Trim())) { returnIDs.Add(item[0].Trim()); } paymentReturn.OrderNum = item[1].Trim(); //订单编号 paymentReturn.ShouldReturn = double.Parse(item[2].Trim()); //应退金额 paymentReturn.ReturnAmount = double.Parse(item[3].Trim()); //本次退付金额 To_PaymentReturnManager.addTo_PaymentReturn(paymentReturn); } } for (int i = 0; i < returnIDs.Count; i++) { if (returnIDs[i] != "") { double hasAmount = To_PaymentReturnManager.GetHasAmount(returnIDs[i]); //得到该退款信息明细表关联的所有退过款的金额 double shouldAmount = To_OrderRefunDetialManager.getTo_OrderRefunDetialById(int.Parse(returnIDs[i])).Money; //得到应退金额 string getstatus = ""; if (hasAmount == 0) { getstatus = "未退款"; } else if (shouldAmount > hasAmount) { getstatus = "部分退款"; } else { getstatus = "完成退款"; } To_OrderRefunDetialManager.updateDetialStatusAndMoney(returnIDs[i], getstatus, hasAmount.ToString()); } } } }
/// <summary> /// 得到可退款金额 /// </summary> /// <param name="money"></param> /// <param name="orderId"></param> /// <param name="payerId"></param> /// <returns></returns> protected string GetCanAmount(object money, object orderRetID) { double hasAmount = To_PaymentReturnManager.GetHasAmount(orderRetID.ToString()); double amount = double.Parse(money.ToString()); if (amount != 0) { return((amount - hasAmount).ToString("F2")); } else { return(amount.ToString()); } }
/// <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()); }
/// <summary> /// 得到退款信息的退款状态和退款金额 /// </summary> /// <param name="orderId"></param> /// <param name="payerId"></param> /// <param name="money"></param> /// <returns></returns> private string[] GetReturnStatusAndMoney(string orderRetID, string money) { string[] result = new string[3]; //0,可否修改;1,支付状态;2,支付金额 DataTable dt = To_PaymentReturnManager.GetOrderReturnDetail("orderRetID=" + orderRetID); double shouldReturn = double.Parse(money); double hasReturn = 0; double isReturn = 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]["returnAmount"].ToString(), out isReturn); hasReturn += isReturn; } } result[0] = "有"; //表示这张退款信息做过付款申请,不能再在订单中修改应退金额 if (hasReturn == 0) { result[1] = "未退款"; } else if (shouldReturn > hasReturn) { result[1] = "部分退款"; } else { result[1] = "完成退款"; } result[2] = hasReturn.ToString("F2"); } else { result[0] = "无"; result[1] = "未退款"; result[2] = hasReturn.ToString("F2"); } return(result); }
/// <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); }
/// <summary> /// 加载上次选择过的退款信息数据 /// </summary> /// <param name="paymentID"></param> private void LoadPaymentReturn(string paymentID) { this.RpReturnList.DataSource = To_PaymentReturnManager.GetOrderReturnDetail(" paymentID ='" + paymentID + "'"); this.RpReturnList.DataBind(); }
/// <summary> /// 得到已经退过款的金额 /// </summary> /// <param name="orderId"></param> /// <param name="payerId"></param> /// <returns></returns> protected string GetHasAmount(object orderRetID) { double hasAmount = To_PaymentReturnManager.GetHasAmount(orderRetID.ToString()); return(hasAmount.ToString("F2")); }
private void LoadReturnDetail(string paymentId) { RpReturnList.DataSource = To_PaymentReturnManager.GetList(" paymentID='" + paymentId + "'"); RpReturnList.DataBind(); }