|
|
|
@ -12,6 +12,7 @@ using DS.WMS.Core.Invoice.Interface;
|
|
|
|
|
using DS.WMS.Core.Sys.Entity;
|
|
|
|
|
using DS.WMS.Core.Sys.Interface;
|
|
|
|
|
using Mapster;
|
|
|
|
|
using Masuit.Tools.Models;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
|
|
|
|
@ -142,7 +143,7 @@ namespace DS.WMS.Core.Invoice.Method
|
|
|
|
|
LoadPort = x.LoadPort,
|
|
|
|
|
Vessel = x.Vessel,
|
|
|
|
|
Voyage = x.Voyage,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
invoice.Summary = invoice.Details.GroupBy(x => new { x.FeeType, x.Currency }).Select(x => new SummaryItem
|
|
|
|
@ -321,13 +322,11 @@ namespace DS.WMS.Core.Invoice.Method
|
|
|
|
|
}
|
|
|
|
|
else if (string.IsNullOrEmpty(app.Currency)) //原币申请
|
|
|
|
|
{
|
|
|
|
|
detail.ExchangeRate = app.ExchangeRates.FirstOrDefault(
|
|
|
|
|
x => x.Currency == invoice.Currency)?.ExchangeRate;
|
|
|
|
|
detail.ExchangeRate = app.ExchangeRates.FirstOrDefault(x => x.Currency == item.Currency)?.ExchangeRate;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
detail.ExchangeRate = app.ExchangeRates.FirstOrDefault(
|
|
|
|
|
x => x.Currency == invoice.Currency)?.ExchangeRate;
|
|
|
|
|
detail.ExchangeRate = app.ExchangeRates.FirstOrDefault(x => x.Currency == invoice.Currency)?.ExchangeRate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -574,7 +573,7 @@ namespace DS.WMS.Core.Invoice.Method
|
|
|
|
|
if (code == null || string.IsNullOrEmpty(code.Name))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (option == BuildOption.Update && codeList.IndexOf(code) == 0)//取第一条发票代码税率
|
|
|
|
|
if (option == BuildOption.Create && codeList.IndexOf(code) == 0)//取第一条发票代码税率
|
|
|
|
|
invoice.TaxRate = code.TaxRate;
|
|
|
|
|
|
|
|
|
|
var invDetail = invoice.InvoiceDetails.Find(x => x.CodeId == code.Id);
|
|
|
|
@ -586,16 +585,14 @@ namespace DS.WMS.Core.Invoice.Method
|
|
|
|
|
CodeId = code.Id,
|
|
|
|
|
Name = code.Name,
|
|
|
|
|
Quantity = 1,
|
|
|
|
|
TaxUnitPrice = invoice.Details.FindAll(x => x.Currency == code.DefaultCurrency).Sum(x => x.ApplyAmount),
|
|
|
|
|
TaxUnitPrice = detail.ApplyAmount,
|
|
|
|
|
TaxRate = code.TaxRate,
|
|
|
|
|
Specification = code.Specification,
|
|
|
|
|
Unit = code.Unit,
|
|
|
|
|
Category = DetailCategory.InvoiceApplication
|
|
|
|
|
Category = DetailCategory.InvoiceIssuance
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
invDetail.TaxAmount = invDetail.TaxUnitPrice * invoice.TaxRate;
|
|
|
|
|
invDetail.UnitPrice = invDetail.TaxUnitPrice - invDetail.TaxAmount;
|
|
|
|
|
invDetail.Amount = invDetail.TaxUnitPrice * invDetail.Quantity;
|
|
|
|
|
invDetail.Amount = invDetail.TaxUnitPrice;
|
|
|
|
|
invoice.InvoiceDetails.Add(invDetail);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -603,6 +600,12 @@ namespace DS.WMS.Core.Invoice.Method
|
|
|
|
|
invDetail.Amount += detail.ApplyAmount;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var item in invoice.InvoiceDetails)
|
|
|
|
|
{
|
|
|
|
|
item.TaxAmount = item.Amount * (invoice.TaxRate / 100);
|
|
|
|
|
item.UnitPrice += item.Amount - item.TaxAmount;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|