...
This commit is contained in:
@@ -24,88 +24,92 @@ namespace Back.Services
|
||||
{
|
||||
#region AdvancedSearch
|
||||
var invok = _invoiceRepo
|
||||
.Get(w => w.CompanyID == CompanyID && w.ID == ID);
|
||||
.Get(w => w.CompanyID == CompanyID && w.ID == ID);
|
||||
if (notloaddelete)
|
||||
{
|
||||
invok = invok
|
||||
.Where(w => !w.IsDeleted);
|
||||
|
||||
}
|
||||
invok = invok
|
||||
.Where(w => !w.IsDeleted);
|
||||
|
||||
}
|
||||
#endregion
|
||||
//-----------------------
|
||||
return await invok
|
||||
.Include(inc => inc.invoiceDetails)
|
||||
.ThenInclude(inc => inc.cODItem)
|
||||
.ThenInclude(inc => inc.CODUnit)
|
||||
.Include(inc=>inc.sentTax)
|
||||
//.Include(inc => inc.payments)
|
||||
.Include(inc => inc.pattern)
|
||||
.Select(s => new InvoiceDTO()
|
||||
{
|
||||
// ExternalAccessCode=s.ExternalAccessCode,
|
||||
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(),
|
||||
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();
|
||||
|
||||
|
||||
return await invok
|
||||
.Include(inc => inc.invoiceDetails)
|
||||
.ThenInclude(inc => inc.cODItem)
|
||||
.ThenInclude(inc => inc.CODUnit)
|
||||
.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(),
|
||||
|
||||
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();
|
||||
|
||||
|
||||
}
|
||||
public async Task<PagingDto<InvoiceGridDTO>?> GetInvoices(int CompanyID, ItemSerchGetInvoices itemSerch)
|
||||
{
|
||||
@@ -126,10 +130,10 @@ namespace Back.Services
|
||||
invok = invok.Where(w => w.Title.Contains(itemSerch.Title));
|
||||
|
||||
if (itemSerch.refInvoiceID != null)
|
||||
invok = invok.Where(w => w.BillReference==itemSerch.refInvoiceID);
|
||||
invok = invok.Where(w => w.BillReference == itemSerch.refInvoiceID);
|
||||
|
||||
if(itemSerch.CodID != null)
|
||||
invok = invok.Where(w => w.invoiceDetails.Any(wa=>wa.CODID== itemSerch.CodID));
|
||||
if (itemSerch.CodID != null)
|
||||
invok = invok.Where(w => w.invoiceDetails.Any(wa => wa.CODID == itemSerch.CodID));
|
||||
//foreach (InputObj item in inputObjs)
|
||||
// invok = invok.Where(ExMethod.GetFunc<Customer>(item.Param, item.Value));
|
||||
|
||||
@@ -143,7 +147,7 @@ namespace Back.Services
|
||||
.Include(inc => inc.pattern)
|
||||
.Select(s => new InvoiceGridDTO()
|
||||
{
|
||||
|
||||
|
||||
CustomerID = s.CustomerID,
|
||||
CustomerName = s.Customer.FullName,
|
||||
ID = s.ID,
|
||||
@@ -163,7 +167,7 @@ namespace Back.Services
|
||||
return await _invoiceRepo.Get(w => w.ID == InvoiceID && w.CompanyID == CompanyID && !w.IsDeleted).AnyAsync();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public async Task<bool> checkFatherInvoiceByInvoiceID(int CompanyID, int InvoiceID)
|
||||
{
|
||||
return await _invoiceRepo.Get(w => w.BillReference == InvoiceID && w.CompanyID == CompanyID && !w.IsDeleted).AnyAsync();
|
||||
@@ -183,12 +187,12 @@ namespace Back.Services
|
||||
var item = await _invoiceRepo.AddAsync(invoice);
|
||||
return item.ID;
|
||||
}
|
||||
catch (Exception ex )
|
||||
catch (Exception ex)
|
||||
{
|
||||
return -1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return -1;
|
||||
@@ -203,9 +207,9 @@ namespace Back.Services
|
||||
catch (Exception ex)
|
||||
{
|
||||
return -1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -221,7 +225,7 @@ namespace Back.Services
|
||||
{
|
||||
return await _invoiceRepo
|
||||
.Get(w => w.ID == InvoiceID && w.CompanyID == CompanyID && !w.IsDeleted)
|
||||
.Include(inc=>inc.invoiceDetails)
|
||||
.Include(inc => inc.invoiceDetails)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
public async Task<bool> DeleteInvoice(Invoice item)
|
||||
|
Reference in New Issue
Block a user