Fix invoice generation and other minor cosmetic items
This commit is contained in:
parent
6dab5bded8
commit
62f587d7e6
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
@ -23,16 +24,6 @@ class InvoiceEmail extends Command
|
||||
*/
|
||||
protected $description = 'Email Invoices to be client';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
@ -41,6 +32,7 @@ class InvoiceEmail extends Command
|
||||
public function handle()
|
||||
{
|
||||
$o = Invoice::findOrFail($this->argument('id'));
|
||||
Config::set('site',$o->account->site);
|
||||
|
||||
Mail::to($o->account->user->email)->send(new \App\Mail\InvoiceEmail($o));
|
||||
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Account;
|
||||
use App\Models\Invoice;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
use App\Models\{Account,Invoice};
|
||||
|
||||
class InvoiceGenerate extends Command
|
||||
{
|
||||
@ -23,16 +23,6 @@ class InvoiceGenerate extends Command
|
||||
*/
|
||||
protected $description = 'Generate Invoices to be Sent';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
@ -46,6 +36,8 @@ class InvoiceGenerate extends Command
|
||||
$accounts = Account::active()->get();
|
||||
|
||||
foreach ($accounts as $o) {
|
||||
Config::set('site',$o->site);
|
||||
|
||||
$io = new Invoice;
|
||||
$io->account_id = $o->id;
|
||||
|
||||
|
@ -91,6 +91,11 @@ class Account extends Model implements IDs
|
||||
return $active ? $query->active() : $query;
|
||||
}
|
||||
|
||||
public function site()
|
||||
{
|
||||
return $this->belongsTo(Site::class);
|
||||
}
|
||||
|
||||
public function taxes()
|
||||
{
|
||||
return $this->hasMany(Tax::class,'country_id','country_id');
|
||||
|
@ -8,6 +8,4 @@ class Rtm extends Model
|
||||
{
|
||||
protected $table = 'ab_rtm';
|
||||
public $timestamps = FALSE;
|
||||
|
||||
|
||||
}
|
@ -7,7 +7,7 @@ A new invoice has been generated on your account. A summary of that invoice is b
|
||||
| # | ID | Name | Amount |
|
||||
| -: | - |:-----| ------:|
|
||||
@foreach ($invoice->products() as $po)
|
||||
| {{ $po->count }} | {{ $po->product_id }} | {{ $po->name($invoice->account->user->language) }} | ${{ number_format($invoice->items->filter(function($item) use ($po) {return $item->product_id == $po->id; })->sum('total'),$invoice->currency()->rounding) }} |
|
||||
| {{ $po->count }} | {{ $po->product_id }} | {{ $po->name }} | ${{ number_format($invoice->items->filter(function($item) use ($po) {return $item->product_id == $po->id; })->sum('total'),$invoice->currency()->rounding) }} |
|
||||
@endforeach
|
||||
||| Sub Total | ${{ $invoice->sub_total }} |
|
||||
||| Tax | ${{ $invoice->tax_total }} |
|
||||
|
Loading…
Reference in New Issue
Block a user