public virtual bool IsApplicable(PXGraph graph, LandedCostCode aCode, POReceiptLine aLine) { bool transferinsidewarehouse = false; if (aLine.ReceiptType == POReceiptType.TransferReceipt) { INTran ortran = PXSelectReadonly <INTran, Where <INTran.tranType, Equal <Required <INTran.origTranType> >, And <INTran.refNbr, Equal <Required <INTran.origRefNbr> > > > > .SelectWindowed(graph, 0, 1, aLine.OrigTranType, aLine.OrigRefNbr, aLine.OrigLineNbr); transferinsidewarehouse = (ortran == null || ortran.SiteID == aLine.SiteID); } if (transferinsidewarehouse == false) { HasApplicableTransfers = true; } //Memo - in this release, non-stock Items are not applicable for the landed cost. Review later. return(!transferinsidewarehouse && (aCode.AllocationMethod != LandedCostAllocationMethod.None && (aLine.LineType == POLineType.GoodsForInventory || aLine.LineType == POLineType.GoodsForReplenishment || aLine.LineType == POLineType.GoodsForSalesOrder || aLine.LineType == POLineType.GoodsForDropShip || aLine.LineType == POLineType.NonStock || aLine.LineType == POLineType.NonStockForDropShip || aLine.LineType == POLineType.NonStockForSalesOrder))); }
public virtual bool IsApplicable(PXGraph graph, LandedCostCode aCode, POReceiptLine aLine) { bool transferinsidewarehouse = false; if (aLine.ReceiptType == POReceiptType.TransferReceipt) { INTran ortran = INTran.PK.Find(graph, aLine.OrigDocType, aLine.OrigRefNbr, aLine.OrigLineNbr); transferinsidewarehouse = (ortran == null || ortran.SiteID == aLine.SiteID); } if (transferinsidewarehouse == false) { HasApplicableTransfers = true; } //Memo - in this release, non-stock Items are not applicable for the landed cost. Review later. return(!transferinsidewarehouse && (aCode.AllocationMethod != LandedCostAllocationMethod.None && (aLine.LineType == POLineType.GoodsForInventory || aLine.LineType == POLineType.GoodsForReplenishment || aLine.LineType == POLineType.GoodsForSalesOrder || aLine.LineType == POLineType.GoodsForDropShip || aLine.LineType == POLineType.NonStock || aLine.LineType == POLineType.NonStockForDropShip || aLine.LineType == POLineType.NonStockForSalesOrder || aLine.LineType == POLineType.GoodsForServiceOrder || aLine.LineType == POLineType.NonStockForServiceOrder || aLine.LineType == POLineType.GoodsForManufacturing || aLine.LineType == POLineType.NonStockForManufacturing))); }
public virtual bool IsApplicable(PXGraph graph, POLandedCostDetail aTran, LandedCostCode aCode, POReceiptLine aLine) { if (!IsApplicable(graph, aCode, aLine)) { return(false); } if (aTran.InventoryID.HasValue) { if (aTran.InventoryID != aLine.InventoryID) { return(false); } } return(true); }
public virtual bool ValidateLCTran(PXGraph graph, POLandedCostDoc doc, IEnumerable <POLandedCostReceiptLine> landedCostReceiptLines, POLandedCostDetail row, out string message) { decimal valueToCompare = decimal.Zero; int count = 0; if (row != null && !String.IsNullOrEmpty(row.LandedCostCodeID)) { LandedCostCode code = PXSelect <LandedCostCode, Where <LandedCostCode.landedCostCodeID, Equal <Required <LandedCostCode.landedCostCodeID> > > > .Select(graph, row.LandedCostCodeID); var receiptLines = GetReceiptLines(graph, landedCostReceiptLines); foreach (POReceiptLine it in receiptLines) { var landedCostReceiptLine = landedCostReceiptLines.Single(t => t.POReceiptType == it.ReceiptType && t.POReceiptNbr == it.ReceiptNbr && t.POReceiptLineNbr == it.LineNbr); if (IsApplicable(graph, row, code, it)) { var landedCostAllocationItem = new LandedCostAllocationItem() { LandedCostCode = code, ReceiptLine = it, LandedCostDetail = row, LandedCostReceiptLine = landedCostReceiptLine }; valueToCompare += GetBaseValue(landedCostAllocationItem); } count++; } if (!HasApplicableTransfers) { message = Messages.LandedCostCannotBeDistributed; return(false); } switch (code.AllocationMethod) { case LandedCostAllocationMethod.ByCost: message = Messages.LandedCostReceiptTotalCostIsZero; break; case LandedCostAllocationMethod.ByWeight: message = Messages.LandedCostReceiptTotalWeightIsZero; break; case LandedCostAllocationMethod.ByVolume: message = Messages.LandedCostReceiptTotalVolumeIsZero; break; case LandedCostAllocationMethod.ByQuantity: message = Messages.LandedCostReceiptTotalQuantityIsZero; break; case LandedCostAllocationMethod.None: message = Messages.LandedCostReceiptNoReceiptLines; valueToCompare = count; break; default: message = Messages.LandedCostUnknownAllocationType; break; } if (valueToCompare == Decimal.Zero) { return(false); } } message = String.Empty; return(true); }
public virtual bool NeedsApplicabilityChecking(LandedCostCode aCode) { return(aCode.AllocationMethod != LandedCostAllocationMethod.None); }