This commit is contained in:
mmrbnjd
2025-01-22 13:02:53 +03:30
parent 83d7514581
commit 88d4b63394
5 changed files with 382 additions and 54 deletions

View File

@@ -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;
}
}