|
|
|
@ -25,6 +25,7 @@ namespace DS.WMS.Core.Fee.Method.ReportProviders
|
|
|
|
|
form = await context.TenantDb.Queryable<SeaExport>().Where(s => s.Id == context.BusinessId)
|
|
|
|
|
.Select(s => new ProfitAccounting
|
|
|
|
|
{
|
|
|
|
|
Id = s.Id,
|
|
|
|
|
ETDValue = s.ETD,
|
|
|
|
|
Operator = s.OperatorName,
|
|
|
|
|
CustomerService = s.CustomerServiceName,
|
|
|
|
@ -66,56 +67,86 @@ namespace DS.WMS.Core.Fee.Method.ReportProviders
|
|
|
|
|
x.RemarkType,
|
|
|
|
|
x.Remark
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
form.InternalRemark = remarks.Find(x => x.RemarkType == "1")?.Remark;
|
|
|
|
|
form.CabinRemark = remarks.Find(x => x.RemarkType == "2")?.Remark;
|
|
|
|
|
form.BookingRemark = remarks.Find(x => x.RemarkType == "3")?.Remark;
|
|
|
|
|
form.InternalRemark = string.Join(Environment.NewLine, remarks.Where(x => x.RemarkType == "1").Select(x => x.Remark));
|
|
|
|
|
form.CabinRemark = string.Join(Environment.NewLine, remarks.Where(x => x.RemarkType == "2").Select(x => x.Remark));
|
|
|
|
|
form.BookingRemark = string.Join(Environment.NewLine, remarks.Where(x => x.RemarkType == "3").Select(x => x.Remark));
|
|
|
|
|
|
|
|
|
|
var list = await context.TenantDb.Queryable<FeeRecord>().Where(x => x.BusinessId == context.BusinessId && x.BusinessType == context.BusinessType)
|
|
|
|
|
.WhereIF(context.Ids != null && context.Ids.Length > 0, x => context.Ids.Contains(x.Id))
|
|
|
|
|
.Select<FeeRecordRes>().ToListAsync();
|
|
|
|
|
.OrderByDescending(x => x.Currency).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
|
|
|
|
|
AccountingItem? item = form.FeeGroups.Find(x => x.FeeName == fee.FeeName);
|
|
|
|
|
string amount = $"{GetSymbol(fee.Currency)}{Math.Round(fee.Amount.GetValueOrDefault(), 0, MidpointRounding.AwayFromZero)}";
|
|
|
|
|
if (fee.FeeType == FeeType.Receivable)
|
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
|
if (item == null || string.IsNullOrEmpty(item.RecvAmount))
|
|
|
|
|
{
|
|
|
|
|
FeeName = fee.FeeName,
|
|
|
|
|
Items = [item]
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
form.FeeGroups.Add(group);
|
|
|
|
|
}
|
|
|
|
|
else if (group.Items.Exists(x => x.FeeType == fee.FeeType))
|
|
|
|
|
{
|
|
|
|
|
group = new FeeGroup
|
|
|
|
|
item = new AccountingItem
|
|
|
|
|
{
|
|
|
|
|
FeeName = fee.FeeName,
|
|
|
|
|
RecvAmount = amount,
|
|
|
|
|
RecvCustomerName = fee.CustomerName,
|
|
|
|
|
RecvRemark = fee.Remark
|
|
|
|
|
};
|
|
|
|
|
form.FeeGroups.Add(item);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FeeName = fee.FeeName,
|
|
|
|
|
Items = [item]
|
|
|
|
|
};
|
|
|
|
|
form.FeeGroups.Add(group);
|
|
|
|
|
item.RecvAmount = amount;
|
|
|
|
|
item.RecvCustomerName = fee.CustomerName;
|
|
|
|
|
item.RecvRemark = fee.Remark;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
group.Items.Add(item);
|
|
|
|
|
if (item == null || string.IsNullOrEmpty(item.PayAmount))
|
|
|
|
|
{
|
|
|
|
|
item = new AccountingItem
|
|
|
|
|
{
|
|
|
|
|
FeeName = fee.FeeName,
|
|
|
|
|
PayAmount = amount,
|
|
|
|
|
PayCustomerName = fee.CustomerName,
|
|
|
|
|
PayRemark = fee.Remark
|
|
|
|
|
};
|
|
|
|
|
form.FeeGroups.Add(item);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
item.PayAmount = amount;
|
|
|
|
|
item.PayCustomerName = fee.CustomerName;
|
|
|
|
|
item.PayRemark = fee.Remark;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return form ?? new ProfitAccounting { Statistics = new FeeAuditStatistics(new List<FeeRecordRes>()) };
|
|
|
|
|
return form ?? new ProfitAccounting { Statistics = new FeeAuditStatistics([]) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static char GetSymbol(string currency)
|
|
|
|
|
{
|
|
|
|
|
char symbol = default;
|
|
|
|
|
switch (currency)
|
|
|
|
|
{
|
|
|
|
|
case "RMB":
|
|
|
|
|
symbol = '¥';
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "USD":
|
|
|
|
|
symbol = '$';
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return symbol;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|