Like we did with the Item by Contract report, today we’ll add the option to download the Customer by Contract report.
The refreshed version of completecontracts.php, completecontracts.js, and the customer_by_contract-dl.php file itself, available from bendustries.co/files/contracts/warehousereports_inc_cbc-dl.zip. Or the report by itself is bendustries.co/files/contracts/customer_by_contract-dl.zip.
As before, contractreports just needs two lines uncommented to show the download button, so they look like this:
<div class="subtext">Download in Excel xls format</div>
<button onclick="return false" id="dlCustByContract" value="dlCustByContract" url="#">Download</button>
I did rework warehousereports.php and warehousereports.js versus the previous versions. Specifically, I renamed the files for these reports. Previously, they were contract_by_customer, until I realized the name is a bit confusing, as it’s backwards. That is to say, I highly recommend you take the lazy route and just pull down the full version posted above.
Once the modified files are in place and you download this report, you’ll get something like this:
I searched on ‘S3’ here. Notice it’s in the 4th spot for these customers – this search will find a contract in any position.
That’s all there is to it. As we move on, this will get easier, as we’re building on work we’ve already done. Having done the Customer by Contract report first, it makes it easier to port that over to the downloadable version. Having built the downloadable version of Item by Contract, that makes it trivial to combine the two files to create this report. We start with the item_by_contract-dl.php, and change the references to the results from the SQL query we take from the customer_by_contract.php file. With a handful of reports in hand, it becomes very easy to add more later, as we simply expand on what we’ve already built.
If you’re liking the ideas you see here but want to put the work in getting this set up for your own dealership, find me at
Recent Comments