updated send mining taxes invoices
This commit is contained in:
50
app/Jobs/Commands/MiningTaxes/CreateMiningTaxesInvoice.php
Normal file
50
app/Jobs/Commands/MiningTaxes/CreateMiningTaxesInvoice.php
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Jobs\Commands\MiningTaxes;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use Log;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
//Application Library
|
||||||
|
use App\Library\Helpers\LookupHelper;
|
||||||
|
|
||||||
|
//Models
|
||||||
|
use App\Models\MiningTax\Invoice;
|
||||||
|
|
||||||
|
class CreateMiningTaxesInvoice implements ShouldQueue
|
||||||
|
{
|
||||||
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new job instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the job.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
//Declare variables
|
||||||
|
$lookup = new LookupHelper;
|
||||||
|
$mainAlts = array();
|
||||||
|
$mainIds = new Collection;
|
||||||
|
|
||||||
|
//Get all of the users in the database
|
||||||
|
$characters = User::all();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -53,17 +53,17 @@ class SendMiningTaxesInvoices implements ShouldQueue
|
|||||||
$mainIds = new Collection;
|
$mainIds = new Collection;
|
||||||
|
|
||||||
//Get all of the users in the database
|
//Get all of the users in the database
|
||||||
$charIds = User::all();
|
$users = User::all();
|
||||||
|
|
||||||
//Get a list of the alts for each character, then process the ledgers and combine them to send one mail out
|
//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
|
//in this first part
|
||||||
foreach($charIds as $charId) {
|
foreach($users as $char) {
|
||||||
//Gather up all of the ledgers from the character and its alts.
|
//Gather up all of the ledgers from the character and its alts.
|
||||||
$ledgers = $this->LedgersWithAlts($charId);
|
$ledgers = $this->LedgersWithAlts($char->character_id);
|
||||||
|
|
||||||
if(sizeof($ledgers) > 0) {
|
if(sizeof($ledgers) > 0) {
|
||||||
//Create an invoice from the ledger rows
|
//Create an invoice from the ledger rows
|
||||||
$this->CreateInvoice($charId, $ledgers, $mailDelay);
|
$this->CreateInvoice($char->character_id, $ledgers, $mailDelay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ class CreateMiningTaxTables extends Migration
|
|||||||
'Paid Late',
|
'Paid Late',
|
||||||
'Deferred',
|
'Deferred',
|
||||||
'Deleted',
|
'Deleted',
|
||||||
|
'Combined',
|
||||||
])->default('Pending');
|
])->default('Pending');
|
||||||
$table->text('mail_body')->nullable();
|
$table->text('mail_body')->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|||||||
@@ -24,6 +24,16 @@ class ModifyMiningTaxTables extends Migration
|
|||||||
])->default('No');
|
])->default('No');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!Schema::hasTable('alliance_mining_tax_wallet')) {
|
||||||
|
Schema::create('alliance_mining_tax_wallet', function (Blueprint $table) {
|
||||||
|
$table->unsignedBigInteger('id')->primary();
|
||||||
|
$table->unsignedBigInteger('character_id')->unique();
|
||||||
|
$table->string('character_name');
|
||||||
|
$table->decimal('amount', 20, 2)->default(0.00);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user