예제 #1
0
        protected virtual void APSetup_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            var row = (APSetup)e.Row;

            if (e.Row == null)
            {
                return;
            }

            PXUIFieldAttribute.SetEnabled <APSetup.invoicePrecision>(sender, row, (row.InvoiceRounding != RoundingType.Currency));
            PXUIFieldAttribute.SetEnabled <APSetup.numberOfMonths>(sender, row, row.RetentionType == AR.RetentionTypeList.FixedNumOfMonths);

            VerifyInvoiceRounding(sender, row);

            if (PXAccess.FeatureInstalled <FeaturesSet.distributionStandard>() && !PXAccess.FeatureInstalled <FeaturesSet.inventory>())
            {
                PXDefaultAttribute.SetDefault <APSetup.vendorPriceUpdate>(sender, APVendorPriceUpdateType.Purchase);
                PXStringListAttribute.SetList <APSetup.vendorPriceUpdate>(sender, null, new string[] { APVendorPriceUpdateType.None, APVendorPriceUpdateType.Purchase, APVendorPriceUpdateType.ReleaseAPBill },
                                                                          new string[] { Messages.VendorUpdateNone, Messages.VendorUpdatePurchase, Messages.VendorUpdateAPBillRelease });
            }
        }
        public AccountMaint()
        {
            if (string.IsNullOrEmpty(Company.Current.BaseCuryID))
            {
                throw new PXSetupNotEnteredException(ErrorMessages.SetupNotEntered, typeof(Company), PXMessages.LocalizeNoPrefix(CS.Messages.BranchMaint));
            }
            if (IsCOAOrderVisible == null)
            {
                IsCOAOrderVisible = (GLSetup.Current.COAOrder > 3);
                PXUIFieldAttribute.SetVisible <Account.cOAOrder>(AccountRecords.Cache, null, (bool)IsCOAOrderVisible);
                PXUIFieldAttribute.SetEnabled <Account.cOAOrder>(AccountRecords.Cache, null, (bool)IsCOAOrderVisible);
            }

            var mcFeatureInstalled = PXAccess.FeatureInstalled <FeaturesSet.multicurrency>();

            PXUIFieldAttribute.SetVisible <Account.curyID>(AccountRecords.Cache, null, mcFeatureInstalled);
            PXUIFieldAttribute.SetEnabled <Account.curyID>(AccountRecords.Cache, null, mcFeatureInstalled);

            PXUIFieldAttribute.SetVisible <Account.revalCuryRateTypeId>(AccountRecords.Cache, null, mcFeatureInstalled);
            PXUIFieldAttribute.SetEnabled <Account.revalCuryRateTypeId>(AccountRecords.Cache, null, mcFeatureInstalled);
        }
예제 #3
0
        public static bool IsNeedBalancing(ARInvoiceEntry graph, ARInvoice invoice, string balanceOn)
        {
            if (!PXAccess.FeatureInstalled <FeaturesSet.rutRotDeduction>())
            {
                return(false);
            }

            BranchRUTROT branchRUTROT = GetBranchRUTROT(graph);

            ValidateBranchRUTROTSettings(branchRUTROT);

            if (invoice == null)
            {
                return(branchRUTROT?.BalanceOnProcess == balanceOn);
            }

            ARInvoiceRUTROT invoiceRUTROT = RUTROTHelper.GetExtensionNullable <ARInvoice, ARInvoiceRUTROT>(invoice);

            return(invoice.DocType == ARDocType.Invoice && invoiceRUTROT?.IsRUTROTDeductible == true &&
                   branchRUTROT?.BalanceOnProcess == balanceOn);
        }
        public virtual void FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)
        {
            if (!PXAccess.FeatureInstalled <FeaturesSet.gDPRCompliance>() || e.Row == null)
            {
                return;
            }

            var thisValue = sender.GetValue(e.Row, FieldName);

            if (thisValue == null)
            {
                return;
            }

            var optedInValue = sender.GetValue(e.Row, nameof(IConsentable.ConsentAgreement));

            if (optedInValue == null)
            {
                return;
            }

            var isOptedIn      = (bool)optedInValue;
            var expirationDate = (DateTime?)thisValue;
            var status         = sender.GetStatus(e.Row);

            if (isOptedIn && expirationDate < sender.Graph.Accessinfo.BusinessDate && status != PXEntryStatus.Inserted)
            {
                e.ReturnState = PXFieldState.CreateInstance(e.ReturnState, null, null, null, null, null, null, null, null, null, null,
                                                            Messages.ConsentExpired,
                                                            PXErrorLevel.Warning,
                                                            null, null, null, PXUIVisibility.Undefined, null, null, null);
            }
            else
            {
                e.ReturnState = PXFieldState.CreateInstance(e.ReturnState, null, null, null, null, null, null, null, null, null, null,
                                                            null,
                                                            PXErrorLevel.Undefined,
                                                            null, null, null, PXUIVisibility.Undefined, null, null, null);
            }
        }
