Commit 284f70bd by 陶然

优化

parent 8660e762
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using Kivii.Finances.Entities; using Kivii.Finances.Entities;
using Kivii.Finances.Seeyon.Entities; using Kivii.Finances.Seeyon.Entities;
using Kivii.Seeyon.Entities; using Kivii.Seeyon.Entities;
using Kivii.Text;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -32,6 +33,32 @@ namespace Kivii.Finances.Seeyon.Extensions ...@@ -32,6 +33,32 @@ namespace Kivii.Finances.Seeyon.Extensions
} }
} }
public static Form_InvoiceApply ConvertToForm(this List<InvoiceApply> applys)
{
var apply = applys[0];
var bizKvids = applys.ConvertAll(o => o.Kvid);
var strBizKvids = JsonSerializer.SerializeToString(bizKvids);
var amount = applys.Sum(o => o.Amount);
var rtns = new Form_InvoiceApply();
//var settlementType = "code|MonthlySettlement";//默认月结
rtns.业务类型 = typeof(BillApply).FullName;
rtns.业务编号 = strBizKvids;
rtns.单据编号 = apply.SerialNumber;
rtns.日期 = DateTime.Now.ToString("yyyy-MM-dd");
rtns.所属部门 = KiviiContext.CurrentMember.DepartmentName;
rtns.经办人 = apply.OperatorName;
rtns.付款单位名称 = apply.PayerName;
rtns.纳税人识别号 = apply.PayerTaxNumber;
rtns.地址电话 = $"{apply.PayerCompanyAddress}{apply.PayerPhone}";
rtns.开户行及账号 = $"{apply.PayerRegisteredBank}{apply.PayerBankAccount}";
rtns.发票类型 = apply.Type == "增值税专用发票" ? "-4189929216282050282" : "4529935671729733794";
rtns.申请原因 = apply.Remark;
rtns.数量 = "1";
rtns.金额 = amount.ToString();
return rtns;
}
public static Form_InvoiceApply ConvertToForm(this InvoiceApply apply) public static Form_InvoiceApply ConvertToForm(this InvoiceApply apply)
{ {
var rtns = new Form_InvoiceApply(); var rtns = new Form_InvoiceApply();
......
...@@ -181,16 +181,16 @@ namespace Kivii.Finances.Seeyon.Entities ...@@ -181,16 +181,16 @@ namespace Kivii.Finances.Seeyon.Entities
var groupPayer = applys.GroupBy(a => a.PayerName); var groupPayer = applys.GroupBy(a => a.PayerName);
if (groupPayer.Count() != 1) throw new Exception("不允许多个借票抬头同时申请!"); if (groupPayer.Count() != 1) throw new Exception("不允许多个借票抬头同时申请!");
var applySum = new InvoiceApply(); //var applySum = new InvoiceApply();
applySum.PopulateWith(applys[0]); //applySum.PopulateWith(applys[0]);
applySum.Amount = applys.Sum(a => a.Amount); //applySum.Amount = applys.Sum(a => a.Amount);
applySum.Remark = applys[0].Remark; //applySum.Remark = applys[0].Remark;
var applyForm = applySum.ConvertToForm(); var applyForm = applys.ConvertToForm();
var bizKvids = applys.ConvertAll(o => o.Kvid); //var bizKvids = applys.ConvertAll(o => o.Kvid);
var strBizKvids = JsonSerializer.SerializeToString(bizKvids); //var strBizKvids = JsonSerializer.SerializeToString(bizKvids);
applyForm.业务编号 = strBizKvids; //applyForm.业务编号 = strBizKvids;
var session = KiviiContext.Request.GetSession(); var session = KiviiContext.Request.GetSession();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment