/// <summary> /// 拆分收款,才分成每个月一笔收款 /// </summary> public void CFPayment(int month, DataRow aRow) { TW_PaymentRow paymentRow = aRow as TW_PaymentRow; string pch = paymentRow.TW_PaymentID; DateTime startDate = paymentRow.次到期月份; decimal sumprice = paymentRow.月平均费 * month; decimal firstmonth = paymentRow.支付金额 - sumprice; //开始拆分记录 for (int i = 1; i <= month; i++) { var row = this.TW_Payment.NewTW_PaymentRow(); row.TW_PaymentID = Guid.NewGuid().ToString(); row.次到期月份 = new DateTime(startDate.Year, startDate.Month, 1); //一号 row.本次到期月份 = new DateTime(startDate.Year, startDate.Month, DateTime.DaysInMonth(startDate.Year, startDate.Month)); //月末 row.缴费月数 = 1; row.客户名称ID = paymentRow.客户名称ID; row.支付单位 = paymentRow.支付单位; row.做账会计 = paymentRow.做账会计; row.做账会计ID = paymentRow.做账会计ID; row.业务员 = paymentRow.业务员; row.业务员ID = paymentRow.业务员ID; row.注册员 = paymentRow.注册员; row.注册员ID = paymentRow.注册员ID; if (i == 1) { row.月平均费 = paymentRow.月平均费 + firstmonth; row.月做账费 = paymentRow.月平均费 + firstmonth; row.支付金额 = paymentRow.月平均费 + firstmonth; } else { row.月平均费 = paymentRow.月平均费; row.月做账费 = paymentRow.月平均费; row.支付金额 = paymentRow.月平均费; } if (!paymentRow.Is备注Null()) { row.备注 = string.Format("自动拆分,源金额:{0}元", paymentRow.支付金额) + " " + paymentRow.备注; } else { row.备注 = string.Format("自动拆分,源金额:{0}元", paymentRow.支付金额); } row.支付日期 = paymentRow.支付日期; row.支付单位 = paymentRow.支付单位; row.支付方式 = paymentRow.支付方式; row.收款人 = paymentRow.收款人; row.收款类别 = paymentRow.收款类别; row.是否审核 = false; row.注册提成月 = 0; row.业务提成月 = 0; row.做账提成月 = 0; row.做账团队提成 = 0; row.业务团队提成 = 0; row.做账主管提成 = 0; row.注册团队提成 = 0; row.注册年提成 = 0; row.业务年提成 = 0; row.工本开票提成 = 0; row.做账业务团队提成 = 0; row.批次号 = pch; if (!paymentRow.Is零申报Null()) { row.零申报 = paymentRow.零申报; } else { row.零申报 = false; } if (!paymentRow.Is首年提成结束期Null()) { row.首年提成结束期 = paymentRow.首年提成结束期; } if (!paymentRow.Is银行账号Null()) { row.银行账号 = paymentRow.银行账号; } //if (!paymentRow.Is初始做账时间Null()) // row.初始做账时间 = paymentRow.初始做账时间; if (!paymentRow.Is不收款Null()) { row.收款 = paymentRow.收款; } else { row.收款 = false; } row.操作人 = Security.UserName; row.操作时间 = DateTime.Now; if (i == 1) { row.工本费 = paymentRow.工本费; row.开票费 = paymentRow.开票费; } else { row.工本费 = 0; row.开票费 = 0; } GetZCTC(row); this.TW_Payment.AddTW_PaymentRow(row); startDate = startDate.AddMonths(1); } this.TW_Payment.RemoveTW_PaymentRow(paymentRow); //删除源记录 }
/// <summary> /// 拆分收款,才分成每个月一笔收款 /// </summary> public void CFPayments(int month, DataRow aRow) { TW_PaymentRow paymentRow = aRow as TW_PaymentRow; DateTime startDate = paymentRow.次到期月份; //开始拆分记录 for (int i = 1; i <= month; i++) { var row = this.TW_Payment.NewTW_PaymentRow(); row.TW_PaymentID = Guid.NewGuid().ToString(); row.次到期月份 = new DateTime(startDate.Year, startDate.Month, 1); //一号 row.本次到期月份 = new DateTime(startDate.Year, startDate.Month, DateTime.DaysInMonth(startDate.Year, startDate.Month)); //月末 row.缴费月数 = 1; if (!paymentRow.Is客户名称IDNull()) { row.客户名称ID = paymentRow.客户名称ID; } row.支付单位 = paymentRow.支付单位; row.做账会计 = paymentRow.做账会计; row.做账会计ID = paymentRow.做账会计ID; if (!paymentRow.Is业务员Null()) { row.业务员 = paymentRow.业务员; } if (!paymentRow.Is业务员IDNull()) { row.业务员ID = paymentRow.业务员ID; } if (!paymentRow.Is注册员Null()) { row.注册员 = paymentRow.注册员; } if (!paymentRow.Is注册员IDNull()) { row.注册员ID = paymentRow.注册员ID; } row.做账会计 = paymentRow.做账会计; row.做账会计ID = paymentRow.做账会计ID; row.月平均费 = paymentRow.月平均费; row.月做账费 = paymentRow.月平均费; if (!paymentRow.Is备注Null()) { row.备注 = string.Format("自动拆分,源金额:{0}元", paymentRow.支付金额) + " " + paymentRow.备注; } else { row.备注 = string.Format("自动拆分,源金额:{0}元", paymentRow.支付金额); } row.支付金额 = paymentRow.月平均费; row.支付日期 = paymentRow.支付日期; row.支付单位 = paymentRow.支付单位; if (!paymentRow.Is支付方式Null()) { row.支付方式 = paymentRow.支付方式; } else { row.支付方式 = "其他"; } row.收款人 = paymentRow.收款人; row.收款类别 = paymentRow.收款类别; if (!paymentRow.Is是否审核Null()) { row.是否审核 = paymentRow.是否审核; } else { row.是否审核 = false; } if (!paymentRow.Is审核人Null()) { row.审核人 = paymentRow.审核人; } if (!paymentRow.Is审核时间Null()) { row.审核时间 = paymentRow.审核时间; } if (!paymentRow.Is零申报Null()) { row.零申报 = paymentRow.零申报; } else { row.零申报 = false; } if (!paymentRow.Is首年提成结束期Null()) { row.首年提成结束期 = paymentRow.首年提成结束期; } if (!paymentRow.Is银行账号Null()) { row.银行账号 = paymentRow.银行账号; } if (!paymentRow.Is不收款Null()) { row.收款 = paymentRow.收款; } else { row.收款 = false; } row.操作人 = paymentRow.操作人; row.操作时间 = paymentRow.操作时间; if (i == 1) { row.工本费 = paymentRow.工本费; row.开票费 = paymentRow.开票费; } else { row.工本费 = 0; row.开票费 = 0; } this.TW_Payment.AddTW_PaymentRow(row); startDate = startDate.AddMonths(1); } //this.TW_Payment.RemoveTW_PaymentRow(paymentRow); //删除源记录 }
/// <summary> /// 添加一个收款主记录 /// </summary> /// <param name="mainRow"></param> public void AddPaymentMainRow(TW_PaymentRow mainRow) { TW_PaymentMainRow paymentMain = this.TW_PaymentMain.NewTW_PaymentMainRow(); paymentMain.TW_PaymentID = mainRow.TW_PaymentID; paymentMain.批次号 = mainRow.TW_PaymentID; paymentMain.支付单位 = mainRow.支付单位; paymentMain.支付金额 = mainRow.支付金额; paymentMain.支付日期 = mainRow.支付日期; paymentMain.支付方式 = mainRow.支付方式; paymentMain.收款人 = mainRow.收款人; paymentMain.收款类别 = mainRow.收款类别; if (!mainRow.Is备注Null()) { paymentMain.备注 = mainRow.备注; } paymentMain.客户名称ID = mainRow.客户名称ID; paymentMain.操作人 = mainRow.操作人; paymentMain.操作时间 = mainRow.操作时间; paymentMain.工本费 = mainRow.工本费; paymentMain.开票费 = mainRow.开票费; if (!mainRow.Is做账会计Null()) { paymentMain.做账会计 = mainRow.做账会计; } if (!mainRow.Is上次到期月份Null()) { paymentMain.次到期月份 = mainRow.次到期月份; } if (!mainRow.Is本次到期月份Null()) { paymentMain.本次到期月份 = mainRow.本次到期月份; } if (!mainRow.Is做账会计IDNull()) { paymentMain.做账会计ID = mainRow.做账会计ID; } if (!mainRow.Is业务员Null()) { paymentMain.业务员 = mainRow.业务员; } if (!mainRow.Is业务员IDNull()) { paymentMain.业务员ID = mainRow.业务员ID; } paymentMain.注册员 = mainRow.注册员; paymentMain.注册员ID = mainRow.注册员ID; paymentMain.缴费月数 = mainRow.缴费月数; paymentMain.月平均费 = mainRow.月平均费; paymentMain.月做账费 = mainRow.月平均费; if (!mainRow.Is零申报Null()) { paymentMain.零申报 = mainRow.零申报; } else { paymentMain.零申报 = false; } if (!mainRow.Is首年提成结束期Null()) { paymentMain.首年提成结束期 = mainRow.首年提成结束期; } if (!mainRow.Is银行账号Null()) { paymentMain.银行账号 = mainRow.银行账号; } if (!mainRow.Is不收款Null()) { paymentMain.收款 = mainRow.收款; } else { paymentMain.收款 = false; } paymentMain.是否审核 = false; this.TW_PaymentMain.AddTW_PaymentMainRow(paymentMain); mainRow.批次号 = paymentMain.批次号; //paymentMain.做账会计已提 = mainRow.做账会计已提; //paymentMain.注册员已提 = mainRow.注册员已提; //paymentMain.业务员已提 = mainRow.业务员已提; }