예제 #1
0
        /// <summary>
        /// Fill <see cref="RQRequisitionLineBidding"/> properties from <see cref="RQBidding"/> in view delegate. This is an extension point used by Lexware PriceUnit customization.
        /// </summary>
        /// <param name="rqLineBidding">The line bidding.</param>
        /// <param name="bidding">The bidding.</param>
        protected virtual void FillRequisitionLineBiddingPropertiesInViewDelegate(RQRequisitionLineBidding rqLineBidding, RQBidding bidding)
        {
            rqLineBidding.QuoteNumber       = bidding.QuoteNumber;
            rqLineBidding.QuoteQty          = bidding.QuoteQty ?? 0m;
            rqLineBidding.CuryInfoID        = Vendor.Current.CuryInfoID;
            rqLineBidding.CuryQuoteUnitCost = bidding.CuryQuoteUnitCost ?? 0m;
            rqLineBidding.QuoteUnitCost     = bidding.QuoteUnitCost ?? 0m;
            rqLineBidding.CuryQuoteExtCost  = bidding.CuryQuoteExtCost ?? 0m;
            rqLineBidding.QuoteExtCost      = bidding.QuoteExtCost ?? 0m;
            rqLineBidding.MinQty            = bidding.MinQty ?? 0m;

            if (bidding.CuryQuoteUnitCost == null && rqLineBidding.InventoryID != null)
            {
                string bidVendorCuryID = (string)Vendor.GetValueExt <RQBiddingVendor.curyID>(Vendor.Current);

                POItemCostManager.ItemCost cost = POItemCostManager.Fetch(this, Vendor.Current.VendorID, Vendor.Current.VendorLocationID,
                                                                          docDate: null,
                                                                          curyID: bidVendorCuryID,
                                                                          inventoryID: rqLineBidding.InventoryID,
                                                                          subItemID: rqLineBidding.SubItemID,
                                                                          siteID: null,
                                                                          uom: rqLineBidding.UOM);
                rqLineBidding.CuryQuoteUnitCost =
                    cost.Convert <RQRequisitionLineBidding.inventoryID, RQRequisitionLineBidding.curyInfoID>(this, rqLineBidding, rqLineBidding.UOM);
            }

            if (rqLineBidding.CuryQuoteUnitCost == null)
            {
                rqLineBidding.CuryQuoteUnitCost = 0m;
            }
        }
예제 #2
0
        protected virtual IEnumerable lines()
        {
            if (Vendor.Current == null || Vendor.Current.VendorLocationID == null)
            {
                yield break;
            }
            using (ReadOnlyScope scope = new ReadOnlyScope(this.Lines.Cache))
            {
                bool reset = !Bidding.Cache.IsDirty;
                PXResultset <RQRequisitionLineBidding> list =
                    PXSelectJoin <RQRequisitionLineBidding,
                                  LeftJoin <RQBidding,
                                            On <RQBidding.reqNbr, Equal <RQRequisitionLineBidding.reqNbr>,
                                                And <RQBidding.lineNbr, Equal <RQRequisitionLineBidding.lineNbr>,
                                                     And <RQBidding.vendorID, Equal <Current <RQBiddingVendor.vendorID> >,
                                                          And <RQBidding.vendorLocationID, Equal <Current <RQBiddingVendor.vendorLocationID> > > > > > >,
                                  Where <RQRequisitionLineBidding.reqNbr, Equal <Current <RQBiddingVendor.reqNbr> > > >
                    .Select(this);

                if (reset)
                {
                    this.Lines.Cache.Clear();
                }
                foreach (PXResult <RQRequisitionLineBidding, RQBidding> item in list)
                {
                    RQRequisitionLineBidding result = item;
                    RQBidding bidding = item;
                    bidding = Bidding.Locate(bidding) ?? item;

                    result                   = (RQRequisitionLineBidding)this.Lines.Cache.CreateCopy(result);
                    result.QuoteNumber       = bidding.QuoteNumber;
                    result.QuoteQty          = bidding.QuoteQty ?? 0m;
                    result.CuryInfoID        = Vendor.Current.CuryInfoID;
                    result.CuryQuoteUnitCost = bidding.CuryQuoteUnitCost ?? 0m;
                    result.QuoteUnitCost     = bidding.QuoteUnitCost ?? 0m;
                    result.CuryQuoteExtCost  = bidding.CuryQuoteExtCost ?? 0m;
                    result.QuoteExtCost      = bidding.QuoteExtCost ?? 0m;
                    result.MinQty            = bidding.MinQty ?? 0m;

                    if (bidding.CuryQuoteUnitCost == null && result.InventoryID != null)
                    {
                        POItemCostManager.ItemCost cost =
                            POItemCostManager.Fetch(this,
                                                    Vendor.Current.VendorID,
                                                    Vendor.Current.VendorLocationID, null,
                                                    (string)Vendor.GetValueExt <RQBiddingVendor.curyID>(Vendor.Current),
                                                    result.InventoryID, result.SubItemID, null, result.UOM);
                        result.CuryQuoteUnitCost =
                            cost.Convert <RQRequisitionLineBidding.inventoryID, RQRequisitionLineBidding.curyInfoID>(this, result, result.UOM);;
                    }

                    if (result.CuryQuoteUnitCost == null)
                    {
                        result.CuryQuoteUnitCost = 0m;
                    }

                    result = this.Lines.Insert(result) ?? (RQRequisitionLineBidding)this.Lines.Cache.Locate(result);
                    yield return(result);
                }
            }
        }