예제 #5
0
        public string DefaultRateTypeID(string moduleCode)
        {
            string  rateType = null;
            CMSetup CMSetup  = (CMSetup)Graph.Caches[typeof(CMSetup)].Current;

            if (CMSetup == null)
            {
                CMSetup = PXSelectReadonly <CMSetup> .Select(Graph);
            }
            if (CMSetup != null && PXAccess.FeatureInstalled <CS.FeaturesSet.multicurrency>())
            {
                switch (moduleCode)
                {
                case GL.BatchModule.CA:
                    rateType = CMSetup.CARateTypeDflt;
                    break;

                case GL.BatchModule.AP:
                    rateType = CMSetup.APRateTypeDflt;
                    break;

                case GL.BatchModule.AR:
                    rateType = CMSetup.ARRateTypeDflt;
                    break;

                case GL.BatchModule.GL:
                    rateType = CMSetup.GLRateTypeDflt;
                    break;

                case GL.BatchModule.PM:
                    rateType = CMSetup.PMRateTypeDflt;
                    break;

                default:
                    rateType = null;
                    break;
                }
            }
            return(rateType);
        }
예제 #6
0
        internal static void CheckStaffMembersLicense(PXGraph graph, int?bAccountID, bool?SMEnabled, string status)
        {
            if (bAccountID != null && SMEnabled != null && status != null && (SMEnabled == false || status == EPEmployee.status.Inactive))
            {
                return;
            }

            if (PXAccess.FeatureInstalled <FeaturesSet.serviceManagementStaffMembersPackUnlimited>() == true)
            {
                return;
            }

            int staffMembersCount = PXSelectJoin <BAccount,
                                                  LeftJoin <Vendor,
                                                            On <Vendor.bAccountID, Equal <BAccount.bAccountID> >,
                                                            LeftJoin <EPEmployee,
                                                                      On <EPEmployee.bAccountID, Equal <BAccount.bAccountID> > > >,
                                                  Where2 <
                                                      Where <
                                                          Required <BAccount.bAccountID>, IsNull,
                                                          Or <
                                                              BAccount.bAccountID, NotEqual <Required <BAccount.bAccountID> > > >,
                                                      And <
                                                          Where2 <
                                                              Where <
                                                                  FSxVendor.sDEnabled, Equal <True>,
                                                                  And <Vendor.status, NotEqual <Vendor.status.inactive> > >,
                                                              Or <
                                                                  Where <
                                                                      FSxEPEmployee.sDEnabled, Equal <True>,
                                                                      And <EPEmployee.status, NotEqual <EPEmployee.status.inactive> > > > > > > >
                                    .Select(graph, bAccountID, bAccountID).Count;

            if (bAccountID != null && SMEnabled != null && status != null && SMEnabled == true && status != EPEmployee.status.Inactive)
            {
                staffMembersCount += 1;
            }

            CheckStaffMembersLicense(staffMembersCount);
        }
예제 #7
0
        /// <summary>The FieldUpdated2 event handler for the <see cref="Document.BAccountID" /> field. When the BAccountID field value is changed, <see cref="Document.CuryID" /> is assigned the default
        /// value.</summary>
        /// <param name="e">Parameters of the event.</param>
        protected virtual void _(Events.FieldUpdated <Document, Document.bAccountID> e)
        {
            if (PXAccess.FeatureInstalled <FeaturesSet.multicurrency>())
            {
                if (e.Row == null)
                {
                    return;
                }

                if (e.ExternalCall || e.Row.CuryID == null)
                {
                    CurrencyInfo info = GetCurrencyInfo(e.Row);
                    if (info != null)
                    {
                        CurrencyInfo old = PXCache <CurrencyInfo> .CreateCopy(info);

                        currencyinfo.Cache.SetDefaultExt <CurrencyInfo.curyID>(info);
                        currencyinfo.Cache.SetDefaultExt <CurrencyInfo.curyRateTypeID>(info);
                        currencyinfo.Cache.SetDefaultExt <CurrencyInfo.curyEffDate>(info);
                        if (currencyinfo.Cache.GetStatus(info) == PXEntryStatus.Notchanged || currencyinfo.Cache.GetStatus(info) == PXEntryStatus.Held)
                        {
                            currencyinfo.Cache.SetStatus(info, PXEntryStatus.Updated);
                        }
                        currencyinfo.Cache.RaiseRowUpdated(info, old);
                    }
                    string message = PXUIFieldAttribute.GetError <CurrencyInfo.curyEffDate>(e.Cache.Graph.Caches[typeof(CurrencyInfo)], info);
                    if (string.IsNullOrEmpty(message) == false)
                    {
                        Documents.Cache.RaiseExceptionHandling <Document.documentDate>(e.Row,
                                                                                       e.Row.DocumentDate,
                                                                                       new PXSetPropertyException(message, PXErrorLevel.Warning));
                    }

                    if (info != null)
                    {
                        Documents.Cache.SetValue <Document.curyID>(e.Row, info.CuryID);
                    }
                }
            }
        }
        /// <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();
            }
        }
