/// <summary> /// Enables or disables fields. /// </summary> public virtual void EnableDisable(PXCache cache, INItemClass itemClassRow) { bool isEnabledAsModelTemplate = false; bool isStkItem = itemClassRow.StkItem == true; FSxServiceClass fsxServiceClassRow = cache.GetExtension <FSxServiceClass>(itemClassRow); PXUIFieldAttribute.SetEnabled <FSxServiceClass.dfltBillingRule>(cache, itemClassRow, itemClassRow.ItemType == INItemTypes.ServiceItem); EnableDisable_ItemType(cache, itemClassRow, fsxServiceClassRow); ModelTemplateComponentRecords.AllowSelect = false; if (PXAccess.FeatureInstalled <FeaturesSet.equipmentManagementModule>()) { FSxEquipmentModelTemplate fsxEquipmentModelTemplateRow = cache.GetExtension <FSxEquipmentModelTemplate>(itemClassRow); isEnabledAsModelTemplate = fsxEquipmentModelTemplateRow.EQEnabled == true && fsxEquipmentModelTemplateRow.EquipmentItemClass == ID.Equipment_Item_Class.MODEL_EQUIPMENT; fsxEquipmentModelTemplateRow.Mem_ShowComponent = isEnabledAsModelTemplate; PXUIFieldAttribute.SetEnabled <FSxEquipmentModelTemplate.equipmentItemClass>(cache, itemClassRow, isStkItem); PXUIFieldAttribute.SetEnabled <FSxEquipmentModelTemplate.eQEnabled>(cache, itemClassRow, isStkItem); PXUIFieldAttribute.SetEnabled <FSxEquipmentModelTemplate.dfltModelType>(cache, itemClassRow, isEnabledAsModelTemplate); PXDefaultAttribute.SetPersistingCheck <FSxEquipmentModelTemplate.dfltModelType>(cache, itemClassRow, isEnabledAsModelTemplate == true ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); ModelTemplateComponentRecords.AllowSelect = fsxEquipmentModelTemplateRow.Mem_ShowComponent == true; } ModelTemplateComponentRecords.Cache.AllowInsert = isEnabledAsModelTemplate; ModelTemplateComponentRecords.Cache.AllowUpdate = isEnabledAsModelTemplate; ModelTemplateComponentRecords.Cache.AllowDelete = isEnabledAsModelTemplate; if (isEnabledAsModelTemplate == false) { ModelTemplateComponentRecords.Cache.Clear(); } }
protected virtual void LandedCostCode_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { LandedCostCode row = (LandedCostCode)e.Row; if (row != null) { bool hasVendor = row.VendorID.HasValue; PXDefaultAttribute.SetPersistingCheck <LandedCostCode.vendorLocationID>(sender, e.Row, hasVendor ? PXPersistingCheck.Null : PXPersistingCheck.Nothing); PXUIFieldAttribute.SetRequired <LandedCostCode.vendorLocationID>(sender, hasVendor); PXUIFieldAttribute.SetEnabled <LandedCostCode.vendorLocationID>(sender, e.Row, hasVendor); sender.RaiseExceptionHandling <LandedCostCode.vendorID>(row, row.VendorID, null); if (hasVendor) { Vendor vnd = PXSelect <Vendor, Where <Vendor.bAccountID, Equal <Required <Vendor.bAccountID> > > > .Select(this, row.VendorID); if (vnd != null && vnd.LandedCostVendor == false) { sender.RaiseExceptionHandling <LandedCostCode.vendorID>(row, row.VendorID, new PXSetPropertyException(Messages.LCCodeUsesNonLCVendor, PXErrorLevel.Warning)); } } } }
protected virtual void INSetup_RowPersisting(PXCache cache, PXRowPersistingEventArgs e) { INSetup row = (INSetup)e.Row; if (row == null) { return; } if ((e.Operation & PXDBOperation.Command) == PXDBOperation.Delete) { return; } short newValue = (short)row.TurnoverPeriodsPerYear; if (newValue > 12 || newValue < 1 || (newValue != 0) && ((short)(12 / newValue)) * newValue != 12) { cache.RaiseExceptionHandling <INSetup.turnoverPeriodsPerYear>(row, newValue, new PXSetPropertyException(Messages.PossibleValuesAre)); } PXDefaultAttribute.SetPersistingCheck <INSetup.iNTransitAcctID>(cache, e.Row, PXAccess.FeatureInstalled <FeaturesSet.warehouse>() ? PXPersistingCheck.Null : PXPersistingCheck.Nothing); PXDefaultAttribute.SetPersistingCheck <INSetup.iNTransitSubID>(cache, e.Row, PXAccess.FeatureInstalled <FeaturesSet.warehouse>() ? PXPersistingCheck.Null : PXPersistingCheck.Nothing); }
protected virtual void ARSetup_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { ARSetup row = e.Row as ARSetup; if (row != null) { bool useMultipleBranches = PXSelect <GL.Branch> .Select(this).Count > 0; PXDefaultAttribute.SetPersistingCheck <ARSetup.statementBranchID>(sender, row, (useMultipleBranches && row.ConsolidatedStatement == true) ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); PXDefaultAttribute.SetPersistingCheck <ARSetup.dunningLetterBranchID>(sender, row, (useMultipleBranches && row.ConsolidatedDunningLetter == true) ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); bool existDunningFee = false; foreach (ARDunningSetup item in DunningSetup.Select()) { if (item.DunningFee.HasValue && item.DunningFee != 0m) { existDunningFee = true; break; } } PXDefaultAttribute.SetPersistingCheck <ARSetup.dunningFeeInventoryID>(sender, row, existDunningFee ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); } }
protected virtual void EPAssignmentRoute_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { EPAssignmentRoute row = e.Row as EPAssignmentRoute; if (row == null) { return; } PXDefaultAttribute.SetPersistingCheck <EPAssignmentRoute.workgroupID>(sender, e.Row, row.RouterType == EPRouterType.Workgroup ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); PXDefaultAttribute.SetPersistingCheck <EPAssignmentRoute.routeID>(sender, e.Row, row.RouterType == EPRouterType.Router ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); if (e.Operation == PXDBOperation.Insert && PositionFilter.Current.MapID == row.AssignmentMapID && (PositionFilter.Current.NodeID == row.AssignmentRouteID || PositionFilter.Current.NodeID == null)) { current = row; } }
protected virtual void INItemClassRep_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { INItemClassRep row = (INItemClassRep)e.Row; if (row != null) { bool isTransfer = (row.ReplenishmentSource == INReplenishmentSource.Transfer); bool isFixedReorder = (row.ReplenishmentMethod == INReplenishmentMethod.FixedReorder); PXUIFieldAttribute.SetEnabled <INItemClassRep.replenishmentMethod>(sender, row, row.ReplenishmentSource != INReplenishmentSource.PurchaseToOrder && row.ReplenishmentSource != INReplenishmentSource.DropShipToOrder); PXUIFieldAttribute.SetEnabled <INItemClassRep.replenishmentSourceSiteID>(sender, row, row.ReplenishmentSource == INReplenishmentSource.PurchaseToOrder || row.ReplenishmentSource == INReplenishmentSource.DropShipToOrder || row.ReplenishmentSource == INReplenishmentSource.Transfer || row.ReplenishmentSource == INReplenishmentSource.Purchased); PXUIFieldAttribute.SetEnabled <INItemClassRep.transferLeadTime>(sender, e.Row, isTransfer); PXUIFieldAttribute.SetEnabled <INItemClassRep.transferERQ>(sender, e.Row, isTransfer && isFixedReorder && row.ReplenishmentMethod != INReplenishmentMethod.None); PXUIFieldAttribute.SetEnabled <INItemClassRep.forecastModelType>(sender, e.Row, row.ReplenishmentMethod != INReplenishmentMethod.None); PXUIFieldAttribute.SetEnabled <INItemClassRep.forecastPeriodType>(sender, e.Row, row.ReplenishmentMethod != INReplenishmentMethod.None); PXUIFieldAttribute.SetEnabled <INItemClassRep.historyDepth>(sender, e.Row, row.ReplenishmentMethod != INReplenishmentMethod.None); PXUIFieldAttribute.SetEnabled <INItemClassRep.launchDate>(sender, e.Row, row.ReplenishmentMethod != INReplenishmentMethod.None); PXUIFieldAttribute.SetEnabled <INItemClassRep.terminationDate>(sender, e.Row, row.ReplenishmentMethod != INReplenishmentMethod.None); PXUIFieldAttribute.SetEnabled <INItemClassRep.serviceLevelPct>(sender, e.Row, row.ReplenishmentMethod != INReplenishmentMethod.None); PXDefaultAttribute.SetPersistingCheck <INItemClassRep.transferLeadTime>(sender, e.Row, isTransfer ? PXPersistingCheck.Null : PXPersistingCheck.Nothing); PXDefaultAttribute.SetPersistingCheck <INItemClassRep.transferERQ>(sender, e.Row, (isTransfer && isFixedReorder) ? PXPersistingCheck.Null : PXPersistingCheck.Nothing); } }
protected virtual void DRDeferredCode_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { var code = e.Row as DRDeferredCode; if (code == null) { return; } PXUIFieldAttribute.SetVisible(sender, code, null, true); SetPeriodicallyControlsState(sender, code); var accountIsOptional = code.MultiDeliverableArrangement == true || code.AccountSource == DeferralAccountSource.Item; var subIsOptional = code.MultiDeliverableArrangement == true || code.CopySubFromSourceTran == true; PXDefaultAttribute.SetPersistingCheck <DRDeferredCode.accountID>(sender, code, accountIsOptional ? PXPersistingCheck.Nothing : PXPersistingCheck.NullOrBlank); PXDefaultAttribute.SetPersistingCheck <DRDeferredCode.subID>(sender, code, subIsOptional ? PXPersistingCheck.Nothing : PXPersistingCheck.NullOrBlank); bool isFlexible = DeferredMethodType.RequiresTerms(code); PXUIFieldAttribute.SetEnabled <DRDeferredCode.accountType>(sender, code, !isFlexible && code.Method != DeferredMethodType.CashReceipt); PXUIFieldAttribute.SetEnabled <DRDeferredCode.startOffset>(sender, code, !isFlexible); PXUIFieldAttribute.SetEnabled <DRDeferredCode.occurrences>(sender, code, !isFlexible); PXUIFieldAttribute.SetEnabled <DRDeferredCode.deferralSubMaskAR>(sender, code, code.CopySubFromSourceTran != true); PXUIFieldAttribute.SetEnabled <DRDeferredCode.deferralSubMaskAP>(sender, code, code.CopySubFromSourceTran != true); PXUIFieldAttribute.SetVisible <DRDeferredCode.deferralSubMaskAR>(sender, code, code.AccountType == DeferredAccountType.Income); PXUIFieldAttribute.SetVisible <DRDeferredCode.deferralSubMaskAP>(sender, code, code.AccountType == DeferredAccountType.Expense); PXUIFieldAttribute.SetVisible <DRDeferredCode.recognizeInPastPeriods>(sender, code, isFlexible); if (code.MultiDeliverableArrangement == true) { PXUIFieldAttribute.SetVisible(sender, code, null, false); PXUIFieldAttribute.SetVisible <DRDeferredCode.deferredCodeID>(sender, code, true); PXUIFieldAttribute.SetVisible <DRDeferredCode.description>(sender, code, true); PXUIFieldAttribute.SetVisible <DRDeferredCode.multiDeliverableArrangement>(sender, code, true); } }
protected virtual void GLSetup_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { if (e.Row == null) { return; } GLSetup setup = (GLSetup)e.Row; if (setup.ConsolSegmentId == null) { PXUIFieldAttribute.SetVisible <GLConsolSetup.segmentValue>(ConsolSetupRecords.Cache, null, false); PXDefaultAttribute.SetPersistingCheck <GLConsolSetup.segmentValue>(ConsolSetupRecords.Cache, null, PXPersistingCheck.Nothing); PXUIFieldAttribute.SetVisible <GLConsolSetup.pasteFlag>(ConsolSetupRecords.Cache, null, false); } else { PXUIFieldAttribute.SetVisible <GLConsolSetup.segmentValue>(ConsolSetupRecords.Cache, null, true); PXDefaultAttribute.SetPersistingCheck <GLConsolSetup.segmentValue>(ConsolSetupRecords.Cache, null, PXPersistingCheck.NullOrBlank); PXUIFieldAttribute.SetVisible <GLConsolSetup.pasteFlag>(ConsolSetupRecords.Cache, null, true); } }
/// <summary> /// This method enables or disables the fields on the <c>FSserviceTemplateDet</c> grid depending on the <c>FSServiceTemplateDet.LineType</c> field. /// </summary> public virtual void LineTypeEnableDisable(PXCache cache, FSServiceTemplateDet fsServiceTemplateDetRow) { switch (fsServiceTemplateDetRow.LineType) { case ID.LineType_ServiceTemplate.COMMENT: case ID.LineType_ServiceTemplate.INSTRUCTION: PXUIFieldAttribute.SetEnabled <FSServiceTemplateDet.serviceTemplateID>(cache, fsServiceTemplateDetRow, false); PXDefaultAttribute.SetPersistingCheck <FSServiceTemplateDet.serviceTemplateID>(cache, fsServiceTemplateDetRow, PXPersistingCheck.Nothing); PXUIFieldAttribute.SetEnabled <FSServiceTemplateDet.inventoryID>(cache, fsServiceTemplateDetRow, false); PXDefaultAttribute.SetPersistingCheck <FSServiceTemplateDet.inventoryID>(cache, fsServiceTemplateDetRow, PXPersistingCheck.Nothing); PXUIFieldAttribute.SetEnabled <FSServiceTemplateDet.qty>(cache, fsServiceTemplateDetRow, false); PXDefaultAttribute.SetPersistingCheck <FSServiceTemplateDet.qty>(cache, fsServiceTemplateDetRow, PXPersistingCheck.Nothing); PXUIFieldAttribute.SetEnabled <FSServiceTemplateDet.tranDesc>(cache, fsServiceTemplateDetRow, true); PXDefaultAttribute.SetPersistingCheck <FSServiceTemplateDet.tranDesc>(cache, fsServiceTemplateDetRow, PXPersistingCheck.NullOrBlank); break; case ID.LineType_ServiceTemplate.INVENTORY_ITEM: case ID.LineType_ServiceTemplate.SERVICE: case ID.LineType_ServiceTemplate.NONSTOCKITEM: PXUIFieldAttribute.SetEnabled <FSServiceTemplateDet.serviceTemplateID>(cache, fsServiceTemplateDetRow, false); PXDefaultAttribute.SetPersistingCheck <FSServiceTemplateDet.serviceTemplateID>(cache, fsServiceTemplateDetRow, PXPersistingCheck.Nothing); PXUIFieldAttribute.SetEnabled <FSServiceTemplateDet.inventoryID>(cache, fsServiceTemplateDetRow, true); PXDefaultAttribute.SetPersistingCheck <FSServiceTemplateDet.inventoryID>(cache, fsServiceTemplateDetRow, PXPersistingCheck.NullOrBlank); PXUIFieldAttribute.SetEnabled <FSServiceTemplateDet.qty>(cache, fsServiceTemplateDetRow, true); PXDefaultAttribute.SetPersistingCheck <FSServiceTemplateDet.qty>(cache, fsServiceTemplateDetRow, PXPersistingCheck.NullOrBlank); PXUIFieldAttribute.SetEnabled <FSServiceTemplateDet.tranDesc>(cache, fsServiceTemplateDetRow, true); PXDefaultAttribute.SetPersistingCheck <FSServiceTemplateDet.tranDesc>(cache, fsServiceTemplateDetRow, PXPersistingCheck.NullOrBlank); break; default: PXUIFieldAttribute.SetEnabled <FSServiceTemplateDet.inventoryID>(cache, fsServiceTemplateDetRow, true); PXDefaultAttribute.SetPersistingCheck <FSServiceTemplateDet.inventoryID>(cache, fsServiceTemplateDetRow, PXPersistingCheck.NullOrBlank); PXUIFieldAttribute.SetEnabled <FSServiceTemplateDet.qty>(cache, fsServiceTemplateDetRow, true); PXDefaultAttribute.SetPersistingCheck <FSServiceTemplateDet.qty>(cache, fsServiceTemplateDetRow, PXPersistingCheck.NullOrBlank); PXUIFieldAttribute.SetEnabled <FSServiceTemplateDet.tranDesc>(cache, fsServiceTemplateDetRow, true); PXDefaultAttribute.SetPersistingCheck <FSServiceTemplateDet.tranDesc>(cache, fsServiceTemplateDetRow, PXPersistingCheck.NullOrBlank); break; } }
protected virtual void TaxZone_RowSelected(PXCache cache, PXRowSelectedEventArgs e) { TaxZone row = e.Row as TaxZone; if (row == null) { return; } TX.TXAvalaraSetup avalaraSetup = PXSelect <TX.TXAvalaraSetup> .Select(this); PXUIFieldAttribute.SetVisible <TaxZone.isExternal>(cache, null, avalaraSetup != null && avalaraSetup.IsActive == true); PXUIFieldAttribute.SetVisible <TaxZone.taxVendorID>(cache, e.Row, row.IsExternal == true); PXUIFieldAttribute.SetVisible <TaxZone.taxID>(cache, e.Row, row.IsManualVATZone == true); PXDefaultAttribute.SetPersistingCheck <TaxZone.taxID>(cache, e.Row, PXAccess.FeatureInstalled <FeaturesSet.manualVATEntryMode>() && row.IsManualVATZone == true ? PXPersistingCheck.Null : PXPersistingCheck.Nothing); Details.Cache.AllowInsert = row.IsExternal != true; Details.Cache.AllowUpdate = row.IsExternal != true; Details.Cache.AllowDelete = row.IsExternal != true; Zip.Cache.AllowInsert = row.IsExternal != true; Zip.Cache.AllowUpdate = row.IsExternal != true; Zip.Cache.AllowDelete = row.IsExternal != true; }
protected virtual void MobileNotification_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected baseMethod) { if (baseMethod != null) { baseMethod.Invoke(cache, e); } var row = e.Row as MobileNotification; if (row == null) { return; } bool isTeamsNotification = row.DeliveryType == (byte)3; PXUIFieldAttribute.SetVisible <MobileNotification.destinationEntityID>(cache, row, !isTeamsNotification); PXUIFieldAttribute.SetVisible <MobileNotification.destinationScreenID>(cache, row, !isTeamsNotification); PXUIFieldAttribute.SetVisible <MobileNotification.subject>(cache, row, !isTeamsNotification); PXUIFieldAttribute.SetVisible <MobileNotification.nfrom>(cache, row, !isTeamsNotification); PXUIFieldAttribute.SetVisible <MobileNotification.nto>(cache, row, !isTeamsNotification); PXUIFieldAttribute.SetVisible <MobileNotificationExt.usrTo>(cache, row, isTeamsNotification); PXDefaultAttribute.SetPersistingCheck <MobileNotification.nto>(cache, row, isTeamsNotification ? PXPersistingCheck.Nothing : PXPersistingCheck.NullOrBlank); }
/* Events */ protected void XRBContrHdr_RowSelected(PXCache sender, PXRowSelectedEventArgs e, PXRowSelected del) { // Event handler body before the base BLC event handler collection if (del != null) { del(sender, e); } // Event handler body after the base BLC event handler collection if (e.Row != null) { XRBContrHdr doc = e.Row as XRBContrHdr; if (doc != null) { XRBContrDet current = PXSelect <XRBContrDet, Where <XRBContrDet.manuallyBooked, Equal <False>, And <XRBContrDet.contractID, Equal <Required <XRBContrHdr.contractID> > > > > .Select(Base, doc.ContractID); if (current != null) { var count = PXSelect <XRBGLDist, Where <XRBGLDist.contractID, Equal <Required <XRBContrDet.contractID> >, And <XRBGLDist.contrDetLineNbr, Equal <Required <XRBContrDet.lineNbr> > > > > .Select(Base, current.ContractID, current.LineNbr).Count; if (count > 0) { PXUIFieldAttribute.SetEnabled <XRBContrHdrExt.usrLineofBusiness>(sender, doc, false); } else { PXUIFieldAttribute.SetEnabled <XRBContrHdrExt.usrLineofBusiness>(sender, doc, true); } } PXDefaultAttribute.SetPersistingCheck <XRBContrHdr.classID>(sender, doc, PXPersistingCheck.NullOrBlank); } } }
protected virtual void INTran_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { InventoryItem item = (InventoryItem)PXSelectorAttribute.Select <INTran.inventoryID>(sender, e.Row); INLotSerClass itemclass = (INLotSerClass)PXSelectorAttribute.Select <InventoryItem.lotSerClassID>(this.Caches[typeof(InventoryItem)], item); PXPersistingCheck check = ((INTran)e.Row).InvtMult != 0 && ( (item != null && item.ValMethod == INValMethod.Specific) || (itemclass != null && itemclass.LotSerTrack != INLotSerTrack.NotNumbered && itemclass.LotSerAssign == INLotSerAssign.WhenReceived && ((INTran)e.Row).Qty != 0m)) ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing; PXDefaultAttribute.SetPersistingCheck <INTran.subID>(sender, e.Row, PXPersistingCheck.Null); PXDefaultAttribute.SetPersistingCheck <INTran.locationID>(sender, e.Row, PXPersistingCheck.Null); PXDefaultAttribute.SetPersistingCheck <INTran.lotSerialNbr>(sender, e.Row, check); if (adjustment.Current != null && adjustment.Current.OrigModule != INRegister.origModule.PI && item != null && item.ValMethod == INValMethod.FIFO && ((INTran)e.Row).OrigRefNbr == null) { if (sender.RaiseExceptionHandling <INTran.origRefNbr>(e.Row, null, new PXSetPropertyException(ErrorMessages.FieldIsEmpty, typeof(INTran.origRefNbr).Name))) { throw new PXRowPersistingException(typeof(INTran.origRefNbr).Name, null, ErrorMessages.FieldIsEmpty, typeof(INTran.origRefNbr).Name); } } if (item != null && item.ValMethod == INValMethod.Standard && ((INTran)e.Row).TranType == INTranType.Adjustment && ((INTran)e.Row).BaseQty == 0m && ((INTran)e.Row).TranCost != 0m) { if (sender.RaiseExceptionHandling <INTran.tranCost>(e.Row, ((INTran)e.Row).TranCost, new PXSetPropertyException(Messages.StandardCostNoCostOnlyAdjust))) { throw new PXRowPersistingException(typeof(INTran.tranCost).Name, ((INTran)e.Row).TranCost, Messages.StandardCostNoCostOnlyAdjust); } } }
protected virtual void PaymentMethodAccount_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { PaymentMethodAccount row = (PaymentMethodAccount)e.Row; PXDefaultAttribute.SetPersistingCheck <PaymentMethodAccount.aPLastRefNbr>(sender, e.Row, row.APAutoNextNbr == true ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); if (row.APAutoNextNbr == true && row.APLastRefNbr == null) { sender.RaiseExceptionHandling <PaymentMethodAccount.aPAutoNextNbr>(row, row.APAutoNextNbr, new PXSetPropertyException(Messages.SpecifyLastRefNbr, GL.Messages.ModuleAP)); } if (row.ARAutoNextNbr == true && row.ARLastRefNbr == null) { sender.RaiseExceptionHandling <PaymentMethodAccount.aRAutoNextNbr>(row, row.ARAutoNextNbr, new PXSetPropertyException(Messages.SpecifyLastRefNbr, GL.Messages.ModuleAR)); } CashAccount cashAccount = PXSelectReadonly <CashAccount, Where <CashAccount.cashAccountID, Equal <Required <CashAccount.cashAccountID> > > > .Select(this, row.CashAccountID); if (cashAccount != null && cashAccount.Active != true) { if (e.Operation == PXDBOperation.Update) { PaymentMethodAccount origPaymentAccount = PXSelectReadonly <PaymentMethodAccount, Where <PaymentMethodAccount.paymentMethodID, Equal <Required <PaymentMethodAccount.paymentMethodID> >, And <PaymentMethodAccount.cashAccountID, Equal <Required <PaymentMethodAccount.cashAccountID> > > > > .Select(this, row.PaymentMethodID, row.CashAccountID); if (origPaymentAccount?.CashAccountID == row.CashAccountID) { return; } } string errorMsg = string.Format(CA.Messages.CashAccountInactive, cashAccount.CashAccountCD.Trim()); sender.RaiseExceptionHandling <PaymentMethodAccount.cashAccountID>(e.Row, cashAccount.CashAccountCD, new PXSetPropertyException(errorMsg, PXErrorLevel.Error)); } }
public virtual void INRegister_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { if ((e.Operation & PXDBOperation.Command) == PXDBOperation.Delete) { return; } PXDefaultAttribute.SetPersistingCheck <INTran.toLocationID>(this.transactions.Cache, null, ((INRegister)e.Row).TransferType == INTransferType.OneStep ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); object newValue = sender.GetValue <INRegister.toSiteID>(e.Row); try { sender.RaiseFieldVerifying <INRegister.toSiteID>(e.Row, ref newValue); } catch (PXSetPropertyException ex) { PXCache inRegisterCachce = sender.Graph.Caches[typeof(INRegister)]; if ((String)inRegisterCachce.GetValue <INRegister.transferType>(inRegisterCachce.Current) == INTransferType.OneStep) { sender.RaiseExceptionHandling <INRegister.toSiteID>(e.Row, newValue, new PXSetPropertyException(ex, PXErrorLevel.Error, Messages.WarehouseNotAllowed, Messages.OneStep)); } } }
private void SetPersistingChecks(IRUTROTable document, RUTROT rutrot) { PXPersistingCheck check = document.IsRUTROTDeductible == true ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing; PXPersistingCheck rotCheck = document.IsRUTROTDeductible == true && rutrot?.RUTROTType == RUTROTTypes.ROT ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing; PXDefaultAttribute.SetPersistingCheck <RUTROT.rUTROTType>(Rutrots.Cache, rutrot, check); PXDefaultAttribute.SetPersistingCheck <RUTROT.rOTDeductionPct>(Rutrots.Cache, rutrot, check); PXDefaultAttribute.SetPersistingCheck <RUTROT.curyROTPersonalAllowance>(Rutrots.Cache, rutrot, check); PXDefaultAttribute.SetPersistingCheck <RUTROT.curyROTExtraAllowance>(Rutrots.Cache, rutrot, check); PXDefaultAttribute.SetPersistingCheck <RUTROT.rUTDeductionPct>(Rutrots.Cache, rutrot, check); PXDefaultAttribute.SetPersistingCheck <RUTROT.curyRUTPersonalAllowance>(Rutrots.Cache, rutrot, check); PXDefaultAttribute.SetPersistingCheck <RUTROT.curyRUTExtraAllowance>(Rutrots.Cache, rutrot, check); if (!String.IsNullOrWhiteSpace(rutrot?.ROTOrganizationNbr)) { PXDefaultAttribute.SetPersistingCheck <RUTROT.rOTAppartment>(Rutrots.Cache, rutrot, rotCheck); PXDefaultAttribute.SetPersistingCheck <RUTROT.rOTEstate>(Rutrots.Cache, rutrot, PXPersistingCheck.Nothing); } else { PXDefaultAttribute.SetPersistingCheck <RUTROT.rOTEstate>(Rutrots.Cache, rutrot, rotCheck); PXDefaultAttribute.SetPersistingCheck <RUTROT.rOTAppartment>(Rutrots.Cache, rutrot, PXPersistingCheck.Nothing); } }
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); }
protected virtual void INRegister_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { if (e.Row == null) { return; } release.SetEnabled(e.Row != null && ((INRegister)e.Row).Hold == false && ((INRegister)e.Row).Released == false); iNEdit.SetEnabled(e.Row != null && ((INRegister)e.Row).Hold == false && ((INRegister)e.Row).Released == false); iNRegisterDetails.SetEnabled(e.Row != null && ((INRegister)e.Row).Released == true); PXUIFieldAttribute.SetEnabled(sender, e.Row, ((INRegister)e.Row).Released == false && ((INRegister)e.Row).OrigModule == GL.BatchModule.IN); PXUIFieldAttribute.SetEnabled <INRegister.refNbr>(sender, e.Row, true); PXUIFieldAttribute.SetEnabled <INRegister.totalQty>(sender, e.Row, false); PXUIFieldAttribute.SetEnabled <INRegister.status>(sender, e.Row, false); PXUIFieldAttribute.SetEnabled <INRegister.branchID>(sender, e.Row, false); sender.AllowInsert = true; sender.AllowUpdate = (((INRegister)e.Row).Released == false); sender.AllowDelete = (((INRegister)e.Row).Released == false && ((INRegister)e.Row).OrigModule == GL.BatchModule.IN); lsselect.AllowInsert = (((INRegister)e.Row).Released == false && ((INRegister)e.Row).OrigModule == GL.BatchModule.IN && ((INRegister)e.Row).SiteID != null); lsselect.AllowUpdate = (((INRegister)e.Row).Released == false); lsselect.AllowDelete = (((INRegister)e.Row).Released == false && ((INRegister)e.Row).OrigModule == GL.BatchModule.IN); PXUIFieldAttribute.SetVisible <INRegister.controlQty>(sender, e.Row, (bool)insetup.Current.RequireControlTotal); PXUIFieldAttribute.SetEnabled <INRegister.siteID>(sender, e.Row, ((INRegister)e.Row).Released == false && (((INRegister)e.Row).SiteID == null || transactions.Select().Count == 0)); PXUIFieldAttribute.SetEnabled <INRegister.transferType>(sender, e.Row, ((INRegister)e.Row).OrigModule == GL.BatchModule.IN && ((INRegister)e.Row).Released == false && (((INRegister)e.Row).SiteID == null || ((INRegister)e.Row).SiteID != ((INRegister)e.Row).ToSiteID)); PXUIFieldAttribute.SetVisible <INTran.toLocationID>(this.transactions.Cache, null, ((INRegister)e.Row).TransferType == INTransferType.OneStep); PXUIFieldAttribute.SetVisible <INTran.receiptedQty>(this.transactions.Cache, null, ((INRegister)e.Row).TransferType != INTransferType.OneStep); PXUIFieldAttribute.SetVisible <INTran.iNTransitQty>(this.transactions.Cache, null, ((INRegister)e.Row).TransferType != INTransferType.OneStep); PXDefaultAttribute.SetPersistingCheck <INTran.toLocationID>(this.transactions.Cache, null, ((INRegister)e.Row).TransferType == INTransferType.OneStep ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); addInvBySite.SetEnabled(transactions.Cache.AllowInsert); }
protected override void Master_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { base.Master_RowSelected(sender, e); ARTran row = (ARTran)e.Row; if (row == null) { return; } bool directLine = (row.InvtMult != 0), directStockLine = directLine && (row.LineType == SOLineType.Inventory); PXUIFieldAttribute.SetEnabled <ARTran.subItemID>(sender, row, directStockLine); PXUIFieldAttribute.SetEnabled <ARTran.siteID>(sender, row, directLine); PXUIFieldAttribute.SetEnabled <ARTran.locationID>(sender, row, directStockLine); PXPersistingCheck checkValues = directStockLine ? PXPersistingCheck.Null : PXPersistingCheck.Nothing; PXDefaultAttribute.SetPersistingCheck <ARTran.subItemID>(sender, row, checkValues); PXDefaultAttribute.SetPersistingCheck <ARTran.siteID>(sender, row, checkValues); PXDefaultAttribute.SetPersistingCheck <ARTran.locationID>(sender, row, checkValues); }
/// <summary> /// Enables/Disables the Employee Time Card Integration fields. /// </summary> private void EnableDisableEmployeeTimeCardIntegrationFields(PXCache cache, FSSrvOrdType fsSrvOrdTypeRow) { FSSetup fsSetupRow = SetupRecord.Current; bool enable = fsSetupRow != null && SetupRecord.Current.EnableEmpTimeCardIntegration == true && fsSrvOrdTypeRow.Behavior != ID.Behavior_SrvOrderType.QUOTE; PXUIFieldAttribute.SetEnabled <FSSrvOrdType.requireTimeApprovalToInvoice>(cache, fsSrvOrdTypeRow, enable); PXUIFieldAttribute.SetEnabled <FSSrvOrdType.createTimeActivitiesFromAppointment>(cache, fsSrvOrdTypeRow, enable); PXUIFieldAttribute.SetVisible <FSSrvOrdType.requireTimeApprovalToInvoice>(cache, fsSrvOrdTypeRow, enable); PXUIFieldAttribute.SetVisible <FSSrvOrdType.createTimeActivitiesFromAppointment>(cache, fsSrvOrdTypeRow, enable); bool activateEarningType = enable && fsSrvOrdTypeRow.CreateTimeActivitiesFromAppointment == true; bool requireEarningType = activateEarningType && fsSrvOrdTypeRow.Behavior != ID.Behavior_SrvOrderType.QUOTE; PXUIFieldAttribute.SetEnabled <FSSrvOrdType.dfltEarningType>(cache, fsSrvOrdTypeRow, activateEarningType); PXUIFieldAttribute.SetVisible <FSSrvOrdType.dfltEarningType>(cache, fsSrvOrdTypeRow, activateEarningType); PXUIFieldAttribute.SetRequired <FSSrvOrdType.dfltEarningType>(cache, requireEarningType); PXDefaultAttribute.SetPersistingCheck <FSSrvOrdType.dfltEarningType>(cache, fsSrvOrdTypeRow, requireEarningType ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); }
protected virtual void FSLicense_RowSelected(PXCache cache, PXRowSelectedEventArgs e) { FSLicense fsLicenseRow = (FSLicense)e.Row; if (fsLicenseRow != null) { FSLicenseType fsLicenseTypeRow = PXSelect <FSLicenseType, Where <FSLicenseType.licenseTypeID, Equal <Required <FSLicenseType.licenseTypeID> > > > .Select(this, fsLicenseRow.LicenseTypeID); if (fsLicenseTypeRow != null) { if (fsLicenseTypeRow.OwnerType == ID.OwnerType.EMPLOYEE) { PXUIFieldAttribute.SetEnabled <FSLicense.employeeID>(cache, fsLicenseRow, true); PXDefaultAttribute.SetPersistingCheck <FSLicense.employeeID>(cache, fsLicenseRow, PXPersistingCheck.NullOrBlank); } else { PXUIFieldAttribute.SetEnabled <FSLicense.employeeID>(cache, fsLicenseRow, false); PXDefaultAttribute.SetPersistingCheck <FSLicense.employeeID>(cache, fsLicenseRow, PXPersistingCheck.Nothing); } } } }
protected virtual void Tax_RowSelected(PXCache cache, PXRowSelectedEventArgs e) { if (e.Row == null) { return; } Tax tax = (Tax)e.Row; bool isUsedForManualVAT = PXSelect <TaxZone, Where <TaxZone.taxID, Equal <Required <TaxZone.taxID> > > > .Select(this, tax.TaxID).Count != 0; bool isOutdated = tax.OutDate.HasValue && (tax.OutDate.Value.CompareTo(Accessinfo.BusinessDate) < 0); if (this.Tax.Cache.GetStatus(tax) != PXEntryStatus.Updated) { this.TaxRevisions.Cache.AllowInsert = !isOutdated; this.TaxRevisions.Cache.AllowUpdate = !isOutdated; this.TaxRevisions.Cache.AllowDelete = !isOutdated; } bool isExternal = tax.IsExternal ?? false; if (isExternal) { this.TaxRevisions.Cache.AllowInsert = false; this.TaxRevisions.Cache.AllowUpdate = false; this.TaxRevisions.Cache.AllowDelete = false; this.Categories.Cache.AllowInsert = false; this.Categories.Cache.AllowUpdate = false; this.Categories.Cache.AllowDelete = false; this.Zones.Cache.AllowInsert = false; this.Zones.Cache.AllowUpdate = false; this.Zones.Cache.AllowDelete = false; } bool isVAT = ((Tax)e.Row).TaxType == CSTaxType.VAT; bool isPending = ((Tax)e.Row).PendingTax == true; bool isUse = ((Tax)e.Row).TaxType == CSTaxType.Use; bool isDeductible = ((Tax)e.Row).DeductibleVAT == true; bool isReportingExpenseToSingleAcc = isDeductible && ((Tax)e.Row).ReportExpenseToSingleAccount == true; PXUIFieldAttribute.SetEnabled <Tax.reverseTax>(cache, e.Row, isVAT && !isExternal & !isUsedForManualVAT); PXUIFieldAttribute.SetEnabled <Tax.pendingTax>(cache, e.Row, isVAT && !isExternal); PXUIFieldAttribute.SetEnabled <Tax.directTax>(cache, e.Row, isVAT && !isExternal); PXUIFieldAttribute.SetEnabled <Tax.statisticalTax>(cache, e.Row, isVAT && !isExternal); PXUIFieldAttribute.SetEnabled <Tax.exemptTax>(cache, e.Row, isVAT && !isExternal); PXUIFieldAttribute.SetEnabled <Tax.deductibleVAT>(cache, e.Row, isVAT && !isExternal & !isUsedForManualVAT); PXUIFieldAttribute.SetEnabled <Tax.includeInTaxable>(cache, e.Row, isVAT && !isExternal); PXUIFieldAttribute.SetEnabled <Tax.purchTaxAcctID>(cache, e.Row, isVAT); PXUIFieldAttribute.SetEnabled <Tax.purchTaxSubID>(cache, e.Row, isVAT); PXUIFieldAttribute.SetRequired <Tax.purchTaxAcctID>(cache, isVAT); PXUIFieldAttribute.SetRequired <Tax.purchTaxSubID>(cache, isVAT); PXUIFieldAttribute.SetEnabled <Tax.pendingSalesTaxAcctID>(cache, e.Row, isPending); PXUIFieldAttribute.SetEnabled <Tax.pendingSalesTaxSubID>(cache, e.Row, isPending); PXUIFieldAttribute.SetEnabled <Tax.pendingPurchTaxAcctID>(cache, e.Row, isPending); PXUIFieldAttribute.SetEnabled <Tax.pendingPurchTaxSubID>(cache, e.Row, isPending); PXUIFieldAttribute.SetVisible <Tax.reportExpenseToSingleAccount>(cache, e.Row, isDeductible); PXUIFieldAttribute.SetEnabled <Tax.expenseAccountID>(cache, e.Row, isUse || isReportingExpenseToSingleAcc); PXUIFieldAttribute.SetEnabled <Tax.expenseSubID>(cache, e.Row, isUse || isReportingExpenseToSingleAcc); PXDefaultAttribute.SetPersistingCheck <Tax.expenseAccountID>(cache, e.Row, isReportingExpenseToSingleAcc ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); PXDefaultAttribute.SetPersistingCheck <Tax.expenseSubID>(cache, e.Row, isReportingExpenseToSingleAcc ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); PXUIFieldAttribute.SetRequired <Tax.expenseAccountID>(cache, isUse || isReportingExpenseToSingleAcc); PXUIFieldAttribute.SetRequired <Tax.expenseSubID>(cache, isUse || isReportingExpenseToSingleAcc); PXUIFieldAttribute.SetEnabled <TaxRev.taxableMin>(TaxRevisions.Cache, null, ((Tax)e.Row).TaxCalcLevel == "1" || ((Tax)e.Row).TaxCalcLevel == "2"); PXUIFieldAttribute.SetEnabled <TaxRev.taxableMax>(TaxRevisions.Cache, null, ((Tax)e.Row).TaxCalcLevel == "1" || ((Tax)e.Row).TaxCalcLevel == "2"); PXUIFieldAttribute.SetEnabled <TaxRev.taxRate>(TaxRevisions.Cache, null, ((Tax)e.Row).ExemptTax == false); PXUIFieldAttribute.SetEnabled <TaxRev.nonDeductibleTaxRate>(TaxRevisions.Cache, null, isDeductible); PXUIFieldAttribute.SetVisible <TaxRev.nonDeductibleTaxRate>(TaxRevisions.Cache, null, isDeductible); PXUIFieldAttribute.SetEnabled <Tax.taxType>(cache, e.Row, !isExternal); PXUIFieldAttribute.SetEnabled <Tax.taxCalcType>(cache, e.Row, !isExternal); PXUIFieldAttribute.SetEnabled <Tax.taxCalcRule>(cache, e.Row, !isExternal); PXUIFieldAttribute.SetEnabled <Tax.taxCalcLevel2Exclude>(cache, e.Row, !isExternal); PXUIFieldAttribute.SetEnabled <Tax.taxApplyTermsDisc>(cache, e.Row, !isExternal); PXUIFieldAttribute.SetEnabled <Tax.outDate>(cache, e.Row, !isExternal); PopulateBucketList(e.Row); PXDefaultAttribute.SetDefault <Tax.taxApplyTermsDisc>(cache, CSTaxTermsDiscount.ToTaxableAmount); if (isVAT) { PXStringListAttribute.SetList <Tax.taxApplyTermsDisc>(cache, tax, new [] { CSTaxTermsDiscount.ToTaxableAmount, CSTaxTermsDiscount.ToPromtPayment, CSTaxTermsDiscount.NoAdjust }, new [] { Messages.DiscountToTaxableAmount, Messages.DiscountToPromtPayment, Messages.DiscountToTotalAmount }); } else { PXStringListAttribute.SetList <Tax.taxApplyTermsDisc>(cache, tax, new [] { CSTaxTermsDiscount.ToTaxableAmount, CSTaxTermsDiscount.NoAdjust }, new [] { Messages.DiscountToTaxableAmount, Messages.DiscountToTotalAmount }); } }
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; }
public SetupMaint() { PXDefaultAttribute.SetPersistingCheck <PM.PMProject.defaultSubID>(DefaultProject.Cache, null, PXPersistingCheck.Nothing); }
protected virtual void _(Events.RowSelected <ESignAccount> args) { var account = args.Row; if (account == null) { return; } Users.Cache.AllowSelect = account.Type.Equals(ESignAccount.AccountTypes.Shared); PXUIFieldAttribute.SetVisible <ESignAccount.ownerID>(Accounts.Cache, null, !Users.Cache.AllowSelect); if (account.Type != ESignAccount.AccountTypes.Individual) { PXDefaultAttribute.SetPersistingCheck <ESignAccount.ownerID>(Accounts.Cache, null, PXPersistingCheck.Nothing); } var isAdobe = account.ProviderType == ESignAccount.ProviderTypes.AdobeSign; PXUIFieldAttribute.SetVisible <ESignAccount.reminderType>(Accounts.Cache, null, isAdobe); PXUIFieldAttribute.SetVisible <ESignAccount.clientID>(Accounts.Cache, null, isAdobe); PXUIFieldAttribute.SetVisible <ESignAccount.clientSecret>(Accounts.Cache, null, isAdobe); PXUIFieldAttribute.SetVisible <ESignAccount.warnDays>(Accounts.Cache, null, !isAdobe); PXUIFieldAttribute.SetVisible <ESignAccount.firstReminderDay>(Accounts.Cache, null, !isAdobe); PXUIFieldAttribute.SetVisible <ESignAccount.reminderFrequency>(Accounts.Cache, null, !isAdobe); PXUIFieldAttribute.SetVisible <ESignAccount.isTestApi>(Accounts.Cache, null, !isAdobe); PXUIFieldAttribute.SetVisible <ESignAccount.email>(Accounts.Cache, null, !isAdobe); PXUIFieldAttribute.SetVisible <ESignAccount.password>(Accounts.Cache, null, !isAdobe); var isApiUrlRequired = isAdobe || account.IsTestApi == true; var apiUrlVisibility = isApiUrlRequired ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing; PXDefaultAttribute.SetPersistingCheck <ESignAccount.apiUrl>(Accounts.Cache, account, apiUrlVisibility); PXUIFieldAttribute.SetRequired <ESignAccount.apiUrl>(Accounts.Cache, isApiUrlRequired); if (account.IsTestApi != null) { PXUIFieldAttribute.SetEnabled <ESignAccount.apiUrl>(Accounts.Cache, null, account.IsTestApi.Value); } if (account.SendReminders != null) { PXUIFieldAttribute.SetEnabled <ESignAccount.firstReminderDay>(Accounts.Cache, null, account.SendReminders.Value); PXUIFieldAttribute.SetEnabled <ESignAccount.reminderFrequency>(Accounts.Cache, null, account.SendReminders.Value); PXUIFieldAttribute.SetEnabled <ESignAccount.reminderType>(Accounts.Cache, null, account.SendReminders.Value); } var isDisconnected = IsDisconnected(account) || !isAdobe; Disconnect.SetVisible(isAdobe); Connect.SetEnabled(isDisconnected); Disconnect.SetEnabled(!isDisconnected); PXUIFieldAttribute.SetEnabled <ESignAccount.clientID>(Accounts.Cache, null, isDisconnected); PXUIFieldAttribute.SetEnabled <ESignAccount.clientSecret>(Accounts.Cache, null, isDisconnected); PXUIFieldAttribute.SetEnabled <ESignAccount.apiUrl>(Accounts.Cache, null, isDisconnected && isApiUrlRequired); PXUIFieldAttribute.SetEnabled <ESignAccount.providerType>(Accounts.Cache, null, isDisconnected); PXUIFieldAttribute.SetVisible <ESignAccount.status>(Accounts.Cache, null, isAdobe); }
protected virtual void Contact_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { Contact row = e.Row as Contact; if (row == null) { return; } var isNotInserted = sender.GetStatus(row) != PXEntryStatus.Inserted; Contact.AllowDelete = row.ContactType == ContactTypesAttribute.Person; PXUIFieldAttribute.SetEnabled <Contact.isActive>(Contact.Cache, row, row.ContactType == ContactTypesAttribute.Person); PXUIFieldAttribute.SetEnabled <Contact.classID>(Contact.Cache, row, row.ContactType == ContactTypesAttribute.Person); PXUIFieldAttribute.SetEnabled <Contact.isAddressSameAsMain>(Contact.Cache, row, row.ContactType == ContactTypesAttribute.Person); copyBAccountContactInfo.SetEnabled(row.ContactType == ContactTypesAttribute.Person); Answers.Cache.AllowInsert = row.ContactType == ContactTypesAttribute.Person; Answers.Cache.AllowUpdate = row.ContactType == ContactTypesAttribute.Person; Answers.Cache.AllowDelete = row.ContactType == ContactTypesAttribute.Person; Activities.Cache.AllowInsert = row.ContactType == ContactTypesAttribute.Person; Activities.Cache.AllowUpdate = row.ContactType == ContactTypesAttribute.Person; Activities.Cache.AllowDelete = row.ContactType == ContactTypesAttribute.Person; Relations.Cache.AllowInsert = row.ContactType == ContactTypesAttribute.Person && isNotInserted; Relations.Cache.AllowUpdate = row.ContactType == ContactTypesAttribute.Person; Relations.Cache.AllowDelete = row.ContactType == ContactTypesAttribute.Person; Opportunities.Cache.AllowInsert = row.ContactType == ContactTypesAttribute.Person && isNotInserted; Opportunities.Cache.AllowUpdate = row.ContactType == ContactTypesAttribute.Person; Opportunities.Cache.AllowDelete = row.ContactType == ContactTypesAttribute.Person; Cases.Cache.AllowInsert = row.ContactType == ContactTypesAttribute.Person && isNotInserted; Cases.Cache.AllowUpdate = row.ContactType == ContactTypesAttribute.Person; Cases.Cache.AllowDelete = row.ContactType == ContactTypesAttribute.Person; Members.Cache.AllowInsert = row.ContactType == ContactTypesAttribute.Person && isNotInserted; Members.Cache.AllowUpdate = row.ContactType == ContactTypesAttribute.Person; Members.Cache.AllowDelete = row.ContactType == ContactTypesAttribute.Person; Subscriptions.Cache.AllowInsert = row.ContactType == ContactTypesAttribute.Person && isNotInserted; Subscriptions.Cache.AllowUpdate = row.ContactType == ContactTypesAttribute.Person; Subscriptions.Cache.AllowDelete = row.ContactType == ContactTypesAttribute.Person; NWatchers.Cache.AllowInsert = row.ContactType == ContactTypesAttribute.Person && isNotInserted; NWatchers.Cache.AllowUpdate = row.ContactType == ContactTypesAttribute.Person; NWatchers.Cache.AllowDelete = row.ContactType == ContactTypesAttribute.Person; User.Cache.AllowInsert = row.ContactType == ContactTypesAttribute.Person; User.Cache.AllowUpdate = row.ContactType == ContactTypesAttribute.Person; User.Cache.AllowDelete = row.ContactType == ContactTypesAttribute.Person; User.Cache.AllowSelect = row.ContactType == ContactTypesAttribute.Person; User.Cache.ClearQueryCache(); Roles.Cache.AllowInsert = row.ContactType == ContactTypesAttribute.Person; Roles.Cache.AllowUpdate = row.ContactType == ContactTypesAttribute.Person; Roles.Cache.AllowDelete = row.ContactType == ContactTypesAttribute.Person; Roles.Cache.AllowSelect = row.ContactType == ContactTypesAttribute.Person; Roles.Cache.ClearQueryCache(); UserRoles.Cache.AllowInsert = row.ContactType == ContactTypesAttribute.Person; UserRoles.Cache.AllowUpdate = row.ContactType == ContactTypesAttribute.Person; UserRoles.Cache.AllowDelete = row.ContactType == ContactTypesAttribute.Person; UserRoles.Cache.AllowSelect = row.ContactType == ContactTypesAttribute.Person; UserRoles.Cache.ClearQueryCache(); var bAccount = row.BAccountID. With <int?, BAccount>(_ => (BAccount)PXSelect <BAccount, Where <BAccount.bAccountID, Equal <Required <BAccount.bAccountID> > > > . Select(this, _)); var isCustomerOrProspect = bAccount == null || bAccount.Type == BAccountType.CustomerType || bAccount.Type == BAccountType.ProspectType || bAccount.Type == BAccountType.CombinedType; addOpportunity.SetEnabled(isNotInserted && isCustomerOrProspect); addCase.SetEnabled(isNotInserted && isCustomerOrProspect); PXUIFieldAttribute.SetEnabled <Contact.contactID>(sender, row, true); PXUIFieldAttribute.SetEnabled <Contact.bAccountID>(sender, row, row.ContactType == ContactTypesAttribute.Person); CRContactClass contactClass = row.ClassID. With(_ => (CRContactClass)PXSelectReadonly <CRContactClass, Where <CRContactClass.classID, Equal <Required <CRContactClass.classID> > > > . Select(this, _)); if (contactClass != null) { Activities.DefaultEMailAccountId = contactClass.DefaultEMailAccountID; } bool isUserInserted = row.UserID == null || User.Cache.GetStatus(User.Current) == PXEntryStatus.Inserted; bool hasLoginType = isUserInserted && User.Current != null && User.Current.LoginTypeID != null; PXUIFieldAttribute.SetEnabled <Users.loginTypeID>(User.Cache, User.Current, isUserInserted && row.IsActive == true); PXUIFieldAttribute.SetEnabled <Users.username>(User.Cache, User.Current, this.IsContractBasedAPI || hasLoginType); PXUIFieldAttribute.SetEnabled <Users.generatePassword>(User.Cache, User.Current, this.IsContractBasedAPI || hasLoginType); PXUIFieldAttribute.SetEnabled <Users.password>(User.Cache, User.Current, this.IsContractBasedAPI || (hasLoginType && User.Current.GeneratePassword != true)); var employeeHasUserAttached = row.ContactType == ContactTypesAttribute.Employee && User.Current != null; PXDefaultAttribute.SetPersistingCheck <Contact.eMail>(sender, row, employeeHasUserAttached || (hasLoginType && User.Current.Username != null) ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); PXUIFieldAttribute.SetRequired <Contact.eMail>(sender, employeeHasUserAttached || (hasLoginType && User.Current.Username != null)); User.Current = (Users)User.View.SelectSingleBound(new[] { e.Row }); if (row.DuplicateStatus == DuplicateStatusAttribute.PossibleDuplicated || row.DuplicateFound == true) { sender.RaiseExceptionHandling <Contact.duplicateStatus>(row, null, new PXSetPropertyException(Messages.ContactHavePossibleDuplicates, PXErrorLevel.Warning, row.ContactID)); } }
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 }); } }
protected virtual void _(Events.FieldUpdated <UserPreferences, FSxUserPreferences.trackLocation> e) { if (e.Row == null) { return; } UserPreferences userPreferencesRow = e.Row as UserPreferences; FSxUserPreferences fsxUserPreferencesRow = e.Cache.GetExtension <FSxUserPreferences>(userPreferencesRow); if (fsxUserPreferencesRow != null && fsxUserPreferencesRow.TrackLocation != (bool)e.OldValue) { if (fsxUserPreferencesRow.TrackLocation == true && LocationTracking.Select().Count == 0) { List <FSGPSTrackingLocation> trackingLocations = new List <FSGPSTrackingLocation>(); CSCalendar csCalendarRow = UserCalendar.SelectSingle(); if (csCalendarRow?.SunWorkDay == true) { trackingLocations.Add(new FSGPSTrackingLocation { WeeklyOnDay1 = true, WeekDay = 0, StartTime = csCalendarRow.SunStartTime, EndTime = csCalendarRow.SunEndTime }); } if (csCalendarRow?.MonWorkDay == true) { trackingLocations.Add(new FSGPSTrackingLocation { WeeklyOnDay2 = true, WeekDay = 1, StartTime = csCalendarRow.MonStartTime, EndTime = csCalendarRow.MonEndTime }); } if (csCalendarRow?.TueWorkDay == true) { trackingLocations.Add(new FSGPSTrackingLocation { WeeklyOnDay3 = true, WeekDay = 2, StartTime = csCalendarRow.TueStartTime, EndTime = csCalendarRow.TueEndTime }); } if (csCalendarRow?.WedWorkDay == true) { trackingLocations.Add(new FSGPSTrackingLocation { WeeklyOnDay4 = true, WeekDay = 3, StartTime = csCalendarRow.WedStartTime, EndTime = csCalendarRow.WedEndTime }); } if (csCalendarRow?.ThuWorkDay == true) { trackingLocations.Add(new FSGPSTrackingLocation { WeeklyOnDay5 = true, WeekDay = 4, StartTime = csCalendarRow.ThuStartTime, EndTime = csCalendarRow.ThuEndTime }); } if (csCalendarRow?.FriWorkDay == true) { trackingLocations.Add(new FSGPSTrackingLocation { WeeklyOnDay6 = true, WeekDay = 5, StartTime = csCalendarRow.FriStartTime, EndTime = csCalendarRow.FriEndTime }); } if (csCalendarRow?.SatWorkDay == true) { trackingLocations.Add(new FSGPSTrackingLocation { WeeklyOnDay7 = true, WeekDay = 6, StartTime = csCalendarRow.SatStartTime, EndTime = csCalendarRow.SatEndTime }); } foreach (FSGPSTrackingLocation fsGPSTrackingLocationRow in trackingLocations) { fsGPSTrackingLocationRow.StartDate = Base.Accessinfo.BusinessDate; fsGPSTrackingLocationRow.EndDate = fsGPSTrackingLocationRow.StartDate.Value.AddYears(1000); fsGPSTrackingLocationRow.Interval = fsxUserPreferencesRow.Interval; fsGPSTrackingLocationRow.Distance = fsxUserPreferencesRow.Distance; LocationTracking.Insert(fsGPSTrackingLocationRow); } } else { foreach (FSGPSTrackingLocation fsGPSTrackingLocationRow in LocationTracking.Select()) { fsGPSTrackingLocationRow.IsActive = fsxUserPreferencesRow.TrackLocation; LocationTracking.Cache.Update(fsGPSTrackingLocationRow); } } PXPersistingCheck persistingCheck = fsxUserPreferencesRow.TrackLocation == true ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing; PXDefaultAttribute.SetPersistingCheck <UserPreferences.timeZone>(e.Cache, userPreferencesRow, persistingCheck); } }
protected virtual void CRActivity_RowSelected(PXCache cache, PXRowSelectedEventArgs e) { CRActivity row = (CRActivity)e.Row; if (row == null) { return; } var tAct = (PMTimeActivity)TimeActivity.SelectSingle(); var tActCache = TimeActivity.Cache; PXUIFieldAttribute.SetEnabled <CRActivity.endDate>(cache, row, false); bool wasUsed = !string.IsNullOrEmpty(tAct?.TimeCardCD) || tAct?.Billed == true; if (wasUsed) { PXUIFieldAttribute.SetEnabled(cache, row, false); } bool isPmVisible = ProjectAttribute.IsPMVisible(BatchModule.TA); PXUIFieldAttribute.SetVisible <PMTimeActivity.timeSpent>(tActCache, tAct, tAct?.TrackTime == true); PXUIFieldAttribute.SetVisible <PMTimeActivity.approvalStatus>(tActCache, tAct, tAct?.TrackTime == true); PXUIFieldAttribute.SetVisible <PMTimeActivity.earningTypeID>(tActCache, tAct, tAct?.TrackTime == true); PXUIFieldAttribute.SetVisible <PMTimeActivity.isBillable>(tActCache, tAct, tAct?.TrackTime == true); PXUIFieldAttribute.SetVisible <PMTimeActivity.released>(tActCache, tAct, tAct?.TrackTime == true); PXUIFieldAttribute.SetVisible <PMTimeActivity.timeBillable>(tActCache, tAct, tAct?.IsBillable == true && tAct?.TrackTime == true); PXUIFieldAttribute.SetVisible <PMTimeActivity.arRefNbr>(tActCache, tAct, tAct?.IsBillable == true && tAct?.TrackTime == true); PXUIFieldAttribute.SetVisible <PMTimeActivity.approverID>(tActCache, tAct, tAct?.TrackTime == true); PXUIFieldAttribute.SetVisible <PMTimeActivity.projectID>(tActCache, tAct, tAct?.TrackTime == true && isPmVisible); PXUIFieldAttribute.SetVisible <PMTimeActivity.certifiedJob>(tActCache, tAct, tAct?.TrackTime == true && isPmVisible); PXUIFieldAttribute.SetVisible <PMTimeActivity.projectTaskID>(tActCache, tAct, tAct?.TrackTime == true && isPmVisible); PXUIFieldAttribute.SetVisible <PMTimeActivity.costCodeID>(tActCache, tAct, tAct?.TrackTime == true && isPmVisible); PXUIFieldAttribute.SetVisible <PMTimeActivity.labourItemID>(tActCache, tAct, tAct?.TrackTime == true && isPmVisible); PXUIFieldAttribute.SetVisible <PMTimeActivity.unionID>(tActCache, tAct, tAct?.TrackTime == true); PXUIFieldAttribute.SetVisible <PMTimeActivity.workCodeID>(tActCache, tAct, tAct?.TrackTime == true); PXUIFieldAttribute.SetVisible <PMTimeActivity.overtimeSpent>(tActCache, tAct, false); PXUIFieldAttribute.SetVisible <PMTimeActivity.overtimeSpent>(tActCache, tAct, false); PXUIFieldAttribute.SetVisible <PMTimeActivity.overtimeBillable>(tActCache, tAct, false); bool showMinutes = EPSetupCurrent.RequireTimes == true; PXDBDateAndTimeAttribute.SetTimeEnabled <CRActivity.startDate>(cache, row, showMinutes && tAct?.TrackTime == true); PXDBDateAndTimeAttribute.SetTimeVisible <CRActivity.startDate>(cache, row, showMinutes && tAct?.TrackTime == true); PXDBDateAndTimeAttribute.SetTimeVisible <CRActivity.endDate>(cache, row, showMinutes && tAct?.TrackTime == true); string origTimeStatus = (string)this.TimeActivity.Cache.GetValueOriginal <PMTimeActivity.approvalStatus>(tAct) ?? ActivityStatusListAttribute.Open; string origStatus = (string)this.Activities.Cache.GetValueOriginal <CRActivity.uistatus>(row) ?? origTimeStatus; bool?origTrackTime = (bool?)this.TimeActivity.Cache.GetValueOriginal <PMTimeActivity.trackTime>(tAct) ?? false; if (origStatus == ActivityStatusListAttribute.Completed && origTrackTime != true) { origStatus = ActivityStatusListAttribute.Open; } if (row.IsLocked == true) { origStatus = ActivityStatusListAttribute.Completed; } if (origStatus == ActivityStatusListAttribute.Open) { PXUIFieldAttribute.SetEnabled(cache, row, true); Delete.SetEnabled(!wasUsed); } else { PXUIFieldAttribute.SetEnabled(cache, row, false); Delete.SetEnabled(false); } PXUIFieldAttribute.SetEnabled <CRActivity.source>(cache, row, false); PXUIFieldAttribute.SetEnabled <CRActivity.noteID>(cache, row); MarkAsCompleted.SetEnabled(origStatus == ActivityStatusListAttribute.Open); MarkAsCompleted.SetVisible(origStatus == ActivityStatusListAttribute.Open && tAct?.TrackTime == true); MarkAsCompletedAndFollowUp.SetVisible(false); GotoParentActivity.SetEnabled(row.ParentNoteID != null); // TimeActivity if (tAct?.Released == true) { origTimeStatus = ActivityStatusAttribute.Completed; } if (origTimeStatus == ActivityStatusListAttribute.Open) { PXUIFieldAttribute.SetEnabled(tActCache, tAct, true); PXUIFieldAttribute.SetEnabled <PMTimeActivity.timeBillable>(tActCache, tAct, !wasUsed && tAct?.IsBillable == true); PXUIFieldAttribute.SetEnabled <PMTimeActivity.overtimeBillable>(tActCache, tAct, !wasUsed && tAct?.IsBillable == true); } else { PXUIFieldAttribute.SetEnabled(tActCache, tAct, false); } PXUIFieldAttribute.SetEnabled <PMTimeActivity.approvalStatus>(tActCache, tAct, tAct != null && tAct.TrackTime == true && !wasUsed); PXUIFieldAttribute.SetEnabled <PMTimeActivity.released>(tActCache, tAct, false); PXDefaultAttribute.SetPersistingCheck <CRActivity.ownerID>(cache, row, tAct?.TrackTime == true ? PXPersistingCheck.Null : PXPersistingCheck.Nothing); PXDefaultAttribute.SetPersistingCheck <CRActivity.type>(cache, row, PXPersistingCheck.Null); }
protected virtual void Tax_RowSelected(PXCache cache, PXRowSelectedEventArgs e) { Tax tax = e.Row as Tax; if (tax == null) { return; } bool isUsedForManualVAT = PXSelect <TaxZone, Where <TaxZone.taxID, Equal <Required <TaxZone.taxID> > > > .Select(this, tax.TaxID) .Count != 0; bool isOutdated = tax.OutDate.HasValue && (tax.OutDate.Value.CompareTo(Accessinfo.BusinessDate) < 0); if (Tax.Cache.GetStatus(tax) != PXEntryStatus.Updated) { TaxRevisions.Cache.SetAllEditPermissions(!isOutdated); } bool isExternal = tax.IsExternal ?? false; TaxRevisions.Cache.SetAllEditPermissions(!isExternal); Categories.Cache.SetAllEditPermissions(!isExternal); Zones.Cache.SetAllEditPermissions(!isExternal); bool isVAT = tax.TaxType == CSTaxType.VAT; bool isPending = tax.PendingTax == true; bool isUse = tax.TaxType == CSTaxType.Use; bool isDeductible = tax.DeductibleVAT == true; bool isReportingExpenseToSingleAcc = isDeductible && tax.ReportExpenseToSingleAccount == true; PXUIFieldAttribute.SetEnabled <Tax.reverseTax>(cache, tax, isVAT && !isExternal & !isUsedForManualVAT); PXUIFieldAttribute.SetEnabled <Tax.pendingTax>(cache, tax, isVAT && !isExternal); PXUIFieldAttribute.SetEnabled <Tax.directTax>(cache, tax, isVAT && !isExternal); PXUIFieldAttribute.SetEnabled <Tax.statisticalTax>(cache, tax, isVAT && !isExternal); PXUIFieldAttribute.SetEnabled <Tax.exemptTax>(cache, tax, isVAT && !isExternal); PXUIFieldAttribute.SetEnabled <Tax.deductibleVAT>(cache, tax, isVAT && !isExternal & !isUsedForManualVAT); PXUIFieldAttribute.SetEnabled <Tax.includeInTaxable>(cache, tax, isVAT && !isExternal); PXUIFieldAttribute.SetEnabled <Tax.purchTaxAcctID>(cache, tax, isVAT); PXUIFieldAttribute.SetEnabled <Tax.purchTaxSubID>(cache, tax, isVAT); PXUIFieldAttribute.SetRequired <Tax.purchTaxAcctID>(cache, isVAT); PXUIFieldAttribute.SetRequired <Tax.purchTaxSubID>(cache, isVAT); PXUIFieldAttribute.SetEnabled <Tax.pendingSalesTaxAcctID>(cache, tax, isPending); PXUIFieldAttribute.SetEnabled <Tax.pendingSalesTaxSubID>(cache, tax, isPending); PXUIFieldAttribute.SetEnabled <Tax.pendingPurchTaxAcctID>(cache, tax, isPending); PXUIFieldAttribute.SetEnabled <Tax.pendingPurchTaxSubID>(cache, tax, isPending); PXUIFieldAttribute.SetVisible <Tax.reportExpenseToSingleAccount>(cache, tax, isDeductible); PXUIFieldAttribute.SetEnabled <Tax.expenseAccountID>(cache, tax, isUse || isReportingExpenseToSingleAcc); PXUIFieldAttribute.SetEnabled <Tax.expenseSubID>(cache, tax, isUse || isReportingExpenseToSingleAcc); PXDefaultAttribute.SetPersistingCheck <Tax.expenseAccountID>(cache, tax, isReportingExpenseToSingleAcc ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); PXDefaultAttribute.SetPersistingCheck <Tax.expenseSubID>(cache, tax, isReportingExpenseToSingleAcc ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); PXUIFieldAttribute.SetRequired <Tax.expenseAccountID>(cache, isUse || isReportingExpenseToSingleAcc); PXUIFieldAttribute.SetRequired <Tax.expenseSubID>(cache, isUse || isReportingExpenseToSingleAcc); PXUIFieldAttribute.SetEnabled <TaxRev.taxableMin>(TaxRevisions.Cache, null, tax.TaxCalcLevel == "1" || tax.TaxCalcLevel == "2"); PXUIFieldAttribute.SetEnabled <TaxRev.taxableMax>(TaxRevisions.Cache, null, tax.TaxCalcLevel == "1" || tax.TaxCalcLevel == "2"); PXUIFieldAttribute.SetEnabled <TaxRev.taxRate>(TaxRevisions.Cache, null, tax.ExemptTax == false); PXUIFieldAttribute.SetEnabled <TaxRev.nonDeductibleTaxRate>(TaxRevisions.Cache, null, isDeductible); PXUIFieldAttribute.SetVisible <TaxRev.nonDeductibleTaxRate>(TaxRevisions.Cache, null, isDeductible); PXUIFieldAttribute.SetEnabled <Tax.taxType>(cache, tax, !isExternal); PXUIFieldAttribute.SetEnabled <Tax.taxCalcType>(cache, tax, !isExternal); PXUIFieldAttribute.SetEnabled <Tax.taxCalcRule>(cache, tax, !isExternal); PXUIFieldAttribute.SetEnabled <Tax.taxCalcLevel2Exclude>(cache, tax, !isExternal); PXUIFieldAttribute.SetEnabled <Tax.taxApplyTermsDisc>(cache, tax, !isExternal); PXUIFieldAttribute.SetEnabled <Tax.outDate>(cache, tax, !isExternal); PopulateBucketList(tax); if (isVAT) { PXStringListAttribute.SetList <Tax.taxApplyTermsDisc>(cache, tax, new CSTaxTermsDiscount.ListAttribute()); } else { PXStringListAttribute.SetList <Tax.taxApplyTermsDisc>(cache, tax, new [] { CSTaxTermsDiscount.ToTaxableAmount, CSTaxTermsDiscount.NoAdjust }, new [] { Messages.DiscountToTaxableAmount, Messages.DiscountToTotalAmount }); } if (isDeductible && tax.TaxApplyTermsDisc == CSTaxTermsDiscount.ToPromtPayment) { cache.RaiseExceptionHandling <Tax.deductibleVAT>(tax, tax.DeductibleVAT, new PXSetPropertyException(Messages.DeductiblePPDTaxProhibited, PXErrorLevel.Error)); cache.RaiseExceptionHandling <Tax.taxApplyTermsDisc>(tax, tax.TaxApplyTermsDisc, new PXSetPropertyException(Messages.DeductiblePPDTaxProhibited, PXErrorLevel.Error)); } }