...
This commit is contained in:
@@ -114,7 +114,8 @@ namespace Back.Controllers
|
||||
|
||||
////-----change Cod
|
||||
Cod.TaxRate = item.TaxRate;
|
||||
//Cod.Title = item.Title;
|
||||
if(!await _servCOD.UsedInTheInvoice(Cod.ID))
|
||||
Cod.Title = item.Title;
|
||||
Cod.UnitID = item.UnitID;
|
||||
Cod.ItemTaxID = item.TaxID;
|
||||
Cod.IsDeleted = false;
|
||||
@@ -138,5 +139,10 @@ namespace Back.Controllers
|
||||
//----Update and sendResult
|
||||
return Ok(await _servCOD.DeleteCod(cod));
|
||||
}
|
||||
[HttpGet("UsedInTheInvoice/{ID}")]
|
||||
public async Task<ActionResult<bool>> UsedInTheInvoice(int ID)
|
||||
{
|
||||
return Ok(await _servCOD.UsedInTheInvoice(ID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -130,7 +130,8 @@ namespace Back.Controllers
|
||||
cus.CustomerType = item.CustomerType;
|
||||
cus.EconomicCode = item.EconomicCode;
|
||||
cus.Email = item.Email;
|
||||
// cus.FullName = item.FullName;
|
||||
if(!await _servCus.UsedInTheInvoice(cus.ID))
|
||||
cus.FullName = item.FullName;
|
||||
cus.Info = item.Info;
|
||||
cus.MeliCode = item.MeliCode;
|
||||
cus.PassportNumber = item.PassportNumber;
|
||||
@@ -157,5 +158,10 @@ namespace Back.Controllers
|
||||
//----Update and sendResult
|
||||
return Ok(await _servCus.DeleteCustomer(cus));
|
||||
}
|
||||
[HttpGet("UsedInTheInvoice/{ID}")]
|
||||
public async Task<ActionResult<bool>> UsedInTheInvoice(int ID)
|
||||
{
|
||||
return Ok(await _servCus.UsedInTheInvoice(ID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -170,5 +170,9 @@ namespace Back.Services
|
||||
|
||||
}
|
||||
}
|
||||
public async Task<bool> UsedInTheInvoice(int codID)
|
||||
{
|
||||
return await _CODRepo.Get(w => w.invoiceDetails.Any(a=>a.CODID==codID)).AnyAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -9,12 +9,13 @@ namespace Back.Services
|
||||
public class servCustomer
|
||||
{
|
||||
private readonly IAsyncRepository<Customer> _repoCus;
|
||||
private readonly IAsyncRepository<Invoice> _repoInvoice;
|
||||
private readonly CheckPermission _checkPermission;
|
||||
public servCustomer(IAsyncRepository<Customer> repoCus, CheckPermission checkPermission)
|
||||
public servCustomer(IAsyncRepository<Customer> repoCus, CheckPermission checkPermission, IAsyncRepository<Invoice> repoInvoice)
|
||||
{
|
||||
_repoCus = repoCus;
|
||||
_checkPermission = checkPermission;
|
||||
|
||||
_repoInvoice = repoInvoice;
|
||||
}
|
||||
public async Task<PagingDto<RCustomer>?> GetCustomers(int CompanyID, ItemSerchGetCustomer itemSerch)
|
||||
{
|
||||
@@ -189,6 +190,10 @@ namespace Back.Services
|
||||
|
||||
}
|
||||
}
|
||||
public async Task<bool> UsedInTheInvoice(int cusID)
|
||||
{
|
||||
return await _repoInvoice.Get(w => w.CustomerID == cusID).AnyAsync();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -125,6 +125,9 @@ namespace Back.Services
|
||||
|
||||
if (itemSerch.refInvoiceID != null)
|
||||
invok = invok.Where(w => w.BillReference==itemSerch.refInvoiceID);
|
||||
|
||||
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));
|
||||
|
||||
|
Reference in New Issue
Block a user