예제 #9
0
        public INSiteMaint()
        {
            if (insetup.Current == null)
            {
                throw new PXSetupNotEnteredException(ErrorMessages.SetupNotEntered, typeof(INSetup), PXMessages.LocalizeNoPrefix(IN.Messages.INSetup));
            }

            if (!PXAccess.FeatureInstalled <FeaturesSet.warehouse>())
            {
                site.Cache.AllowInsert = getDefaultSiteID() == null;
                Next.SetVisible(false);
                Previous.SetVisible(false);
                Last.SetVisible(false);
                First.SetVisible(false);
            }

            PXUIFieldAttribute.SetVisible <INSite.pPVAcctID>(siteaccounts.Cache, null, true);
            PXUIFieldAttribute.SetVisible <INSite.pPVSubID>(siteaccounts.Cache, null, true);

            PXUIFieldAttribute.SetVisible <INSite.discAcctID>(siteaccounts.Cache, null, false);
            PXUIFieldAttribute.SetVisible <INSite.discSubID>(siteaccounts.Cache, null, false);

            PXUIFieldAttribute.SetVisible <INSite.freightAcctID>(siteaccounts.Cache, null, false);
            PXUIFieldAttribute.SetVisible <INSite.freightSubID>(siteaccounts.Cache, null, false);

            PXUIFieldAttribute.SetVisible <INSite.miscAcctID>(siteaccounts.Cache, null, false);
            PXUIFieldAttribute.SetVisible <INSite.miscSubID>(siteaccounts.Cache, null, false);

            PXUIFieldAttribute.SetDisplayName <Contact.salutation>(Caches[typeof(Contact)], CR.Messages.Attention);
            PXUIFieldAttribute.SetDisplayName <INSite.overrideInvtAccSub>(siteaccounts.Cache, PXAccess.FeatureInstalled <FeaturesSet.subAccount>() ? Messages.OverrideInventoryAcctSub : Messages.OverrideInventoryAcct);

            PXUIFieldAttribute.SetEnabled <Contact.fullName>(Caches[typeof(Contact)], null);

            action.AddMenuAction(changeID);

            PXImportAttribute importAttribute = location.Attributes.Find(a => a is PXImportAttribute) as PXImportAttribute;

            importAttribute.MappingPropertiesInit += MappingPropertiesInit;
        }
        protected virtual void _(Events.RowInserting <FSModelComponent> e)
        {
            if (e.Row == null || PXAccess.FeatureInstalled <FeaturesSet.equipmentManagementModule>() == false)
            {
                return;
            }

            FSModelComponent fsModelComponentRow = (FSModelComponent)e.Row;

            FSModelComponent fsModelComponentRow_InDB = PXSelect <FSModelComponent,
                                                                  Where <
                                                                      FSModelComponent.componentID, Equal <Required <FSModelComponent.componentID> >,
                                                                      And <
                                                                          FSModelComponent.modelID, Equal <Current <InventoryItem.inventoryID> > > > >
                                                        .SelectWindowed(Base, 0, 1, fsModelComponentRow.ComponentID);

            if (fsModelComponentRow_InDB != null)
            {
                e.Cache.RaiseExceptionHandling <FSModelComponent.componentID>
                    (e.Row, fsModelComponentRow.ComponentID, new PXException(TX.Error.ID_ALREADY_USED));
            }
        }
        protected virtual void _(Events.FieldUpdated <FSModelComponent, FSModelComponent.inventoryID> e)
        {
            if (e.Row == null || PXAccess.FeatureInstalled <FeaturesSet.equipmentManagementModule>() == false)
            {
                return;
            }

            FSModelComponent fsModelComponentRow = (FSModelComponent)e.Row;

            if (fsModelComponentRow.InventoryID != null)
            {
                InventoryItem inventoryItemRow = SharedFunctions.GetInventoryItemRow(Base, fsModelComponentRow.InventoryID);

                FSxEquipmentModel fsxEquipmentModelTemplate = PXCache <InventoryItem> .GetExtension <FSxEquipmentModel>(inventoryItemRow);

                fsModelComponentRow.CpnyWarrantyValue   = fsxEquipmentModelTemplate.CpnyWarrantyValue;
                fsModelComponentRow.CpnyWarrantyType    = fsxEquipmentModelTemplate.CpnyWarrantyType;
                fsModelComponentRow.VendorWarrantyValue = fsxEquipmentModelTemplate.VendorWarrantyValue;
                fsModelComponentRow.VendorWarrantyType  = fsxEquipmentModelTemplate.VendorWarrantyType;
                fsModelComponentRow.VendorID            = inventoryItemRow.PreferredVendorID;
            }
        }
