增加2种费用报表

dev
嵇文龙 2 months ago
parent ce94471941
commit ca08acb5d3

@ -540,32 +540,16 @@ namespace DS.WMS.Core.Fee.Dtos
/// </summary>
public decimal? InvoiceAmount { get; set; }
/// <summary>
/// 未开票金额
/// </summary>
public decimal? InvoiceAmountRest { get { return InvoiceAmount.HasValue ? Amount - InvoiceAmount.Value : null; } }
/// <summary>
/// Desc:申请金额
/// </summary>
public decimal? OrderAmount { get; set; }
/// <summary>
/// Desc:申请开票金额
/// </summary>
public decimal? OrderInvoiceAmount { get; set; }
/// <summary>
/// 是否机密费用
/// </summary>
public bool? IsOpen { get; set; }
/// <summary>
/// 对帐编号
/// </summary>
public string DebitNo { get; set; }
/// <summary>
/// 是否对帐
/// </summary>
public bool IsDebit { get; set; }
/// <summary>
/// 是否垫付费用
/// </summary>
@ -617,36 +601,16 @@ namespace DS.WMS.Core.Fee.Dtos
/// </summary>
public decimal Tax { get; set; }
/// <summary>
/// 申请结算金额
/// </summary>
public decimal OrderSettlementAmount { get; set; }
/// <summary>
/// 含税单价
/// </summary>
public decimal TaxUnitPrice { get; set; }
/// <summary>
/// 申请发票开票金额
/// </summary>
public decimal OrderInvSettlementAmount { get; set; }
/// <summary>
/// 是否财务费用
/// </summary>
public bool IsAcc { get; set; }
/// <summary>
/// 核算单位
/// </summary>
public string SaleOrg { get; set; }
/// <summary>
/// 核算单位Id
/// </summary>
public long SaleOrgId { get; set; }
/// <summary>
/// 创建人
/// </summary>

@ -10,17 +10,17 @@ namespace DS.WMS.Core.Fee.Dtos
public class FeeStatItem
{
/// <summary>
/// 应收款总计(人民币合计
/// 应收款总计(RMB
/// </summary>
public decimal ReceivableTotal { get; set; }
/// <summary>
/// 应付款总计(人民币合计
/// 应付款总计(RMB
/// </summary>
public decimal PayableTotal { get; set; }
/// <summary>
/// 利润总计
/// 利润总计RMB
/// </summary>
public decimal ProfitTotal { get { return ReceivableTotal - PayableTotal; } }
@ -39,6 +39,21 @@ namespace DS.WMS.Core.Fee.Dtos
}
}
/// <summary>
/// 应收利润率(利润/应收)
/// </summary>
public string RecvProfitMargin
{
get
{
if (ReceivableTotal == 0)
return string.Empty;
//利润率=利润÷应付/应收×100%
return string.Concat(Math.Round(ProfitTotal / ReceivableTotal * 100, 2, MidpointRounding.AwayFromZero), "%");
}
}
/// <summary>
/// 人民币应收款
/// </summary>

