예제 #1
0
        protected virtual void RQBiddingVendor_RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
        {
            RQBiddingVendor row = (RQBiddingVendor)e.Row;

            if ((e.Operation & PXDBOperation.Command) == PXDBOperation.Delete)
            {
                return;
            }
            RQBiddingVendorExt rowExt = row.GetExtension <RQBiddingVendorExt>();

            RQRequisition req = PXSelect <RQRequisition,
                                          Where <RQRequisition.reqNbr, Equal <Required <RQRequisition.reqNbr> > > > .Select(Base, row.ReqNbr);

            RQRequisitionExt reqExt = req.GetExtension <RQRequisitionExt>();

            if (reqExt.UsrPurchMethod == 2)
            {
                return;
            }

            if (row.CuryTotalQuoteExtCost > Decimal.Zero)
            {
                if (rowExt.UsrLeadTime == Decimal.Zero)
                {
                    if (sender.RaiseExceptionHandling <RQBiddingVendorExt.usrLeadTime>(e.Row, rowExt.UsrLeadTime, new PXSetPropertyException(LeadTimeCannotBeZero, typeof(RQBiddingVendorExt.usrLeadTime).Name)))
                    {
                        throw new PXRowPersistingException(typeof(RQBiddingVendorExt.usrLeadTime).Name, null, LeadTimeCannotBeZero, typeof(RQBiddingVendorExt.usrLeadTime).Name);
                    }
                }

                if (string.IsNullOrEmpty(rowExt.UsrIncoterm))
                {
                    if (sender.RaiseExceptionHandling <RQBiddingVendorExt.usrIncoterm>(e.Row, null, new PXSetPropertyException(ErrorMessages.FieldIsEmpty, typeof(RQBiddingVendorExt.usrIncoterm).Name)))
                    {
                        throw new PXRowPersistingException(typeof(RQBiddingVendorExt.usrIncoterm).Name, null, ErrorMessages.FieldIsEmpty, typeof(RQBiddingVendorExt.usrIncoterm).Name);
                    }
                }

                if (rowExt.UsrRefDueDate == null)
                {
                    if (sender.RaiseExceptionHandling <RQBiddingVendorExt.usrRefDueDate>(e.Row, null, new PXSetPropertyException(ErrorMessages.FieldIsEmpty, typeof(RQBiddingVendorExt.usrRefDueDate).Name)))
                    {
                        throw new PXRowPersistingException(typeof(RQBiddingVendorExt.usrRefDueDate).Name, null, ErrorMessages.FieldIsEmpty, typeof(RQBiddingVendorExt.usrRefDueDate).Name);
                    }
                }

                if (rowExt.UsrLeadFrom == null)
                {
                    if (sender.RaiseExceptionHandling <RQBiddingVendorExt.usrLeadFrom>(e.Row, null, new PXSetPropertyException(ErrorMessages.FieldIsEmpty, typeof(RQBiddingVendorExt.usrLeadFrom).Name)))
                    {
                        throw new PXRowPersistingException(typeof(RQBiddingVendorExt.usrLeadFrom).Name, null, ErrorMessages.FieldIsEmpty, typeof(RQBiddingVendorExt.usrLeadFrom).Name);
                    }
                }
            }
        }
        protected virtual void RQRequisition_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            RQRequisition    row    = (RQRequisition)e.Row;
            RQRequisitionExt rowExt = row.GetExtension <RQRequisitionExt>();

            if (row == null)
            {
                return;
            }

            bool splitable = row.Splittable == true;

            PXUIFieldAttribute.SetVisible <RQRequisition.curyID>(sender, null, PXAccess.FeatureInstalled <FeaturesSet.multicurrency>());
            PXUIFieldAttribute.SetVisible <RQRequisitionLine.biddingQty>(Base.Lines.Cache, null, splitable);
            PXUIFieldAttribute.SetVisible <RQBidding.orderQty>(Base.Bidding.Cache, null, splitable);

            PXUIFieldAttribute.SetEnabled <RQBidding.selected>(Base.Bidding.Cache, null, splitable);
            PXUIFieldAttribute.SetEnabled <RQRequisition.reqNbr>(sender, null, !(Base.State.Current.SingleMode == true));
            PXUIFieldAttribute.SetEnabled <RQRequisition.vendorID>(sender, row, false);
            PXUIFieldAttribute.SetEnabled <RQRequisition.vendorLocationID>(sender, row, false);

            if (row.Status == RQRequisitionStatus.Bidding)
            {
                PXUIFieldAttribute.SetEnabled <RQRequisition.vendorRefNbr>(sender, row, true);
                PXUIFieldAttribute.SetEnabled <RQRequisition.splittable>(sender, row, true);
            }
            else
            {
                PXUIFieldAttribute.SetEnabled(sender, row, false);
                PXUIFieldAttribute.SetEnabled <RQRequisition.reqNbr>(sender, row, true);
            }

            Base.Process.SetEnabled(row.Status == RQRequisitionStatus.Bidding);
            Base.ChooseVendor.SetEnabled(row.Status == RQRequisitionStatus.Bidding);
            Base.UpdateResult.SetEnabled(row.Status == RQRequisitionStatus.Bidding);
            Base.ClearResult.SetEnabled(row.Status == RQRequisitionStatus.Bidding);

            Base.Document.Cache.AllowInsert     =
                Base.Document.Cache.AllowDelete = false;
            Base.Document.Cache.AllowUpdate     = true;

            Base.Bidding.Cache.AllowInsert         =
                Base.Bidding.Cache.AllowUpdate     =
                    Base.Bidding.Cache.AllowDelete =

                        Base.Vendors.Cache.AllowInsert         =
                            Base.Vendors.Cache.AllowUpdate     =
                                Base.Vendors.Cache.AllowDelete =
                                    row.Status == RQRequisitionStatus.Bidding;

            bool rHold     = row.Hold == true;
            bool custOrder = row.CustomerID != null;
            bool gaRequest = (row.CustomerID == null && rowExt.UsrPurchMethod == 2) || row.CustomerID != null;
        }
