Profit Matters app will have a section with a table of companies. “Company” means “Client”. In this section we create companies and connect each company to relevant Quickbooks Customer.
Besides new section we also have new database structure:
Right after QB is connected to certain company in Bubble.io, we then retrieve “ProfitAndLoss” and “BalanceSheet” reports, aggregation of total numbers for previous month. We create new “Report” that will be used for the company as default report(period is previous month), pull those strings and the company into the parser(backend API workflow in bubble.io), this parser generates values for “Quickbooks reports”.
So, after connection to QB, each company have a default report that will be shown by default if any relevant user opens charts of this company. We store this default “Report” and “Quickbooks reports” that correspond to this report forever in database. However, there is an option to generate new custom reports. The flow to generate will be like in Quickbooks:
Custom report will be stored in database temporarily and it is shown only to user who generated it (we define who created report with “Created By” column). This custom report should be deleted either when session ends or when the page is reloaded.
There is also an edge case of when after connection of QB Customer a month passed and now it’s a new month (for example, QB Customer connected in September, but today is October), we have a “Schedule API workflow” on the page load and when any user attached to this company comes and when it’s new month, the backend workflow is triggered that deletes previous default report and create new for new “last month”(in our example “last month” report previously was August, now it should be September).