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

            FSSrvOrdType fsSrvOrdTypeRow = (FSSrvOrdType)e.Row;

            SOOrderType soOrderTypeRow = PXSelect <SOOrderType,
                                                   Where <SOOrderType.orderType, Equal <Required <FSSrvOrdType.postOrderType> > > >
                                         .Select(this, fsSrvOrdTypeRow.PostOrderType);

            if (soOrderTypeRow == null)
            {
                return;
            }

            if (soOrderTypeRow.Behavior != SOBehavior.IN)
            {
                cache.RaiseExceptionHandling <FSSrvOrdType.postOrderType>(
                    fsSrvOrdTypeRow,
                    fsSrvOrdTypeRow.PostOrderType,
                    new PXSetPropertyException(
                        TX.Warning.SALES_ORDER_NOT_INVOICE,
                        PXErrorLevel.Warning));
            }
        }
        protected override bool EraseCommitment(PXCache sender, object row)
        {
            SOOrder     order     = (SOOrder)PXParentAttribute.SelectParent(sender.Graph.Caches[detailEntity], row, typeof(SOOrder));
            SOOrderType orderType = (SOOrderType)PXSelectorAttribute.Select <SOOrder.orderType>(sender.Graph.Caches[typeof(SOOrder)], order);

            if (order.Hold == true || order.Cancelled == true || orderType.CommitmentTracking != true || sender.GetValue(row, "TaskID") == null)
            {
                return(true);
            }
            else
            {
                return(GetAccountGroup(sender, row) == null);
            }
        }
        public virtual ARTran CreateTranFromShipLine(ARInvoice newdoc, SOOrderType ordertype, string operation, SOLine orderline, ref SOShipLine shipline, CreateTranFromShipLineDelegate baseMethod)
        {
            ARTran tran = baseMethod(newdoc, ordertype, operation, orderline, ref shipline);
            SOLine line = PXSelect <SOLine, Where <SOLine.orderType, Equal <Required <SOLine.orderType> >,
                                                   And <SOLine.orderNbr, Equal <Required <SOLine.orderNbr> >,
                                                        And <SOLine.lineNbr, Equal <Required <SOLine.lineNbr> > > > > > .Select(Base, orderline.OrderType, orderline.OrderNbr, orderline.LineNbr);

            SOLineRUTROT lineRR = PXCache <SOLine> .GetExtension <SOLineRUTROT>(line);

            ARTranRUTROT tranRR = PXCache <ARTran> .GetExtension <ARTranRUTROT>(tran);

            tranRR.IsRUTROTDeductible = lineRR.IsRUTROTDeductible;
            tranRR.RUTROTItemType     = lineRR.RUTROTItemType;
            tranRR.RUTROTWorkTypeID   = lineRR.RUTROTWorkTypeID;
            return(tran);
        }
        public virtual void SetQuickProcessSettingsVisibility(PXCache cache, FSSrvOrdType fsSrvOrdTypeRow, FSQuickProcessParameters fsQuickProcessParametersRow)
        {
            if (fsSrvOrdTypeRow != null)
            {
                bool isQuickProcessChecked = false;
                bool isGeneratingInvoice   = fsQuickProcessParametersRow.GenerateInvoiceFromServiceOrder.Value || fsQuickProcessParametersRow.GenerateInvoiceFromAppointment.Value;
                bool postToSO          = fsSrvOrdTypeRow.PostTo == ID.SrvOrdType_PostTo.SALES_ORDER_MODULE;
                bool postToSOInvoice   = fsSrvOrdTypeRow.PostTo == ID.SrvOrdType_PostTo.SALES_ORDER_INVOICE;
                bool isInvoiceBehavior = false || postToSOInvoice == true;

                if (postToSO == true)
                {
                    SOOrderType soOrderTypeRow = PXSelect <SOOrderType,
                                                           Where <
                                                               SOOrderType.orderType, Equal <Required <SOOrderType.orderType> > > >
                                                 .Select(this, fsSrvOrdTypeRow.PostOrderType);

                    if (soOrderTypeRow != null)
                    {
                        isInvoiceBehavior     = soOrderTypeRow.Behavior == SOBehavior.IN;
                        isQuickProcessChecked = (bool)soOrderTypeRow.AllowQuickProcess;
                    }
                }

                bool enableInvoiceActions = isInvoiceBehavior &&
                                            ((postToSO &&
                                              fsQuickProcessParametersRow.SOQuickProcess == false &&
                                              fsQuickProcessParametersRow.PrepareInvoice == true) ||
                                             postToSOInvoice) && isGeneratingInvoice;

                PXUIFieldAttribute.SetVisible <FSQuickProcessParameters.sOQuickProcess>(cache, fsQuickProcessParametersRow, postToSO && isQuickProcessChecked);
                PXUIFieldAttribute.SetVisible <FSQuickProcessParameters.prepareInvoice>(cache, fsQuickProcessParametersRow, postToSO && isInvoiceBehavior && fsQuickProcessParametersRow.SOQuickProcess == false);
                PXUIFieldAttribute.SetVisible <FSQuickProcessParameters.emailSalesOrder>(cache, fsQuickProcessParametersRow, postToSO);

                PXUIFieldAttribute.SetVisible <FSQuickProcessParameters.releaseInvoice>(cache, fsQuickProcessParametersRow, enableInvoiceActions);
                PXUIFieldAttribute.SetVisible <FSQuickProcessParameters.emailInvoice>(cache, fsQuickProcessParametersRow, enableInvoiceActions);

                PXUIFieldAttribute.SetVisible <FSQuickProcessParameters.releaseBill>(cache, fsQuickProcessParametersRow, false);
                PXUIFieldAttribute.SetVisible <FSQuickProcessParameters.payBill>(cache, fsQuickProcessParametersRow, false);

                PXUIFieldAttribute.SetEnabled <FSQuickProcessParameters.sOQuickProcess>(cache, fsQuickProcessParametersRow, fsQuickProcessParametersRow.PrepareInvoice.Value == false && isGeneratingInvoice);
                PXUIFieldAttribute.SetEnabled <FSQuickProcessParameters.releaseInvoice>(cache, fsQuickProcessParametersRow, enableInvoiceActions);
                PXUIFieldAttribute.SetEnabled <FSQuickProcessParameters.emailInvoice>(cache, fsQuickProcessParametersRow, enableInvoiceActions);
            }
        }