Page MenuHomePhorge

D4653.1774876292.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D4653.1774876292.diff

diff --git a/src/app/Console/Commands/Data/Reports/VatCommand.php b/src/app/Console/Commands/Data/Reports/VatCommand.php
--- a/src/app/Console/Commands/Data/Reports/VatCommand.php
+++ b/src/app/Console/Commands/Data/Reports/VatCommand.php
@@ -2,6 +2,7 @@
namespace App\Console\Commands\Data\Reports;
+use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Mail\Mailables\Attachment;
use Illuminate\Support\Facades\DB;
@@ -31,6 +32,10 @@
{
$recipient = $this->argument('email');
+ // Note: Constructor takes care of date, but startOfDay()/endOfDay() takes care of time
+ $start = (new Carbon('first day of last month'))->startOfDay();
+ $end = (new Carbon('last day of last month'))->endOfDay();
+
$result = DB::select(
<<<SQL
SELECT
@@ -51,8 +56,11 @@
WHERE
p.status = 'paid'
AND us.`key` = 'country'
+ AND p.created_at >= ?
+ AND p.created_at <= ?
ORDER BY timestamp, country
- SQL
+ SQL,
+ [$start->toDateTimeString(), $end->toDateTimeString()]
);
$fp = fopen('php://memory', 'w');

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 30, 1:11 PM (2 d, 10 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18809715
Default Alt Text
D4653.1774876292.diff (1 KB)

Event Timeline