invoice stuff

This commit is contained in:
2021-03-18 00:11:40 +09:00
parent ce99ad9cf9
commit db11b6255b

View File

@@ -60,7 +60,17 @@ class MiningTaxesInvoices extends Command
$task->SetStartStatus(); $task->SetStartStatus();
//Get the characters for each non-invoiced ledger entry //Get the characters for each non-invoiced ledger entry
$charIds = Ledger::distinct('character_id')->pluck('character_id'); $charIds = Ledger::where([
'invoiced' => 'No',
])->distinct('character_id')
->pluck('character_id');
dd($charIds);
if($charIds == null) {
return 0;
}
//Foreach character tally up the mining ledger. //Foreach character tally up the mining ledger.
foreach($charIds as $charId) { foreach($charIds as $charId) {
@@ -76,8 +86,6 @@ class MiningTaxesInvoices extends Command
'invoiced' => 'No', 'invoiced' => 'No',
])->get()->toArray(); ])->get()->toArray();
dd($rows);
//Taly up the item composition from each row and multiply by the quantity //Taly up the item composition from each row and multiply by the quantity
foreach($rows as $row) { foreach($rows as $row) {
if(!isset($ores[$row['type_id']])) { if(!isset($ores[$row['type_id']])) {
@@ -89,13 +97,9 @@ class MiningTaxesInvoices extends Command
$totalPrice = $totalPrice + $row['amount']; $totalPrice = $totalPrice + $row['amount'];
} }
dd($totalPrice);
//Reduce the total price by the take percentage //Reduce the total price by the take percentage
$invoiceAmount = $totalPrice * $config['mining_tax']; $invoiceAmount = $totalPrice * $config['mining_tax'];
$invoiceAmount = round($invoiceAmount, 2); $invoiceAmount = round($invoiceAmount, 2);
dd($invoiceAmount);
//Get the character name from the character id //Get the character name from the character id
$charName = $lookup->CharacterIdToName($charId); $charName = $lookup->CharacterIdToName($charId);