예제 #12
0
        protected virtual void _(Events.RowSelected <FinPeriod> e)
        {
            ShowUnpostedDocuments.SetEnabled(SelectedItems.Any());

            if (PXAccess.FeatureInstalled <FeaturesSet.branch>() &&
                !PXAccess.FeatureInstalled <FeaturesSet.centralizedPeriodsManagement>())
            {
                return;
            }

            FinPeriod row = (FinPeriod)e.Row;

            if (row == null)
            {
                return;
            }

            bool      warnDocsUnposted    = (row.Selected == true && UnpostedDocuments.View.SelectSingleBound(new[] { row }) != null);
            Exception warnDocsUnpostedExc = warnDocsUnposted ? new PXSetPropertyException(Messages.UnpostedDocsExist, PXErrorLevel.RowWarning) : null;

            FinPeriods.Cache.RaiseExceptionHandling <FinPeriod.selected>(row, null, warnDocsUnpostedExc);
        }
예제 #13
0
        public virtual void SOShipmentFilter_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            _ActionChanged = !sender.ObjectsEqual <SOShipmentFilter.action>(e.Row, e.OldRow);
            if (_ActionChanged && e.Row != null)
            {
                var row = ((SOShipmentFilter)e.Row);

                row.PackagingType = SOPackageType.ForFiltering.Both;

                if (GetActionIDByName(row.Action) == SOShipmentEntryActionsAttribute.CreateDropshipInvoice)
                {
                    row.SiteID = null;
                }
            }

            if ((_ActionChanged || !sender.ObjectsEqual <SOShipmentFilter.definePrinterManually>(e.Row, e.OldRow) || !sender.ObjectsEqual <SOShipmentFilter.printWithDeviceHub>(e.Row, e.OldRow)) &&
                Filter.Current != null && PXAccess.FeatureInstalled <FeaturesSet.deviceHub>() && Filter.Current.PrintWithDeviceHub == true && Filter.Current.DefinePrinterManually == true)
            {
                string actualReportID = SOReports.GetReportID(GetActionIDByName(Filter.Current.Action), null) ?? SOReports.GetReportIDByName(Orders, Filter.Current.Action);
                Filter.Current.PrinterID = new NotificationUtility(this).SearchPrinter(ARNotificationSource.Customer, actualReportID, Accessinfo.BranchID);
            }
        }
        protected virtual void INItemClass_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            INItemClass     itemClassRow       = (INItemClass)e.Row;
            FSxServiceClass fsxServiceClassRow = cache.GetExtension <FSxServiceClass>(itemClassRow);

            if (string.IsNullOrEmpty(fsxServiceClassRow.DfltBillingRule))
            {
                cache.RaiseExceptionHandling <FSxServiceClass.dfltBillingRule>(e.Row, fsxServiceClassRow.DfltBillingRule, new PXException(PX.Objects.FS.TX.Error.FIELD_EMPTY));
                e.Cancel = true;
            }

            if (PXAccess.FeatureInstalled <FeaturesSet.equipmentManagementModule>())
            {
                FSxEquipmentModelTemplate fsxEquipmentModelTemplateRow = cache.GetExtension <FSxEquipmentModelTemplate>(itemClassRow);
                CheckComponentsClassID(fsxEquipmentModelTemplateRow);
            }
        }
            public void FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
            {
                CurrencyInfo info = e.Row as CurrencyInfo;

                if (info != null && !String.IsNullOrEmpty(info.ModuleCode))
                {
                    CMSetup CMSetup = info.getCMSetup(sender);
                    if (CMSetup != null && PXAccess.FeatureInstalled <FeaturesSet.multicurrency>())
                    {
                        string rateType;
                        switch (info.ModuleCode)
                        {
                        case BatchModule.CA:
                            rateType = CMSetup.CARateTypeDflt;
                            break;

                        case BatchModule.AP:
                            rateType = CMSetup.APRateTypeDflt;
                            break;

                        case BatchModule.AR:
                            rateType = CMSetup.ARRateTypeDflt;
                            break;

                        case BatchModule.GL:
                            rateType = CMSetup.GLRateTypeDflt;
                            break;

                        default:
                            rateType = null;
                            break;
                        }
                        if (!string.IsNullOrEmpty(rateType))
                        {
                            e.NewValue = rateType;
                        }
                    }
                }
            }
