DEV Community

Cover image for Logistics Automation - Invoice Generation
Bala Madhusoodhanan
Bala Madhusoodhanan

Posted on

Logistics Automation - Invoice Generation

Need for Digital Invoice Generation:
Invoice generation process for small business generally is a hassle, as it is time-consuming and prone to errors. The process involves spending countless hours on manual data entry, printing and mailing invoices, and chasing payments. The organisation and their customers would also benefiting from a more efficient and convenient billing process, leading to a better overall experience.

Conceptual Architecture View:
Image description

Platform Setup:

  • Connect the data connectors needed for the App a) Sharepoint Connector - Add the sharepoint list as a data source to PowerApp. The sharepoint list has some details that would be pulled to generate data related to invoices b) Office365Outlook Connector - This connector would be leveraged to

Image description

  • Enable PDF function (preview) which would help you to create PDF outputs with screen / container controls Image description

Setup and Tricks for Configuration

  1. Data selection scoping: In order to have smaller data transaction, the control leveraged is a drop down list item which pulls distinct values based on the customer name
Distinct("InvoiceSharepoint",'CustID~customer identifier')
Enter fullscreen mode Exit fullscreen mode

I might have multiple Work / group of tasks performed for a specific customer so the second drop down list is now pulling all the unique task ID

Distinct(Filter(InvoiceSharepoint, 'CustID' = CustID.Selected.Result),TaskIDs)
Enter fullscreen mode Exit fullscreen mode

the User experience would be as below where the associate would select the customer first and then the app will pull all the Tasks / orderID for which the Invoice would be generated subsequently

2.Add Container for datatable: Add the Datatable (Preview) to the container and filter the data to pull all the lineitems against the unique task ID selected by the user

Image description

Filter('InvoiceSharepoint', 'Title' = TaskIDs.SelectedText.Value)
Enter fullscreen mode Exit fullscreen mode

The data scoping logic would be something like below

Image description

So the data scoping on an App would look something as below

Image description

3.PDF Magic and email - The last set is to Wrap the data on the container (Container10) as a PDF document and pushing that using the outlook send email function as an attachment.

Office365Outlook.SendEmailV2(User().Email,"PDF Invoice", "Here is your Invoice",
   {Attachments:Table({
       Name:"Invoice.PDF",ContentBytes:PDF(Container10)
   }
   )
   }
)
Enter fullscreen mode Exit fullscreen mode

The above magical code would wrap all the data in a container and push it as a PDF to the user.

Image description

Conclusion

Digital invoice generation can help small businesses offering logistics services to streamline their billing process, increase efficiency and improve cash flow. Power Platform could assist with automation with invoice generation

Product reference:

  1. PDF Functions https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/controls/control-pdf-viewer

  2. Container Controls https://dev.to/balagmadhu/container-controls-powerapps-2l7d

Top comments (0)