invoice changes

This commit is contained in:
2021-08-01 23:36:03 -05:00
parent 83592117d1
commit 339b1063c6
2 changed files with 54 additions and 0 deletions

View File

@@ -151,16 +151,22 @@ class MiningTaxesAdminController extends Controller
*/
public function displayInvoice($invoiceId) {
$ores = array();
$moons = array();
$totalPrice = 0.00;
$structure = new StructureHelper;
$config = config('esi');
//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;
@@ -170,7 +176,25 @@ class MiningTaxesAdminController 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.admin.display.details.invoice')->with('ores', $ores)
->with('moons', $moons)
->with('invoice', $invoice)
->with('totalPrice', $totalPrice);
}

View File

@@ -28,5 +28,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