Commit 4ba00004 by 陶然

优化

parent d9e65daf
...@@ -33,20 +33,20 @@ namespace Kivii.Finances.Seeyon.Extensions ...@@ -33,20 +33,20 @@ namespace Kivii.Finances.Seeyon.Extensions
} }
} }
public static Form_InvoiceApply ConvertToForm(this List<InvoiceApply> applys) public static FormMain_InvoiceApplication0710 ConvertToForm(this List<InvoiceApply> applys)
{ {
var apply = applys[0]; var apply = applys[0];
var bizKvids = applys.ConvertAll(o => o.Kvid.ToString()); var bizKvids = applys.ConvertAll(o => o.Kvid.ToString());
//var strBizKvids = JsonSerializer.SerializeToString(bizKvids); //var strBizKvids = JsonSerializer.SerializeToString(bizKvids);
var amount = applys.Sum(o => o.Amount); var amount = applys.Sum(o => o.Amount);
var rtns = new Form_InvoiceApply(); var rtns = new FormMain_InvoiceApplication0710();
//var settlementType = "code|MonthlySettlement";//默认月结 //var settlementType = "code|MonthlySettlement";//默认月结
rtns.业务类型 = typeof(BillApply).FullName; rtns.业务类型 = typeof(BillApply).FullName;
rtns.业务编号 = bizKvids; rtns.业务编号 = bizKvids;
rtns.单据编号 = apply.SerialNumber; rtns.单据编号 = apply.SerialNumber;
rtns.申请日期 = DateTime.Now.ToString("yyyy-MM-dd"); rtns.申请日期 = DateTime.Now.ToString("yyyy-MM-dd");
rtns.所属部门 = KiviiContext.CurrentMember.DepartmentName; rtns.申请部门 = KiviiContext.CurrentMember.DepartmentName;
rtns.经办 = apply.OperatorName; rtns.申请 = apply.OperatorName;
rtns.付款单位名称 = apply.PayerName; rtns.付款单位名称 = apply.PayerName;
rtns.纳税人识别号 = apply.PayerTaxNumber; rtns.纳税人识别号 = apply.PayerTaxNumber;
rtns.地址电话 = $"{apply.PayerCompanyAddress}{apply.PayerPhone}"; rtns.地址电话 = $"{apply.PayerCompanyAddress}{apply.PayerPhone}";
...@@ -54,23 +54,25 @@ namespace Kivii.Finances.Seeyon.Extensions ...@@ -54,23 +54,25 @@ namespace Kivii.Finances.Seeyon.Extensions
rtns.发票类型 = apply.Type == "增值税专用发票" ? "-4189929216282050282" : "4529935671729733794"; rtns.发票类型 = apply.Type == "增值税专用发票" ? "-4189929216282050282" : "4529935671729733794";
rtns.申请原因 = apply.Remark; rtns.申请原因 = apply.Remark;
rtns.数量 = "1"; rtns.数量 = "1";
rtns.金额 = amount.ToString(); rtns.总金额 = amount.ToString();
rtns.金额大写 = amount.ConvertToChinese();
rtns.收款单位 = apply.PayeeName;
return rtns; return rtns;
} }
public static Form_InvoiceApply ConvertToForm(this InvoiceApply apply) public static FormMain_InvoiceApplication0710 ConvertToForm(this InvoiceApply apply)
{ {
var bizKvids = new List<string>(); var bizKvids = new List<string>();
bizKvids.Add(apply.Kvid.ToString()); bizKvids.Add(apply.Kvid.ToString());
var rtns = new Form_InvoiceApply(); var rtns = new FormMain_InvoiceApplication0710();
//var settlementType = "code|MonthlySettlement";//默认月结 //var settlementType = "code|MonthlySettlement";//默认月结
rtns.业务类型 = typeof(BillApply).FullName; rtns.业务类型 = typeof(BillApply).FullName;
rtns.业务编号 = bizKvids; rtns.业务编号 = bizKvids;
rtns.单据编号 = apply.SerialNumber; rtns.单据编号 = apply.SerialNumber;
rtns.申请日期 = DateTime.Now.ToString("yyyy-MM-dd"); rtns.申请日期 = DateTime.Now.ToString("yyyy-MM-dd");
rtns.所属部门 = KiviiContext.CurrentMember.DepartmentName; rtns.申请部门 = KiviiContext.CurrentMember.DepartmentName;
rtns.经办 = apply.OperatorName; rtns.申请 = apply.OperatorName;
rtns.付款单位名称 = apply.PayerName; rtns.付款单位名称 = apply.PayerName;
rtns.纳税人识别号 = apply.PayerTaxNumber; rtns.纳税人识别号 = apply.PayerTaxNumber;
rtns.地址电话 = $"{apply.PayerCompanyAddress}{apply.PayerPhone}"; rtns.地址电话 = $"{apply.PayerCompanyAddress}{apply.PayerPhone}";
...@@ -78,11 +80,13 @@ namespace Kivii.Finances.Seeyon.Extensions ...@@ -78,11 +80,13 @@ namespace Kivii.Finances.Seeyon.Extensions
rtns.发票类型 = apply.Type == "增值税专用发票" ? "-4189929216282050282" : "4529935671729733794"; rtns.发票类型 = apply.Type == "增值税专用发票" ? "-4189929216282050282" : "4529935671729733794";
rtns.申请原因 = apply.Remark; rtns.申请原因 = apply.Remark;
rtns.数量 = "1"; rtns.数量 = "1";
rtns.金额 = apply.Amount.ToString(); rtns.总金额 = apply.Amount.ToString();
rtns.金额大写 = apply.Amount.ConvertToChinese();
rtns.收款单位 = apply.PayeeName;
return rtns; return rtns;
} }
public static ResponseForm<ResponseData> RequestBillForm(this JsonServiceClient client, Form_InvoiceApply form, IAuthSession session) public static ResponseForm<ResponseData> RequestBillForm(this JsonServiceClient client, FormMain_InvoiceApplication0710 form, IAuthSession session)
{ {
if (client == null) throw new ArgumentNullException("client"); if (client == null) throw new ArgumentNullException("client");
if (form == null) throw new ArgumentNullException("form"); if (form == null) throw new ArgumentNullException("form");
...@@ -95,10 +99,84 @@ namespace Kivii.Finances.Seeyon.Extensions ...@@ -95,10 +99,84 @@ namespace Kivii.Finances.Seeyon.Extensions
//request.data.senderLoginName = token.bindingUser.loginName; //request.data.senderLoginName = token.bindingUser.loginName;
request.data.subject = $"预借发票申请({token.bindingUser.name} {DateTime.Now:yyyy-MM-dd HH:mm})"; request.data.subject = $"预借发票申请({token.bindingUser.name} {DateTime.Now:yyyy-MM-dd HH:mm})";
request.data.data = new RequestForm_InvoiceApply(); request.data.data = new RequestForm_InvoiceApply();
request.data.data.formmain_0318 = new Form_InvoiceApply(); request.data.data.formmain_0710 = new FormMain_InvoiceApplication0710();
request.data.data.formmain_0318 = form; request.data.data.formmain_0710 = form;
var rtns = client.Post<ResponseForm<ResponseData>>($"{Configs.RouteRequestForm}?token={token.id}", request); var rtns = client.Post<ResponseForm<ResponseData>>($"{Configs.RouteRequestForm}?token={token.id}", request);
return rtns; return rtns;
} }
public static string ConvertToChinese(this decimal Num)
{
string[] DX_SZ = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖", "拾" };//大写数字
string[] DX_DW = { "元", "拾", "佰", "仟", "万", "拾", "佰", "仟", "亿", "拾", "佰", "仟", "万" };
string[] DX_XSDS = { "角", "分" };//大些小数单位
if (Num == 0) return DX_SZ[0];
Boolean IsXS_bool = false;//是否小数
string NumStr;//整个数字字符串
string NumStr_Zs;//整数部分
string NumSr_Xs = "";//小数部分
string NumStr_R = "";//返回的字符串
NumStr = Num.ToString();
NumStr_Zs = NumStr;
if (NumStr_Zs.Contains("."))
{
NumStr = Math.Round(Num, 2).ToString();
NumStr_Zs = NumStr.Substring(0, NumStr.IndexOf("."));
NumSr_Xs = NumStr.Substring((NumStr.IndexOf(".") + 1), (NumStr.Length - NumStr.IndexOf(".") - 1));
IsXS_bool = true;
}
int k = 0;
Boolean IsZeor = false;//整数中间连续0的情况
for (int i = 0; i < NumStr_Zs.Length; i++) //整数
{
int j = int.Parse(NumStr_Zs.Substring(i, 1));
if (j != 0)
{
NumStr_R += DX_SZ[j] + DX_DW[NumStr_Zs.Length - i - 1];
IsZeor = false; //没有连续0
}
else if (j == 0)
{
k++;
if (!IsZeor && !(NumStr_Zs.Length == i + 1)) //等于0不是最后一位,连续0取一次
{
//有问题
if (NumStr_Zs.Length - i - 1 >= 4 && NumStr_Zs.Length - i - 1 <= 6)
NumStr_R += DX_DW[4] + "零";
else
if (NumStr_Zs.Length - i - 1 > 7)
NumStr_R += DX_DW[8] + "零";
else
NumStr_R += "零";
IsZeor = true;
}
if (NumStr_Zs.Length == i + 1)// 等于0且是最后一位 变成 XX元整
NumStr_R += DX_DW[NumStr_Zs.Length - i - 1];
}
}
if (NumStr_Zs.Length > 2 && k == NumStr_Zs.Length - 1)
NumStr_R = NumStr_R.Remove(NumStr_R.IndexOf('零'), 1); //比如1000,10000元整的情况下 去0
if (!IsXS_bool) return NumStr_R + "整"; //如果没有小数就返回
else
{
for (int i = 0; i < NumSr_Xs.Length; i++)
{
int j = int.Parse(NumSr_Xs.Substring(i, 1));
NumStr_R += DX_SZ[j] + DX_XSDS[NumSr_Xs.Length - i - 1];
}
}
return NumStr_R;
}
} }
} }
...@@ -214,10 +214,10 @@ namespace Kivii.Finances.Seeyon.Entities ...@@ -214,10 +214,10 @@ namespace Kivii.Finances.Seeyon.Entities
_log.Type = "流转"; _log.Type = "流转";
_log.Summary = $"提交了账单借票,审批将在OA执行"; _log.Summary = $"提交了账单借票,审批将在OA执行";
conn.Insert(_log); conn.Insert(_log);
rtns.Results.Add(apply); rtns.Results.Add(apply);
} }
return rtns; return rtns;
} }
...@@ -228,9 +228,107 @@ namespace Kivii.Finances.Seeyon.Entities ...@@ -228,9 +228,107 @@ namespace Kivii.Finances.Seeyon.Entities
public class RequestForm_InvoiceApply public class RequestForm_InvoiceApply
{ {
public Form_InvoiceApply formmain_0318 { get; set; } public FormMain_InvoiceApplication0710 formmain_0710 { get; set; }
}
/// <summary>
/// 发起流程表单接口【到账发票申请】
/// </summary>
public class FormMain_InvoiceApplication0710
{
/// <summary>
/// 唯一编号,BizKvid
/// </summary>
public List<string> 业务编号 { get; set; }
/// <summary>
/// 业务类型,BizType
/// </summary>
public string 业务类型 { get; set; }
/// <summary>
/// 单据编号
/// </summary>
public string 单据编号 { get; set; }
/// <summary>
/// 格式:2023-10-11
/// </summary>
public string 申请日期 { get; set; }
public string 申请部门 { get; set; }
public string 申请人 { get; set; }
public string 付款单位名称 { get; set; }
public string 纳税人识别号 { get; set; }
public string 地址电话 { get; set; }
public string 开户行及账号 { get; set; }
/// <summary>
/// 发票类型{普通:4529935671729733794 专票:-4189929216282050282}
/// </summary>
public string 发票类型 { get; set; }
public string 申请原因 { get; set; }
public string 数量 { get; set; }
public string 总金额 { get; set; }
public string 金额大写 { get; set; }
public string 收款单位 { get; set; }
}
/// <summary>
/// 发起流程表单接口【发票当月作废申请】
/// </summary>
public class FormMain_InvoiceVoid0712
{
/// <summary>
/// 唯一编号,BizKvid
/// </summary>
public List<string> 业务编号 { get; set; }
/// <summary>
/// 业务类型,BizType
/// </summary>
public string 业务类型 { get; set; }
/// <summary>
/// 单据编号
/// </summary>
public string 单据编号 { get; set; }
/// <summary>
/// 格式:2023-10-11
/// </summary>
public string 申请日期 { get; set; }
public string 申请部门 { get; set; }
public string 申请人 { get; set; }
public string 原发票号 { get; set; }
/// <summary>
/// 原发票类型{普通:4529935671729733794 专票:-4189929216282050282}
/// </summary>
public string 原发票类型 { get; set; }
public string 原发票开票单位 { get; set; }
public string 原因 { get; set; }
public string 原开票金额 { get; set; }
} }
public class Form_InvoiceApply
/// <summary>
/// 发起流程表单接口【跨月发票红冲申请】
/// </summary>
public class FormMain_InvoiceRedOffset0338
{ {
/// <summary> /// <summary>
/// 唯一编号,BizKvid /// 唯一编号,BizKvid
...@@ -251,19 +349,79 @@ namespace Kivii.Finances.Seeyon.Entities ...@@ -251,19 +349,79 @@ namespace Kivii.Finances.Seeyon.Entities
/// </summary> /// </summary>
public string 申请日期 { get; set; } public string 申请日期 { get; set; }
public string 申请部门 { get; set; }
public string 申请人 { get; set; }
/// <summary>
/// 是:-9179045864512534208 否:-7622688603542042575
/// </summary>
public string 是否为预借发票 { get; set; }
public string 原因 { get; set; }
public string 原发票号 { get; set; }
/// <summary>
/// 原发票类型{普通:4529935671729733794 专票:-4189929216282050282}
/// </summary>
public string 原发票类型 { get; set; }
public string 原发票开票单位 { get; set; }
public string 原开票金额 { get; set; }
public string 冲红发票号码 { get; set; }
}
/// <summary>
/// 发起流程表单接口【预借发票/收据申请】
/// </summary>
public class FormMain_AdvanceInvoice0712
{
/// <summary>
/// 唯一编号,BizKvid
/// </summary>
public List<string> 业务编号 { get; set; }
/// <summary>
/// 业务类型,BizType
/// </summary>
public string 业务类型 { get; set; }
/// <summary>
/// 单据编号
/// </summary>
public string 单据编号 { get; set; }
/// <summary>
/// 格式:2023-10-11
/// </summary>
public string 日期 { get; set; }
public string 所属部门 { get; set; } public string 所属部门 { get; set; }
public string 经办人 { get; set; } public string 经办人 { get; set; }
public string 付款单位名称 { get; set; } public string 付款单位名称 { get; set; }
public string 纳税人识别号 { get; set; } public string 纳税人识别号 { get; set; }
public string 地址电话 { get; set; } public string 地址电话 { get; set; }
public string 开户行及账号 { get; set; } public string 开户行及账号 { get; set; }
/// <summary> /// <summary>
/// 发票类型{普通:4529935671729733794 专票:-4189929216282050282} /// 发票类型{普通:4529935671729733794 专票:-4189929216282050282}
/// </summary> /// </summary>
public string 发票类型 { get; set; } public string 发票类型 { get; set; }
public string 申请原因 { get; set; } public string 申请原因 { get; set; }
public string 数量 { get; set; } public string 数量 { get; set; }
public string 金额 { get; set; } public string 金额 { get; set; }
public string 收款单位 { get; set; }
} }
} }
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