예제 #3
0
        protected virtual void RQBiddingVendor_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e)
        {
            RQBiddingVendor    row    = (RQBiddingVendor)e.Row;
            RQBiddingVendorExt rowExt = row.GetExtension <RQBiddingVendorExt>();

            RQRequisition req = PXSelect <RQRequisition,
                                          Where <RQRequisition.reqNbr, Equal <Required <RQRequisition.reqNbr> > > > .Select(Base, row.ReqNbr);

            RQRequisitionExt reqExt = req.GetExtension <RQRequisitionExt>();

            if (req.CustomerID == null)
            {
                rowExt.UsrLeadTime = 30;
            }
        }
예제 #4
0
        protected virtual void RQBiddingVendor_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            RQBiddingVendor row = (RQBiddingVendor)e.Row;

            if (row == null)
            {
                return;
            }

            RQBiddingVendorExt rowExt = row.GetExtension <RQBiddingVendorExt>();

            bool bidExists = row.CuryTotalQuoteExtCost > Decimal.Zero == true;

            RQRequisition req = PXSelect <RQRequisition,
                                          Where <RQRequisition.reqNbr, Equal <Required <RQRequisition.reqNbr> > > > .Select(Base, row.ReqNbr);

            RQRequisitionExt reqExt = req.GetExtension <RQRequisitionExt>();


            if (bidExists)
            {
                if (req.CustomerID != null || reqExt.UsrPurchMethod != 2)
                {
                    if (req.CustomerID != null)
                    {
                        PXDefaultAttribute.SetPersistingCheck <RQBiddingVendorExt.usrIncoterm>(sender, row, bidExists ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing);
                    }

                    PXDefaultAttribute.SetPersistingCheck <RQBiddingVendorExt.usrLeadFrom>(sender, row, bidExists ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing);
                    PXDefaultAttribute.SetPersistingCheck <RQBiddingVendorExt.usrLeadTime>(sender, row, bidExists ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing);
                    PXDefaultAttribute.SetPersistingCheck <RQBiddingVendorExt.usrRefDueDate>(sender, row, bidExists ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing);
                }
            }

            //ValidateLeadTime(sender, e);
        }