public ActionResult GetWarehouseStockInfoPartialList(long?WarehouseId, long?ItemTypeId, long?ItemId) { IEnumerable <WarehouseStockInfoDTO> warehouseStockInfoDTO = _warehouseStockInfoBusiness.GetAllWarehouseStockInfoByOrgId(OrgId).Select(info => new WarehouseStockInfoDTO { StockInfoId = info.StockInfoId, WarehouseId = info.WarehouseId, Warehouse = (_warehouseBusiness.GetWarehouseOneByOrgId(info.WarehouseId.Value, OrgId).WarehouseName), ItemTypeId = info.ItemTypeId, ItemType = (_itemTypeBusiness.GetItemType(info.ItemTypeId.Value, OrgId).ItemName), ItemId = info.ItemId, Item = (_itemBusiness.GetItemOneByOrgId(info.ItemId.Value, OrgId).ItemName), UnitId = info.UnitId, Unit = (_unitBusiness.GetUnitOneByOrgId(info.UnitId.Value, OrgId).UnitSymbol), StockInQty = info.StockInQty, StockOutQty = info.StockOutQty, Remarks = info.Remarks, OrganizationId = info.OrganizationId, }).AsEnumerable(); warehouseStockInfoDTO = warehouseStockInfoDTO.Where(ws => (WarehouseId == null || WarehouseId == 0 || ws.WarehouseId == WarehouseId) && (ItemTypeId == null || ItemTypeId == 0 || ws.ItemTypeId == ItemTypeId) && (ItemId == null || ItemId == 0 || ws.ItemId == ItemId)).ToList(); List <WarehouseStockInfoViewModel> warehouseStockInfoViews = new List <WarehouseStockInfoViewModel>(); AutoMapper.Mapper.Map(warehouseStockInfoDTO, warehouseStockInfoViews); return(PartialView("_WarehouseStockInfoList", warehouseStockInfoViews)); }
public bool SaveRequisition(ReqInfoDTO reqInfoDTO, long userId, long orgId) { RequsitionInfo requsitionInfo = new RequsitionInfo(); requsitionInfo.WarehouseId = reqInfoDTO.WarehouseId.Value; requsitionInfo.LineId = reqInfoDTO.LineId.Value; requsitionInfo.OrganizationId = orgId; requsitionInfo.StateStatus = "Pending"; requsitionInfo.ReqInfoCode = ("REQ-" + DateTime.Now.ToString("yy") + DateTime.Now.ToString("MM") + DateTime.Now.ToString("dd") + DateTime.Now.ToString("hh") + DateTime.Now.ToString("mm") + DateTime.Now.ToString("ss")); requsitionInfo.EntryDate = DateTime.Now; requsitionInfo.EUserId = userId; List <RequsitionDetail> requsitionDetails = new List <RequsitionDetail>(); foreach (var item in reqInfoDTO.ReqDetails) { RequsitionDetail requsitionDetail = new RequsitionDetail(); requsitionDetail.ItemTypeId = item.ItemTypeId; requsitionDetail.ItemId = item.ItemId; requsitionDetail.Quantity = item.Quantity; requsitionDetail.UnitId = itemBusiness.GetItemOneByOrgId(item.ItemId.Value, orgId).UnitId; requsitionDetail.Remarks = item.Remarks; requsitionDetail.EUserId = userId; requsitionDetail.EntryDate = DateTime.Now; requsitionDetail.OrganizationId = orgId; requsitionDetails.Add(requsitionDetail); } requsitionInfo.RequsitionDetails = requsitionDetails; requsitionInfoRepository.Insert(requsitionInfo); return(requsitionInfoRepository.Save()); }
public ActionResult GetRequsitionDetails(long?reqId) { IEnumerable <RequsitionDetailDTO> requsitionDetailDTO = _requsitionDetailBusiness.GetAllReqDetailByOrgId(OrgId).Where(rqd => reqId == null || reqId == 0 || rqd.ReqInfoId == reqId).Select(d => new RequsitionDetailDTO { ReqDetailId = d.ReqDetailId, ItemTypeId = d.ItemTypeId.Value, ItemTypeName = (_itemTypeBusiness.GetItemType(d.ItemTypeId.Value, OrgId).ItemName), ItemId = d.ItemId.Value, ItemName = (_itemBusiness.GetItemOneByOrgId(d.ItemId.Value, OrgId).ItemName), Quantity = d.Quantity.Value, UnitName = (_unitBusiness.GetUnitOneByOrgId(d.UnitId.Value, OrgId).UnitSymbol) }).ToList(); List <RequsitionDetailViewModel> requsitionDetailViewModels = new List <RequsitionDetailViewModel>(); AutoMapper.Mapper.Map(requsitionDetailDTO, requsitionDetailViewModels); ViewBag.RequisitionStatus = _requsitionInfoBusiness.GetRequisitionById(reqId.Value, OrgId).StateStatus; return(PartialView("_GetRequsitionDetails", requsitionDetailViewModels)); }
public ActionResult GetUnitByItemId(long itemId) { var unitId = _itemBusiness.GetItemOneByOrgId(itemId, OrgId).UnitId; var unit = _unitBusiness.GetUnitOneByOrgId(unitId, OrgId); UnitDomainDTO unitDTO = new UnitDomainDTO(); unitDTO.UnitId = unit.UnitId; unitDTO.UnitName = unit.UnitName; unitDTO.UnitSymbol = unit.UnitSymbol; return(Json(unitDTO)); }