diff --git a/app/Http/Controllers/MiningTaxes/MiningTaxesController.php b/app/Http/Controllers/MiningTaxes/MiningTaxesController.php index 67d5a2815..ec08c794c 100644 --- a/app/Http/Controllers/MiningTaxes/MiningTaxesController.php +++ b/app/Http/Controllers/MiningTaxes/MiningTaxesController.php @@ -344,16 +344,26 @@ class MiningTaxesController extends Controller */ public function displayInvoice($invoiceId) { $ores = array(); + $moons = array(); $totalPrice = 0.00; + $structure = new StructureHelper; + $config = config('esi'); + $systems = AllianceMoon::where([ + 'rented' => 'No', + ])->pluck('system_name')->unique()->toArray(); + + //Get the invoice from the database $invoice = Invoice::where([ 'invoice_id' => $invoiceId, ])->first(); + //Get the line items for the ledger for the invoice $items = Ledger::where([ 'invoice_id' => $invoiceId, ])->get(); + //Build the total ores table for the display page foreach($items as $item) { if(!isset($ores[$item['ore_name']])) { $ores[$item['ore_name']] = 0; @@ -363,7 +373,25 @@ class MiningTaxesController extends Controller $totalPrice += $item['amount']; } + //Print out the lines of the ledger line by line for another table + foreach($items as $item) { + //Get the structure info from the database or esi + $tempObserverInfo = $structure->GetStructureInfo($item['observer_id']); + + //Create the array for the line by line + array_push($moons, [ + 'character_name' => $item['character_name'], + 'observer_name' => $tempObserverInfo->name, + 'type_id' => $item['type_id'], + 'ore_name' => $item['ore_name'], + 'quantity' => $item['quantity'], + 'amount' => $item['amount'], + 'tax_amount' => $item['amount'] * $config['public_mining_tax'], + ]); + } + return view('miningtax.user.display.details.invoice')->with('ores', $ores) + ->with('moons', $moons) ->with('invoice', $invoice) ->with('totalPrice', $totalPrice); } diff --git a/config/esi.php b/config/esi.php index 3edd46c96..8095b2844 100644 --- a/config/esi.php +++ b/config/esi.php @@ -7,6 +7,7 @@ 'primary' => env('ESI_PRIMARY_CHAR', 93738489), 'alliance' => env('ESI_ALLIANCE', 99004116), 'corporation' => env('ESI_CORPORATION', 98287666), + 'public_mining_tax' => env('PUBLIC_MINING_TAX', 0.15), 'mining_tax' => env('MINING_TAX', 0.15), 'refine_rate' => env('REFINE_RATE', 0.7948248), ]; diff --git a/resources/views/miningtax/user/display/details/invoice.blade.php b/resources/views/miningtax/user/display/details/invoice.blade.php index 37aa042df..f01bf1c10 100644 --- a/resources/views/miningtax/user/display/details/invoice.blade.php +++ b/resources/views/miningtax/user/display/details/invoice.blade.php @@ -27,5 +27,35 @@ +
+
+
+

Ledger Details

+
+
+ + + + + + + + + + + @foreach($moons as $moon) + + + + + + + + + @endforeach + +
Character NameObserver NameOre NameQuantityPriceTax Amount
{{ $moon['character_name'] }}{{ $moon['observer_name'] }}{{ $moon['ore_name'] }}{{ $moon['quantity'] }}{{ $moon['amount'] {{ $moon['tax_amount'] }}
+
+
@endsection \ No newline at end of file