예제 #16
0
        public BranchMaint()
        {
            this.Employees.Cache.AllowInsert = false;
            this.Employees.Cache.AllowDelete = false;
            this.Employees.Cache.AllowUpdate = false;
            PXUIFieldAttribute.SetDisplayName(Caches[typeof(Contact)], typeof(Contact.salutation).Name, CR.Messages.Attention);

            PXUIFieldAttribute.SetEnabled <Contact.fullName>(Caches[typeof(Contact)], null);
            if (!PXAccess.FeatureInstalled <FeaturesSet.branch>())
            {
                BranchBAccount br = PXSelectReadonly <BranchBAccount> .SelectWindowed(this, 0, 1);

                this.CurrentBAccount.Cache.AllowInsert = (br == null);
                this.CurrentBAccount.Cache.AllowDelete = (br == null);
                Next.SetVisible(false);
                Prev.SetVisible(false);
                Last.SetVisible(false);
                First.SetVisible(false);
                Insert.SetVisible(false);
                Delete.SetVisible(false);
            }
        }
예제 #17
0
        private DistributionRounding GetDistributor(long?curyInfoID)
        {
            var arsetup  = new PXSelect <ARSetup>(this).SelectSingle();
            var curyInfo = new PXSelect <CurrencyInfo, Where <CurrencyInfo.curyInfoID, Equal <Required <ARInvoice.curyInfoID> > > >(this).SelectSingle(curyInfoID);

            if (curyInfo == null)
            {
                return new DistributionRounding(arsetup, PXAccess.FeatureInstalled <PX.Objects.CS.FeaturesSet.invoiceRounding>())
                       {
                           CuryPlaces = 0, PreventOverflow = true
                       }
            }
            ;
            else
            {
                return new DistributionRounding(arsetup, PXAccess.FeatureInstalled <PX.Objects.CS.FeaturesSet.invoiceRounding>())
                       {
                           CuryPlaces = curyInfo.CuryPrecision ?? 0, PreventOverflow = true
                       }
            };
        }
    }
예제 #18
0
 public bool PrepareImportRow(string viewName, IDictionary keys, IDictionary values)
 {
     if (string.Compare(viewName, PIDetail.View.Name, true) == 0)
     {
         PXCache       barCodeCache = AddByBarCode.Cache;
         INBarCodeItem item         = (INBarCodeItem)(AddByBarCode.Current ?? barCodeCache.CreateInstance());
         try
         {
             barCodeCache.SetValueExt <INBarCodeItem.inventoryID>(item, GetImportedValue <INPIDetail.inventoryID>(values, true));
             if (PXAccess.FeatureInstalled <FeaturesSet.subItem>())
             {
                 barCodeCache.SetValueExt <INBarCodeItem.subItemID>(item, GetImportedValue <INPIDetail.subItemID>(values, true));
             }
             if (PXAccess.FeatureInstalled <FeaturesSet.warehouseLocation>())
             {
                 barCodeCache.SetValueExt <INBarCodeItem.locationID>(item, GetImportedValue <INPIDetail.locationID>(values, true));
             }
             if (PXAccess.FeatureInstalled <FeaturesSet.lotSerialTracking>())
             {
                 barCodeCache.SetValueExt <INBarCodeItem.lotSerialNbr>(item, GetImportedValue <INPIDetail.lotSerialNbr>(values, false));
             }
             barCodeCache.SetValueExt <INBarCodeItem.qty>(item, GetImportedValue <INPIDetail.physicalQty>(values, true));
             barCodeCache.SetValueExt <INBarCodeItem.autoAddLine>(item, false);
             barCodeCache.Update(item);
             UpdatePhysicalQty();
         }
         catch (Exception e)
         {
             PXTrace.WriteError(IN.Messages.RowError, excelRowNumber, e.Message);
             importHasError = true;
         }
         finally
         {
             excelRowNumber++;
         }
     }
     return(false);
 }
예제 #19
0
        protected virtual void _(Events.RowPersisting <TDetail> e)
        {
            if (e.Operation.Command() == PXDBOperation.Delete)
            {
                return;
            }

            var headerBranchId = (int?)HeaderCache.GetValue <THeaderBranchField>(HeaderCache.Current);

            if (headerBranchId == null || PXAccess.FeatureInstalled <FeaturesSet.interBranch>())
            {
                return;
            }

            var detailSite = (INSite)PXSelectorAttribute.Select(DetailsCache, e.Row, typeof(TDetailSiteField).Name);

            if (detailSite == null || PXAccess.IsSameParentOrganization(headerBranchId, detailSite.BranchID))
            {
                return;
            }

            DetailsCache.RaiseExceptionHandling <INTran.siteID>(e.Row, detailSite.SiteCD, new PXSetPropertyException(Common.Messages.InterBranchFeatureIsDisabled));
        }
