protected virtual void SOOrderType_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { if (e.Row == null) { return; } SOOrderType ordertype = (SOOrderType)e.Row; SOOrderType link = references.SelectWindowed(0, 1, ordertype.OrderType); PXUIFieldAttribute.SetEnabled <SOOrderType.template>(sender, e.Row, link == null); bool isTemplateUpdatable = link == null && ordertype.OrderType != null && (ordertype.OrderType == ordertype.Template || ordertype.Template == null); SOOrderTypeOperation def = this.defaultOperation.Select(ordertype.OrderType, ordertype.DefaultOperation); if (def == null) { def = new SOOrderTypeOperation(); } PXUIFieldAttribute.SetEnabled <SOOrderType.billSeparately>(sender, e.Row, ordertype.ARDocType != ARDocType.NoUpdate); PXUIFieldAttribute.SetEnabled <SOOrderType.invoiceNumberingID>(sender, e.Row, ordertype.ARDocType != ARDocType.NoUpdate); if (ordertype.ARDocType == ARDocType.NoUpdate) { INTranType.CustomListAttribute listattr = new INTranType.SONonARListAttribute(); PXStringListAttribute.SetList <SOOrderTypeOperation.iNDocType>(this.operations.Cache, null, listattr.AllowedValues, listattr.AllowedLabels); } else { INTranType.CustomListAttribute listattr = new INTranType.SOListAttribute(); PXStringListAttribute.SetList <SOOrderTypeOperation.iNDocType>(this.operations.Cache, null, listattr.AllowedValues, listattr.AllowedLabels); } SOOrder order = PXSelectJoin <SOOrder, InnerJoin <INItemPlan, On <INItemPlan.refNoteID, Equal <SOOrder.noteID> > >, Where <SOOrder.orderType, Equal <Required <SOOrder.orderType> >, And <Where <INItemPlan.planType, Equal <INPlanConstants.plan60>, Or <INItemPlan.planType, Equal <INPlanConstants.plan66>, Or <INItemPlan.planType, Equal <INPlanConstants.plan68> > > > > > > .SelectWindowed(this, 0, 1, ordertype.OrderType); //PXUIFieldAttribute.SetEnabled<SOOrderType.requireLocation>(sender, ordertype, order == null && isTemplateUpdatable); //PXUIFieldAttribute.SetEnabled<SOOrderType.requireLocation>(sender, e.Row, def.INDocType != INTranType.NoUpdate && isTemplateUpdatable); PXUIFieldAttribute.SetEnabled <SOOrderType.requireShipping>(sender, e.Row, def.INDocType != INTranType.NoUpdate && def.INDocType != INTranType.Transfer && isTemplateUpdatable); PXUIFieldAttribute.SetEnabled <SOOrderType.aRDocType>(sender, e.Row, def.INDocType != INTranType.Transfer && isTemplateUpdatable); PXUIFieldAttribute.SetEnabled <SOOrderType.behavior>(sender, e.Row, isTemplateUpdatable); PXUIFieldAttribute.SetEnabled <SOOrderType.defaultOperation>(sender, e.Row, isTemplateUpdatable && ordertype.Behavior == SOBehavior.RM); PXUIFieldAttribute.SetVisible <SOOrderTypeOperation.active>(operations.Cache, null, ordertype.Behavior == SOBehavior.RM || ordertype.Behavior == SOBehavior.IN); PXUIFieldAttribute.SetVisible <SOOrderTypeOperation.autoCreateIssueLine>(operations.Cache, null, ordertype.Behavior == SOBehavior.RM); PXPersistingCheck activeCheck = ordertype.Active == true ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing; PXDefaultAttribute.SetPersistingCheck <SOOrderType.salesSubMask>(sender, ordertype, activeCheck); //PXDefaultAttribute.SetPersistingCheck<SOOrderType.cOGSSubMask>(sender, ordertype, activeCheck); PXDefaultAttribute.SetPersistingCheck <SOOrderType.miscSubMask>(sender, ordertype, activeCheck); PXDefaultAttribute.SetPersistingCheck <SOOrderType.freightSubMask>(sender, ordertype, activeCheck); PXDefaultAttribute.SetPersistingCheck <SOOrderType.discSubMask>(sender, ordertype, activeCheck); PXDefaultAttribute.SetPersistingCheck <SOOrderType.freightAcctID>(sender, ordertype, activeCheck); PXDefaultAttribute.SetPersistingCheck <SOOrderType.freightSubID>(sender, ordertype, activeCheck); PXUIFieldAttribute.SetEnabled <SOOrderType.copyLineNotesToInvoiceOnlyNS>(sender, ordertype, ordertype.CopyLineNotesToInvoice == true); PXUIFieldAttribute.SetEnabled <SOOrderType.copyLineFilesToInvoiceOnlyNS>(sender, ordertype, ordertype.CopyLineFilesToInvoice == true); PXUIFieldAttribute.SetEnabled <SOOrderType.requireAllocation>(sender, ordertype, ordertype.RequireShipping == true); PXUIFieldAttribute.SetEnabled <SOOrderType.requireLotSerial>(sender, ordertype, ordertype.RequireShipping == true); PXUIFieldAttribute.SetEnabled <SOOrderType.copyLotSerialFromShipment>(sender, ordertype, ordertype.RequireShipping == true); PXUIFieldAttribute.SetEnabled <SOOrderType.useDiscountSubFromSalesSub>(sender, ordertype, ordertype.PostLineDiscSeparately == true); bool allowUserDefinedOrderTypes = PXAccess.FeatureInstalled <FeaturesSet.userDefinedOrderTypes>(); soordertype.AllowInsert = allowUserDefinedOrderTypes; currentordertype.AllowInsert = allowUserDefinedOrderTypes; bool allowUpdateOrderTypes = allowUserDefinedOrderTypes || sender.GetStatus(e.Row) != PXEntryStatus.Inserted; soordertype.AllowUpdate = allowUpdateOrderTypes; currentordertype.AllowUpdate = allowUpdateOrderTypes; }
protected virtual void SOOrderType_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { if (e.Row == null) { return; } SOOrderType ordertype = (SOOrderType)e.Row; SOOrderType link = references.SelectWindowed(0, 1, ordertype.OrderType); bool isTemplateUpdatable = ordertype.IsSystem == false && link == null && ordertype.OrderType != null; PXUIFieldAttribute.SetEnabled <SOOrderType.template>(sender, e.Row, isTemplateUpdatable); SOOrderTypeOperation def = this.defaultOperation.Select(ordertype.OrderType, ordertype.DefaultOperation); if (def == null) { def = new SOOrderTypeOperation(); } PXUIFieldAttribute.SetEnabled <SOOrderType.billSeparately>(sender, e.Row, ordertype.ARDocType != ARDocType.NoUpdate); PXUIFieldAttribute.SetEnabled <SOOrderType.invoiceNumberingID>(sender, e.Row, ordertype.ARDocType != ARDocType.NoUpdate); if (ordertype.ARDocType == ARDocType.NoUpdate) { INTranType.CustomListAttribute listattr = new INTranType.SONonARListAttribute(); PXStringListAttribute.SetList <SOOrderTypeOperation.iNDocType>(this.operations.Cache, null, listattr.AllowedValues, listattr.AllowedLabels); } else { INTranType.CustomListAttribute listattr = new INTranType.SOListAttribute(); PXStringListAttribute.SetList <SOOrderTypeOperation.iNDocType>(this.operations.Cache, null, listattr.AllowedValues, listattr.AllowedLabels); } SOOrder order = PXSelectJoin <SOOrder, InnerJoin <INItemPlan, On <INItemPlan.refNoteID, Equal <SOOrder.noteID> > >, Where <SOOrder.orderType, Equal <Required <SOOrder.orderType> >, And <Where <INItemPlan.planType, Equal <INPlanConstants.plan60>, Or <INItemPlan.planType, Equal <INPlanConstants.plan66>, Or <INItemPlan.planType, Equal <INPlanConstants.plan68> > > > > > > .SelectWindowed(this, 0, 1, ordertype.OrderType); //PXUIFieldAttribute.SetEnabled<SOOrderType.requireLocation>(sender, ordertype, order == null && isTemplateUpdatable); //PXUIFieldAttribute.SetEnabled<SOOrderType.requireLocation>(sender, e.Row, def.INDocType != INTranType.NoUpdate && isTemplateUpdatable); PXUIFieldAttribute.SetEnabled <SOOrderType.requireShipping>(sender, e.Row, def.INDocType != INTranType.NoUpdate && def.INDocType != INTranType.Transfer && isTemplateUpdatable); PXUIFieldAttribute.SetEnabled <SOOrderType.aRDocType>(sender, e.Row, def.INDocType != INTranType.Transfer && isTemplateUpdatable); PXUIFieldAttribute.SetEnabled <SOOrderType.behavior>(sender, e.Row, isTemplateUpdatable); PXUIFieldAttribute.SetEnabled <SOOrderType.defaultOperation>(sender, e.Row, isTemplateUpdatable && ordertype.Behavior == SOBehavior.RM); PXUIFieldAttribute.SetVisible <SOOrderTypeOperation.active>(operations.Cache, null, ordertype.Behavior == SOBehavior.RM || ordertype.Behavior == SOBehavior.IN); PXUIFieldAttribute.SetVisible <SOOrderTypeOperation.autoCreateIssueLine>(operations.Cache, null, ordertype.Behavior == SOBehavior.RM); PXUIFieldAttribute.SetEnabled <SOOrderType.copyLineNotesToInvoiceOnlyNS>(sender, ordertype, ordertype.CopyLineNotesToInvoice == true); PXUIFieldAttribute.SetEnabled <SOOrderType.copyLineFilesToInvoiceOnlyNS>(sender, ordertype, ordertype.CopyLineFilesToInvoice == true); PXUIFieldAttribute.SetEnabled <SOOrderType.requireAllocation>(sender, ordertype, ordertype.RequireShipping == true); PXUIFieldAttribute.SetEnabled <SOOrderType.requireLotSerial>(sender, ordertype, ordertype.RequireShipping == true); PXUIFieldAttribute.SetEnabled <SOOrderType.copyLotSerialFromShipment>(sender, ordertype, ordertype.RequireShipping == true); PXUIFieldAttribute.SetEnabled <SOOrderType.useDiscountSubFromSalesSub>(sender, ordertype, ordertype.PostLineDiscSeparately == true); PXUIFieldAttribute.SetVisible <SOOrderType.recalculateDiscOnPartialShipment>(sender, e.Row, PXAccess.FeatureInstalled <FeaturesSet.inventory>() && PXAccess.FeatureInstalled <FeaturesSet.customerDiscounts>()); bool allowUserDefinedOrderTypes = PXAccess.FeatureInstalled <FeaturesSet.userDefinedOrderTypes>(); soordertype.AllowInsert = allowUserDefinedOrderTypes; currentordertype.AllowInsert = allowUserDefinedOrderTypes; bool allowUpdateOrderTypes = allowUserDefinedOrderTypes || sender.GetStatus(e.Row) != PXEntryStatus.Inserted; soordertype.AllowUpdate = allowUpdateOrderTypes; currentordertype.AllowUpdate = allowUpdateOrderTypes; PXUIFieldAttribute.SetVisible <SOOrderType.commitmentTracking>(sender, e.Row, CommitmentTracking); if (!PXAccess.FeatureInstalled <FeaturesSet.inventory>()) { PXDefaultAttribute.SetDefault <SOOrderType.behavior>(sender, SOBehavior.IN); PXStringListAttribute.SetList <SOOrderType.behavior>(sender, null, new string[] { SOBehavior.IN, SOBehavior.QT, SOBehavior.CM }, new string[] { Messages.INName, Messages.QTName, Messages.CMName }); } }