created simplified mining tax invoice

This commit is contained in:
2021-05-25 00:45:07 +09:00
parent 63a06e78e1
commit 9a797a159d
2 changed files with 9 additions and 12 deletions

View File

@@ -148,8 +148,8 @@ class TestController extends Controller
}
}
}
dd($ledgers->count());
var_dump($ledgers);
}
}
}

View File

@@ -73,22 +73,19 @@ class SendMiningTaxesInvoicesOld implements ShouldQueue
foreach($mains as $main) {
//Declare some variables for each run through the for loop
$ledgers = new Collection;
$mainLedgers = new Collection;
$mainLedgerCount = 0;
$altLedgers = new Collection;
$alts = new Collection;
//Count the ledgers for the main
$mainLedgerCount = Ledger::where([
'character_id' => $main->character_id,
])->count();
'invoiced' => 'No',
])->where('last_updated', '>', Carbon::now()->subDays(7))->count();
//If there are ledgers for the main, then let's grab them
if($mainLedgerCount > 0) {
$mainLedgers = Ledger::where([
'character_id' => $main->character_id,
'invoiced' => 'No',
])->get();
])->where('last_updated', '>', Carbon::now()->subDays(7))->get();
//Cycle through the entries, and add them to the ledger to send with the invoice
foreach($mainLedgers as $row) {
@@ -114,15 +111,15 @@ class SendMiningTaxesInvoicesOld implements ShouldQueue
//Cycle through the alts, and get the ledgers, and push onto the stack
foreach($alts as $alt) {
$altLedgerCount = Ledger::where([
'character_id' => 'No',
'character_id' => $alt->character_id,
'invoiced' => 'No',
])->count();
])->where('last_updated', '>', Carbon::now()->subDays(7))->count();
if($altLedgerCount > 0) {
$altLedgers = Ledger::where([
'character_id' => 'No',
'character_id' => $alt->character_id,
'invoiced' => 'No',
])->get();
])->where('last_updated', '>', Carbon::now()->subDays(7))->get();
foreach($altLedgers as $row) {
$ledgers->push([