...
This commit is contained in:
@@ -23,51 +23,55 @@ namespace Back.Services.Warehouse
|
||||
_RemittanceRepo = remittanceRepo;
|
||||
_ReceiptRepo = receiptRepo;
|
||||
}
|
||||
public async Task<PagingDto<CirculationDto>> Circulation(int CompanyID,string date="",int CODID=0,int PageIndex=1,int PageSize=5)
|
||||
public async Task<PagingDto<CirculationDto>> Circulation(int CompanyID, string date = "", int CODID = 0, int PageIndex = 1, int PageSize = 5)
|
||||
{
|
||||
var RequestRemittance = _RemittanceRepo.Get(w => w.cODItem.CompanyID == CompanyID && !w.Deleted)
|
||||
.Select(s=>new CirculationDto
|
||||
.Select(s => new CirculationDto
|
||||
{
|
||||
CODID=s.CODID,
|
||||
CODTitle=s.cODItem.Title,
|
||||
Date=s.Date,
|
||||
Count=s.Count,
|
||||
info=s.info,
|
||||
Type=TypeCirculation.Remittance,
|
||||
ID= s.ID,
|
||||
CODID = s.CODID,
|
||||
CODTitle = s.cODItem.Title,
|
||||
Date = s.Date.ShamciToFormatShamci(),
|
||||
Count = s.Count,
|
||||
info = s.info,
|
||||
Type = TypeCirculation.Remittance,
|
||||
ModelTypeID = (int)s.Type,
|
||||
ModelTypeTitle= s.Type.GetDisplayName()
|
||||
ModelTypeTitle = s.Type.GetDisplayName(),
|
||||
invoiceID = s.InvoiceID,
|
||||
});
|
||||
if (!string.IsNullOrEmpty(date))
|
||||
RequestRemittance = RequestRemittance.Where(w => w.Date == date);
|
||||
if (CODID!=0)
|
||||
if (CODID != 0)
|
||||
RequestRemittance = RequestRemittance.Where(w => w.CODID == CODID);
|
||||
//-----------
|
||||
var RequestReceipt = _ReceiptRepo.Get(w => w.cODItem.CompanyID == CompanyID && !w.Deleted)
|
||||
.Select(s => new CirculationDto
|
||||
{
|
||||
ID = s.ID,
|
||||
CODID = s.CODID,
|
||||
CODTitle = s.cODItem.Title,
|
||||
Date = s.Date,
|
||||
Date = s.Date.ShamciToFormatShamci(),
|
||||
Count = s.Count,
|
||||
info = s.info,
|
||||
Type = TypeCirculation.Receipt,
|
||||
ModelTypeID = (int)s.Type,
|
||||
ModelTypeTitle = s.Type.GetDisplayName()
|
||||
ModelTypeTitle = s.Type.GetDisplayName(),
|
||||
invoiceID = s.InvoiceID,
|
||||
});
|
||||
if (!string.IsNullOrEmpty(date))
|
||||
RequestReceipt = RequestReceipt.Where(w => w.Date == date);
|
||||
if (CODID != 0)
|
||||
RequestReceipt = RequestReceipt.Where(w => w.CODID == CODID);
|
||||
|
||||
return await RequestReceipt.Union(RequestRemittance).OrderByDescending(o => o.Date).Paging(PageIndex, PageSize);
|
||||
return await RequestReceipt.Union(RequestRemittance).OrderByDescending(o => o.Date).Paging(PageIndex, PageSize);
|
||||
//var list = await RequestReceipt.ToListAsync();
|
||||
//list.AddRange(await RequestRemittance.ToListAsync());
|
||||
//return await list.OrderByDescending(o=>o.Date).AsQueryable().Paging(PageIndex, PageSize);
|
||||
}
|
||||
public async Task<decimal> Inventory(int CompanyID,int CODID)
|
||||
public async Task<decimal> Inventory(int CompanyID, int CODID)
|
||||
{
|
||||
var CReceipt=await _ReceiptRepo.Get(w => w.cODItem.CompanyID == CompanyID && w.CODID == CODID && w.ForSale && !w.Deleted).SumAsync(s => s.Count);
|
||||
var CRemittance=await _RemittanceRepo.Get(w => w.cODItem.CompanyID == CompanyID && w.CODID == CODID && !w.Deleted).SumAsync(s => s.Count);
|
||||
var CReceipt = await _ReceiptRepo.Get(w => w.cODItem.CompanyID == CompanyID && w.CODID == CODID && w.ForSale && !w.Deleted).SumAsync(s => s.Count);
|
||||
var CRemittance = await _RemittanceRepo.Get(w => w.cODItem.CompanyID == CompanyID && w.CODID == CODID && !w.Deleted).SumAsync(s => s.Count);
|
||||
return CReceipt - CRemittance;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user