test mining taxes

This commit is contained in:
2021-05-24 19:53:53 +09:00
parent 565f51e81c
commit 8d5ba9c42e
3 changed files with 83 additions and 0 deletions

View File

@@ -2,11 +2,23 @@
namespace App\Http\Controllers\Test; namespace App\Http\Controllers\Test;
//Internal Library
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Log;
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
//Application Library
use App\Library\Helpers\LookupHelper; use App\Library\Helpers\LookupHelper;
//Models
use App\Models\MiningTax\Invoice;
use App\Models\MiningTax\Ledger;
use App\Models\User\UserAlt;
use App\Models\User\User;
class TestController extends Controller class TestController extends Controller
{ {
public function displayCharTest() { public function displayCharTest() {
@@ -23,6 +35,72 @@ class TestController extends Controller
} }
public function DebugMiningTaxesInvoices() {
$lookup = new LookupHelper;
$ledgers = new Collection;
//Get all of the users in the database
$users = User::all();
//Get a list of the alts for each character, then process the ledgers and combine them to send one mail out
//in this first part
foreach($users as $char) {
$alts = $char->userAlts();
$mainLedgers = Ledger::where([
'character_id' => $char->character_id,
'invoiced' => 'No',
])->get();
if(Ledger::where([
'character_id' => $char->character_id,
])->count() > 0) {
foreach($mainLedgers as $row) {
$ledgers->push([
'main_id' => $row->character_id,
'character_id' => $row->character_id,
'character_name' => $row->character_name,
'observer_id' => $row->observer_id,
'last_updated' => $row->last_updated,
'type_id' => $row->type_id,
'ore_name' => $row->ore_name,
'quantity' => $row->quantity,
'amount' => $row->amount,
'invoiced' => $row->invoiced,
'invoice_id' => $row->invoice_id,
])
}
}
foreach($alts as $alt) {
if($alt->character_id != $char->character_id) {
$ledgerRows = Ledger::where([
'character_id' => $alt->character_id,
'invoiced' => 'No',
])->get();
if($ledgerRows->count() > 0) {
$ledgers->push([
'main_id' => $char->character_id,
'character_id' => $alt->character_id,
'observer_id' => $row->observer_id,
'last_updated' => $row->last_updated,
'type_id' => $row->type_id,
'ore_name' => $row->ore_name,
'quantity' => $row->quantity,
'amount' => $row->amount,
'invoiced' => $row->invoiced,
'invoice_id' => $row->invoice_id,
])
}
}
}
}
return view('test.miningtax.invoice')->with('ledgers', $ledgers);
}
public function DebugMiningTaxes($invoiceId) { public function DebugMiningTaxes($invoiceId) {
$invoice = array(); $invoice = array();
$ores = array(); $ores = array();

View File

@@ -0,0 +1,4 @@
@extends('layouts.user.dashb4');
@section('content')
{{ var_dump($ledgers) }}
@endsection

View File

@@ -148,6 +148,7 @@ Route::group(['middleware' => ['auth']], function(){
* Test Controller display pages * Test Controller display pages
*/ */
Route::get('/test/char/display', 'Test\TestController@displayCharTest'); Route::get('/test/char/display', 'Test\TestController@displayCharTest');
Route::get('/test/miningtax/invoice', 'Test\TestController@DebugMiningTaxesInvoices');
}); });