invoice details

This commit is contained in:
2021-08-01 23:14:29 -05:00
parent ff1e396fbc
commit 83592117d1
3 changed files with 59 additions and 0 deletions

View File

@@ -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);
}

View File

@@ -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),
];

View File

@@ -27,5 +27,35 @@
</table>
</div>
</div>
<br>
<div class="card">
<div class="card-header">
<h2>Ledger Details</h2>
</div>
<div class="card-body">
<table class="table table-striped table-bordered">
<thead>
<th>Character Name</th>
<th>Observer Name</th>
<th>Ore Name</th>
<th>Quantity</th>
<th>Price</th>
<th>Tax Amount</th>
</thead>
<tbody>
@foreach($moons as $moon)
<tr>
<td>{{ $moon['character_name'] }}</td>
<td>{{ $moon['observer_name'] }}</td>
<td>{{ $moon['ore_name'] }}</td>
<td>{{ $moon['quantity'] }}</td>
<td>{{ $moon['amount'] </td>
<td>{{ $moon['tax_amount'] }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endsection