예제 #20
0
        protected virtual void EPSetup_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            EPSetup row = e.Row as EPSetup;

            if (row != null)
            {
                PXUIFieldAttribute.SetEnabled <EPSetup.useReceiptAccountForTips>(cache, row, row.NonTaxableTipItem.HasValue);
                PXUIFieldAttribute.SetEnabled <EPSetup.offBalanceAccountGroupID>(cache, row, row.PostingOption == EPPostOptions.PostToOffBalance);
                if (row.CustomWeek == true)
                {
                    EPCustomWeek lastWeek = (EPCustomWeek)PXSelectOrderBy <EPCustomWeek, OrderBy <Desc <EPCustomWeek.weekID> > > .SelectSingleBound(this, null);

                    PXUIFieldAttribute.SetEnabled <EPSetup.customWeek>(cache, row, lastWeek == null);
                }

                bool claimApprovalVisible = PXAccess.FeatureInstalled <FeaturesSet.approvalWorkflow>() &&
                                            PXAccess.FeatureInstalled <FeaturesSet.expenseManagement>();

                PXUIFieldAttribute.SetVisible <EPSetup.claimDetailsAssignmentMapID>(cache, null, claimApprovalVisible);
                PXUIFieldAttribute.SetVisible <EPSetup.claimAssignmentMapID>(cache, null, claimApprovalVisible);
                PXUIFieldAttribute.SetVisible <EPSetup.claimDetailsAssignmentNotificationID>(cache, null, claimApprovalVisible);
            }
        }
        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;
        }
예제 #22
0
 protected virtual void _(Events.FieldSelecting <PMLaborCostRate, PMLaborCostRate.taskID> e)
 {
     if (e.Row != null && e.Row.Type == PMLaborCostRateType.Certified)
     {
         e.ReturnState = PXStringState.CreateInstance(null, null, null, nameof(PMLaborCostRate.TaskID), false, null, null, null, null, null, null);
         PXFieldState ss = e.ReturnState as PXFieldState;
         ss.Enabled    = false;
         ss.Visible    = PXAccess.FeatureInstalled <FeaturesSet.projectModule>();
         ss.Visibility = PXAccess.FeatureInstalled <FeaturesSet.projectModule>() ? PXUIVisibility.Visible : PXUIVisibility.Invisible;
         e.Cancel      = true;
     }
     else if (e.Row == null)
     {
         //For Excel Import - make field as editable in order to map the field.
         e.ReturnState = PXStringState.CreateInstance(null, null, null, nameof(PMLaborCostRate.TaskID), false, null, null, null, null, null, null);
         PXFieldState ss = e.ReturnState as PXFieldState;
         ss.Enabled     = true;
         ss.Visible     = PXAccess.FeatureInstalled <FeaturesSet.projectModule>();
         ss.Visibility  = PXAccess.FeatureInstalled <FeaturesSet.projectModule>() ? PXUIVisibility.Visible : PXUIVisibility.Invisible;
         ss.DisplayName = PXUIFieldAttribute.GetDisplayName <PMLaborCostRate.taskID>(e.Cache);
         e.Cancel       = true;
     }
 }
        protected virtual void SOOrder_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
        {
            if (e.Operation.Command() == PXDBOperation.Delete || !Base.IsTransferOrder)
            {
                return;
            }

            var order = (SOOrder)e.Row;

            if (order?.BranchID == null || PXAccess.FeatureInstalled <FeaturesSet.interBranch>())
            {
                return;
            }

            var destSite = INSite.PK.Find(Base, order.DestinationSiteID);

            if (destSite == null || PXAccess.IsSameParentOrganization(order.BranchID, destSite.BranchID))
            {
                return;
            }

            cache.RaiseExceptionHandling <SOOrder.destinationSiteID>(e.Row, destSite.SiteCD, new PXSetPropertyException(Common.Messages.InterBranchFeatureIsDisabled));
        }
