Function #53: Transaction Level Profitability for Invoices

Function #53: Transaction Level Profitability for Invoices



Hello everyone, and welcome back to our series!

We have previously provided custom functions for calculating the profitability of a quote and a sales order. There may be instances where the invoice may differ from its corresponding quote or sales order. This could be due to changes in item rates, discounts, or even the addition or removal of items based on customer demands. In such cases, accurately determining the profit margin means you need to calculate it directly for the invoice. Today's custom function will help you with that.

Prerequisites: 

1. Create a custom field named "Total Margin" for Invoices. This field will display the profit margin.



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 invoice has been created.

Custom Function:

Navigate to Settings -> Automation -> Workflow Actions -> Custom Functions -> +New Custom Function -> Add the function code from this GitHub link -> Save.
 
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.

We trust this function will be beneficial to you. If you require any assistance with its implementation, please don't hesitate to reach out to our Support team at support[at]zohobooks[dot]com. We're here to help.

Regards,
Shireen Farhana
Zoho Books
    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方