Custom Calculation in Zoho Books Invoices
Custom Calculation in Zoho Books Invoices: Incorporating Two Custom Fields for Item Amount
Zoho Books typically calculates the Item Amount in invoices by multiplying Quantity and Rate. However, a new function has been introduced that allows you to include two custom fields in this calculation, making it more flexible for diverse business needs. The formula becomes:
Item Amount = Custom Field 1 × Custom Field 2 × Rate × Quantity
This enhancement is particularly useful for businesses that require more detailed measurements for their billing. For example, a steel production plant can use this function to calculate the Item Amount of steel sheets based on their length, width, quantity, and rate per square foot. The length and width would be entered into the custom fields, and the function would then automatically calculate the Item Amount.
Prerequisites for Implementation: Create a Connection: A connection named "zbooks" is required for the function to execute successfully. Create Custom Fields: Set up two item-level custom fields (Decimal type) for your two additional variables (e.g., "Length" and "Width"). These will be displayed in sales transactions. Create another custom field named "Unit Rate" (also an item-level field) to store the original sales rate of the line item.
Once the invoice is saved, the custom function will be executed. It first copies the original sales rate to the "Unit Rate" custom field. Then, it calculates "Length × Width × Unit Rate" and populates this result into the default "Rate" field. Finally, Zoho Books calculates "Rate (Default field) × Quantity" and fills the result into the "Amount" field. For detailed instructions and the custom function code, you can refer to the GitHub link provided in the source.
Source: Custom calculation in item table of invoices (2 fields)