예제 #24
0
        public void ProcessRequest(HttpContext context)
        {
            if (!IsSecureConnection())
            {
                throw new PXSetPropertyException(Messages.OutlookPluginHttps);
            }
            if (!PXAccess.FeatureInstalled <PX.Objects.CS.FeaturesSet.outlookIntegration>())
            {
                throw new PXSetPropertyException(Messages.OutlookFeatureNotInstalled);
            }
            context.Response.Clear();
            context.Response.Cache.SetCacheability(HttpCacheability.Private);
            context.Response.Cache.SetValidUntilExpires(true);
            context.Response.AddHeader("Connection", "Keep-Alive");
            context.Response.BufferOutput = false;
            foreach (string ck in context.Request.Cookies.AllKeys)
            {
                context.Response.Cookies.Add(context.Request.Cookies[ck]);
            }
            context.Response.AddHeader("content-type", "application/octet-stream");
            context.Response.AddHeader("Accept-Ranges", "bytes");

            string text = null;

            using (var fs = Assembly.GetExecutingAssembly().GetManifestResourceStream(_resourceAddinManifest))
            {
                using (var sR = new StreamReader(fs))
                {
                    string address = GetSiteBaseUrl(context.Request);
                    text = sR.ReadToEnd().Replace("{domain}", address.Replace("http://", "https://"));
                }
            }
            byte[] buffer = Encoding.UTF8.GetBytes(text);
            context.Response.AddHeader("Content-Disposition", "attachment; filename=" + _outputFileName);
            context.Response.ContentType = "application/xml";
            context.Response.BinaryWrite(buffer);
        }
        public virtual object GetExpenseAccountSub(PXCache sender, PXFieldDefaultingEventArgs e, InventoryItem item, int?siteID,
                                                   GetAccountSubUsingPostingClassDelegate GetAccountSubUsingPostingClass,
                                                   GetAccountSubFromItemDelegate GetAccountSubFromItem)
        {
            object expenseAccountSubID = null;

            if (item != null && item.StkItem != true)
            {
                var insetup = (INSetup)PXSetup <INSetup> .SelectWindowed(sender.Graph, 0, 1);

                if (item.NonStockReceipt == true && PXAccess.FeatureInstalled <FeaturesSet.inventory>() && insetup != null && insetup.UpdateGL == true)
                {
                    INPostClass postClass = INPostClass.PK.Find(sender.Graph, item.PostClassID);
                    if (postClass != null)
                    {
                        var site = INSite.PK.Find(sender.Graph, siteID);
                        try
                        {
                            expenseAccountSubID = GetAccountSubUsingPostingClass(item, site, postClass);
                        }
                        catch (PXMaskArgumentException)
                        {
                        }
                    }
                    else
                    {
                        expenseAccountSubID = null;
                    }
                }
                else
                {
                    expenseAccountSubID = GetAccountSubFromItem(item);
                }
            }

            return(expenseAccountSubID);
        }
예제 #26
0
        public override void CacheAttached(PXCache sender)
        {
            base.CacheAttached(sender);

            var values = new List <string>()
            {
                " "
            };
            var labels = new List <string>()
            {
                " "
            };

            var type = typeof(PMTask);

            // Acuminator disable once PX1045 PXGraphCreateInstanceInEventHandlers Needed because the info is retrieved using a graph instance.
            if (PXAccess.FeatureInstalled <FeaturesSet.projectModule>())
            {
                ProjectEntry projectEntryGraph = PXGraph.CreateInstance <ProjectEntry>();
                foreach (var field in projectEntryGraph.GetFieldNames(SmartsheetConstants.ViewName.TASK))
                {
                    if (ignoredFields.Any(fieldName => field.Contains(fieldName) || field.Contains("_") || field.Contains("Note")))
                    {
                        continue;
                    }
                    if (!values.Contains(field))
                    {
                        PXFieldState fs = projectEntryGraph.Caches[type].GetStateExt(null, field) as PXFieldState;
                        values.Add(field);
                        labels.Add(fs != null ? fs.DisplayName : field);
                    }
                }
            }

            _AllowedValues = values.ToArray();
            _AllowedLabels = labels.ToArray();
        }
예제 #27
0
        public ContractItemMaint()
        {
            CurrentTemplates.Cache.AllowInsert         =
                CurrentTemplates.Cache.AllowUpdate     =
                    CurrentTemplates.Cache.AllowDelete = false;
            CurrentContracts.Cache.AllowInsert         =
                CurrentContracts.Cache.AllowUpdate     =
                    CurrentContracts.Cache.AllowDelete = false;
            FieldDefaulting.AddHandler <InventoryItem.stkItem>((sender, e) => { if (e.Row != null)
                                                                                {
                                                                                    e.NewValue = false;
                                                                                }
                                                               });

            if (!PXAccess.FeatureInstalled <FeaturesSet.multicurrency>())
            {
                PXUIFieldAttribute.SetVisible <ContractItem.curyID>(ContractItems.Cache, null, false);
                FieldDefaulting.AddHandler <ContractItem.curyID>((sender, e) =>
                {
                    e.NewValue = Company.Current.BaseCuryID;
                    e.Cancel   = true;
                });
            }
        }
        protected virtual void TaxAdjustment_VendorID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            TaxAdjustment doc = (TaxAdjustment)e.Row;

            if (doc == null)
            {
                return;
            }

            if (PXAccess.FeatureInstalled <FeaturesSet.multicurrency>())
            {
                if (e.ExternalCall || sender.GetValuePending <TaxAdjustment.curyID>(doc) == null)
                {
                    CurrencyInfo info = CurrencyInfoAttribute.SetDefaults <TaxAdjustment.curyInfoID>(sender, doc);

                    string message = PXUIFieldAttribute.GetError <CurrencyInfo.curyEffDate>(currencyinfo.Cache, info);
                    if (string.IsNullOrEmpty(message) == false)
                    {
                        sender.RaiseExceptionHandling <TaxAdjustment.docDate>(doc, doc.DocDate, new PXSetPropertyException(message, PXErrorLevel.Warning));
                    }

                    if (info != null)
                    {
                        doc.CuryID = info.CuryID;
                    }
                }
            }

            if (!this.IsCopyPasteContext)
            {
                sender.SetDefaultExt <TaxAdjustment.vendorLocationID>(e.Row);
                sender.SetDefaultExt <TaxAdjustment.taxPeriod>(e.Row);
                sender.SetDefaultExt <TaxAdjustment.adjAccountID>(e.Row);
                sender.SetDefaultExt <TaxAdjustment.adjSubID>(e.Row);
            }
        }
