This commit is contained in:
mmrbnjd
2024-05-29 15:51:06 +03:30
parent 8efa1d6f81
commit 85a72bc1ad
6 changed files with 96 additions and 48 deletions

View File

@@ -92,7 +92,7 @@ namespace Back.Services
{
#region AdvancedSearch
var invok = _invoiceRepo
.Get(w => w.CompanyID == CompanyID && !w.IsDeleted);
.Get(w => w.CompanyID == CompanyID && !w.IsDeleted && !w.BillReference.HasValue);
if (itemSerch.InvoiceID != null)
invok = invok.Where(w => w.ID == itemSerch.InvoiceID);
@@ -209,7 +209,7 @@ namespace Back.Services
}
}
public async Task<bool> ChangeInvoiceType(Invoice invoiceitem, InvoiceType item, bool action = true)
public async Task<InvoiceDTO?> ChangeInvoiceType(Invoice invoiceitem, InvoiceType item, bool action = true)
{
string old = invoiceitem.invoiceType.GetEnumDisplayName();
invoiceitem.invoiceType = item;
@@ -226,8 +226,19 @@ namespace Back.Services
UserID = invoiceitem.LastChangeUserID
});
if (action)
return await _invoiceRepo.UpdateAsync(invoiceitem);
else return true;
{
var result = await _invoiceRepo.UpdateAsync(invoiceitem);
if (result)
{
return await GetInvoice(invoiceitem.CompanyID.Value, invoiceitem.ID);
}
else
{
return null;
}
}
else return await GetInvoice(invoiceitem.CompanyID.Value, invoiceitem.ID);
//_contextMongodb.InsertItem(new SysLog()
//{
// TraceIdentifierID = _httpContextAccessor.HttpContext.TraceIdentifier,
@@ -249,7 +260,7 @@ namespace Back.Services
// Route = _httpContextAccessor.HttpContext.Request.Path,
// Type = "catch"
//});
return false;
return null;
}