Example #1
0
        protected virtual void RQRequisitionLineBidding_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e)
        {
            RQRequisitionLineBidding newRow = (RQRequisitionLineBidding)e.Row;
            RQRequisitionLineBidding oldRow = (RQRequisitionLineBidding)e.OldRow;

            RQRequisitionLineBiddingExt newExt = (RQRequisitionLineBiddingExt)cache.GetExtension <RQRequisitionLineBiddingExt>(e.Row);
            RQRequisitionLineBiddingExt oldExt = (RQRequisitionLineBiddingExt)cache.GetExtension <RQRequisitionLineBiddingExt>(e.OldRow);

            if (newRow.MinQty != oldRow.MinQty || newRow.QuoteUnitCost != oldRow.QuoteUnitCost ||
                newRow.QuoteQty != oldRow.QuoteQty || newRow.QuoteNumber != oldRow.QuoteNumber)
            {
                RQBidding bidding = PXSelect <RQBidding,
                                              Where <RQBidding.reqNbr, Equal <Required <RQBidding.reqNbr> >,
                                                     And <RQBidding.lineNbr, Equal <Required <RQBidding.lineNbr> >,
                                                          And <RQBidding.vendorID, Equal <Required <RQBidding.vendorID> >,
                                                               And <RQBidding.vendorLocationID, Equal <Required <RQBidding.vendorLocationID> > > > > > >
                                    .SelectWindowed(Base, 0, 1,
                                                    Base.Vendor.Current.ReqNbr,
                                                    newRow.LineNbr,
                                                    Base.Vendor.Current.VendorID,
                                                    Base.Vendor.Current.VendorLocationID);

                if (bidding == null)
                {
                    bidding = new RQBidding
                    {
                        VendorID         = Base.Vendor.Current.VendorID,
                        VendorLocationID = Base.Vendor.Current.VendorLocationID,
                        ReqNbr           = Base.Vendor.Current.ReqNbr,
                        CuryInfoID       = Base.Vendor.Current.CuryInfoID,
                        LineNbr          = newRow.LineNbr
                    };
                }
                else
                {
                    bidding = (RQBidding)Base.Bidding.Cache.CreateCopy(bidding);
                }

                RQBiddingExt biddingExt = Base.Bidding.Cache.GetExtension <RQBiddingExt>(bidding);

                biddingExt.UsrInitialCost        = newExt.UsrInitialCost;
                biddingExt.UsrCuryInitialCost    = newExt.UsrCuryInitialCost;
                biddingExt.UsrCuryInitialExtCost = newExt.UsrCuryInitialExtCost;
                biddingExt.UsrInitialExtCost     = newExt.UsrInitialExtCost;

                Base.Bidding.Update(bidding);
            }
        }
Example #2
0
        protected virtual RQRequisitionLineBidding PrepareRQRequisitionLineBiddingInViewDelegate(PXResult <RQRequisitionLineBidding, RQBidding> item)
        {
            RQRequisitionLineBidding rqLineBidding = item;
            RQBidding bidding = item;

            bidding = Base.Bidding.Locate(bidding) ?? item;
            RQBiddingExt biddingExt = Base.Bidding.Cache.GetExtension <RQBiddingExt>(bidding);

            rqLineBidding = (RQRequisitionLineBidding)this.Lines.Cache.CreateCopy(rqLineBidding);
            RQRequisitionLineBiddingExt rqLineBiddingExt = (RQRequisitionLineBiddingExt)this.Lines.Cache.GetExtension <RQRequisitionLineBiddingExt>(rqLineBidding);

            FillRequisitionLineBiddingPropertiesInViewDelegate(rqLineBidding, bidding, rqLineBiddingExt, biddingExt);

            rqLineBidding = this.Lines.Insert(rqLineBidding) ?? (RQRequisitionLineBidding)this.Lines.Cache.Locate(rqLineBidding);
            return(rqLineBidding);
        }
        protected virtual void EnsureLine(RQRequisition row, RQRequisitionLine line, RQRequisitionLineExt lineext)
        {
            if (row.VendorID == null || row.VendorLocationID == null)
            {
                lineext.UsrPatternCost        = 0;
                lineext.UsrCuryPatternCost    = 0;
                lineext.UsrInitialCost        = 0;
                lineext.UsrCuryInitialCost    = 0;
                lineext.UsrCuryInitialExtCost = 0;
                lineext.UsrInitialExtCost     = 0;
            }
            else
            {
                PXCache   cache   = Base.Bidding.Cache;
                RQBidding bidding = PXSelect <RQBidding,
                                              Where <RQBidding.reqNbr, Equal <Required <RQBidding.reqNbr> >,
                                                     And <RQBidding.lineNbr, Equal <Required <RQBidding.lineNbr> >,
                                                          And <RQBidding.vendorID, Equal <Required <RQBidding.vendorID> >,
                                                               And <RQBidding.vendorLocationID, Equal <Required <RQBidding.vendorLocationID> > > > > > > .Select(Base, line.ReqNbr, line.LineNbr, row.VendorID, row.VendorLocationID);

                if (bidding != null)
                {
                    RQBiddingExt biddingext = bidding.GetExtension <RQBiddingExt>();

                    //Pattern
                    lineext.UsrCuryPatternCost = Tools.ConvertCurrency <RQRequisitionLine.curyInfoID>(Base.Lines.Cache, line, biddingext.UsrPatternCost ?? 0);
                    //Unit Cost
                    line.CuryEstUnitCost = Tools.ConvertCurrency <RQRequisitionLine.curyInfoID>(Base.Lines.Cache, line, bidding.QuoteUnitCost ?? 0);
                    //Ext Cost
                    line.CuryEstExtCost = Tools.ConvertCurrency <RQRequisitionLine.curyInfoID>(Base.Lines.Cache, line, bidding.QuoteExtCost ?? 0);
                    //Initial Cost
                    lineext.UsrCuryInitialCost = Tools.ConvertCurrency <RQRequisitionLine.curyInfoID>(Base.Lines.Cache, line, biddingext.UsrInitialCost ?? 0);
                    //Initial Ext Cost
                    lineext.UsrCuryInitialCost = Tools.ConvertCurrency <RQRequisitionLine.curyInfoID>(Base.Lines.Cache, line, biddingext.UsrInitialExtCost ?? 0);
                }
            }
        }
Example #4
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;
            }
        }