protected virtual void FSAppointmentDetPart_RowSelecting(PXCache cache, PXRowSelectingEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            var fsAppointmentDetPartRow = (FSAppointmentDetPart)e.Row;

            // FSAppointmentDet.BillingRule is an Unbound field so we need to calculate it
            if (fsAppointmentDetPartRow.LineType == ID.LineType_All.INVENTORY_ITEM)
            {
                fsAppointmentDetPartRow.BillingRule = ID.BillingRule.FLAT_RATE;
            }
            else
            {
                fsAppointmentDetPartRow.BillingRule = ID.BillingRule.NONE;
            }

            // IsFree is an Unbound field so we need to calculate it
            fsAppointmentDetPartRow.IsFree = ServiceOrderAppointmentHandlers.IsFree(fsAppointmentDetPartRow.BillingRule, fsAppointmentDetPartRow.ManualPrice, fsAppointmentDetPartRow.LineType);

            using (new PXConnectionScope())
            {
                SharedFunctions.SetInventoryItemExtensionInfo(this, fsAppointmentDetPartRow.InventoryID, fsAppointmentDetPartRow);
            }
        }
Esempio n. 2
0
        protected virtual void _(Events.RowSelecting <FSAppointmentDet> e)
        {
            if (e.Row == null)
            {
                return;
            }

            var fsAppointmentDetURow = (FSAppointmentDet)e.Row;

            // FSAppointmentDet.BillingRule is an Unbound field so we need to calculate it
            if (fsAppointmentDetURow.IsService == true)
            {
                if (fsAppointmentDetURow.LineType == ID.LineType_ALL.NONSTOCKITEM)
                {
                    fsAppointmentDetURow.BillingRule = ID.BillingRule.FLAT_RATE;
                }
                else if (fsAppointmentDetURow.SODetID > 0)
                {
                    using (new PXConnectionScope())
                    {
                        var fsSODetRow = PXSelectReadonly <FSSODet,
                                                           Where <
                                                               FSSODet.sODetID, Equal <Required <FSSODet.sODetID> > > >
                                         .Select(e.Cache.Graph, fsAppointmentDetURow.SODetID);

                        fsAppointmentDetURow.BillingRule = ((FSSODet)fsSODetRow)?.BillingRule;
                    }
                }
            }
            else if (fsAppointmentDetURow.IsInventoryItem == true || fsAppointmentDetURow.IsPickupDelivery == true)
            {
                fsAppointmentDetURow.BillingRule = ID.BillingRule.FLAT_RATE;
            }
            else
            {
                fsAppointmentDetURow.BillingRule = ID.BillingRule.NONE;
            }

            // IsFree is an Unbound field so we need to calculate it
            fsAppointmentDetURow.IsFree = ServiceOrderAppointmentHandlers.IsFree(fsAppointmentDetURow.BillingRule, fsAppointmentDetURow.ManualPrice, fsAppointmentDetURow.LineType);

            if (fsAppointmentDetURow.IsInventoryItem)
            {
                using (new PXConnectionScope())
                {
                    SharedFunctions.SetInventoryItemExtensionInfo(this, fsAppointmentDetURow.InventoryID, fsAppointmentDetURow);
                }
            }
        }
        protected virtual void FSAppointmentInventoryItem_RowSelecting(PXCache cache, PXRowSelectingEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            var fsAppointmentInventoryItemRow = (FSAppointmentInventoryItem)e.Row;

            // FSAppointmentDet.BillingRule is an Unbound field so we need to calculate it
            fsAppointmentInventoryItemRow.BillingRule = ID.BillingRule.FLAT_RATE;

            // IsFree is an Unbound field so we need to calculate it
            fsAppointmentInventoryItemRow.IsFree = ServiceOrderAppointmentHandlers.IsFree(fsAppointmentInventoryItemRow.BillingRule, fsAppointmentInventoryItemRow.ManualPrice, fsAppointmentInventoryItemRow.LineType);
        }
        protected virtual void FSAppointmentDetService_RowSelecting(PXCache cache, PXRowSelectingEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            var fsAppointmentDetServiceRow = (FSAppointmentDetService)e.Row;

            // FSAppointmentDet.BillingRule is an Unbound field so we need to calculate it
            if (fsAppointmentDetServiceRow.LineType == ID.LineType_All.SERVICE)
            {
                if (fsAppointmentDetServiceRow.SODetID > 0)
                {
                    using (new PXConnectionScope())
                    {
                        var fsSODetRow = (FSSODet)PXSelectReadonly <FSSODet,
                                                                    Where <
                                                                        FSSODet.sODetID, Equal <Required <FSSODet.sODetID> > > >
                                         .Select(cache.Graph, fsAppointmentDetServiceRow.SODetID);

                        fsAppointmentDetServiceRow.BillingRule = fsSODetRow?.BillingRule;
                    }
                }
            }
            else if (fsAppointmentDetServiceRow.LineType == ID.LineType_All.NONSTOCKITEM)
            {
                fsAppointmentDetServiceRow.BillingRule = ID.BillingRule.FLAT_RATE;
            }
            else
            {
                fsAppointmentDetServiceRow.BillingRule = ID.BillingRule.NONE;
            }

            // IsFree is an Unbound field so we need to calculate it
            fsAppointmentDetServiceRow.IsFree = ServiceOrderAppointmentHandlers.IsFree(fsAppointmentDetServiceRow.BillingRule, fsAppointmentDetServiceRow.ManualPrice, fsAppointmentDetServiceRow.LineType);
        }
Esempio n. 5
0
        public static void FSSODet_RowSelecting(PXCache cache, PXRowSelectingEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            var           fsSODetRow       = (FSSODet)e.Row;
            FSAppointment fsAppointmentRow = null;

            using (new PXConnectionScope())
            {
                fsAppointmentRow = PXSelectJoin <FSAppointment,
                                                 InnerJoin <FSAppointmentDet,
                                                            On <
                                                                FSAppointmentDet.appointmentID, Equal <FSAppointment.appointmentID> > >,
                                                 Where <
                                                     FSAppointment.sOID, Equal <Required <FSAppointment.sOID> >,
                                                     And <FSAppointmentDet.sODetID, Equal <Required <FSAppointmentDet.sODetID> > > >,
                                                 OrderBy <
                                                     Desc <FSAppointmentDet.createdDateTime> > >
                                   .SelectWindowed(cache.Graph, 0, 1, fsSODetRow.SOID, fsSODetRow.SODetID);

                SharedFunctions.SetInventoryItemExtensionInfo(cache.Graph, fsSODetRow.InventoryID, fsSODetRow);
            }

            if (fsAppointmentRow != null)
            {
                fsSODetRow.Mem_LastReferencedBy = fsAppointmentRow.RefNbr;
            }
            else
            {
                fsSODetRow.Mem_LastReferencedBy = null;
            }

            fsSODetRow.IsFree = ServiceOrderAppointmentHandlers.IsFree(fsSODetRow.BillingRule, fsSODetRow.ManualPrice, fsSODetRow.LineType);
        }