Function #13: Transaction level profitability

Function #13: Transaction level profitability

In Zoho Books, the Profit & Loss report provides valuable insights into the overall profitability of your business, indicating whether you have made a profit or incurred a loss. However, there may be occasions when you wish to assess whether a specific sale you made has been profitable. For such cases, you can utilize today's custom function which will automatically calculate profitability at the sales order level.

Prerequisites:
1. You need to create a Sales Order level custom field with the name "Total Margin" and data type as "Decimal". 



2. Create a Connection named "zbooks" to successfully execute the function. You can watch the GIF attached below to know how to create the connection. 


Note:
The cost price to calculate the margin will not be fetched and updated based on FIFO. The margin will be calculated based on the sales price entered in the transaction and the cost price mentioned at the item level. Also, the margin will be updated only after the sales order has been created.

Custom Function:
Navigate to Settings -> Automation -> Custom Functions -> +New Custom Function > Add the function code from this GitHub link.
 
Workflow Rule: 
Go to Settings -> Automation -> Workflow Rules -> +New Workflow Rule and set up the workflow rule as shown below:-



In the final step of this workflow rule, associate the custom function you created and then hit Save. Here's a GIF of how the function will work.



This function helps you analyze the financial performance of each sale, providing you with a clearer understanding of whether a particular transaction has been profitable or not. We believe that this function will be highly advantageous for your business. If you require any assistance with setting up this custom function, please do not hesitate to reach out to us at support[at]zohobooks[dot]com. Our team is always there for assistance!

Regards,
Shireen Farhana S
Zoho Books.