Skip to main content

AccPac report

AccPac report can be downloaded from BE Invoice. Select a few invoices; then choose Export dropdown, choose AccPac.

Terms: PBI: Pay By Invoice. For AccPac, PBI orders are exported differently than non-PBI orders.

 

Code: ConvertToAccpac.php

Steps to build AccPac report:

First; grab all the headers (orders)
Query: 

$orderHeaders = $connection->fetchAll($queryGetHeaders);

Second; grab all the details from `sales_invoice_item` :

$orderSkuRows = $connection->fetchAll($queryGetSkuRows);

With the $orderHeaders and $orderSkuRows, we are ready to build the report. 

Order headers are grouped by Accounting Label (or sales_payment's po_number; in case the order is PBI)

Group the $orderSkuRows by Accounting Label; then Ord