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;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Config;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
@ -23,16 +24,6 @@ class InvoiceEmail extends Command
|
|||||||
*/
|
*/
|
||||||
protected $description = 'Email Invoices to be client';
|
protected $description = 'Email Invoices to be client';
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new command instance.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*
|
*
|
||||||
@ -41,6 +32,7 @@ class InvoiceEmail extends Command
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$o = Invoice::findOrFail($this->argument('id'));
|
$o = Invoice::findOrFail($this->argument('id'));
|
||||||
|
Config::set('site',$o->account->site);
|
||||||
|
|
||||||
Mail::to($o->account->user->email)->send(new \App\Mail\InvoiceEmail($o));
|
Mail::to($o->account->user->email)->send(new \App\Mail\InvoiceEmail($o));
|
||||||
|
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App\Models\Account;
|
|
||||||
use App\Models\Invoice;
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Config;
|
||||||
|
|
||||||
|
use App\Models\{Account,Invoice};
|
||||||
|
|
||||||
class InvoiceGenerate extends Command
|
class InvoiceGenerate extends Command
|
||||||
{
|
{
|
||||||
@ -23,16 +23,6 @@ class InvoiceGenerate extends Command
|
|||||||
*/
|
*/
|
||||||
protected $description = 'Generate Invoices to be Sent';
|
protected $description = 'Generate Invoices to be Sent';
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new command instance.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*
|
*
|
||||||
@ -46,6 +36,8 @@ class InvoiceGenerate extends Command
|
|||||||
$accounts = Account::active()->get();
|
$accounts = Account::active()->get();
|
||||||
|
|
||||||
foreach ($accounts as $o) {
|
foreach ($accounts as $o) {
|
||||||
|
Config::set('site',$o->site);
|
||||||
|
|
||||||
$io = new Invoice;
|
$io = new Invoice;
|
||||||
$io->account_id = $o->id;
|
$io->account_id = $o->id;
|
||||||
|
|
||||||
|
@ -91,6 +91,11 @@ class Account extends Model implements IDs
|
|||||||
return $active ? $query->active() : $query;
|
return $active ? $query->active() : $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function site()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Site::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function taxes()
|
public function taxes()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Tax::class,'country_id','country_id');
|
return $this->hasMany(Tax::class,'country_id','country_id');
|
||||||
|
@ -8,6 +8,4 @@ class Rtm extends Model
|
|||||||
{
|
{
|
||||||
protected $table = 'ab_rtm';
|
protected $table = 'ab_rtm';
|
||||||
public $timestamps = FALSE;
|
public $timestamps = FALSE;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -618,7 +618,7 @@ class Service extends Model implements IDs
|
|||||||
|
|
||||||
// Two Yearly
|
// Two Yearly
|
||||||
case 5:
|
case 5:
|
||||||
if (!$this->product->price_recur_strict)
|
if (! $this->product->price_recur_strict)
|
||||||
$date = $this->getInvoiceNextAttribute()->addYear(2)->subDay();
|
$date = $this->getInvoiceNextAttribute()->addYear(2)->subDay();
|
||||||
else {
|
else {
|
||||||
$date = $this->getInvoiceNextAttribute()->addYear(2)->subDay()->endOfYear();
|
$date = $this->getInvoiceNextAttribute()->addYear(2)->subDay()->endOfYear();
|
||||||
|
@ -7,7 +7,7 @@ A new invoice has been generated on your account. A summary of that invoice is b
|
|||||||
| # | ID | Name | Amount |
|
| # | ID | Name | Amount |
|
||||||
| -: | - |:-----| ------:|
|
| -: | - |:-----| ------:|
|
||||||
@foreach ($invoice->products() as $po)
|
@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
|
@endforeach
|
||||||
||| Sub Total | ${{ $invoice->sub_total }} |
|
||| Sub Total | ${{ $invoice->sub_total }} |
|
||||||
||| Tax | ${{ $invoice->tax_total }} |
|
||| Tax | ${{ $invoice->tax_total }} |
|
||||||
|
Loading…
Reference in New Issue
Block a user