Compare commits
4 Commits
d2f7661ee2
...
078dc6ab39
Author | SHA1 | Date | |
---|---|---|---|
078dc6ab39 | |||
7e383511ab | |||
725b6f317d | |||
f43748e20a |
@ -37,7 +37,8 @@ class ChargeController extends Controller
|
|||||||
public function delete(Charge $o): array
|
public function delete(Charge $o): array
|
||||||
{
|
{
|
||||||
if (Gate::allows('delete',$o)) {
|
if (Gate::allows('delete',$o)) {
|
||||||
$o->delete();
|
$o->active = FALSE;
|
||||||
|
$o->save();
|
||||||
|
|
||||||
return ['ok'];
|
return ['ok'];
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
@ -252,11 +253,59 @@ class Account extends Model implements IDs
|
|||||||
|
|
||||||
/* METHODS */
|
/* METHODS */
|
||||||
|
|
||||||
|
public function invoice_next(): Collection
|
||||||
|
{
|
||||||
|
// Collect all the invoice items for our active services
|
||||||
|
$nextdate = ($x=$this
|
||||||
|
->services_active
|
||||||
|
->filter(fn($item)=>$item->isBilled() && $item->invoice_next)
|
||||||
|
->sortBy(fn($item)=>(string)$item->invoice_next))
|
||||||
|
->first()
|
||||||
|
?->invoice_next
|
||||||
|
->clone();
|
||||||
|
|
||||||
|
// Add any additional items that will be invoiced 30 days
|
||||||
|
$nextitemsdate = max($nextdate,Carbon::now())
|
||||||
|
->clone()
|
||||||
|
->addMonth()
|
||||||
|
->subDay()
|
||||||
|
->endOfday();
|
||||||
|
|
||||||
|
$items = $x
|
||||||
|
->filter(fn($item)=>$item->invoice_next->lessThan($nextitemsdate))
|
||||||
|
->sortBy(fn($item)=>$item->invoice_next.$item->name)
|
||||||
|
->map(fn($item)=>$item->next_invoice_items($nextitemsdate))
|
||||||
|
->flatten();
|
||||||
|
|
||||||
|
// Add any account charges (charges with no active service)
|
||||||
|
foreach ($this->charges->filter(function($item) { return $item->unprocessed && ((! $this->service_id) || (! $item->service->isBilled())); }) as $oo) {
|
||||||
|
$ii = new InvoiceItem;
|
||||||
|
|
||||||
|
$ii->active = TRUE;
|
||||||
|
$ii->service_id = $oo->service_id;
|
||||||
|
$ii->product_id = $this->product_id;
|
||||||
|
$ii->quantity = $oo->quantity;
|
||||||
|
$ii->item_type = $oo->type;
|
||||||
|
$ii->price_base = $oo->amount;
|
||||||
|
$ii->start_at = $oo->start_at;
|
||||||
|
$ii->stop_at = $oo->stop_at;
|
||||||
|
$ii->module_id = 30; // @todo This shouldnt be hard coded
|
||||||
|
$ii->module_ref = $oo->id;
|
||||||
|
$ii->site_id = 1; // @todo
|
||||||
|
|
||||||
|
$ii->addTaxes($this->country->taxes);
|
||||||
|
$items->push($ii);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $items;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of invoices (summary) for this account
|
* List of invoices (summary) for this account
|
||||||
*
|
*
|
||||||
* @param Collection|NULL $invoices
|
* @param Collection|NULL $invoices
|
||||||
* @return Collection
|
* @param bool $all
|
||||||
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function invoiceSummary(Collection $invoices=NULL,bool $all=FALSE): Builder
|
public function invoiceSummary(Collection $invoices=NULL,bool $all=FALSE): Builder
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Database\Eloquent\Casts\AsCollection;
|
use Illuminate\Database\Eloquent\Casts\AsCollection;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
@ -11,7 +12,6 @@ use Illuminate\Support\Collection;
|
|||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||||
use Leenooks\Carbon;
|
|
||||||
use Leenooks\Casts\LeenooksCarbon;
|
use Leenooks\Casts\LeenooksCarbon;
|
||||||
|
|
||||||
use App\Models\Product\Type;
|
use App\Models\Product\Type;
|
||||||
@ -33,8 +33,6 @@ use App\Traits\{ScopeServiceActive,ScopeServiceUserAuthorised};
|
|||||||
* + billing_interval : The period that this service is billed for by default
|
* + billing_interval : The period that this service is billed for by default
|
||||||
* + billing_interval_string : The period that this service is billed for by default as a name
|
* + billing_interval_string : The period that this service is billed for by default as a name
|
||||||
* + invoiced_to : When this service has been billed to
|
* + invoiced_to : When this service has been billed to
|
||||||
* + category : The type of service this is, eg: broadband, phone
|
|
||||||
* + category_name : The type of service this is, eg: Broadband, Telephone (in human friendly)
|
|
||||||
* + contract_term : The term that this service must be active
|
* + contract_term : The term that this service must be active
|
||||||
* + contract_end : The date that the contract ends for this service
|
* + contract_end : The date that the contract ends for this service
|
||||||
* + name : Service short name with service address
|
* + name : Service short name with service address
|
||||||
@ -615,10 +613,13 @@ class Service extends Model implements IDs
|
|||||||
*
|
*
|
||||||
* @return Carbon
|
* @return Carbon
|
||||||
*/
|
*/
|
||||||
public function getInvoiceNextAttribute(): Carbon
|
public function getInvoiceNextAttribute(): ?Carbon
|
||||||
{
|
{
|
||||||
$last = $this->getInvoicedToAttribute();
|
$last = $this->getInvoicedToAttribute();
|
||||||
|
|
||||||
|
if ($this->stop_at && $last->greaterThan($this->stop_at))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
return $last
|
return $last
|
||||||
? $last->addDay()
|
? $last->addDay()
|
||||||
: (min($this->start_at,$this->invoice_next_at) ?: Carbon::now());
|
: (min($this->start_at,$this->invoice_next_at) ?: Carbon::now());
|
||||||
@ -1074,9 +1075,9 @@ class Service extends Model implements IDs
|
|||||||
if (is_null($billdate))
|
if (is_null($billdate))
|
||||||
$billdate = $invoiced_to->clone()->addDays(config('osb.invoice_days'));
|
$billdate = $invoiced_to->clone()->addDays(config('osb.invoice_days'));
|
||||||
|
|
||||||
while ($invoiced_to < ($this->stop_at ?: $billdate)) {
|
while ($invoiced_to <= ($this->stop_at ?: $billdate)) {
|
||||||
$ii = new InvoiceItem;
|
$ii = new InvoiceItem;
|
||||||
$period = Invoice::invoice_period($invoiced_to,$this->getBillingIntervalAttribute(),$this->product->price_recur_strict);
|
$period = Invoice::invoice_period($invoiced_to,$this->getBillingIntervalAttribute(),(bool)$this->product->price_recur_strict);
|
||||||
|
|
||||||
$ii->active = TRUE;
|
$ii->active = TRUE;
|
||||||
$ii->service_id = $this->id;
|
$ii->service_id = $this->id;
|
||||||
|
@ -5,8 +5,6 @@ namespace App\Models;
|
|||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Support\Collection;
|
|
||||||
use Illuminate\Database\Eloquent\Collection as DatabaseCollection;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Laravel\Passport\HasApiTokens;
|
use Laravel\Passport\HasApiTokens;
|
||||||
use Leenooks\Traits\ScopeActive;
|
use Leenooks\Traits\ScopeActive;
|
||||||
@ -272,41 +270,6 @@ class User extends Authenticatable implements IDs
|
|||||||
return in_array($this->role(),['wholesaler']);
|
return in_array($this->role(),['wholesaler']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all the items for the next invoice
|
|
||||||
*
|
|
||||||
* @param bool $future
|
|
||||||
* @return DatabaseCollection
|
|
||||||
* @deprecated This should be done in accounts
|
|
||||||
*/
|
|
||||||
public function next_invoice_items(bool $future=FALSE): Collection
|
|
||||||
{
|
|
||||||
return collect();
|
|
||||||
$result = new DatabaseCollection;
|
|
||||||
$this->services->load(['invoice_items.taxes']);
|
|
||||||
|
|
||||||
foreach ($this->services as $o) {
|
|
||||||
if ($future) {
|
|
||||||
if ($o->invoice_next->subDays(config('app.invoice_inadvance'))->isPast())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if ($o->invoice_next->subDays(config('app.invoice_inadvance'))->isFuture())
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($o->next_invoice_items($future) as $oo)
|
|
||||||
$result->push($oo);
|
|
||||||
}
|
|
||||||
|
|
||||||
$result->load([
|
|
||||||
'product.translate',
|
|
||||||
'service.type',
|
|
||||||
]);
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine what the logged in user's role is
|
* Determine what the logged in user's role is
|
||||||
* + Wholesaler - aka Super User
|
* + Wholesaler - aka Super User
|
||||||
|
40
composer.lock
generated
40
composer.lock
generated
@ -1386,16 +1386,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "jenssegers/model",
|
"name": "jenssegers/model",
|
||||||
"version": "v1.5.2",
|
"version": "v1.5.3",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/jenssegers/model.git",
|
"url": "https://github.com/jenssegers/model.git",
|
||||||
"reference": "2f91457d2efa7f0440ed8703a0d85ba65ee31b94"
|
"reference": "8a81b2e6fdd49fa0372fb56c62e23de13bf0d623"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/jenssegers/model/zipball/2f91457d2efa7f0440ed8703a0d85ba65ee31b94",
|
"url": "https://api.github.com/repos/jenssegers/model/zipball/8a81b2e6fdd49fa0372fb56c62e23de13bf0d623",
|
||||||
"reference": "2f91457d2efa7f0440ed8703a0d85ba65ee31b94",
|
"reference": "8a81b2e6fdd49fa0372fb56c62e23de13bf0d623",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -1431,9 +1431,9 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/jenssegers/model/issues",
|
"issues": "https://github.com/jenssegers/model/issues",
|
||||||
"source": "https://github.com/jenssegers/model/tree/v1.5.2"
|
"source": "https://github.com/jenssegers/model/tree/v1.5.3"
|
||||||
},
|
},
|
||||||
"time": "2024-04-03T13:39:07+00:00"
|
"time": "2024-07-25T12:44:26+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "knplabs/knp-snappy",
|
"name": "knplabs/knp-snappy",
|
||||||
@ -1534,16 +1534,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/framework",
|
"name": "laravel/framework",
|
||||||
"version": "v11.18.1",
|
"version": "v11.19.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/laravel/framework.git",
|
"url": "https://github.com/laravel/framework.git",
|
||||||
"reference": "b19ba518c56852567e99fbae9321bc436c2cc5a8"
|
"reference": "5e103d499e9ee5bcfc184412d034c4e516b87085"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/laravel/framework/zipball/b19ba518c56852567e99fbae9321bc436c2cc5a8",
|
"url": "https://api.github.com/repos/laravel/framework/zipball/5e103d499e9ee5bcfc184412d034c4e516b87085",
|
||||||
"reference": "b19ba518c56852567e99fbae9321bc436c2cc5a8",
|
"reference": "5e103d499e9ee5bcfc184412d034c4e516b87085",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -1736,7 +1736,7 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"source": "https://github.com/laravel/framework"
|
||||||
},
|
},
|
||||||
"time": "2024-07-26T10:39:29+00:00"
|
"time": "2024-07-30T15:22:41+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/intuit",
|
"name": "laravel/intuit",
|
||||||
@ -3056,11 +3056,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "leenooks/laravel",
|
"name": "leenooks/laravel",
|
||||||
"version": "11.1.7",
|
"version": "11.1.8",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://gitea.dege.au/laravel/leenooks.git",
|
"url": "https://gitea.dege.au/laravel/leenooks.git",
|
||||||
"reference": "eaece2b69d028fba0db5a5bb55b1386acf017cbc"
|
"reference": "8acc3a91af7e4ce622aec60934a2f942b4a19eda"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
@ -3093,7 +3093,7 @@
|
|||||||
"laravel",
|
"laravel",
|
||||||
"leenooks"
|
"leenooks"
|
||||||
],
|
],
|
||||||
"time": "2024-07-28T04:52:56+00:00"
|
"time": "2024-07-31T12:40:35+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "leenooks/passkey",
|
"name": "leenooks/passkey",
|
||||||
@ -8909,16 +8909,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit",
|
"name": "phpunit/phpunit",
|
||||||
"version": "11.2.8",
|
"version": "11.2.9",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
"reference": "a7a29e8d3113806f18f99d670f580a30e8ffff39"
|
"reference": "c197bbaaca360efda351369bf1fd9cc1ca6bcbf7"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a7a29e8d3113806f18f99d670f580a30e8ffff39",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c197bbaaca360efda351369bf1fd9cc1ca6bcbf7",
|
||||||
"reference": "a7a29e8d3113806f18f99d670f580a30e8ffff39",
|
"reference": "c197bbaaca360efda351369bf1fd9cc1ca6bcbf7",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -8989,7 +8989,7 @@
|
|||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.2.8"
|
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.2.9"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -9005,7 +9005,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-07-18T14:56:37+00:00"
|
"time": "2024-07-30T11:09:23+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/cli-parser",
|
"name": "sebastian/cli-parser",
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
@endphp
|
@endphp
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{ url('r/switch/start',$ao->user_id) }}"><i class="fas fa-external-link-alt"></i></a></td>
|
<td><a href="{{ url('r/switch/start',$ao->user_id) }}"><i class="fas fa-external-link-alt"></i></a></td>
|
||||||
<td>{{ $ao->name }}</td>
|
<td><a href="{{ url('u/home',$ao->user_id) }}">{{ $ao->name }}</a></td>
|
||||||
<td class="text-right">{{ $ao->services->where('active',TRUE)->count() }} <small>/{{ $ao->services->count() }}</small></td>
|
<td class="text-right">{{ $ao->services->where('active',TRUE)->count() }} <small>/{{ $ao->services->count() }}</small></td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
<!-- $o=Account::class -->
|
||||||
|
@use(Carbon\Carbon)
|
||||||
|
|
||||||
|
<!-- Show next items for an invoice -->
|
||||||
|
@if(($x=$o->invoice_next())->count())
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<p>The following items will be invoiced on or after <strong>{{ max($x->first()->start_at->subDays(config('osb.invoice_days')),Carbon::now())->format('Y-m-d') }}</strong></p>
|
||||||
|
<table class="table table-sm table-stripped">
|
||||||
|
<!-- Group by Service -->
|
||||||
|
@foreach ($x->groupBy('service_id') as $id => $oo)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $oo->first()?->product?->category_name ?: '-' }}</td>
|
||||||
|
<td>
|
||||||
|
@if($id)
|
||||||
|
<a href="{{ url('u/service',$oo->first()->service_id) }}">{{ $oo->first()->service->name }}</a>
|
||||||
|
@else
|
||||||
|
Account Charges
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td class="text-right">${{ number_format($oo->sum('total'),2) }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th class="text-right" colspan="2">TOTAL</th>
|
||||||
|
<th class="text-right">${{ number_format($x->sum('total'),2) }}</th>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@else
|
||||||
|
<p>No items currently due to invoice.</p>
|
||||||
|
@endif
|
@ -27,7 +27,7 @@
|
|||||||
<td>{{ $so->product->category_name }}</td>
|
<td>{{ $so->product->category_name }}</td>
|
||||||
<td>{{ $so->name_short }}</td>
|
<td>{{ $so->name_short }}</td>
|
||||||
<td>{{ $so->product->name }}</td>
|
<td>{{ $so->product->name }}</td>
|
||||||
<td>{{ $so->external_billing ? '-' : $so->invoice_next->format('Y-m-d') }}</td>
|
<td>{{ ($so->external_billing || (! $so->invoice_next)) ? '-' : $so->invoice_next->format('Y-m-d') }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
<th>Service</th>
|
<th>Service</th>
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
<th class="text-right">Total</th>
|
<th class="text-right">Total</th>
|
||||||
|
<th> </th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
@ -42,7 +43,8 @@
|
|||||||
<td>{{ $o->account->name }}</td>
|
<td>{{ $o->account->name }}</td>
|
||||||
<td><a href="{{ url('u/service',$o->service_id) }}">{{ $o->service->name_short }}</a></td>
|
<td><a href="{{ url('u/service',$o->service_id) }}">{{ $o->service->name_short }}</a></td>
|
||||||
<td>{{ $o->description }}</td>
|
<td>{{ $o->description }}</td>
|
||||||
<td class="text-right">{{ number_format($o->quantity*$o->amount,2) }}</td>
|
<td class="text-right">{{ number_format($o->total,2) }}</td>
|
||||||
|
<td><a class="charge_delete text-dark" data-id="{{ $o->id }}" href="{{ url('/r/charge/delete',$o->id) }}"><i class="fas fa-fw fa-ban"></i></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
@empty
|
@empty
|
||||||
<tr>
|
<tr>
|
||||||
@ -55,18 +57,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<x-leenooks::modal.delete hide="row" trigger="charge_delete"/>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('page-styles')
|
@pa(datatables,rowgroup|conditionalpaging)
|
||||||
@css(datatables,bootstrap4)
|
|
||||||
@append
|
|
||||||
@section('page-scripts')
|
|
||||||
@js(datatables,bootstrap4)
|
|
||||||
|
|
||||||
|
@section('page-scripts')
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#unprocessed_charges').DataTable( {
|
$('#unprocessed_charges').DataTable({
|
||||||
order: [1,'desc'],
|
conditionalPaging: true,
|
||||||
|
order: [[3,'desc'],[1,'desc']],
|
||||||
|
rowGroup: {
|
||||||
|
dataSrc: [3],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -76,7 +76,7 @@
|
|||||||
<div class="tab-pane fade" id="tab-futureinvoice">
|
<div class="tab-pane fade" id="tab-futureinvoice">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-xl-9">
|
<div class="col-12 col-xl-9">
|
||||||
@include('theme.backend.adminlte.invoice.widget.next',['future'=>TRUE])
|
@include('theme.backend.adminlte.account.widget.invoice_next',['o'=>$ao])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
<!-- @todo These needs to be optimised, and change for $o = Account::class -->
|
|
||||||
<!-- Show next items for an invoice -->
|
|
||||||
@if(($x=$o->next_invoice_items($future))->count())
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
<table class="table">
|
|
||||||
<!-- Group by Account -->
|
|
||||||
@foreach ($x->groupBy('product_id') as $id => $oo)
|
|
||||||
<tr>
|
|
||||||
<th colspan="4">{{ $oo->first()->product->name }}</th>
|
|
||||||
<th class="text-right">${{ number_format($oo->sum('total'),2) }}</th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
@foreach ($oo->groupBy('service_id') as $ooo)
|
|
||||||
<tr>
|
|
||||||
<td class="pt-0 pb-1" style="width: 12em;"><a href="{{ url('u/service',$ooo->first()->service_id) }}">{{ $ooo->first()->service->sid }}</a></td>
|
|
||||||
<td class="pt-0 pb-1" colspan="3">{{ $ooo->first()->service->name }}</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
@foreach ($ooo as $io)
|
|
||||||
<tr>
|
|
||||||
<td class="pt-0 pb-1"> </td>
|
|
||||||
<td class="pt-0 pb-1"> </td>
|
|
||||||
<td class="pt-0 pb-1">{{ $io->item_type_name }}</td>
|
|
||||||
<td class="text-right pt-0 pb-1">${{ number_format($io->total,2) }}</td>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
@endforeach
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th class="text-right" colspan="4">TOTAL</th>
|
|
||||||
<th class="text-right">${{ number_format($x->sum('total'),2) }}</th>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@else
|
|
||||||
<p>No items currently due to invoice.</p>
|
|
||||||
@endif
|
|
@ -1,49 +1,21 @@
|
|||||||
<!-- $o=Service\Phone::class -->
|
<!-- $o=Service\Phone::class -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
|
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
|
||||||
@include('adminlte::widget.form_text',[
|
<x-leenooks::form.text id="service_number" name="phone[service_number]" icon="fa-phone" label="Service Number" old="phone.service_number" :value="$o->service_number"/>
|
||||||
'label'=>'Service Number',
|
|
||||||
'icon'=>'fas fa-phone',
|
|
||||||
'id'=>'service_number',
|
|
||||||
'old'=>'phone.service_number',
|
|
||||||
'name'=>'phone[service_number]',
|
|
||||||
'value'=>$o->service_number ?? '',
|
|
||||||
])
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 col-sm-9 col-md-6 col-xl-7">
|
<div class="col-12 col-sm-9 col-md-6 col-xl-7">
|
||||||
@include('adminlte::widget.form_text',[
|
<x-leenooks::form.text id="service_address" name="phone[service_address]" icon="fa-map" label="Service Address" old="phone.service_address" :value="$o->service_address"/>
|
||||||
'label'=>'Service Address',
|
|
||||||
'icon'=>'fas fa-map',
|
|
||||||
'id'=>'service_address',
|
|
||||||
'old'=>'phone.service_address',
|
|
||||||
'name'=>'phone[service_address]',
|
|
||||||
'value'=>$o->service_address ?? '',
|
|
||||||
])
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-sm-9 col-md-12 col-xl-6">
|
<div class="col-12 col-sm-9 col-md-12 col-xl-6">
|
||||||
@include('adminlte::widget.form_text',[
|
<x-leenooks::form.text id="service_username" name="phone[service_username]" icon="fa-user" label="Service Username" old="phone.service_username" :value="$o->service_username"/>
|
||||||
'label'=>'Service Username',
|
|
||||||
'icon'=>'fas fa-user',
|
|
||||||
'id'=>'service_username',
|
|
||||||
'old'=>'phone.service_username',
|
|
||||||
'name'=>'phone[service_username]',
|
|
||||||
'value'=>$o->service_username ?? '',
|
|
||||||
])
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 col-sm-9 col-md-5 col-xl-6">
|
<div class="col-12 col-sm-9 col-md-5 col-xl-6">
|
||||||
@include('adminlte::widget.form_text',[
|
<x-leenooks::form.text id="service_password" name="phone[service_password]" icon="fa-lock" label="Service Password" old="phone.service_password" :value="$o->service_password"/>
|
||||||
'label'=>'Service Password',
|
|
||||||
'icon'=>'fas fa-lock',
|
|
||||||
'id'=>'service_password',
|
|
||||||
'old'=>'phone.service_password',
|
|
||||||
'name'=>'phone[service_password]',
|
|
||||||
'value'=>$o->service_password ?? '',
|
|
||||||
])
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -52,24 +24,10 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
|
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
|
||||||
@include('adminlte::widget.form_date',[
|
<x-leenooks::form.date id="connect_at" name="phone[connect_at]" icon="fa-calendar" label="Connect Date" old="phone.connect_at" :value="$o->connect_at?->format('Y-m-d')"/>
|
||||||
'label'=>'Connect Date',
|
|
||||||
'icon'=>'fas fa-calendar',
|
|
||||||
'id'=>'connect_at',
|
|
||||||
'old'=>'phone.connect_at',
|
|
||||||
'name'=>'phone[connect_at]',
|
|
||||||
'value'=>$o->connect_at ? $o->connect_at->format('Y-m-d') : '',
|
|
||||||
])
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
|
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
|
||||||
@include('adminlte::widget.form_date',[
|
<x-leenooks::form.date id="expire_at" name="phone[expire_at]" icon="fa-calendar" label="Contract End" old="phone.expire_at" :value="$o->expire_at?->format('Y-m-d') ?: ($o->connect_at?->addMonths($o->contract_term)->format('Y-m-d'))"/>
|
||||||
'label'=>'Contract End',
|
|
||||||
'icon'=>'fas fa-calendar',
|
|
||||||
'id'=>'expire_at',
|
|
||||||
'old'=>'phone.expire_at',
|
|
||||||
'name'=>'phone[expire_at]',
|
|
||||||
'value'=>$o->expire_at ? $o->expire_at->format('Y-m-d') : ($o->connect_at ? $o->connect_at->addMonths($o->contract_term)->format('Y-m-d') : ''),
|
|
||||||
])
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
Loading…
x
Reference in New Issue
Block a user