예제 #29
0
        protected virtual void ApproveBillsFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            PXUIFieldAttribute.SetEnabled(APDocumentList.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <APInvoice.paySel>(APDocumentList.Cache, null, true);
            PXUIFieldAttribute.SetEnabled <APInvoice.payLocationID>(APDocumentList.Cache, null, true);
            PXUIFieldAttribute.SetEnabled <APInvoice.payAccountID>(APDocumentList.Cache, null, true);
            PXUIFieldAttribute.SetEnabled <APInvoice.payTypeID>(APDocumentList.Cache, null, true);
            PXUIFieldAttribute.SetEnabled <APInvoice.payDate>(APDocumentList.Cache, null, true);
            PXUIFieldAttribute.SetEnabled <APInvoice.separateCheck>(APDocumentList.Cache, null, true);

            PXUIFieldAttribute.SetVisible <ApproveBillsFilter.curyID>(sender, null, PXAccess.FeatureInstalled <FeaturesSet.multicurrency>());

            PXUIFieldAttribute.SetDisplayName <APInvoice.selected>(APDocumentList.Cache, Messages.Approve);
            PXUIFieldAttribute.SetDisplayName <APInvoice.vendorID>(APDocumentList.Cache, Messages.VendorID);

            APDocumentList.Cache.AllowInsert = APDocumentList.Cache.AllowDelete = false;

            ApproveBillsFilter row = e.Row as ApproveBillsFilter;

            if (row != null)
            {
                row.Days = PXMessages.LocalizeNoPrefix(row.Days);
            }
        }
예제 #30
0
        protected virtual PXSelectBase <SOOrder> BuildCommandPrepareInvoice()
        {
            var cmd =
                new PXSelectJoinGroupBy <SOOrder,
                                         InnerJoin <SOOrderType, On <SOOrderType.orderType, Equal <SOOrder.orderType>, And <SOOrderType.aRDocType, NotEqual <ARDocType.noUpdate> > >,
                                                    LeftJoin <Carrier, On <SOOrder.shipVia, Equal <Carrier.carrierID> >,
                                                              LeftJoin <SOOrderShipment, On <SOOrderShipment.orderType, Equal <SOOrder.orderType>, And <SOOrderShipment.orderNbr, Equal <SOOrder.orderNbr> > >,
                                                                        LeftJoinSingleTable <ARInvoice, On <ARInvoice.docType, Equal <SOOrderShipment.invoiceType>, And <ARInvoice.refNbr, Equal <SOOrderShipment.invoiceNbr> > >,
                                                                                             LeftJoinSingleTable <Customer, On <SOOrder.customerID, Equal <Customer.bAccountID> > > > > > >,
                                         Where <SOOrder.hold, Equal <boolFalse>, And <SOOrder.cancelled, Equal <boolFalse>,
                                                                                      And <Where <Customer.bAccountID, IsNull, Or <Match <Customer, Current <AccessInfo.userName> > > > > > >,
                                         Aggregate <
                                             GroupBy <SOOrder.orderType,
                                                      GroupBy <SOOrder.orderNbr,
                                                               GroupBy <SOOrder.approved> > > > >(this);

            if (PXAccess.FeatureInstalled <FeaturesSet.inventory>())
            {
                cmd.WhereAnd <
                    Where <Sub <Sub <Sub <SOOrder.shipmentCntr,
                                          SOOrder.openShipmentCntr>,
                                     SOOrder.billedCntr>,
                                SOOrder.releasedCntr>, Greater <short0>,
                           Or2 <Where <SOOrder.orderQty, Equal <decimal0>,
                                       And <SOOrder.curyUnbilledMiscTot, Greater <decimal0> > >,
                                Or <Where <SOOrderType.requireShipping, Equal <boolFalse>, And <ARInvoice.refNbr, IsNull> > > > > >();
            }
            else
            {
                cmd.WhereAnd <
                    Where <SOOrder.curyUnbilledMiscTot, Greater <decimal0>, And <SOOrderShipment.shipmentNbr, IsNull,
                                                                                 Or <Where <SOOrderType.requireShipping, Equal <boolFalse>, And <ARInvoice.refNbr, IsNull> > > > > >();
            }

            return(cmd);
        }