Search code examples
acumaticaportal

Adding the currency balance fields to the customer portal?


I have tried to add the Current Balance (Currency) field to the "My Documents (SP.40.20.00)" page of the customer portal in the header area, but those fields do not show up no matter what I do, and modifying (Overriding) the Aggregate function doesn't seem possible (Wrapper error). Is there any other way for me to get the Currency (customer) total instead of the default currency total?

Link to the project


Solution

  • The base graph you're working on (ARDocumentEnq) has visibility validations in a RowSelected event based on the feature set selected in the licence and the selected row CuryID/company base currency.

    Check that those features are enabled on the main site in Configuration->Common Settings->Licensing->Enable/Disable Features and work out the conditions you need for row.CuryID and Company.Current.BaseCuryID. To override base graph conditions, you can add a RowSelected event in a graph extension.

    public class ARDocumentEnq_Extension:PXGraphExtension<ARDocumentEnq>
      {
        public virtual void ARDocumentFilter_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
          ARDocumentEnq.ARDocumentFilter row = (ARDocumentEnq.ARDocumentFilter)e.Row;
          if (row == null) return;
    
          PXCache docCache = Base.Documents.Cache;
    
          // Forcing display
          bool byPeriod = true; //(row.Period != null);
          bool isMCFeatureInstalled = true; //PXAccess.FeatureInstalled<FeaturesSet.multicurrency>();
          bool isForeignCurrencySelected = true; //String.IsNullOrEmpty(row.CuryID) == false && (row.CuryID != this.Company.Current.BaseCuryID);
          bool isBaseCurrencySelected = true; //String.IsNullOrEmpty(row.CuryID) == false && (row.CuryID == this.Company.Current.BaseCuryID);
    
          PXUIFieldAttribute.SetVisible<ARDocumentEnq.ARDocumentFilter.curyID>(cache, row, isMCFeatureInstalled);
          PXUIFieldAttribute.SetVisible<ARDocumentEnq.ARDocumentFilter.curyBalanceSummary>(cache, row, isMCFeatureInstalled && isForeignCurrencySelected);
          PXUIFieldAttribute.SetVisible<ARDocumentEnq.ARDocumentFilter.curyDifference>(cache, row, isMCFeatureInstalled && isForeignCurrencySelected);
          PXUIFieldAttribute.SetVisible<ARDocumentEnq.ARDocumentFilter.curyCustomerBalance>(cache, row, isMCFeatureInstalled && isForeignCurrencySelected);
          PXUIFieldAttribute.SetVisible<ARDocumentEnq.ARDocumentFilter.curyCustomerDepositsBalance>(cache, row, isMCFeatureInstalled && isForeignCurrencySelected);
    
          PXUIFieldAttribute.SetVisible<ARDocumentEnq.ARDocumentResult.curyID>(docCache, null, isMCFeatureInstalled);
          PXUIFieldAttribute.SetVisible<ARDocumentEnq.ARDocumentResult.rGOLAmt>(docCache, null, isMCFeatureInstalled && !isBaseCurrencySelected);
          PXUIFieldAttribute.SetVisible<ARDocumentEnq.ARDocumentResult.curyBegBalance>(docCache, null, byPeriod && isMCFeatureInstalled && !isBaseCurrencySelected);
          PXUIFieldAttribute.SetVisible<ARDocumentEnq.ARDocumentResult.begBalance>(docCache, null, byPeriod);
          PXUIFieldAttribute.SetVisible<ARDocumentEnq.ARDocumentResult.curyOrigDocAmt>(docCache, null, isMCFeatureInstalled && !isBaseCurrencySelected);
          PXUIFieldAttribute.SetVisible<ARDocumentEnq.ARDocumentResult.curyDocBal>(docCache, null, isMCFeatureInstalled && !isBaseCurrencySelected);
          PXUIFieldAttribute.SetVisible<ARDocumentEnq.ARDocumentResult.curyDiscActTaken>(docCache, null, isMCFeatureInstalled && !isBaseCurrencySelected);
        }
      }