public bool SaveReportCombination(OrderDto dto, OrderDetailDto orderDetailDto, string orderTypeAbbrev, string remarksType = null) { var productList = _inventoryService.FindByProductId((int)orderDetailDto.ProductId); ReportCombinationDto reportDto = new ReportCombinationDto() { TrackingID = 0, ProductID = (long)orderDetailDto.ProductId, RequestNum = dto.OrderNum, DateCreated = System.DateTime.Now, ProductQty = productList.Quantity, Qty = orderDetailDto.Quantity, BranchId = productList.BranchID }; if (orderTypeAbbrev == Enums.OrderTypeAbbrev.SO.ToString()) { reportDto.RequestType = Enums.OrderTypeAbbrev.SO.ToString(); //reportDto.SalesOrderQty = (productList.Quantity - orderDetailDto.Quantity); reportDto.SalesOrderQty = orderDetailDto.Quantity; } else if (orderTypeAbbrev == Enums.OrderTypeAbbrev.PO.ToString()) { reportDto.RequestType = Enums.OrderTypeAbbrev.PO.ToString(); if (!orderDetailDto.isNewPurchaseOrder) { //reportDto.PurchaseOrderQty = (productList.Quantity + orderDetailDto.Quantity); reportDto.PurchaseOrderQty = orderDetailDto.Quantity; } else { reportDto.PurchaseOrderQty = orderDetailDto.Quantity; } } else if (orderTypeAbbrev == Enums.OrderTypeAbbrev.CR.ToString()) { reportDto.RequestType = Enums.OrderTypeAbbrev.CR.ToString(); reportDto.Remarks = dto.Remarks; if (remarksType == "+") { //reportDto.PurchaseOrderQty = (productList.Quantity + orderDetailDto.Quantity); reportDto.PurchaseOrderQty = (orderDetailDto.Quantity); } else if (remarksType == "-") { //reportDto.SalesOrderQty = (productList.Quantity - orderDetailDto.Quantity); reportDto.SalesOrderQty = (orderDetailDto.Quantity); } } if (_reportCombination.Insert(reportDto.DtoToEntity()).IsNull()) { return(false); } return(true); }
public static IOBalanceEntity.ReportCombination DtoToEntity(this ReportCombinationDto dto) { IOBalanceEntity.ReportCombination entity = null; if (!dto.IsNull()) { entity = new IOBalanceEntity.ReportCombination { TrackingID = dto.TrackingID, ProductID = dto.ProductID, DateCreated = dto.DateCreated, ProductQty = dto.ProductQty, PurchaseOrderQty = dto.PurchaseOrderQty, SalesOrderQty = dto.SalesOrderQty, RequestNum = dto.RequestNum, RequestType = dto.RequestType, Qty = dto.Qty, BranchID = dto.BranchId, Remarks = dto.Remarks }; } return(entity); }