@ -1,16 +1,12 @@
using DS.Module.Core;
namespace DS.WMS.Core.Fee.Dtos
namespace DS.WMS.Core.Fee.Dtos.Report
{
/// <summary>
/// 费用核算单
/// </summary>
public class CostAccountingForm
public class CostAccounting
{
//public long BusinessId { get; set; }
//public BusinessType BusinessType { get; set; }
/// <summary>
/// 业务编号
/// </summary>

@ -0,0 +1,109 @@
namespace DS.WMS.Core.Fee.Dtos.Report
{
/// <summary>
/// 费用确认单
/// </summary>
public class DebitNote
{
/// <summary>
/// 委托单位
/// </summary>
public string CustomerName { get; set; }
/// <summary>
/// 委托编号
/// </summary>
public string CustomerNo { get; set; }
/// <summary>
/// 主提单号
/// </summary>
public string MBLNO { get; set; }
/// <summary>
/// 分提单号
/// </summary>
public string HBLNO { get; set; }
/// <summary>
/// 起运港
/// </summary>
public string LoadPort { get; set; }
/// <summary>
/// 目的港
/// </summary>
public string DischargePort { get; set; }
/// <summary>
/// 开船日期
/// </summary>
public DateTime? ETD { get; set; }
/// <summary>
/// 箱型箱量
/// </summary>
public string CntrTotal { get; set; }
/// <summary>
/// 船名
/// </summary>
public string Vessel { get; set; }
/// <summary>
/// 航次
/// </summary>
public string Voyno { get; set; }
/// <summary>
/// 费用明细
/// </summary>
public List<DebitNoteItem> Items { get; set; } = [];
}
/// <summary>
/// 费用项
/// </summary>
public class DebitNoteItem
{
/// <summary>
/// 费用名称
/// </summary>
public string FeeName { get; set; }
/// <summary>
/// 计费单位
/// </summary>
public string? Unit { get; set; }
/// <summary>
/// 数量
/// </summary>
public int Quantity { get; set; }
/// <summary>
/// 币种
/// </summary>
public string Currency { get; set; }
/// <summary>
/// 单价
/// </summary>
public decimal UnitPrice { get; set; }
/// <summary>
/// USD金额
/// </summary>
public decimal AmountUSD { get; set; }
/// <summary>
/// RMB金额
/// </summary>
public decimal AmountRMB { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remark { get; set; }
}
}

@ -0,0 +1,250 @@
using DS.Module.Core;
using DS.WMS.Core.Op.Entity;
namespace DS.WMS.Core.Fee.Dtos.Report
{
/// <summary>
/// 利润核算单
/// </summary>
public class ProfitAccounting
{
/// <summary>
/// 客户编号
/// </summary>
public string CustomerCode { get; set; }
/// <summary>
/// 业务编号
/// </summary>
public string CustomerNo { get; set; }
/// <summary>
/// 主提单号
/// </summary>
public string MBLNO { get; set; }
/// <summary>
/// 分提单号
/// </summary>
public string HBLNO { get; set; }
/// <summary>
/// 约主名称
/// </summary>
public string ContractClientName { get; set; }
/// <summary>
/// 运费协议号(约号)
/// </summary>
public string ContractNo { get; set; }
/// <summary>
/// 船代
/// </summary>
public string ShipAgency { get; set; }
/// <summary>
/// 订舱代理(订舱口)
/// </summary>
public string Forwarder { get; set; }
/// <summary>
/// 订舱代理联系人信息
/// </summary>
public Contact? ForwarderContact { get; set; }
/// <summary>
/// 委托单位
/// </summary>
public string CustomerName { get; set; }
/// <summary>
/// 委托单位联系人信息
/// </summary>
public Contact? CustomerContact { get; set; }
/// <summary>
/// 国内发货人
/// </summary>
public string ShipperCn { get; set; }
/// <summary>
/// 国内发货人联系人信息
/// </summary>
public Contact? ShipperCNContact { get; set; }
/// <summary>
/// 箱型箱量
/// </summary>
public string CntrTotal { get; set; }
/// <summary>
/// 品名
/// </summary>
public string GoodsName { get; set; }
/// <summary>
/// 海关代码
/// </summary>
public string HSCode { get; set; }
/// <summary>
/// 起运港
/// </summary>
public string LoadPort { get; set; }
/// <summary>
/// 目的港
/// </summary>
public string DischargePort { get; set; }
/// <summary>
/// 开船日期
/// </summary>
public DateTime? ETD { get; set; }
///// <summary>
///// 预抵日期
///// </summary>
//public DateTime? ETA { get; set; }
/// <summary>
/// 实际开船日期
/// </summary>
public DateTime? ATD { get; set; }
///// <summary>
///// 实际到港日期
///// </summary>
//public DateTime? ATA { get; set; }
/// <summary>
/// 截单日期
/// </summary>
public DateTime? CloseDocDate { get; set; }
/// <summary>
/// 截港日期
/// </summary>
public DateTime? ClosingDate { get; set; }
/// <summary>
/// 场站
/// </summary>
public string Yard { get; set; }
/// <summary>
/// 车队
/// </summary>
public string Trucker { get; set; }
/// <summary>
/// 报关行
/// </summary>
public string Customser { get; set; }
/// <summary>
/// 服务项目
/// </summary>
public string ServiceItem { get; set; }
/// <summary>
/// 内部备注
/// </summary>
public string? Remark { get; set; }
/// <summary>
/// 销售
/// </summary>
public string Sale { get; set; }
/// <summary>
/// 操作
/// </summary>
public string Operator { get; set; }
/// <summary>
/// 客服
/// </summary>
public string CustomerService { get; set; }
/// <summary>
/// 单证
/// </summary>
public string Doc { get; set; }
/// <summary>
/// 费用组
/// </summary>
public List<FeeGroup> FeeGroups { get; set; } = [];
/// <summary>
/// 客户账期(结算日期)
/// </summary>
public string AccountDate { get; set; }
/// <summary>
/// 订舱口账期
/// </summary>
public string ForwarderAccountDate { get; set; }
/// <summary>
/// 占资时长
/// </summary>
public int OccupatedDuration { get; set; }
/// <summary>
/// TEU利润率
/// </summary>
public string TEUProfitMargin { get; set; }
/// <summary>
/// 预计资金使用成本
/// </summary>
public int ECCU { get; set; }
public FeeAuditStatistics Statistics { get; set; }
}
/// <summary>
/// 费用组
/// </summary>
public class FeeGroup
{
/// <summary>
/// 费用名称
/// </summary>
public string FeeName { get; set; }
/// <summary>
/// 待审核费用
/// </summary>
public List<AccountingItem> Items { get; set; }
}
/// <summary>
/// 费用项
/// </summary>
public class AccountingItem
{
/// <summary>
/// 费用类型
/// </summary>
public FeeType FeeType { get; set; }
/// <summary>
/// 金额
/// </summary>
public decimal Amount { get; set; }
/// <summary>
/// 结算对象
/// </summary>
public string CustomerName { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remark { get; set; }
}
}

@ -949,7 +949,7 @@ namespace DS.WMS.Core.Fee.Method
User = User,
ServiceProvider = ServiceProvider
};
var data = provider.GetDataAsync(context);
var data = await provider.GetDataAsync(context);
if (context.ErrorResult == null)
return DataResult<dynamic>.Success(data);

@ -1,5 +1,6 @@
using DS.Module.Core;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Dtos.Report;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Fee.Interface;
using DS.WMS.Core.Op.Entity;
@ -17,7 +18,7 @@ namespace DS.WMS.Core.Fee.Method.ReportProviders
{
public async Task<dynamic?> GetDataAsync(ReportContext context)
{
CostAccountingForm? form = null;
CostAccounting? form = null;
switch (context.BusinessType)
{
case BusinessType.OceanShippingExport:
@ -62,9 +63,9 @@ namespace DS.WMS.Core.Fee.Method.ReportProviders
}
//获取海运出口打印数据
static async Task<CostAccountingForm> GetOceanShippingExportAsync(ISqlSugarClient tenantDb, params long[] idArray)
static async Task<CostAccounting> GetOceanShippingExportAsync(ISqlSugarClient tenantDb, params long[] idArray)
{
CostAccountingForm form = null;
CostAccounting form = null;
var list = await tenantDb.Queryable<FeeRecord>().InnerJoin<SeaExport>((x, y) => x.BusinessId == y.Id)
.Where((x, y) => idArray.Contains(x.Id)
//&& x.FeeStatus == FeeStatus.SettlementCompleted
@ -93,7 +94,7 @@ namespace DS.WMS.Core.Fee.Method.ReportProviders
return form;
var item = list[0];
form = new CostAccountingForm
form = new CostAccounting
{
BusinessNo = item.CustomerNo,
AccountingPeriod = item.AccountDate,

@ -0,0 +1,54 @@
using DS.Module.Core;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Dtos.Report;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Fee.Interface;
using DS.WMS.Core.Op.Entity;
using Masuit.Tools.Systems;
using SqlSugar;
namespace DS.WMS.Core.Fee.Method.ReportProviders
{
/// <summary>
/// 费用确认单
/// </summary>
public class DebitNoteReport : IReportProvider
{
public async Task<dynamic?> GetDataAsync(ReportContext context)
{
DebitNote? form = null;
long id = context.Ids[0];
switch (context.BusinessType)
{
case BusinessType.OceanShippingExport:
form = await context.TenantDb.Queryable<SeaExport>().Where(s => s.Id == id).Select<DebitNote>().FirstAsync();
break;
case BusinessType.OceanShippingImport:
break;
default:
context.ErrorResult = DataResult.Failed(string.Format(MultiLanguageConst.GetDescription(
MultiLanguageConst.BusinessNotSupported), context.BusinessType.GetDescription()));
break;
}
if (form != null)
{
form.Items = await context.TenantDb.Queryable<FeeRecord>().Where(x => x.BusinessId == id && x.BusinessType == context.BusinessType)
.Select(x => new DebitNoteItem
{
FeeName = x.FeeName,
Unit = x.UnitText,
Quantity = (int)x.Quantity,
Currency = x.Currency,
AmountRMB = x.Currency == FeeCurrency.RMB_CODE ? x.Amount : 0,
AmountUSD = x.Currency == FeeCurrency.USD_CODE ? x.Amount : 0,
UnitPrice = x.TaxUnitPrice,
Remark = x.Remark
}).ToListAsync();
}
return form;
}
}
}

@ -0,0 +1,110 @@
using DS.Module.Core;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Dtos.Report;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Fee.Interface;
using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Op.Entity;
using Masuit.Tools.Systems;
namespace DS.WMS.Core.Fee.Method.ReportProviders
{
/// <summary>
/// 利润核算单
/// </summary>
public class ProfitAccountingReport : IReportProvider
{
internal static readonly string[] CustomerTypes = ["booking", "controller", "shippercn"];
public async Task<dynamic?> GetDataAsync(ReportContext context)
{
ProfitAccounting? form = null;
long id = context.Ids[0];
switch (context.BusinessType)
{
case BusinessType.OceanShippingExport:
form = await context.TenantDb.Queryable<SeaExport>().Where(s => s.Id == id)
.LeftJoin<InfoClient>((s, c) => s.CustomerId == c.Id)
.Select((s, c) => new ProfitAccounting
{
CustomerCode = c.CodeName,
Sale = s.Sale,
Operator = s.OperatorName,
CustomerService = s.CustomerServiceName,
Doc = s.DocName
}, true).FirstAsync();
break;
case BusinessType.OceanShippingImport:
break;
default:
context.ErrorResult = DataResult.Failed(string.Format(MultiLanguageConst.GetDescription(
MultiLanguageConst.BusinessNotSupported), context.BusinessType.GetDescription()));
break;
}
if (form != null)
{
var contacts = await context.TenantDb.Queryable<BusinessOrderContact>().Where(c1 => c1.BusinessId == id && CustomerTypes.Contains(c1.CustomerType))
.Select(x => new Contact
{
Name = x.Name,
Tel = x.Tel,
Mobile = x.Mobile,
Email = x.Email,
CustomerType = x.CustomerType
}).ToListAsync();
form.ForwarderContact = contacts.Find(x => x.CustomerType == "booking");
form.CustomerContact = contacts.Find(x => x.CustomerType == "controller");
form.ShipperCNContact = contacts.Find(x => x.CustomerType == "shippercn");
var list = await context.TenantDb.Queryable<FeeRecord>().Where(x => x.BusinessId == id && x.BusinessType == context.BusinessType)
.Select<FeeRecordRes>().ToListAsync();
if (list.Count > 0)
{
form.Statistics = new FeeAuditStatistics(list);
for (int i = 0; i < list.Count; i++)
{
var fee = list[i];
var item = new AccountingItem
{
Amount = Math.Round(fee.Amount.GetValueOrDefault(), 0, MidpointRounding.AwayFromZero),
CustomerName = fee.CustomerName,
FeeType = fee.FeeType,
Remark = fee.Remark
};
var group = form.FeeGroups.Find(x => x.FeeName == fee.FeeName && x.Items?.Count < 2);
if (group == null)
{
group = new FeeGroup
{
FeeName = fee.FeeName,
Items = [item]
};
form.FeeGroups.Add(group);
}
else if (group.Items.Exists(x => x.FeeType == fee.FeeType))
{
group = new FeeGroup
{
FeeName = fee.FeeName,
Items = [item]
};
form.FeeGroups.Add(group);
}
else
{
group.Items.Add(item);
}
}
}
}
return form;
}
}
}

@ -167,6 +167,11 @@
/// 邮箱
/// </summary>
public string? Email { get; set; }
/// <summary>
/// 类型
/// </summary>
public string? CustomerType { get; set; }
}
/// <summary>

@ -200,7 +200,7 @@ namespace DS.WMS.FeeApi.Controllers
}
/// <summary>
/// 获取费用核算单打印信息
/// 获取费用打印数据
/// </summary>
/// <param name="model">费用记录ID</param>
/// <returns></returns>

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<NameOfLastUsedPublishProfile>D:\Code\ds8-solution-pro\ds-wms-service\DS.WMS.MainApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<NameOfLastUsedPublishProfile>D:\Source\Repos\DS8\ds-wms-service\DS.WMS.MainApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
</PropertyGroup>
</Project>
Loading…
Cancel
Save