Wiki

Wiki

Open in ChatGPT
Ask ChatGPT about this page
Open in Claude
Ask Claude about this page

Utility Invoices Report

Introduction

This script represents a custom Utility Invoices Report implemented as a Script Report in the Property Management Solution module of ERPNext. It is designed to track utility charges by generating a detailed report of utility invoices issued to customers over a given period.

1. Purpose of the Report

The report is used to provide a list of utility charges for different properties or leases. It pulls data from the Sales Invoice doctype, focusing specifically on invoices containing an item code "Utility Charges." The report aggregates utility charges by month and displays them in a tabular format.

2. Key Functions and Structure

Here’s a breakdown of the key elements of the report:

1. Columns Definition

The get_residential_columns() function generates the structure of the columns for the report. This includes details like apartment number, client, advance payments, invoice details, and monthly amounts for each invoice:

  • This function also appends columns for each month of the selected year.

2. Utility Sales Invoice Retrieval

The function get_utility_sales_invoice() retrieves relevant sales invoices that match the item code Utility Charges:

This function generates a list of invoices that match the item code "Utility Charges."

It calls set_monthly_amount() to calculate the charges for each month.

3. Monthly Amount Calculation

The set_monthly_amount() function calculates the monthly distribution of charges over the duration of the lease.

It uses the rate of utility charges per invoice and calculates how the total amount is spread over the months.

4. Checking Date Range for Monthly Distribution

The check_dates() function breaks down the utility charges across the months:

It ensures that the correct number of days are calculated for each month, taking leap years and February's shorter days into account.

5. Execution of the Report

The report uses the execute() function to compile the report based on the provided filters:

The report generates columns dynamically based on the selected year and fetches the relevant invoice data.

Last updated 1 month ago
Was this helpful?
Thanks!