<?php

use App\Domains\Stats\Services\OrderService;
use App\Domains\Export\Services\ExportService;
use App\Domains\Stats\Services\RenewalService;
use App\Domains\Virtual\Services\PropertyService;
use App\Domains\Stats\Exports\CompanyReportDetailExport;

require_once realpath(dirname(__FILE__) . '/TestCase.php');

dd(array_filter(["", 1]));

// $sql = <<< EOF
// select
// 	"sim" ,
// 	"company_id",
// 	"package_id",
// 	"type",
// 	case
// 		"type"
// 		when 3 then sum(counts)
// 		else count(*)
// 	end as counts ,
// 	"unit_price"
// from
// 	"virtual_order_cards_partition"
// where
// 	("type" in (0)
// 	and "company_id" in (23)
// 	and "package_id" in (98)
// 	and "unit_price" = 14400
// 	and ("service_start_at" <= '2019-10-31 23:59:59'
// 	and "service_end_at" >= '2019-10-01 00:00:00'))
// 	and "virtual_order_cards_partition"."deleted_at" is null
// 	and "refunded_at" is null
// group by
// 	"company_id" ,
// 	"package_id",
// 	"type",
// 	"unit_price" ,
// 	"sim"
// order by
// 	"sim" asc
// limit 100000
// EOF;


// $res = DB::select($sql);

// dd($res);

$conditions = [
    'type' => [0],
    'company_id' => [23],
    'package_id' => [98],
    'unit_price' => 14400,
    'month' => '2019-10'
];

$export = new CompanyReportDetailExport($conditions);

$url = ExportService::store($export, "public", false);
