|
|
|
@ -38,12 +38,6 @@ namespace DS.WMS.Core.Settlement.Method
|
|
|
|
|
{
|
|
|
|
|
var query = TenantDb.Queryable<ApplicationSettlement>().Select(x => new PaymentSettlementDto
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
ApplicationNO = x.ApplicationNO, //申请编号
|
|
|
|
|
SettlementNO = x.SettlementNO, //结算单号
|
|
|
|
|
CustomerId = x.CustomerId, //结算单位
|
|
|
|
|
CustomerName = x.CustomerName,
|
|
|
|
|
Mode = x.Mode, //结算类型
|
|
|
|
|
SettlementTypeName = x.SettlementType.StlName, //结算方式
|
|
|
|
|
RMBAmount = SqlFunc.Subqueryable<ApplicationDetail>().Where(y => y.ApplicationId == x.Id && y.Currency == FeeCurrency.RMB_CODE)
|
|
|
|
|
.Select(y => SqlFunc.AggregateSum(y.ApplyAmount)),
|
|
|
|
@ -51,32 +45,12 @@ namespace DS.WMS.Core.Settlement.Method
|
|
|
|
|
.Select(y => SqlFunc.AggregateSum(y.ApplyAmount)),
|
|
|
|
|
OtherAmount = SqlFunc.Subqueryable<ApplicationDetail>().Where(y => y.ApplicationId == x.Id && y.Currency != FeeCurrency.RMB_CODE && y.Currency != FeeCurrency.USD_CODE)
|
|
|
|
|
.Select(y => SqlFunc.AggregateSum(y.ApplyAmount)),
|
|
|
|
|
Note = x.Note, //备注
|
|
|
|
|
CustomerAccount = x.CustomerBank.AccountName + "/" + x.CustomerBank.Currency,
|
|
|
|
|
CustomerBank = x.CustomerBank.BankName,
|
|
|
|
|
CustomerBankName = x.CustomerBank.BankName,
|
|
|
|
|
//未开票
|
|
|
|
|
UnInvoiceList = SqlFunc.Subqueryable<ApplicationDetail>().InnerJoin<FeeRecord>((d, f) => d.RecordId == f.Id && (f.Amount - f.InvoiceAmount - f.OrderInvoiceAmount) != 0)
|
|
|
|
|
.GroupBy((d, f) => f.Currency).ToList((d, f) => new CurrencyAmount { Currency = f.Currency, Amount = f.Amount - f.InvoiceAmount - f.OrderInvoiceAmount }),
|
|
|
|
|
CreateBy = x.CreateBy, //结算人
|
|
|
|
|
CreateTime = x.CreateTime, //创建日期
|
|
|
|
|
SettlementDate = x.SettlementDate, //结算日期
|
|
|
|
|
IsExportVoucher = default, //是否导出凭证
|
|
|
|
|
Currency = x.Currency, //币别
|
|
|
|
|
Amount = x.Amount, //原始金额
|
|
|
|
|
AccountAmount = x.AccountAmount, //记账资料
|
|
|
|
|
PrePayAmount = x.PrePayAmount, //预付支资料
|
|
|
|
|
AHSRAmount = x.AHSRAmount, //实收支资料
|
|
|
|
|
FinancialAmount = x.FinancialAmount,//财务费用
|
|
|
|
|
AdvanceAmount = x.AdvanceAmount, //预收支资料
|
|
|
|
|
IsLocked = x.IsLocked, //锁定状态
|
|
|
|
|
LockTime = x.LockTime,
|
|
|
|
|
LockUserId = x.LockUserId,
|
|
|
|
|
UnlockTime = x.UnlockTime,
|
|
|
|
|
UnlockUserId = x.UnlockUserId,
|
|
|
|
|
IsVoucherDisabled = x.IsVoucherDisabled, //禁用凭证
|
|
|
|
|
SaleDeptId = x.SaleDeptId, //所属分部
|
|
|
|
|
LedgerVoucherNO = x.LedgerVoucherNO //总账凭证号
|
|
|
|
|
});
|
|
|
|
|
}, true);
|
|
|
|
|
|
|
|
|
|
var whereList = request.GetConditionalModels(Db);
|
|
|
|
|
var result = await query.Where(whereList).ToQueryPageAsync(request.PageCondition);
|
|
|
|
|