seed data:
            // Setup
                    $tenantId = $this->setUpNewBasicTenant();

                    $outPut = $this->mockPdo->query("select COALESCE(MAX(id), 0) from food_order")->fetchColumn();
                    $lastOrderId = (int)$outPut;
                    $lastOrderId++;

                    // get a user id to use for the order inserts
                    $outPut = $this->mockPdo->query("select COALESCE(MAX(pk_user_id), 0) from user_login")->fetchColumn();
                    $lastUserId = (int)$outPut;

                    // get last inseted order item id to use for the order item inserts
                    $outPut = $this->mockPdo->query("select COALESCE(MAX(id), 0) from food_order_item")->fetchColumn();
                    $lastOrderItemId = (int)$outPut;

                    // get last inserted food order vat summary
                    $outPut = $this->mockPdo->query("select COALESCE(MAX(id), 0) from food_order_vat_summary")->fetchColumn();
                    $lastVatSummaryId = (int)$outPut;

                    // get last inserted id for food_order_refund_event
                    $outPut = $this->mockPdo->query("select COALESCE(MAX(id), 0) from food_order_refund_event")->fetchColumn();
                    $lastRefundEventId = (int)$outPut;

                    $outPut = $this->mockPdo->query("select COALESCE(MAX(refund_group_id), 0) from food_order_refund_event")->fetchColumn();
                    $lastRefundGroupId = (int)$outPut;
                    $lastRefundGroupId++; // incremented to start the next insert at the correct refund group id

                    // date should be yesterday ad 13:00 to ensure it is within the opening hours and picked up by the reporting function

                    $fiveDaysAgoAt1300  = (new \DateTime('5 days ago', new \DateTimeZone('Europe/London')))->setTime(13, 0)->format('Y-m-d H:i:s');
                    $fiveDaysAgoAt1310  = (new \DateTime('5 days ago', new \DateTimeZone('Europe/London')))->setTime(13, 10)->format('Y-m-d H:i:s');
                    $fiveDaysAgoAt0000  = (new \DateTime('5 days ago', new \DateTimeZone('Europe/London')))->setTime(0, 0)->format('Y-m-d H:i:s');
                    $fiveDaysAgo        = (new \DateTime('5 days ago', new \DateTimeZone('Europe/London')))->format('Y-m-d');
                    $fourDaysAgoAt0000  = (new \DateTime('4 days ago', new \DateTimeZone('Europe/London')))->setTime(0, 0)->format('Y-m-d H:i:s');
                    $fourDaysAgoAt1300  = (new \DateTime('4 days ago', new \DateTimeZone('Europe/London')))->setTime(13, 0)->format('Y-m-d H:i:s');
                    $fourDaysAgoAt1310  = (new \DateTime('4 days ago', new \DateTimeZone('Europe/London')))->setTime(13, 10 )->format('Y-m-d H:i:s');
                    $fourDaysAgo        = (new \DateTime('4 days ago', new \DateTimeZone('Europe/London')))->format('Y-m-d');
                    $threeDaysAgoAt1300 = (new \DateTime('3 days ago', new \DateTimeZone('Europe/London')))->setTime(13, 0)->format('Y-m-d H:i:s');
                    $threeDaysAgoAt1310 = (new \DateTime('3 days ago', new \DateTimeZone('Europe/London')))->setTime(13, 10)->format('Y-m-d H:i:s');
                    $threeDaysAgoAt0000 = (new \DateTime('3 days ago', new \DateTimeZone('Europe/London')))->setTime(0, 0)->format('Y-m-d H:i:s');
                    $threeDaysAgo       = (new \DateTime('3 days ago', new \DateTimeZone('Europe/London')))->format('Y-m-d');
                    $twoDaysAgoAt1300   = (new \DateTime('2 days ago', new \DateTimeZone('Europe/London')))->setTime(13, 0)->format('Y-m-d H:i:s');
                    $twoDaysAgoAt1310   = (new \DateTime('2 days ago', new \DateTimeZone('Europe/London')))->setTime(13, 10)->format('Y-m-d H:i:s');
                    $twoDaysAgoAt0000   = (new \DateTime('2 days ago', new \DateTimeZone('Europe/London')))->setTime(0, 0)->format('Y-m-d H:i:s');
                    $twoDaysAgo         = (new \DateTime('2 days ago', new \DateTimeZone('Europe/London')))->format('Y-m-d');
                    $oneDayAgoAt1300    = (new \DateTime('yesterday', new \DateTimeZone('Europe/London')))->setTime(13, 0)->format('Y-m-d H:i:s');
                    $oneDayAgoAt0000    = (new \DateTime('yesterday', new \DateTimeZone('Europe/London')))->setTime(0, 0)->format('Y-m-d H:i:s');
                    $oneDayAgo          = (new \DateTime('yesterday', new \DateTimeZone('Europe/London')))->format('Y-m-d');
                    $todayAt0000        = (new \DateTime('today', new \DateTimeZone('Europe/London')))->setTime(0, 0)->format('Y-m-d H:i:s');
            // Data Setup    
                    $order = [];    
        
                    $lastOrderId++; // incremented to start the next insert at the correct id
                    // insert and order with an item that is fully charged
                    $this->mockPdo->exec("INSERT INTO food_order    (id,                public_order_code,      user_id,                guest_user_id,          tenant_id,      delivery_address_id,    billing_address_id,     order_status,   order_type,     product_total_original_gross,  product_total_current_gross,    order_total_current_gross,      order_total_original_gross,     order_full_refund,      order_total_current_reason,                             payment_status,         delivery_fee_gross,      delivery_fee_vat,   delivery_fee_vat_rate,     customer_service_fee_gross,     customer_service_fee_vat,   customer_service_fee_vat_rate,          platform_fee_gross,     platform_fee_vat,   platform_fee_vat_rate,       stripe_fee_total,       small_order_fee_gross,  small_order_fee_vat,   small_order_fee_vat_rate,            comment,    tenant_comment,     currency,   transaction_id,                   refunded_id,        payment_intent_id,                  stripe_receipt_url,     created_at,                     updated_at) 
                                                VALUES              ($lastOrderId,      'C02QD5MS',             $lastUserId,            NULL,                   $tenantId,      2,                      NULL,                   'confirmed',   'collection',    13100,                         13100,                          13150,                          13150,                           000,                   'Delivery Charge Applied',                              'paid',                  0,                       0,                  0.00,                      050,                            8,                          20.00,                                  050,                    8,                  20.00,                       447,                   0,                      0,                     0,                                 NULL,       '',                 'GBP',      'ch_3TCdZxDRk9nZ67Cn2c0uUuj8',    '',                 'pi_3TCdZxDRk9nZ67Cn2DmYfS9e',      '',                     '$fiveDaysAgoAt1300',           '$fiveDaysAgoAt1300')");  

                    $order[$lastOrderId]['orderId'] = $lastOrderId;
                    
                    // insert an order item for that order
                    $this->mockPdo->exec("INSERT INTO `food_order_item` ( `order_id`,   `menu_item_id`,      `item_name`,                       `item_base_price`,      `item_total_gross_original`,    `item_modified_reason`,                     `item_quantity`,    `item_note`,    `item_status`,      `item_tenant_comment`,      `created_at`,               `updated_at`,           `item_total_net_original`,       `item_total_vat_original`,      `item_total_gross_modified`,        `item_total_net_modified`,      `item_total_vat_modified`,      `item_vat_rate`) 
                                                                VALUES  ($lastOrderId,  95,                  'Chip Roll',                       300,                    900,                            'Base price only',                           3,                  NULL,           'pending',          NULL,                       '$fiveDaysAgoAt1300',      '$fiveDaysAgoAt1300',    750,                            150,                            900,                                 750,                            150,                            20.00),
                                                                        ($lastOrderId,  101,                 'Large Chips',                     400,                    1200,                           'Base price only',                           3,                  NULL,           'pending',          NULL,                       '$fiveDaysAgoAt1300',      '$fiveDaysAgoAt1300',    1000,                           200,                            1200,                                1000,                           200,                            20.00),
                                                                        ($lastOrderId,  248,                 'vat 17.5',                        1000,                   3000,                           'Base price only',                           3,                  NULL,           'pending',          NULL,                       '$fiveDaysAgoAt1300',      '$fiveDaysAgoAt1300',    2553,                           447,                            3000,                                2553,                           447,                            17.50),
                                                                        ($lastOrderId,  249,                 'vat 15',                          1000,                   3000,                           'Base price only',                           3,                  NULL,           'pending',          NULL,                       '$fiveDaysAgoAt1300',      '$fiveDaysAgoAt1300',    2609,                           391,                            3000,                                2609,                           391,                            15.00),
                                                                        ($lastOrderId,  250,                 'vat 0',                           50,                     200,                            'Base price only',                           4,                  NULL,           'pending',          NULL,                       '$fiveDaysAgoAt1300',      '$fiveDaysAgoAt1300',    200,                            0,                              200,                                 200,                            0,                              0.00),
                                                                        ($lastOrderId,  191,                 '4 Nuggets and Chips (Kids Meal)', 800,                    2400,                           'Base price only',                           3,                  NULL,           'pending',          NULL,                       '$fiveDaysAgoAt1300',      '$fiveDaysAgoAt1300',    2000,                           400,                            2400,                                2000,                           400,                            20.00),
                                                                        ($lastOrderId,  188,                 'Sausage and Chips (Kids Meal)',   800,                    2400,                           'Base price only',                           3,                  NULL,           'pending',          NULL,                       '$fiveDaysAgoAt1300',      '$fiveDaysAgoAt1300',    2000,                           400,                            2400,                                2000,                           400,                            20.00)");
                                                                        
                    $lastOrderItemId ++; // incremented to match the id of the inserted order item for the last insert
                    
                    $lastOrderItemId ++; // incremented to match the id of the inserted order item for the last insert
                    $item3Id = $lastOrderItemId;
                    $order[$lastOrderId]['itemId'][] = $lastOrderItemId;
                    // insert a vat summary for that order
                    $this->mockPdo->exec("INSERT INTO food_order_vat_summary    (order_id,      vat_rate,   vat_gross_original,     vat_net_original,   vat_amount_original,    vat_gross_modified,     vat_net_modified,   vat_amount_modified,       created_at,             updated_at) 
                                                                VALUES          ($lastOrderId,  20.00,      6900,                   5750,               1150,                   6900,                   5750,               1150,                      '$fiveDaysAgoAt1300',   '$fiveDaysAgoAt1300'),
                                                                                ($lastOrderId,  17.50,      3000,                   2553,               447,                    3000,                   2553,               447,                       '$fiveDaysAgoAt1300',   '$fiveDaysAgoAt1300'),
                                                                                ($lastOrderId,  15.00,      3000,                   2609,               391,                    3000,                   2609,               391,                       '$fiveDaysAgoAt1300',   '$fiveDaysAgoAt1300'),
                                                                                ($lastOrderId,  0.00,       200,                    200,                 0,                     200,                    200,                0,                         '$fiveDaysAgoAt1300',   '$fiveDaysAgoAt1300')");
                    $lastVatSummaryId++; // incremented to match the id of the inserted vat summary for the last insert
                    // update the order to have a partial refund to test the impact of refunds on the reporting state
                    $this->mockPdo->exec("UPDATE food_order SET product_total_current_gross = 0, order_total_current_gross = 0, payment_status = 'partial_refund', updated_at = '$fourDaysAgoAt1310' WHERE id = $lastOrderId");
                    
                    // update the order items to reflect the partial refund, with one item fully refunded and one item partially refunded
                    $this->mockPdo->exec("UPDATE food_order_item SET item_total_gross_modified = 600,   item_total_net_modified = 500,      item_total_vat_modified = 100,  item_quantity = 2, item_status = 'partial_refund', updated_at = '$fourDaysAgoAt1310' WHERE id = $lastOrderItemId");
                    $this->mockPdo->exec("UPDATE food_order_item SET item_total_gross_modified = 0,     item_total_net_modified = 0,        item_total_vat_modified = 0,    item_quantity = 0, item_status = 'partial_refund', updated_at = '$fourDaysAgoAt1310' WHERE id = $lastOrderItemId + 1");
                    $this->mockPdo->exec("UPDATE food_order_item SET item_total_gross_modified = 3000,  item_total_net_modified = 2553,     item_total_vat_modified = 447,  item_quantity = 3, item_status = 'partial_refund', updated_at = '$fourDaysAgoAt1310' WHERE id = $lastOrderItemId + 2");
                    $this->mockPdo->exec("UPDATE food_order_item SET item_total_gross_modified = 2000,  item_total_net_modified = 1739,     item_total_vat_modified = 261,  item_quantity = 2, item_status = 'partial_refund', updated_at = '$fourDaysAgoAt1310' WHERE id = $lastOrderItemId + 3");
                    $this->mockPdo->exec("UPDATE food_order_item SET item_total_gross_modified = 200,   item_total_net_modified = 200,      item_total_vat_modified = 0,    item_quantity = 4, item_status = 'partial_refund', updated_at = '$fourDaysAgoAt1310' WHERE id = $lastOrderItemId + 4");
                    $this->mockPdo->exec("UPDATE food_order_item SET item_total_gross_modified = 800,   item_total_net_modified = 667,      item_total_vat_modified = 133,  item_quantity = 1, item_status = 'partial_refund', updated_at = '$fourDaysAgoAt1310' WHERE id = $lastOrderItemId + 5");
                    $this->mockPdo->exec("UPDATE food_order_item SET item_total_gross_modified = 0,     item_total_net_modified = 0,        item_total_vat_modified = 0,    item_quantity = 0, item_status = 'partial_refund', updated_at = '$fourDaysAgoAt1310' WHERE id = $lastOrderItemId + 6");
                    
                    // print the first item added to the order item table to check the id is correct
                        //$outPut = $this->mockPdo->query("SELECT min(id), item_name  FROM food_order_item WHERE order_id = $lastOrderId")->fetch(PDO::FETCH_ASSOC);
                        //$this->assertEquals($lastOrderItemId, $outPut['min(id)']);
                        //echo "Last Order Item ID: " . $lastOrderItemId . "\n";
                        //echo "First Order Item ID for the Order: " . $outPut['min(id)'] . "\n";
                        //echo "First Order Item Name for the Order: " . $outPut['item_name'] . "\n";
                    
                    
                    // update the vat summary to reflect the partial refund
                    $this->mockPdo->exec("UPDATE food_order_vat_summary SET vat_gross_modified = 73,    vat_net_modified = 61,       vat_amount_modified = 12,            updated_at = '$fourDaysAgoAt1310' WHERE id = $lastVatSummaryId");
                    $this->mockPdo->exec("UPDATE food_order_vat_summary SET vat_gross_modified = 159,   vat_net_modified = 125,     vat_amount_modified = 24,            updated_at = '$fourDaysAgoAt1310' WHERE id = $lastVatSummaryId + 1");
                    $this->mockPdo->exec("UPDATE food_order_vat_summary SET vat_gross_modified = 106,   vat_net_modified = 92,      vat_amount_modified = 14,            updated_at = '$fourDaysAgoAt1310' WHERE id = $lastVatSummaryId + 2");
                    $this->mockPdo->exec("UPDATE food_order_vat_summary SET vat_gross_modified = 11,    vat_net_modified = 11,      vat_amount_modified = 0,             updated_at = '$fourDaysAgoAt1310' WHERE id = $lastVatSummaryId + 3");


                    //items ref 
                    $it  = $lastOrderItemId - 1;
                    $it2 = $lastOrderItemId ;
                    $it3 =  $lastOrderItemId +2;
                    $it5 =  $lastOrderItemId +4;
                    $it6 =  $lastOrderItemId +5;
        
                    $this->mockPdo->exec("INSERT INTO `food_order_refund_event` (`refund_group_id`,     `order_id`,     `tenant_id`,    `refund_type`,  `order_item_id`,        `gross_pence`,  `net_pence`,    `vat_pence`,    `vat_rate`,     `note`,         `processed_at`) VALUES
                                                                                ($lastRefundGroupId,    $lastOrderId,   $tenantId,      'item',         $it,                    300,	        250,	        50,             20.00,           NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId,    $lastOrderId,   $tenantId,      'item',         $it3,                   1000,	        870,	        130,            15.00,           NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +1, $lastOrderId,   $tenantId,      'partial',      NULL,                   3,	            3,	            0,              0.00,            NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +1, $lastOrderId,   $tenantId,      'partial',      NULL,                   34,	            30,	            4,              15.00,           NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +1, $lastOrderId,   $tenantId,      'partial',      NULL,                   51,	            43,	            8,              17.50,           NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +1, $lastOrderId,   $tenantId,      'partial',      NULL,                   112,	        93,	            19,             20.00,           NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +2, $lastOrderId,   $tenantId,      'item',         $it2,                   400,	        333,	        67,             20.00,           NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +2, $lastOrderId,   $tenantId,      'item',         $it5,                   1600,	        1333,	        267,            20.00,           NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +3, $lastOrderId,   $tenantId,      'partial',      NULL,                   4,	            4,	            0,              0.00,            NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +3, $lastOrderId,   $tenantId,      'partial',      NULL,                   41,	            36,	            5,              15.00,           NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +3, $lastOrderId,   $tenantId,      'partial',      NULL,                   61,	            52,	            9,              17.50,           NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +3, $lastOrderId,   $tenantId,      'partial',      NULL,                   93,	            78,	            15,             20.00,           NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +4, $lastOrderId,   $tenantId,      'item',         $it2,                   800,	        667,	        133,            20.00,           NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +4, $lastOrderId,   $tenantId,      'item',         $it6,                   2400,	        2000,	        400,            20.00,           NULL,           '$fourDaysAgoAt1310'),  
                                                                                ($lastRefundGroupId +5, $lastOrderId,   $tenantId,      'partial',      NULL,                   12,	            12,	            0,              0.00,            NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +5, $lastOrderId,   $tenantId,      'partial',      NULL,                   121,	        105,	        16,             15.00,           NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +5, $lastOrderId,   $tenantId,      'partial',      NULL,                   182,	        155,	        27,             17.50,           NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +5, $lastOrderId,   $tenantId,      'partial',      NULL,                   85,	            71,	            14,             20.00,           NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +6, $lastOrderId,   $tenantId,      'partial',      NULL,                   177,	        177,	        0,              0.00,            NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +6, $lastOrderId,   $tenantId,      'partial',      NULL,                   1773,	        1542,	        231,            15.00,           NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +6, $lastOrderId,   $tenantId,      'partial',      NULL,                   2659,	        2263,	        396,            17.50,           NULL,           '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +6, $lastOrderId,   $tenantId,      'partial',      NULL,                   1242,	        1035,	        207,            20.00,           NULL,           '$fourDaysAgoAt1310');");


                    $this->mockPdo->exec("INSERT INTO `food_order_refund` ( `order_id`, `vat_rate`, `gross_pence`, `net_pence`, `vat_pence`, `note`, `created_at`) VALUES
                                                    ($lastOrderId, 0,	    3,	    3,	    0,      NULL,   '$fourDaysAgoAt1310'),
                                                    ($lastOrderId, 15,	    34,	    30,	    4,      NULL,   '$fourDaysAgoAt1310'),
                                                    ($lastOrderId, 17.5,	51,	    43,	    8,      NULL,   '$fourDaysAgoAt1310'),
                                                    ($lastOrderId, 20,	    112,	93,	    19,     NULL,   '$fourDaysAgoAt1310'),
                                                    ($lastOrderId, 0,	    4,	    4,	    0,      NULL,   '$fourDaysAgoAt1310'),
                                                    ($lastOrderId, 15,	    41,	    36,	    5,      NULL,   '$fourDaysAgoAt1310'),
                                                    ($lastOrderId, 17.5,	61,	    52,	    9,      NULL,   '$fourDaysAgoAt1310'),
                                                    ($lastOrderId, 20,	    93,	    78,	    15,     NULL,   '$fourDaysAgoAt1310'),
                                                    ($lastOrderId, 0,	    12,	    12,	    0,      NULL,   '$fourDaysAgoAt1310'),
                                                    ($lastOrderId, 15,	    121,	105,	16,     NULL,   '$fourDaysAgoAt1310'),
                                                    ($lastOrderId, 17.5,	182,	155,	27,     NULL,   '$fourDaysAgoAt1310'),
                                                    ($lastOrderId, 20,	    85,	    71,	    14,     NULL,   '$fourDaysAgoAt1310'),
                                                    ($lastOrderId, 0,	    177,	177,	0,      NULL,   '$fourDaysAgoAt1310'),
                                                    ($lastOrderId, 15,	    1773,	1542,	231,    NULL,   '$fourDaysAgoAt1310'),
                                                    ($lastOrderId, 17.5,	2659,	2263,	396,    NULL,   '$fourDaysAgoAt1310'),
                                                    ($lastOrderId, 20,	    1242,	1035,	207,    NULL,   '$fourDaysAgoAt1310')");
                // Another insert:
                    $lastOrderId++; // incremented to start the next insert at the correct id
                    $this->mockPdo->exec("INSERT INTO food_order    (id,                public_order_code,      user_id,                guest_user_id,          tenant_id,      delivery_address_id,    billing_address_id,     order_status,   order_type,     product_total_original_gross,  product_total_current_gross,    order_total_current_gross,      order_total_original_gross,     order_full_refund,      order_total_current_reason,                             payment_status,         delivery_fee_gross,     customer_service_fee_gross,     customer_service_fee_vat,   customer_service_fee_vat_rate,          platform_fee_gross,     platform_fee_vat,   platform_fee_vat_rate,       stripe_fee_total,       small_order_fee_gross,  small_order_fee_vat,   small_order_fee_vat_rate,           comment,    tenant_comment,     currency,   transaction_id,                 refunded_id,            payment_intent_id,              stripe_receipt_url,     created_at,                 updated_at) 
                                            VALUES              ($lastOrderId,      'C02QD57Z',             $lastUserId,            NULL,                   $tenantId,      2,                      NULL,                   'confirmed',   'collection',     2000,                          2000,                           2050,                           2050,                           000,                   'Delivery Charge Applied',                              'paid',                  0,                      050,                            1,                          20.00,                                  050,                    8,                  20.00,                       87,                    0,                       0,                     0,                                 NULL,       '',                 'GBP',      'ch_3TCdZxDRk9nZ67Cn2c0uUuj8',  '',             'pi_3TCdZxDRk9nZ67Cn2DmYfS9e',  '',                     '$fiveDaysAgoAt1300',        '$fiveDaysAgoAt1300')");
                    $orderId[] = $lastOrderId;

                    // insert an order item for that order
                    $this->mockPdo->exec("INSERT INTO `food_order_item` ( `order_id`,   `menu_item_id`,     `item_name`,    `item_base_price`,  `item_total_gross_original`,    `item_modified_reason`,     `item_quantity`,    `item_note`,    `item_status`,      `item_tenant_comment`,      `created_at`,               `updated_at`,           `item_total_net_original`,      `item_total_vat_original`,      `item_total_gross_modified`,    `item_total_net_modified`,      `item_total_vat_modified`,      `item_vat_rate`) 
                                                                VALUES  ($lastOrderId,  91,                 'Medium Cod',   1000,               2000,                           'Base price only',          2,                  NULL,           'pending',          NULL,                       '$fiveDaysAgoAt1300',      '$fiveDaysAgoAt1300',    1667,                           333,                            2000,                           1667,                           333,                            20.00)  ");
                    $lastOrderItemId ++;
                    
                    $this->mockPdo->exec("INSERT INTO food_order_vat_summary    (order_id,      vat_rate,   vat_gross_original,     vat_net_original,   vat_amount_original,    vat_gross_modified,     vat_net_modified,   vat_amount_modified,        created_at,             updated_at) 
                                                                VALUES          ($lastOrderId,  20.00,      2000,                   1667,               333,                    2000,                   1667,               333,                        '$fiveDaysAgoAt1300',   '$fiveDaysAgoAt1300')");
                    $lastVatSummaryId++;
                    // update the order to have a partial refund to test the impact of refunds on the reporting state
                    $this->mockPdo->exec("UPDATE food_order SET product_total_current_gross = 1000, order_total_current_gross = 1050, payment_status = 'partial_refund', updated_at = '$fourDaysAgoAt1310' WHERE id = $lastOrderId");
                    // update the order item to have a partial refund to test the impact of refunds on the reporting state
                    $this->mockPdo->exec("UPDATE food_order_item SET item_total_gross_modified = 1000, item_total_net_modified = 833, item_total_vat_modified = 167, item_status = 'partial_refund', updated_at = '$fourDaysAgoAt1310' WHERE id = $lastOrderItemId");
                    // update the vat summary to reflect the partial refund
                    $this->mockPdo->exec("UPDATE food_order_vat_summary SET vat_gross_modified = 1000, vat_net_modified = 833, vat_amount_modified = 167, updated_at = '$fourDaysAgoAt1310' WHERE id = $lastVatSummaryId");
                    // insert a refund event for the partial refund
                    $this->mockPdo->exec("INSERT INTO food_order_refund_event ( refund_group_id,    order_id,        tenant_id,     refund_type,    order_item_id,      gross_pence,    net_pence,      vat_pence,  vat_rate,   note,                               processed_at) 
                                                                        VALUES (2,                  $lastOrderId,   $tenantId,      'item',         $lastOrderItemId,   1000,           833,            167,        20.00,      'Partial refund for order item',    '$fourDaysAgoAt1310')");
                    $lastRefundEventId++;
                // Another insert:
                    
                    $lastOrderId++; // incremented to start the next insert at the correct id
                    // insert and order with an item that is fully charged
                    $this->mockPdo->exec("INSERT INTO food_order    (id,                public_order_code,      user_id,                guest_user_id,          tenant_id,      delivery_address_id,    billing_address_id,     order_status,   order_type,     product_total_original_gross,  product_total_current_gross,    order_total_current_gross,      order_total_original_gross,     order_full_refund,      order_total_current_reason,                             payment_status,         delivery_fee_gross,      delivery_fee_vat,   delivery_fee_vat_rate,     customer_service_fee_gross,     customer_service_fee_vat,   customer_service_fee_vat_rate,          platform_fee_gross,     platform_fee_vat,   platform_fee_vat_rate,       stripe_fee_total,       small_order_fee_gross,  small_order_fee_vat,   small_order_fee_vat_rate,          comment,    tenant_comment,     currency,   transaction_id,                   refunded_id,        payment_intent_id,                  stripe_receipt_url,     created_at,                     updated_at) 
                                                VALUES              ($lastOrderId,      'C02QD5M6',             $lastUserId,            NULL,                   $tenantId,      2,                      NULL,                   'confirmed',   'collection',    2250,                          2250,                           2300,                           2300,                           000,                   'Delivery Charge Applied',                              'paid',                  0,                       0,                  0.00,                      050,                            1,                          20.00,                                  050,                    8,                  20.00,                       95,                     0,                      0,                     0,                                 NULL,       '',                 'GBP',      'ch_3TCdZxDRk9nZ67Cn2c0uUuj8',    '',                 'pi_3TCdZxDRk9nZ67Cn2DmYfS9e',      '',                     '$fiveDaysAgoAt1300',           '$fiveDaysAgoAt1300')");  

                    $order[$lastOrderId]['orderId'] = $lastOrderId;
                    
                    // insert an order item for that order
                    $this->mockPdo->exec("INSERT INTO `food_order_item` ( `order_id`,   `menu_item_id`,     `item_name`,                        `item_base_price`,      `item_total_gross_original`,    `item_modified_reason`,                     `item_quantity`,    `item_note`,    `item_status`,      `item_tenant_comment`,      `created_at`,               `updated_at`,           `item_total_net_original`,      `item_total_vat_original`,      `item_total_gross_modified`,        `item_total_net_modified`,      `item_total_vat_modified`,      `item_vat_rate`) 
                                                                VALUES  ($lastOrderId,  11,                 'Cheese &amp; Onion Pasty',         400,                    800,                            'Includes extras: Ketchup (£0.10)',          2,                  NULL,           'pending',          NULL,                       '$fiveDaysAgoAt1300',      '$fiveDaysAgoAt1300',    667,                           133,                            800,                                667,                            133,                            20.00),
                                                                        ($lastOrderId,  238,                '1pc Chicken',                      200,                    400,                            'Base price only',                           2,                  NULL,           'pending',          NULL,                       '$fiveDaysAgoAt1300',      '$fiveDaysAgoAt1300',    333,                           67,                             400,                                333,                            67,                             20.00),
                                                                        ($lastOrderId,  250,                'vat 0',                            50,                     50,                             'Base price only',                           1,                  NULL,           'pending',          NULL,                       '$fiveDaysAgoAt1300',      '$fiveDaysAgoAt1300',    50,                            0,                              50,                                 50,                             0,                              0.00),  
                                                                        ($lastOrderId,  248,                'vat 0',                            1000,                   1000,                           'Base price only',                           1,                  NULL,           'pending',          NULL,                       '$fiveDaysAgoAt1300',      '$fiveDaysAgoAt1300',    851,                           149,                            1000,                               851,                            149,                            17.5)");
                    $lastOrderItemId ++; // incremented to match the id of the inserted order item for the last insert
                    $item1Id = $lastOrderItemId;
                    $order[$lastOrderId]['itemId'][] = $lastOrderItemId;
                    $lastOrderItemId ++; // incremented to match the id of the inserted order item for the last insert
                    $item2Id = $lastOrderItemId;
                    $order[$lastOrderId]['itemId'][] = $lastOrderItemId;

                    $lastOrderItemId ++; // incremented to match the id of the inserted order item for the last insert
                    $item3Id = $lastOrderItemId;
                    $order[$lastOrderId]['itemId'][] = $lastOrderItemId;
                    // insert a vat summary for that order
                    $this->mockPdo->exec("INSERT INTO food_order_vat_summary    (order_id,      vat_rate,   vat_gross_original,     vat_net_original,   vat_amount_original,    vat_gross_modified,     vat_net_modified,   vat_amount_modified,        created_at,             updated_at) 
                                                                VALUES          ($lastOrderId,  20.00,      1200,                   1000,               200,                     1200,                  1000,               200,                        '$fiveDaysAgoAt1300',   '$fiveDaysAgoAt1300'),
                                                                                ($lastOrderId,  17.50,      1000,                   851,                149,                     1000,                  851,                149,                        '$fiveDaysAgoAt1300',   '$fiveDaysAgoAt1300'),
                                                                                ($lastOrderId,  0.00,       50,                     50,                 0,                       50,                    50,                 0,                          '$fiveDaysAgoAt1300',   '$fiveDaysAgoAt1300')");
                    $lastVatSummaryId++; // incremented to match the id of the inserted vat summary for the last insert
                    $vatSummery1Id = $lastVatSummaryId;
                    $order[$lastOrderId]['vatSummaryId'] = $lastVatSummaryId;
                    $lastVatSummaryId++; // incremented to match the id of the inserted vat summary for the last insert
                    $vatSummery2Id = $lastVatSummaryId;
                    $order[$lastOrderId]['vatSummaryId'] = $lastVatSummaryId;
                    $lastVatSummaryId++; // incremented to match the id of the inserted vat summary for the last insert
                    $vatSummery3Id = $lastVatSummaryId;
                    $order[$lastOrderId]['vatSummaryId'] = $lastVatSummaryId;
                    // update the order to have a partial refund to test the impact of refunds on the reporting state
                    $this->mockPdo->exec("UPDATE food_order SET product_total_current_gross = 1800, order_total_current_gross = 1850, payment_status = 'partial_refund', updated_at = '$fourDaysAgoAt1310' WHERE id = $lastOrderId");
                    
                    // update the vat summary to reflect the partial refund
                    $this->mockPdo->exec("UPDATE food_order_vat_summary SET vat_gross_modified = 959,   vat_net_modified = 799,     vat_amount_modified = 160,          updated_at = '$fourDaysAgoAt1310' WHERE id = $vatSummery1Id");
                    $this->mockPdo->exec("UPDATE food_order_vat_summary SET vat_gross_modified = 800,   vat_net_modified = 681,     vat_amount_modified = 119,          updated_at = '$fourDaysAgoAt1310' WHERE id = $vatSummery2Id");
                    $this->mockPdo->exec("UPDATE food_order_vat_summary SET vat_gross_modified = 41,    vat_net_modified = 41,      vat_amount_modified = 0,            updated_at = '$fourDaysAgoAt1310' WHERE id = $vatSummery3Id");
        
                    $this->mockPdo->exec("INSERT INTO `food_order_refund_event` (`refund_group_id`,     `order_id`, `tenant_id`, `refund_type`, `order_item_id`, `gross_pence`, `net_pence`, `vat_pence`, `vat_rate`, `note`, `processed_at`) VALUES
                                                                                ($lastRefundGroupId,    $lastOrderId, $tenantId, 'partial', NULL, 2, 2, 0, 0.00, NULL,       '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId,    $lastOrderId, $tenantId, 'partial', NULL, 44, 37, 7, 17.50, NULL,    '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId,    $lastOrderId, $tenantId, 'partial', NULL, 54, 45, 9, 20.00, NULL,    '$fourDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +1, $lastOrderId, $tenantId, 'partial', NULL, 4, 4, 0, 0.00, NULL,       '$threeDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +1, $lastOrderId, $tenantId, 'partial', NULL, 89, 76, 13, 17.50, NULL,   '$threeDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +1, $lastOrderId, $tenantId, 'partial', NULL, 107, 89, 18, 20.00, NULL,  '$threeDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +2, $lastOrderId, $tenantId, 'partial', NULL, 3, 3, 0, 0.00, NULL,       '$twoDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +2, $lastOrderId, $tenantId, 'partial', NULL, 67, 57, 10, 17.50, NULL,   '$twoDaysAgoAt1310'),
                                                                                ($lastRefundGroupId +2, $lastOrderId, $tenantId, 'partial', NULL, 80, 67, 13, 20.00, NULL,   '$twoDaysAgoAt1310')");
                    
                    $this->mockPdo->exec("INSERT INTO `food_order_refund` ( `order_id`, `vat_rate`, `gross_pence`, `net_pence`, `vat_pence`, `note`, `created_at`) VALUES
                                                    ($lastOrderId, 0.00, 2, 2, 0,       NULL, '$fourDaysAgoAt1310'),
                                                    ($lastOrderId, 17.50, 44, 37, 7,    NULL, '$fourDaysAgoAt1310'),
                                                    ($lastOrderId, 20.00, 54, 45, 9,    NULL, '$fourDaysAgoAt1310'),
                                                    ($lastOrderId, 0.00, 4, 4, 0,       NULL, '$threeDaysAgoAt1310'),
                                                    ($lastOrderId, 17.50, 89, 76, 13,   NULL, '$threeDaysAgoAt1310'),
                                                    ($lastOrderId, 20.00, 107, 89, 18,  NULL, '$threeDaysAgoAt1310'),
                                                    ($lastOrderId, 0.00, 3, 3, 0,       NULL, '$twoDaysAgoAt1310'),
                                                    ($lastOrderId, 17.50, 67, 57, 10,   NULL, '$twoDaysAgoAt1310'),
                                                    ($lastOrderId, 20.00, 80, 67, 13,   NULL, '$twoDaysAgoAt1310')");
                // Another insert
                    $lastOrderId++;
                    $this->mockPdo->exec("INSERT INTO food_order    (id,            public_order_code,  user_id,             guest_user_id,  tenant_id,  delivery_address_id,    billing_address_id,     order_status,   order_type,     product_total_original_gross,  product_total_current_gross,    order_total_current_gross,      order_total_original_gross,     order_full_refund,      order_total_current_reason,                             payment_status,         delivery_fee_gross,     customer_service_fee_gross,         platform_fee_gross,       stripe_fee_total,   small_order_fee_gross,    comment,    tenant_comment,     currency,   transaction_id,                 refunded_id,    payment_intent_id,              stripe_receipt_url,     created_at,                 updated_at) 
                                                        VALUES      ($lastOrderId,  'C02Q357Z',         $lastUserId,         NULL,           $tenantId,    2,                      NULL,                   'confirmed',    'delivery',     1540,                          1540,                           1790,                           1790,                           000,                   'Delivery Charge Applied',                              'paid',                  200,                    050,                                050,                      062,                250,                     NULL,       '',                 'GBP',      'ch_3TCdZxDRk9nZ67Cn2c0uUuj8',  '',             'pi_3TCdZxDRk9nZ67Cn2DmYfS9e',  '',                     '$fourDaysAgoAt1300', '$fourDaysAgoAt1300')");

                    $lastOrderId++;

                    $this->mockPdo->exec("INSERT INTO food_order    (id,            public_order_code,  user_id,             guest_user_id,  tenant_id,  delivery_address_id,    billing_address_id,     order_status,   order_type,     product_total_original_gross,  product_total_current_gross,    order_total_current_gross,      order_total_original_gross,     order_full_refund,      order_total_current_reason,                             payment_status,         delivery_fee_gross,     customer_service_fee_gross,         platform_fee_gross,       stripe_fee_total,   small_order_fee_gross,    comment,    tenant_comment,     currency,   transaction_id,                 refunded_id,    payment_intent_id,              stripe_receipt_url,     created_at,                 updated_at) 
                                                        VALUES      ($lastOrderId,  'C02QG57Z',         $lastUserId,         NULL,           $tenantId,    2,                      NULL,                   'confirmed',    'delivery',     1540,                          1540,                           0000,                           1790,                           1790,                   'Delivery Charge Applied',                              'refunded',             200,                    050,                                050,                      062,                250,                     NULL,       '',                 'GBP',      'ch_3TCdZxDRk9nZ67Cn2c0uUuj8',  '',             'pi_3TCdZxDRk9nZ67Cn2DmYfS9e',  '',                     '$threeDaysAgoAt1300', '$threeDaysAgoAt1300')");
                    $lastOrderId++;  
Results:

(
    [0] => Array
        (
            [id] => 84
            [run_id] => 1
            [run_type] => Automatic
            [tenant_id] => 24
            [window_start] => 2026-04-14 00:00:00
            [window_end] => 2026-04-15 00:00:00
            [business_date] => 2026-04-14
            [order_count] => 3
            [full_refund_count] => 0
            [partial_or_item_refund_order_count] => 0
            [full_refund_total] => 0
            [customer_paid_total] => 17500
            [item_refund_total] => 0
            [partial_refund_total] => 0
            [platform_stripe_fees_net] => 629
            [platform_fees_net] => 150
            [platform_customer_service_fee_net] => 150
            [platform_tenant_fee_gross] => 150
            [platform_customer_service_fee_gross] => 150
            [platform_gross_revenue] => 300
            [platform_refunds] => 0
            [platform_net_revenue] => 300
            [platform_refund_impact] => 0
            [platform_net_impact] => 300
            [platform_sales_vat] => 0
            [platform_refund_vat] => 0
            [platform_net_vat] => 0
            [created_at] => 2026-04-19 01:13:49
            [updated_at] => 2026-04-19 01:13:49
        )

    [1] => Array
        (
            [id] => 85
            [run_id] => 2
            [run_type] => Automatic
            [tenant_id] => 24
            [window_start] => 2026-04-15 00:00:00
            [window_end] => 2026-04-16 00:00:00
            [business_date] => 2026-04-15
            [order_count] => 1
            [full_refund_count] => 0
            [partial_or_item_refund_order_count] => 3
            [full_refund_total] => 0
            [customer_paid_total] => 1790
            [item_refund_total] => 7500
            [partial_refund_total] => 6750
            [platform_stripe_fees_net] => 62
            [platform_fees_net] => 50
            [platform_customer_service_fee_net] => 50
            [platform_tenant_fee_gross] => 50
            [platform_customer_service_fee_gross] => 50
            [platform_gross_revenue] => 100
            [platform_refunds] => 0
            [platform_net_revenue] => 100
            [platform_refund_impact] => 0
            [platform_net_impact] => 100
            [platform_sales_vat] => 0
            [platform_refund_vat] => 0
            [platform_net_vat] => 0
            [created_at] => 2026-04-19 01:13:49
            [updated_at] => 2026-04-19 01:13:49
        )

    [2] => Array
        (
            [id] => 86
            [run_id] => 3
            [run_type] => Automatic
            [tenant_id] => 24
            [window_start] => 2026-04-16 00:00:00
            [window_end] => 2026-04-17 00:00:00
            [business_date] => 2026-04-16
            [order_count] => 1
            [full_refund_count] => 0
            [partial_or_item_refund_order_count] => 1
            [full_refund_total] => 0
            [customer_paid_total] => 1790
            [item_refund_total] => 0
            [partial_refund_total] => 200
            [platform_stripe_fees_net] => 62
            [platform_fees_net] => 50
            [platform_customer_service_fee_net] => 50
            [platform_tenant_fee_gross] => 50
            [platform_customer_service_fee_gross] => 50
            [platform_gross_revenue] => 100
            [platform_refunds] => 0
            [platform_net_revenue] => 100
            [platform_refund_impact] => 0
            [platform_net_impact] => 100
            [platform_sales_vat] => 0
            [platform_refund_vat] => 0
            [platform_net_vat] => 0
            [created_at] => 2026-04-19 01:13:49
            [updated_at] => 2026-04-19 01:13:49
        )

    [3] => Array
        (
            [id] => 87
            [run_id] => 4
            [run_type] => Automatic
            [tenant_id] => 24
            [window_start] => 2026-04-17 00:00:00
            [window_end] => 2026-04-18 00:00:00
            [business_date] => 2026-04-17
            [order_count] => 0
            [full_refund_count] => 0
            [partial_or_item_refund_order_count] => 1
            [full_refund_total] => 0
            [customer_paid_total] => 0
            [item_refund_total] => 0
            [partial_refund_total] => 150
            [platform_stripe_fees_net] => 0
            [platform_fees_net] => 0
            [platform_customer_service_fee_net] => 0
            [platform_tenant_fee_gross] => 0
            [platform_customer_service_fee_gross] => 0
            [platform_gross_revenue] => 0
            [platform_refunds] => 0
            [platform_net_revenue] => 0
            [platform_refund_impact] => 0
            [platform_net_impact] => 0
            [platform_sales_vat] => 0
            [platform_refund_vat] => 0
            [platform_net_vat] => 0
            [created_at] => 2026-04-19 01:13:49
            [updated_at] => 2026-04-19 01:13:49
        )

    [4] => Array
        (
            [id] => 88
            [run_id] => 5
            [run_type] => Automatic
            [tenant_id] => 24
            [window_start] => 2026-04-18 00:00:00
            [window_end] => 2026-04-19 00:00:00
            [business_date] => 2026-04-18
            [order_count] => 0
            [full_refund_count] => 0
            [partial_or_item_refund_order_count] => 0
            [full_refund_total] => 0
            [customer_paid_total] => 0
            [item_refund_total] => 0
            [partial_refund_total] => 0
            [platform_stripe_fees_net] => 0
            [platform_fees_net] => 0
            [platform_customer_service_fee_net] => 0
            [platform_tenant_fee_gross] => 0
            [platform_customer_service_fee_gross] => 0
            [platform_gross_revenue] => 0
            [platform_refunds] => 0
            [platform_net_revenue] => 0
            [platform_refund_impact] => 0
            [platform_net_impact] => 0
            [platform_sales_vat] => 0
            [platform_refund_vat] => 0
            [platform_net_vat] => 0
            [created_at] => 2026-04-19 01:13:49
            [updated_at] => 2026-04-19 01:13:49
        )

)

Reporting State Tenant after EOD run: Array
(
    [0] => Array
        (
            [id] => 84
            [run_id] => 1
            [run_type] => Automatic
            [tenant_id] => 24
            [window_start] => 2026-04-14 00:00:00
            [window_end] => 2026-04-15 00:00:00
            [business_date] => 2026-04-14
            [order_count] => 3
            [full_refund_count] => 0
            [partial_or_item_refund_order_count] => 0
            [customer_paid_total] => 17500
            [item_refund_total] => 0
            [partial_refund_total] => 0
            [tenant_gross_sales] => 17350
            [tenant_full_refund_total] => 0
            [tenant_total_refunds] => 0
            [tenant_refund_total] => 0
            [tenant_delivery_fees_net] => 0
            [tenant_small_order_fees_net] => 0
            [tenant_platform_fees_net] => 150
            [tenant_stripe_fees_net] => 629
            [tenant_net_pre_fee] => 17350
            [tenant_net_post_platform_fee] => 17200
            [tenant_net] => 16571
            [tenant_refund_impact] => 0
            [tenant_stripe_fee_impact] => -629
            [tenant_uncovered_stripe_refund_impact] => 0
            [tenant_net_impact_pre_fee] => 17350
            [tenant_net_impact_post_platform_fee] => 17200
            [tenant_net_impact] => 16571
            [tenant_sales_vat_gross] => 17350
            [tenant_sales_vat_net] => 14680
            [tenant_sales_vat] => 2670
            [tenant_refund_vat_gross] => 0
            [tenant_refund_vat_net] => 0
            [tenant_refund_vat] => 0
            [tenant_net_vat_gross] => 17350
            [tenant_net_vat_net] => 14680
            [tenant_net_vat] => 2670
            [created_at] => 2026-04-19 01:13:49
            [updated_at] => 2026-04-19 01:13:49
        )

    [1] => Array
        (
            [id] => 85
            [run_id] => 2
            [run_type] => Automatic
            [tenant_id] => 24
            [window_start] => 2026-04-15 00:00:00
            [window_end] => 2026-04-16 00:00:00
            [business_date] => 2026-04-15
            [order_count] => 1
            [full_refund_count] => 0
            [partial_or_item_refund_order_count] => 3
            [customer_paid_total] => 1790
            [item_refund_total] => 7500
            [partial_refund_total] => 6750
            [tenant_gross_sales] => 1740
            [tenant_full_refund_total] => 0
            [tenant_total_refunds] => 14250
            [tenant_refund_total] => 14250
            [tenant_delivery_fees_net] => 200
            [tenant_small_order_fees_net] => 250
            [tenant_platform_fees_net] => 50
            [tenant_stripe_fees_net] => 62
            [tenant_net_pre_fee] => 0
            [tenant_net_post_platform_fee] => 0
            [tenant_net] => 0
            [tenant_refund_impact] => -14250
            [tenant_stripe_fee_impact] => -62
            [tenant_uncovered_stripe_refund_impact] => -447
            [tenant_net_impact_pre_fee] => -12510
            [tenant_net_impact_post_platform_fee] => -12560
            [tenant_net_impact] => -12622
            [tenant_sales_vat_gross] => 0
            [tenant_sales_vat_net] => 0
            [tenant_sales_vat] => 0
            [tenant_refund_vat_gross] => 14250
            [tenant_refund_vat_net] => 12069
            [tenant_refund_vat] => 2181
            [tenant_net_vat_gross] => -14250
            [tenant_net_vat_net] => -12069
            [tenant_net_vat] => -2181
            [created_at] => 2026-04-19 01:13:49
            [updated_at] => 2026-04-19 01:13:49
        )

    [2] => Array
        (
            [id] => 86
            [run_id] => 3
            [run_type] => Automatic
            [tenant_id] => 24
            [window_start] => 2026-04-16 00:00:00
            [window_end] => 2026-04-17 00:00:00
            [business_date] => 2026-04-16
            [order_count] => 1
            [full_refund_count] => 0
            [partial_or_item_refund_order_count] => 1
            [customer_paid_total] => 1790
            [item_refund_total] => 0
            [partial_refund_total] => 200
            [tenant_gross_sales] => 1740
            [tenant_full_refund_total] => 0
            [tenant_total_refunds] => 200
            [tenant_refund_total] => 200
            [tenant_delivery_fees_net] => 200
            [tenant_small_order_fees_net] => 250
            [tenant_platform_fees_net] => 50
            [tenant_stripe_fees_net] => 62
            [tenant_net_pre_fee] => 1540
            [tenant_net_post_platform_fee] => 1490
            [tenant_net] => 1428
            [tenant_refund_impact] => -200
            [tenant_stripe_fee_impact] => -62
            [tenant_uncovered_stripe_refund_impact] => 0
            [tenant_net_impact_pre_fee] => 1540
            [tenant_net_impact_post_platform_fee] => 1490
            [tenant_net_impact] => 1428
            [tenant_sales_vat_gross] => 0
            [tenant_sales_vat_net] => 0
            [tenant_sales_vat] => 0
            [tenant_refund_vat_gross] => 200
            [tenant_refund_vat_net] => 169
            [tenant_refund_vat] => 31
            [tenant_net_vat_gross] => -200
            [tenant_net_vat_net] => -169
            [tenant_net_vat] => -31
            [created_at] => 2026-04-19 01:13:49
            [updated_at] => 2026-04-19 01:13:49
        )

    [3] => Array
        (
            [id] => 87
            [run_id] => 4
            [run_type] => Automatic
            [tenant_id] => 24
            [window_start] => 2026-04-17 00:00:00
            [window_end] => 2026-04-18 00:00:00
            [business_date] => 2026-04-17
            [order_count] => 0
            [full_refund_count] => 0
            [partial_or_item_refund_order_count] => 1
            [customer_paid_total] => 0
            [item_refund_total] => 0
            [partial_refund_total] => 150
            [tenant_gross_sales] => 0
            [tenant_full_refund_total] => 0
            [tenant_total_refunds] => 150
            [tenant_refund_total] => 150
            [tenant_delivery_fees_net] => 0
            [tenant_small_order_fees_net] => 0
            [tenant_platform_fees_net] => 0
            [tenant_stripe_fees_net] => 0
            [tenant_net_pre_fee] => 0
            [tenant_net_post_platform_fee] => 0
            [tenant_net] => 0
            [tenant_refund_impact] => -150
            [tenant_stripe_fee_impact] => 0
            [tenant_uncovered_stripe_refund_impact] => 0
            [tenant_net_impact_pre_fee] => -150
            [tenant_net_impact_post_platform_fee] => -150
            [tenant_net_impact] => -150
            [tenant_sales_vat_gross] => 0
            [tenant_sales_vat_net] => 0
            [tenant_sales_vat] => 0
            [tenant_refund_vat_gross] => 150
            [tenant_refund_vat_net] => 127
            [tenant_refund_vat] => 23
            [tenant_net_vat_gross] => -150
            [tenant_net_vat_net] => -127
            [tenant_net_vat] => -23
            [created_at] => 2026-04-19 01:13:49
            [updated_at] => 2026-04-19 01:13:49
        )

    [4] => Array
        (
            [id] => 88
            [run_id] => 5
            [run_type] => Automatic
            [tenant_id] => 24
            [window_start] => 2026-04-18 00:00:00
            [window_end] => 2026-04-19 00:00:00
            [business_date] => 2026-04-18
            [order_count] => 0
            [full_refund_count] => 0
            [partial_or_item_refund_order_count] => 0
            [customer_paid_total] => 0
            [item_refund_total] => 0
            [partial_refund_total] => 0
            [tenant_gross_sales] => 0
            [tenant_full_refund_total] => 0
            [tenant_total_refunds] => 0
            [tenant_refund_total] => 0
            [tenant_delivery_fees_net] => 0
            [tenant_small_order_fees_net] => 0
            [tenant_platform_fees_net] => 0
            [tenant_stripe_fees_net] => 0
            [tenant_net_pre_fee] => 0
            [tenant_net_post_platform_fee] => 0
            [tenant_net] => 0
            [tenant_refund_impact] => 0
            [tenant_stripe_fee_impact] => 0
            [tenant_uncovered_stripe_refund_impact] => 0
            [tenant_net_impact_pre_fee] => 0
            [tenant_net_impact_post_platform_fee] => 0
            [tenant_net_impact] => 0
            [tenant_sales_vat_gross] => 0
            [tenant_sales_vat_net] => 0
            [tenant_sales_vat] => 0
            [tenant_refund_vat_gross] => 0
            [tenant_refund_vat_net] => 0
            [tenant_refund_vat] => 0
            [tenant_net_vat_gross] => 0
            [tenant_net_vat_net] => 0
            [tenant_net_vat] => 0
            [created_at] => 2026-04-19 01:13:49
            [updated_at] => 2026-04-19 01:13:49
        )

)