Inventory
This commit is contained in:
@@ -11,6 +11,7 @@ namespace Back.Controllers.Warehouse
|
|||||||
{
|
{
|
||||||
private readonly WarehouseService _warehouseService;
|
private readonly WarehouseService _warehouseService;
|
||||||
private readonly servUser _servUser;
|
private readonly servUser _servUser;
|
||||||
|
[HttpGet("Circulation")]
|
||||||
public async Task<IActionResult> Circulation(string date = "", int CODID = 0, int PageIndex = 1, int PageSize = 5)
|
public async Task<IActionResult> Circulation(string date = "", int CODID = 0, int PageIndex = 1, int PageSize = 5)
|
||||||
{
|
{
|
||||||
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||||
@@ -19,6 +20,14 @@ namespace Back.Controllers.Warehouse
|
|||||||
var CompanyID = user.RolUsers.First().CompanyID;
|
var CompanyID = user.RolUsers.First().CompanyID;
|
||||||
return Ok(await _warehouseService.Circulation(CompanyID,date,CODID));
|
return Ok(await _warehouseService.Circulation(CompanyID,date,CODID));
|
||||||
}
|
}
|
||||||
|
[HttpGet("Inventory/{CODID}")]
|
||||||
|
public async Task<IActionResult> Inventory(int CODID)
|
||||||
|
{
|
||||||
|
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||||
|
var UserID = claim.Value;
|
||||||
|
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
|
||||||
|
var CompanyID = user.RolUsers.First().CompanyID;
|
||||||
|
return Ok(await _warehouseService.Inventory(CompanyID, CODID));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -64,9 +64,11 @@ namespace Back.Services.Warehouse
|
|||||||
//list.AddRange(await RequestRemittance.ToListAsync());
|
//list.AddRange(await RequestRemittance.ToListAsync());
|
||||||
//return await list.OrderByDescending(o=>o.Date).AsQueryable().Paging(PageIndex, PageSize);
|
//return await list.OrderByDescending(o=>o.Date).AsQueryable().Paging(PageIndex, PageSize);
|
||||||
}
|
}
|
||||||
public async Task Inventory(int CompanyID,int CODID)
|
public async Task<int> Inventory(int CompanyID,int CODID)
|
||||||
{
|
{
|
||||||
|
var CReceipt=await _ReceiptRepo.Get(w => w.cODItem.CompanyID == CompanyID && w.CODID == CODID && w.ForSale ).SumAsync(s => s.Count);
|
||||||
|
var CRemittance=await _RemittanceRepo.Get(w => w.cODItem.CompanyID == CompanyID && w.CODID == CODID ).SumAsync(s => s.Count);
|
||||||
|
return CReceipt - CRemittance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user