29 Separating Event Adjustment Amount and Percentage Fields

Learn how to customize the Oracle Communications Billing Care Event Adjustment dialog box to provide separate adjustment amount and percentage fields.

Topics in this document:

About Event Adjustments using Amount and Percentage

The Billing Care Event Adjustment dialog box provides only one field, the Adjustment field, in which to enter an adjustment amount or percentage for an event.

You can customize the dialog box to display separate amount adjustment and percent adjustment fields by using the Billing Care SDK. You can also make the fields independent of each other, such that entering a value in one field disables the other field.

Separating Amount and Percentage Fields

To separate the amount and percentage fields in the Event Adjustment dialog box:

  1. Create a custom view model for the Event Adjustment dialog box. See "Creating Custom View Model to Separate Amount and Percentage Fields".

  2. Create a customRegistry.js file that configures Billing Care to use your custom view model. See "Adding CustomEventAdjustmentViewModel to the Registry".

  3. Package and deploy your customization to your Billing Care domain using one of the methods described in "Using an Exploded Archive during Customization" or "Packaging and Deploying Customizations".

Creating Custom View Model to Separate Amount and Percentage Fields

Billing Care uses the EventAdjustmentViewModel.js file to determine what fields to display in the Event Adjustment dialog box. The fields defined in the view model are bound in the HTML file used to render the custom view or page. To change what fields are displayed, create a custom view model, such as CustomEventAdjustmentViewModel.js, that overrides the dialog box's default display. See "About View Models" for more information about Billing Care view models.

To create a custom view model for the Event Adjustment dialog box:

  1. Create a CustomEventAdjustmentViewModel.js file in the myproject/web/custom/viewmodels/ARActions/adjustments directory, where myproject is the folder containing your NetBeans IDE project.

  2. Open the CustomEventAdjustmentViewModel.js file using a text editor and define your custom fields. For example:

    define(['jquery', 'knockout',
        'viewmodels/ARActions/adjustments/EventAdjustmentViewModel'],
            function ($, ko, EventAdjustmentViewModel) {
     
                function CustomEventAdjustmentViewModel() {
                    EventAdjustmentViewModel.apply(this, arguments);
                    self = this;
                    self.percentValue = 0;
                    self.amountValue = 0;
    self.adjustmentPercentage = ko.observable(0).extend({notify:
    "always"}).extend({numeric: 2});
                    self.amountStateController = ko.computed(function () {
                        if ((Number(self.adjustmentAmount()) === 0) &&
                                (Number(self.adjustmentPercentage()) === 0)) {
                            self.enablePercentage(true);
                            self.enableAmount(true);
                        } else if (Number(self.adjustmentPercentage()) === 0) {
                            self.enablePercentage(false);
                            self.enableAmount(true);
                        } else {
                            self.enablePercentage(true);
                            self.enableAmount(false);
                        }
                    });
                }
                CustomEventAdjustmentViewModel.prototype = new
    EventAdjustmentViewModel();
                return  CustomEventAdjustmentViewModel;
       }
    );
  3. Save the file in your NetBeans IDE project.

Adding CustomEventAdjustmentViewModel to the Registry

Configure Billing Care to override the default EventAdjustmentViewModel with your custom view model when rendering the Event Adjustment dialog box. To do so, add the name and path to your custom view model to the customRegistry.js file. For more information about the registry file, see "About the Registry File".

To add CustomEventAdjustmentViewModel to the registry:

  1. Create a customRegistry.js file in the myproject/web/custom/ directory.

  2. Add the following lines to the file:

    eventAdjustment: {
       viewmodel: 'custom/viewmodels/ARActions/adjustments/CustomEventAdjustmentViewModel'
    }
  3. Save the file in your NetBeans IDE project.