Feature Requests
Share ideas, discuss and vote on requests from other users in community
This object is in archive! 

Report on transactions by US State

tsiedsma shared this idea 1 year ago
Under Consideration

Due to the South Dakota v. Wayfair ruling by the US Supreme Court, all online sellers need to charge appropriate sales tax to each state where it is not exempt for their specific service. Most states have a requirement of 200 unique transactions per year or $100,000 in sales per year to their state.

In order to know which states we need to charge tax in, we need a report on transactions by state, both in quantity and total amount.

Please make a report available ASAP for this as we're now in 2019 where the tax laws are in effect and we have no easy way to run such a report. The current transaction reports don't allow filtering by state, same with the customer lists.

Comments (1)


Lines 674 and 677 of the attached file outline which states charge tax on hosting and domains.

The report should be able to list transactions by state for hosting and domains.

This is a decent start, it's rough and mostly just to get some rough numbers. Definitely needs improving and adding support to drill down to domains and hosting if not more.

  1. $states = Capsule::table('tblclients')->where('country', 'US')->distinct()->orderBy('state', 'asc')->get(['state']);

    foreach ($states as $state)


    $data = Capsule::table('tblaccounts')

    ->select(Capsule::raw('COUNT(*) AS mycount, SUM(amountin) AS mytotal'))

    ->join('tblclients', 'tblclients.id', '=', 'tblaccounts.userid')

    ->where('tblaccounts.date', '>', '2018-01-01')

    ->where('tblaccounts.date', '<', '2018-12-31')

    ->where('tblclients.country', 'US')

    ->where('tblclients.state', $state->state)->get();

    echo "State: {$state->state} - " . $data[0]->mycount . ' - ' . $data[0]->mytotal . "<br>";