示例#1
0
        protected virtual void _(Events.FieldUpdated <FSAdjust, FSAdjust.adjdOrderNbr> e)
        {
            try
            {
                FSAdjust fsAdjustRow = (FSAdjust)e.Row;

                var resultSet = PXSelectJoin <FSServiceOrder,
                                              InnerJoin <CurrencyInfo,
                                                         On <
                                                             CurrencyInfo.curyInfoID, Equal <FSServiceOrder.curyInfoID> > >,
                                              Where <
                                                  FSServiceOrder.srvOrdType, Equal <Required <FSServiceOrder.srvOrdType> >,
                                                  And <FSServiceOrder.refNbr, Equal <Required <FSServiceOrder.refNbr> > > > >
                                .Select(Base, fsAdjustRow.AdjdOrderType, fsAdjustRow.AdjdOrderNbr);

                foreach (PXResult <FSServiceOrder, CurrencyInfo> result in resultSet)
                {
                    FSAdjust_AdjdOrderNbr_FieldUpdated <FSServiceOrder>(result, fsAdjustRow);
                    return;
                }
            }
            catch (PXSetPropertyException ex)
            {
                throw new PXException(ex.Message);
            }
        }
示例#2
0
        protected virtual void _(Events.RowSelecting <FSAdjust> e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSAdjust fsAdjustRow = (FSAdjust)e.Row;

            using (new PXConnectionScope())
            {
                fsAdjustRow.SOCuryCompletedBillableTotal = ServiceOrderCore.GetServiceOrderBillableTotal(e.Cache.Graph, fsAdjustRow.AdjdOrderType, fsAdjustRow.AdjdOrderNbr);
            }
        }
示例#3
0
        public virtual IEnumerable ViewFSAppointmentSource(PXAdapter adapter)
        {
            FSAdjust fsAdjustRow = FSAdjustments.Current;

            if (fsAdjustRow != null &&
                !(String.IsNullOrEmpty(fsAdjustRow.AdjdOrderType) ||
                  String.IsNullOrEmpty(fsAdjustRow.AdjdAppRefNbr)))
            {
                AppointmentEntry graphAppointmentEntry = PXGraph.CreateInstance <AppointmentEntry>();
                graphAppointmentEntry.AppointmentRecords.Current = graphAppointmentEntry.AppointmentRecords.Search <FSAppointment.refNbr>(fsAdjustRow.AdjdAppRefNbr, fsAdjustRow.AdjdOrderType);

                if (graphAppointmentEntry.AppointmentRecords.Current != null)
                {
                    throw new PXRedirectRequiredException(graphAppointmentEntry, true, "View Appointment Source")
                          {
                              Mode = PXBaseRedirectException.WindowMode.NewWindow
                          };
                }
            }
            return(adapter.Get());
        }
示例#4
0
        public virtual IEnumerable ViewFSDocumentToApply(PXAdapter adapter)
        {
            FSAdjust fsAdjustRow = FSAdjustments.Current;

            if (fsAdjustRow != null &&
                !(String.IsNullOrEmpty(fsAdjustRow.AdjdOrderType) ||
                  String.IsNullOrEmpty(fsAdjustRow.AdjdOrderNbr)))
            {
                ServiceOrderEntry graphServiceOrderEntry = PXGraph.CreateInstance <ServiceOrderEntry>();
                graphServiceOrderEntry.ServiceOrderRecords.Current = graphServiceOrderEntry.ServiceOrderRecords.Search <FSServiceOrder.refNbr>(fsAdjustRow.AdjdOrderNbr, fsAdjustRow.AdjdOrderType);

                if (graphServiceOrderEntry.ServiceOrderRecords.Current != null)
                {
                    throw new PXRedirectRequiredException(graphServiceOrderEntry, true, "View Service Order")
                          {
                              Mode = PXBaseRedirectException.WindowMode.NewWindow
                          };
                }
            }
            return(adapter.Get());
        }
示例#5
0
        protected virtual void _(Events.RowPersisting <FSAdjust> e)
        {
            //If there is not header
            if (Base.Document.Current == null || e.Row == null)
            {
                return;
            }

            FSAdjust fsAdjustRow = (FSAdjust)e.Row;

            FSServiceOrder fsServiceOrderRow = PXSelect <FSServiceOrder,
                                                         Where <
                                                             FSServiceOrder.srvOrdType, Equal <Required <FSServiceOrder.srvOrdType> >,
                                                             And <FSServiceOrder.refNbr, Equal <Required <FSServiceOrder.refNbr> > > > >
                                               .SelectWindowed(Base, 0, 1, fsAdjustRow.AdjdOrderType, fsAdjustRow.AdjdOrderNbr);

            if (fsServiceOrderRow != null && string.Equals(fsServiceOrderRow.CuryID, Base.Document.Current.CuryID) == false)
            {
                e.Cache.RaiseExceptionHandling <FSAdjust.adjdOrderNbr>(fsAdjustRow, fsAdjustRow.AdjdOrderNbr, new PXSetPropertyException("DIFERENTE CURY ID", PXErrorLevel.Error));
            }
        }
示例#6
0
        protected void FSAdjust_AdjdOrderNbr_FieldUpdated <T>(PXResult <T, CurrencyInfo> res, FSAdjust adj)
            where T : FSServiceOrder, new()
        {
            T fsServiceOrderRow = PXCache <T> .CreateCopy((T)res);

            adj.CustomerID         = Base.Document.Current.CustomerID;
            adj.AdjgDocDate        = Base.Document.Current.AdjDate;
            adj.AdjgCuryInfoID     = Base.Document.Current.CuryInfoID;
            adj.AdjdCuryInfoID     = fsServiceOrderRow.CuryInfoID;
            adj.AdjdOrigCuryInfoID = fsServiceOrderRow.CuryInfoID;
            adj.AdjdOrderDate      = fsServiceOrderRow.OrderDate > Base.Document.Current.AdjDate
                ? Base.Document.Current.AdjDate
                : fsServiceOrderRow.OrderDate;
            adj.Released = false;

            if (Base.Document.Current != null && string.IsNullOrEmpty(Base.Document.Current.DocDesc))
            {
                Base.Document.Current.DocDesc = fsServiceOrderRow.DocDesc;
            }
        }