|
|
@ -25,6 +25,7 @@ namespace DS.WMS.Core.Fee.Method.ReportProviders
|
|
|
|
form = await context.TenantDb.Queryable<SeaExport>().Where(s => s.Id == context.BusinessId)
|
|
|
|
form = await context.TenantDb.Queryable<SeaExport>().Where(s => s.Id == context.BusinessId)
|
|
|
|
.Select(s => new ProfitAccounting
|
|
|
|
.Select(s => new ProfitAccounting
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
Id = s.Id,
|
|
|
|
ETDValue = s.ETD,
|
|
|
|
ETDValue = s.ETD,
|
|
|
|
Operator = s.OperatorName,
|
|
|
|
Operator = s.OperatorName,
|
|
|
|
CustomerService = s.CustomerServiceName,
|
|
|
|
CustomerService = s.CustomerServiceName,
|
|
|
@ -66,56 +67,86 @@ namespace DS.WMS.Core.Fee.Method.ReportProviders
|
|
|
|
x.RemarkType,
|
|
|
|
x.RemarkType,
|
|
|
|
x.Remark
|
|
|
|
x.Remark
|
|
|
|
}).ToListAsync();
|
|
|
|
}).ToListAsync();
|
|
|
|
form.InternalRemark = remarks.Find(x => x.RemarkType == "1")?.Remark;
|
|
|
|
form.InternalRemark = string.Join(Environment.NewLine, remarks.Where(x => x.RemarkType == "1").Select(x => x.Remark));
|
|
|
|
form.CabinRemark = remarks.Find(x => x.RemarkType == "2")?.Remark;
|
|
|
|
form.CabinRemark = string.Join(Environment.NewLine, remarks.Where(x => x.RemarkType == "2").Select(x => x.Remark));
|
|
|
|
form.BookingRemark = remarks.Find(x => x.RemarkType == "3")?.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)
|
|
|
|
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))
|
|
|
|
.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)
|
|
|
|
if (list.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
form.Statistics = new FeeAuditStatistics(list);
|
|
|
|
form.Statistics = new FeeAuditStatistics(list);
|
|
|
|
for (int i = 0; i < list.Count; i++)
|
|
|
|
for (int i = 0; i < list.Count; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var fee = list[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),
|
|
|
|
if (item == null || string.IsNullOrEmpty(item.RecvAmount))
|
|
|
|
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
|
|
|
|
item = new AccountingItem
|
|
|
|
{
|
|
|
|
{
|
|
|
|
FeeName = fee.FeeName,
|
|
|
|
FeeName = fee.FeeName,
|
|
|
|
Items = [item]
|
|
|
|
RecvAmount = amount,
|
|
|
|
|
|
|
|
RecvCustomerName = fee.CustomerName,
|
|
|
|
|
|
|
|
RecvRemark = fee.Remark
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
form.FeeGroups.Add(item);
|
|
|
|
form.FeeGroups.Add(group);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (group.Items.Exists(x => x.FeeType == fee.FeeType))
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
group = new FeeGroup
|
|
|
|
item.RecvAmount = amount;
|
|
|
|
|
|
|
|
item.RecvCustomerName = fee.CustomerName;
|
|
|
|
|
|
|
|
item.RecvRemark = fee.Remark;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (item == null || string.IsNullOrEmpty(item.PayAmount))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
item = new AccountingItem
|
|
|
|
{
|
|
|
|
{
|
|
|
|
FeeName = fee.FeeName,
|
|
|
|
FeeName = fee.FeeName,
|
|
|
|
Items = [item]
|
|
|
|
PayAmount = amount,
|
|
|
|
|
|
|
|
PayCustomerName = fee.CustomerName,
|
|
|
|
|
|
|
|
PayRemark = fee.Remark
|
|
|
|
};
|
|
|
|
};
|
|
|
|
form.FeeGroups.Add(group);
|
|
|
|
form.FeeGroups.Add(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
group.Items.Add(item);
|
|
|
|
item.PayAmount = amount;
|
|
|
|
|
|
|
|
item.PayCustomerName = fee.CustomerName;
|
|
|
|
|
|
|
|
item.PayRemark = fee.Remark;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 form ?? new ProfitAccounting { Statistics = new FeeAuditStatistics(new List<FeeRecordRes>()) };
|
|
|
|
return symbol;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|