FullInvoiceItem

This commit is contained in:
mmrbnjd
2024-07-20 17:34:28 +03:30
parent cb8c69d81b
commit bd99459bc2
5 changed files with 158 additions and 125 deletions

View File

@@ -80,24 +80,24 @@ namespace Back.Controllers
if (result == null)
return BadRequest(new List<string> { "صورتحساب یافت نشد" });
else
{
if (result.invoiceType == InvoiceType.Bidding)
return BadRequest(new List<string> { "صورتحساب در وضعیت پیش نویس نمیتواند آماده ارسال شود" });
//else
//{
// if (result.invoiceType == InvoiceType.Bidding)
// return BadRequest(new List<string> { "صورتحساب در وضعیت پیش نویس نمیتواند آماده ارسال شود" });
if (await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result))
return BadRequest(new List<string> { "این صورتحساب قبلا به سازمان ارسال شده" });
// if (await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result))
// return BadRequest(new List<string> { "این صورتحساب قبلا به سازمان ارسال شده" });
if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
&& !result.BillReference.HasValue)
return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع وجود داشته باشد" });
// if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
// && !result.BillReference.HasValue)
// return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع وجود داشته باشد" });
if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
&& !await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result.invoice))
return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع به سامانه مودیان ارسال شده باشد" });
// if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
// && !await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result.invoice))
// return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع به سامانه مودیان ارسال شده باشد" });
}
//}
return Ok(await _servTaxPayer.PreparationInvoiceBeforeSending(item, result));

View File

@@ -25,12 +25,12 @@ namespace Back.Data.Models
public string? mu { get { return cODItem != null ? cODItem.CODUnit.UnitTaxID : null; } }
//میزان ارز
[MaxLength(18)]
public decimal? cfee { get { return fee / exr; } }
public decimal? cfee { get { return exr==null || exr==0 ? null : fee / exr; } }
//مبلغ مالیات بر ارزش افزوده
[MaxLength(18)]
public decimal? vam { get
{
return invoice?.pattern?.inp == 9 ? fee*vra/100 :
return vra==0 ? 0 : invoice?.pattern?.inp == 9 ? fee*vra/100 :
invoice?.pattern?.inp == 13 ? ((tcpbs+9)/100)+((prdis*vra)/100)
: vra * adis / 100;
} }

View File

@@ -33,81 +33,79 @@ namespace Back.Services
}
#endregion
//-----------------------
return await invok
var item= await invok
.Include(inc => inc.invoiceDetails)
.ThenInclude(inc => inc.cODItem)
.ThenInclude(inc => inc.CODUnit)
.Include(inc => inc.Customer)
.Include(inc => inc.sentTax)
//.Include(inc => inc.payments)
.Include(inc => inc.pattern)
.ThenInclude(inc => inc.BillType)
.Select(s => new InvoiceDTO()
{
IsDeleted = s.IsDeleted,
PatternID = s.PatternID,
PatternTitle = s.pattern.Title,
CustomerID = s.CustomerID,
CustomerName = s.Customer.FullName,
ID = s.ID,
InvoiceDate = s.InvoiceDate.ShamciToFormatShamci(),
invoiceTypeTitle = s.invoiceType.GetEnumDisplayName(),
invoiceType = s.invoiceType,
Title = s.Title,
InvoicIssueDate = s.InvoicIssueDate.ShamciToFormatShamci(),
BillReference = s.BillReference,
tbill = s.tbill,
Des = s.Des,
PreparedtoSendtoTax = s.PreparedtoSendtoTax,
tdis = s.tdis,
//
tvam = s.tvam,
Udate = s.Udate.ShamciToFormatShamci(),
.ThenInclude(inc => inc.BillType).FirstOrDefaultAsync();
return new InvoiceDTO()
{
InvoiceSendTaxs = s.sentTax.OrderBy(o => o.ID).Select(s => new SentTaxDto()
{
Date = s.Date.ShamciToFormatShamci(),
Time = s.Time,
ID = s.ID,
InvoiceID = s.InvoiceID,
SentStatus = s.SentStatus,
InvoiceType = s.InvoiceType,
msgInvoiceType = s.InvoiceType.GetEnumDisplayName(),
msgSentStatus = s.SentStatus.GetEnumDisplayName()
}).ToList(),
//items = s.invoiceDetails.OrderBy(o => o.ID).Select(x => new InvoiceItemDTO()
//{
// ID = x.ID,
// CODID = x.CODID,
// adis = x.adis,
// am = x.am.Value,
// dis = x.dis,
// fee = x.fee.Value,
// mu = x.unitTitle,
// sstt = x.sstt,
// tsstam = x.tsstam,
// vam = x.vam,
// vra = x.vra,
// prdis = x.prdis
//}).ToList(),
payments = new List<InvoicePaymentDTO>()
//s.payments.OrderBy(o => o.ID).Select(x => new InvoicePaymentDTO()
//{
// ID = x.ID,
// acn = x.acn,
// iinn = x.acn,
// pcn = x.acn,
// pdt = x.pdt,
// PaymentDateTime=x.PaymentDateTime,
// pid = x.pid,
// pmt = x.pmt,
// pv = x.pv,
// trmn = x.trmn,
// trn = x.acn
//}).ToList()
})
.FirstOrDefaultAsync();
IsDeleted = item.IsDeleted,
PatternID = item.PatternID,
PatternTitle = item.pattern.Title,
CustomerID = item.CustomerID,
CustomerName = item.Customer.FullName,
ID = item.ID,
InvoiceDate = item.InvoiceDate.ShamciToFormatShamci(),
invoiceTypeTitle = item.invoiceType.GetEnumDisplayName(),
invoiceType = item.invoiceType,
Title = item.Title,
InvoicIssueDate = item.InvoicIssueDate.ShamciToFormatShamci(),
BillReference = item.BillReference,
tbill = item.tbill,
Des = item.Des,
PreparedtoSendtoTax = item.PreparedtoSendtoTax,
tdis = item.tdis,
tvam = item.tvam,
Udate = item.Udate.ShamciToFormatShamci(),
InvoiceSendTaxs = item.sentTax.OrderBy(o => o.ID).Select(s => new SentTaxDto()
{
Date = s.Date.ShamciToFormatShamci(),
Time = s.Time,
ID = s.ID,
InvoiceID = s.InvoiceID,
SentStatus = s.SentStatus,
InvoiceType = s.InvoiceType,
msgInvoiceType = s.InvoiceType.GetEnumDisplayName(),
msgSentStatus = s.SentStatus.GetEnumDisplayName()
}).ToList(),
items = item.invoiceDetails.OrderBy(o => o.ID).Select(x => new InvoiceItemDTO()
{
ID = x.ID,
CODID = x.CODID,
adis = x.adis,
am = x.am.Value,
dis = x.dis,
fee = x.fee.Value,
mu = x.unitTitle,
sstt = x.sstt,
tsstam = x.tsstam,
vam = x.vam,
vra = x.vra,
prdis = x.prdis
}).ToList(),
payments = new List<InvoicePaymentDTO>()
//s.payments.OrderBy(o => o.ID).Select(x => new InvoicePaymentDTO()
//{
// ID = x.ID,
// acn = x.acn,
// iinn = x.acn,
// pcn = x.acn,
// pdt = x.pdt,
// PaymentDateTime=x.PaymentDateTime,
// pid = x.pid,
// pmt = x.pmt,
// pv = x.pv,
// trmn = x.trmn,
// trn = x.acn
//}).ToList()
};
}