Example #1
0
        protected virtual void FillRequisitionLineBiddingPropertiesInViewDelegate(RQRequisitionLineBidding rqLineBidding, RQBidding bidding, RQRequisitionLineBiddingExt rqLineBiddingExt, RQBiddingExt biddingExt)
        {
            rqLineBidding.QuoteNumber       = bidding.QuoteNumber;
            rqLineBidding.QuoteQty          = bidding.QuoteQty ?? 0m;
            rqLineBidding.CuryInfoID        = Base.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 (biddingExt.UsrInitialCost == 0)
            {
                rqLineBiddingExt.UsrInitialCost    = bidding.QuoteUnitCost ?? 0m;
                rqLineBiddingExt.UsrInitialExtCost = (bidding.QuoteUnitCost ?? 0m) * (bidding.QuoteQty ?? 0m);
            }
            else
            {
                rqLineBiddingExt.UsrInitialCost    = biddingExt.UsrInitialCost ?? 0m;
                rqLineBiddingExt.UsrInitialExtCost = biddingExt.UsrInitialExtCost ?? 0m;
            }

            if (biddingExt.UsrCuryInitialCost == 0)
            {
                rqLineBiddingExt.UsrCuryInitialCost    = bidding.CuryQuoteUnitCost ?? 0m;
                rqLineBiddingExt.UsrCuryInitialExtCost = (bidding.CuryQuoteUnitCost ?? 0m) * (bidding.QuoteQty ?? 0m);
            }
            else
            {
                rqLineBiddingExt.UsrCuryInitialCost    = biddingExt.UsrCuryInitialCost ?? 0m;
                rqLineBiddingExt.UsrCuryInitialExtCost = biddingExt.UsrCuryInitialExtCost ?? 0m;
            }


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

                POItemCostManager.ItemCost cost = POItemCostManager.Fetch(Base, Base.Vendor.Current.VendorID, Base.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>(Base, rqLineBidding, rqLineBidding.UOM);
            }

            if (rqLineBidding.CuryQuoteUnitCost == null)
            {
                rqLineBidding.CuryQuoteUnitCost = 0m;
            }
        }
        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);
                }
            }
        }