|
|
@ -136,8 +136,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
|
|
|
|
var _detail = await _bbacMng.GetDetailAsync(invbillNum, EnumBusinessType.MaiDanJianBBAC).ConfigureAwait(false);//查出买单数量
|
|
|
|
var invoiceGrpDetails = _settleAccountDbContext.Set<INVOICE_WAIT_DETAIL>() |
|
|
|
.Where(t => t.InvbillNum == invbillNum) |
|
|
|
.ToList(); |
|
|
|
.Where(t => t.InvbillNum == invbillNum) |
|
|
|
.ToList(); |
|
|
|
if (invoiceGrpDetails.Any()) |
|
|
|
{ |
|
|
|
var tedSaInvs = new List<TED_SAS_INVOICE>(); |
|
|
@ -158,6 +158,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
List<INVOICE_WAIT_DETAIL> invdetials = new List<INVOICE_WAIT_DETAIL>(); |
|
|
|
foreach (var itm in invoiceGrpDetails) |
|
|
|
{ |
|
|
|
itm.SetProperty("ErpToLoc",$"C{invoiceGrp.ClientCode}"); |
|
|
|
invdetials.Add(itm);//添加发票明细
|
|
|
|
var first = _detail.FirstOrDefault(p => p.ContractDocID == itm.Extend1 && p.PartCode == itm.PartCode ); |
|
|
|
if (first == null) |
|
|
@ -203,14 +204,29 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
InvoiceNetAmount = invoiceGrpDetail.Amt, |
|
|
|
InvoiceTaxAmount = Math.Round(invoiceGrpDetail.Amt * 0.13m, 2), |
|
|
|
TaxRate = 0.13m, |
|
|
|
Location = invoiceGrp.GetProperty("ErpToLoc", string.Empty), |
|
|
|
Location = invoiceGrpDetail.GetProperty("ErpToLoc", string.Empty), |
|
|
|
begintime = invoiceGrpDetail.BeginDate, |
|
|
|
endtime = invoiceGrpDetail.EndDate, |
|
|
|
domain = "BJBMPT", |
|
|
|
LINE = (i + 1).ToString() |
|
|
|
}); |
|
|
|
} |
|
|
|
tedSaInvs.FirstOrDefault().InvoiceTaxAmount += invoiceGrp.TaxDiff; |
|
|
|
|
|
|
|
var invbefore = invoiceGrp.TaxAmt + invoiceGrp.TaxDiff; |
|
|
|
var invafter=tedSaInvs.Sum(p => p.InvoiceNetAmount) + tedSaInvs.Sum(p => p.InvoiceTaxAmount); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var invdiff = invbefore - invafter; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tedSaInvs.FirstOrDefault(p => p.LINE == "2").InvoiceTaxAmount +=invdiff; |
|
|
|
tedSaInvs.FirstOrDefault(p => p.LINE == "1").InvoiceTaxAmount += invoiceGrp.TaxDiff; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//红冲发票提交QAD
|
|
|
|
if (!string.IsNullOrEmpty(invoiceGrp.ParentInvbillNum)) |
|
|
|
{ |
|
|
|