Skip to main content

New Page

This API is used to download a job card report in PDF format. It fetches details about a specific job card, calculates various costs (labour, material, tax, etc.), and generates a report with both estimated and actual values.

Key Parameters

1. Input Parameters

job_card_id: The ID of the job card for which the report is generated.

remote_utility_id: The utility ID associated with the job card.

tab_name: Indicates the status of the job card (e.g., "assigned", "completed").

2. Output Parameters

The API returns a PDF report containing:

Utility Details: Name and logo of the utility.

Consumer Details: Information about the consumer or meter.

Job Details: Details of the job card (e.g., description, effort, downtime).

Cost Details: Estimated and actual costs (labour, material, tax, etc.).

Task Details: Tasks performed or to be performed.

Material Details: Materials used or to be used.

Reading Details: Readings taken or to be taken.

Technician Details: Field force members assigned to the job.


Calculation Workflow

1. Fetch Job Card Details

The API retrieves the job card using the job_card_id and remote_utility_id.

It also fetches related details like:

Consumer Information: From the utility's consumer service.

Meter Information: If the job card is associated with a meter.

Utility Details: Name and logo of the utility.


2. Calculate Labour Costs

Estimated Labour Cost:

Taken directly from the job card’s SOP (job_card.sop.rate).

Actual Labour Cost:

Calculated based on the time spent by field force members and their pay rates.

Formula:

Copy

Actual Labour Cost = Sum of (Normal Pay per Minute * Total Minutes Worked)

Where:

Normal Pay per Minute: Derived from the field force member’s normal_pay (converted to per-minute rate).

Total Minutes Worked: Sum of total_interval (time spent on tasks) and total_travel_time.


3. Calculate Material Costs

Estimated Material Cost:

Taken directly from the job card’s SOP (job_card.sop.material_cost_count).

Actual Material Cost:

Calculated based on the quantity used and cost per unit of materials.

Formula:

Actual Material Cost = Sum of (Quantity Used * Cost per Unit)


4. Calculate Other Costs

Estimated Other Cost:

Taken directly from the job card’s SOP (job_card.sop.estimated_other_cost).

Actual Other Cost:

Taken from the job card’s total_travel_cost.


5. Calculate Tax

Tax Rate:

Fetched from the utility’s onboarding service using the tax ID from the SOP.

Estimated Taxable Cost:

Formula:

Estimated Taxable Cost = (Estimated Labour Cost + Estimated Material Cost + Estimated Other Cost) * (Tax Rate / 100)

Actual Taxable Cost:

Formula:

Actual Taxable Cost = (Actual Labour Cost + Actual Material Cost + Actual Other Cost) * (Tax Rate / 100)

6. Calculate Total Costs

Estimated Total Cost:

Formula:

Estimated Total Cost = Estimated Labour Cost + Estimated Material Cost + Estimated Other Cost + Estimated Taxable Cost

Actual Total Cost:

Formula:

Copy

Actual Total Cost = Actual Labour Cost + Actual Material Cost + Actual Other Cost + Actual Taxable Cost

7. Prepare Report Data

The API organizes all the calculated data into a structured format:

Utility Details: Name and logo.

Consumer Details: Consumer or meter information.

Job Details: Job card information (e.g., description, effort, downtime).

Cost Details: Estimated and actual costs.

Task Details: Tasks performed or to be performed.

Material Details: Materials used or to be used.

Reading Details: Readings taken or to be taken.

Technician Details: Field force members assigned to the job.


Response Structure

The API returns a PDF report with the following sections:

Utility Details: Name and logo.

Consumer Details: Consumer or meter information.

Job Details: Job card information.

Cost Details: Estimated and actual costs.

Task Details: Tasks performed or to be performed.

Material Details: Materials used or to be used.

Reading Details: Readings taken or to be taken.

Technician Details: Field force members assigned to the job.