Billing System
3. Bill Schedule Configuration: Defines when bills should be generated .
Required Schedule Parameters:
- Bill Cycle: Select from previously created bill cycles
- Bill Template: Select from previously created bill templates
- Schedule Start Date: Date when the bill generation should start
- Time: Specific time when the bill generation should execute
- Is Recurring: Whether this is a one-time or recurring schedule
- First Bill Date: Date when the first bill should be generated
- Invoice Start Date: Beginning of the billing period for consumption calculation
- Invoice End Date: End of the billing period for consumption calculation
Process Steps:
- Click "Add Bill Schedule" button from the Schedule tab
- Select the appropriate Bill Cycle and Bill Template from the dropdowns
- Configure the schedule parameters including start date and time
- Set recurrence settings if applicable
- Specify billing period dates
- Click "Submit" to create the schedule
Developer Notes:
- Schedules are stored in the bill_schedules table
- Recurring schedules trigger automatic job creation in the task scheduler
- The system validates that invoice start and end dates align with the billing frequency
4. Bill Generation Process Execution
When a scheduled bill run executes, the system follows this technical process:
4.1. Component Data Collection Sequence
The system collects data through the following component pipeline:
Bill_Component
├── UtilityDetailComponent
│ └── Fetches utility configuration (name, tax info, rate types)
├── ConsumerDetailComponent
│ └── Retrieves consumer details (IDs, plans, activation dates, meters)
├── PlanDetailComponent
│ └── Obtains rate plans and billing frequencies
├── RateDetailComponent
│ └── Processes rate configurations (fixed, variable, tiered rates)
├── BillDetailComponent
│ └── Processes historical bill data and calculates due dates
├── MeterDetailComponent
│ └── Fetches meter information (IDs, types, device details)
├── MeterReadingComponent
│ └── Retrieves current and previous meter readings
├── ConsumptionDetailComponent
│ └── Calculates consumption based on meter readings
├── PaymentsDetailComponent
│ └── Processes payment history and totals
└── OutstandingDetailComponent
└── Calculates outstanding balances from previous bills
Each component populates two key data structures:
- calculation_specific_data: Component-specific calculations and intermediate values
- bill_json_data: Structured data that will form the final bill
5. Bill Run Monitoring
After a bill run has executed, bills can be monitored and managed from the Run tab:
Run Tab Columns:
- Invoice No: Unique bill identifier
- Invoice Date: Date when the bill was generated
- Consumer: Name of the consumer
- Mobile No: Consumer's contact number
- Bill Amount: Total amount due
- Status: Current status (Generated, Sent, Paid, etc.)
- Bill Type: Classification (Regular, Estimated, Final)
- Action: Available operations (View, Edit, Download, Send)
Process Steps:
Technical Implementation Details
Class Hierarchy
The bill generation process relies on the following class hierarchy:
BaseBillCreationClass
├── ComponentManager
│ ├── UtilityDetailComponent
│ ├── ConsumerDetailComponent
│ ├── PlanDetailComponent
│ ├── RateDetailComponent
│ ├── BillDetailComponent
│ ├── MeterDetailComponent
│ ├── MeterReadingComponent
│ ├── ConsumptionDetailComponent
│ ├── PaymentsDetailComponent
│ └── OutstandingDetailComponent
└── CalculationManager
├── BaseCalculatorComponent
├── RoshanCalculatorComponent
└── AxisCalculatorComponent
5. Printing & Distribution:
- Tracks delivery of paper and electronic bills.
Data Flow Diagram
Bill Run Trigger
↓
BaseBillCreationClass initialization
↓
Component Data Collection
↓
Calculation Process
↓
Bill JSON Generation
↓
Bill Storage & Distribution
No Comments