Compare commits
No commits in common. "7ec28218fade7ea1af7e45c43e40f3b70b49679b" and "b877a2b6730e0611d00acb39c3ac6f2ec1cf5e8f" have entirely different histories.
7ec28218fa
...
b877a2b673
@ -8,7 +8,7 @@ use Illuminate\Support\Arr;
|
|||||||
|
|
||||||
use App\Http\Requests\{SupplierAddEdit,SupplierProductAddEdit};
|
use App\Http\Requests\{SupplierAddEdit,SupplierProductAddEdit};
|
||||||
use App\Jobs\ImportCosts;
|
use App\Jobs\ImportCosts;
|
||||||
use App\Models\{Supplier,SupplierDetail};
|
use App\Models\{Cost,Supplier,SupplierDetail};
|
||||||
|
|
||||||
class SupplierController extends Controller
|
class SupplierController extends Controller
|
||||||
{
|
{
|
||||||
@ -24,7 +24,7 @@ class SupplierController extends Controller
|
|||||||
foreach (Arr::except($request->validated(),['supplier_details','api_key','api_secret','submit']) as $key => $item)
|
foreach (Arr::except($request->validated(),['supplier_details','api_key','api_secret','submit']) as $key => $item)
|
||||||
$o->{$key} = $item;
|
$o->{$key} = $item;
|
||||||
|
|
||||||
$o->active = (bool)$request->validated('active');
|
$o->active = (bool)$request->active;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$o->save();
|
$o->save();
|
||||||
@ -50,6 +50,25 @@ class SupplierController extends Controller
|
|||||||
->with('success','Supplier Saved');
|
->with('success','Supplier Saved');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the suppliers invoice
|
||||||
|
*
|
||||||
|
* @param Cost $o
|
||||||
|
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
|
public function cost(Cost $o)
|
||||||
|
{
|
||||||
|
// @todo Need to add the services that are active that are not on the bill for the supplier.
|
||||||
|
return view('theme.backend.adminlte.supplier.cost.view')
|
||||||
|
->with('o',$o);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function cost_add(Supplier $o)
|
||||||
|
{
|
||||||
|
return view('theme.backend.adminlte.supplier.cost.add')
|
||||||
|
->with('o',$o);
|
||||||
|
}
|
||||||
|
|
||||||
public function cost_submit(Request $request,Supplier $o)
|
public function cost_submit(Request $request,Supplier $o)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
|
18
app/Http/Controllers/Wholesale/ReportController.php
Normal file
18
app/Http/Controllers/Wholesale/ReportController.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Wholesale;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
|
||||||
|
class ReportController extends Controller
|
||||||
|
{
|
||||||
|
public function accounts()
|
||||||
|
{
|
||||||
|
return view('account/report');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function products()
|
||||||
|
{
|
||||||
|
return view('product/report');
|
||||||
|
}
|
||||||
|
}
|
@ -126,7 +126,7 @@ class ImportCosts implements ShouldQueue
|
|||||||
$cost = ($x=$this->getColumnKey('PRICETOTAL')) ? str_replace([',','$'],'',$fields[$x]) : NULL;
|
$cost = ($x=$this->getColumnKey('PRICETOTAL')) ? str_replace([',','$'],'',$fields[$x]) : NULL;
|
||||||
$start_at = Carbon::createFromFormat('d M Y',$m[3]);
|
$start_at = Carbon::createFromFormat('d M Y',$m[3]);
|
||||||
$stop_at = Carbon::createFromFormat('d M Y',$m[4]);
|
$stop_at = Carbon::createFromFormat('d M Y',$m[4]);
|
||||||
$so = Service::search($m[1])->ServiceActive()->with(['type','product.type.supplied'])->single();
|
$so = Service::search($m[1])->active()->with(['type','product.type.supplied'])->single();
|
||||||
|
|
||||||
if ($so) {
|
if ($so) {
|
||||||
// r[1] = Monthly Charge or Extra Charge,r[2] = "On Plan", r[3] = Plan Info
|
// r[1] = Monthly Charge or Extra Charge,r[2] = "On Plan", r[3] = Plan Info
|
||||||
@ -197,7 +197,7 @@ class ImportCosts implements ShouldQueue
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dump(['line'=>$line,'sql'=>Service::search($m[1])->ServiceActive()->with(['type','product.type.supplied'])->toSql()]);
|
dump(['line'=>$line,'sql'=>Service::search($m[1])->active()->with(['type','product.type.supplied'])->toSql()]);
|
||||||
|
|
||||||
$to = Cost\Generic::where('site_id',$this->co->site_id)
|
$to = Cost\Generic::where('site_id',$this->co->site_id)
|
||||||
->where('cost_id',$this->co->id)
|
->where('cost_id',$this->co->id)
|
||||||
|
@ -8,9 +8,9 @@ abstract class Type extends Model
|
|||||||
{
|
{
|
||||||
public $timestamps = FALSE;
|
public $timestamps = FALSE;
|
||||||
|
|
||||||
protected $casts = [
|
protected $dates = [
|
||||||
'start_at' => 'datetime:Y-m-d',
|
'start_at',
|
||||||
'end_at' => 'datetime:Y-m-d',
|
'end_at',
|
||||||
];
|
];
|
||||||
|
|
||||||
/* RELATIONS */
|
/* RELATIONS */
|
||||||
|
@ -7,7 +7,7 @@ use Illuminate\Support\Facades\Route;
|
|||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Intuit\Traits\IntuitSocialite;
|
use Intuit\Traits\IntuitSocialite;
|
||||||
|
|
||||||
use App\Models\{Checkout,Cost,Payment,Product,Service,Supplier};
|
use App\Models\{Checkout,Payment,Product,Service,Supplier};
|
||||||
|
|
||||||
class AppServiceProvider extends ServiceProvider
|
class AppServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
@ -36,7 +36,6 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
$this->bootIntuitSocialite();
|
$this->bootIntuitSocialite();
|
||||||
|
|
||||||
Route::model('co',Checkout::class);
|
Route::model('co',Checkout::class);
|
||||||
Route::model('cso',Cost::class);
|
|
||||||
Route::model('po',Payment::class);
|
Route::model('po',Payment::class);
|
||||||
Route::model('pdo',Product::class);
|
Route::model('pdo',Product::class);
|
||||||
Route::model('so',Service::class);
|
Route::model('so',Service::class);
|
||||||
|
@ -47,9 +47,10 @@
|
|||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@pa(datatables,rowgroup|select|searchpanes|searchpanes-left)
|
|
||||||
|
|
||||||
@section('page-scripts')
|
@section('page-scripts')
|
||||||
|
@css(datatables,bootstrap4|fixedheader|responsive|rowgroup|select|searchpanes|searchpanes-left)
|
||||||
|
@js(datatables,bootstrap4|fixedheader|responsive|rowgroup|select|searchpanes)
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#table').DataTable({
|
$('#table').DataTable({
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
@use(App\Models\Service)
|
|
||||||
|
|
||||||
@extends('adminlte::layouts.app')
|
@extends('adminlte::layouts.app')
|
||||||
|
|
||||||
@section('htmlheader_title')
|
@section('htmlheader_title')
|
||||||
@ -31,7 +29,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (Service::ServiceActive()->with(['product.translate'])->get()->groupBy('product_id') as $s)
|
@foreach (\App\Models\Service::active()->with(['product.translate'])->get()->groupBy('product_id') as $s)
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{ url('a/product/details',[($x=$s->first())->product_id]) }}">{{ $x->id }}</a></td>
|
<td><a href="{{ url('a/product/details',[($x=$s->first())->product_id]) }}">{{ $x->id }}</a></td>
|
||||||
<td>{{ $x->product->category_name }}</td>
|
<td>{{ $x->product->category_name }}</td>
|
||||||
@ -47,9 +45,21 @@
|
|||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@pa(datatables,rowgroup)
|
|
||||||
|
|
||||||
@section('page-scripts')
|
@section('page-scripts')
|
||||||
|
@css(datatables,bootstrap4|fixedheader|responsive|rowgroup|buttons)
|
||||||
|
@js(datatables,bootstrap4|fixedheader|responsive|rowgroup|buttons)
|
||||||
|
|
||||||
|
<style>
|
||||||
|
tr.odd td:first-child,
|
||||||
|
tr.even td:first-child {
|
||||||
|
padding-left: 3em;
|
||||||
|
}
|
||||||
|
table.dataTable tr.dtrg-group.dtrg-level-1 td {
|
||||||
|
background-color: #e0e0e0;
|
||||||
|
color: #4c110f;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#table').DataTable({
|
$('#table').DataTable({
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
@use(Carbon\Carbon)
|
<!-- $o = Supplier::class -->
|
||||||
|
|
||||||
<!-- $spo=Supplier::class -->
|
|
||||||
@extends('adminlte::layouts.app')
|
@extends('adminlte::layouts.app')
|
||||||
|
|
||||||
@section('htmlheader_title')
|
@section('htmlheader_title')
|
||||||
@ -11,44 +9,47 @@
|
|||||||
Add Cost
|
Add Cost
|
||||||
@endsection
|
@endsection
|
||||||
@section('contentheader_description')
|
@section('contentheader_description')
|
||||||
{{ $spo->name }}
|
{{ $o->name }}
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('main-content')
|
@section('main-content')
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-sm-9 col-md-7 col-lg-6">
|
<div class="col-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="row">
|
<form class="g-0 needs-validation" method="POST" action="{{ url('a/supplier/cost/new',[$o->id]) }}" enctype="multipart/form-data">
|
||||||
<div class="col-8">
|
@include('adminlte::widget.success')
|
||||||
<h3>{{ $spo->name }}</h3>
|
|
||||||
</div>
|
|
||||||
<div class="col-4">
|
|
||||||
<x-leenooks::button.success class="float-right"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form method="POST" enctype="multipart/form-data">
|
|
||||||
@csrf
|
@csrf
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
|
||||||
<x-leenooks::form.date id="billed_at" name="billed_at" icon="fa-calendar" label="Invoice Date" old="billed_at" :value="Carbon::now()->format('Y-m-d')"/>
|
@include('adminlte::widget.form_date',[
|
||||||
|
'label'=>'Invoice Date',
|
||||||
|
'icon'=>'fas fa-calendar',
|
||||||
|
'id'=>'billed_at',
|
||||||
|
'old'=>'billed_at',
|
||||||
|
'name'=>'billed_at',
|
||||||
|
'value'=>\Carbon\Carbon::now()->format('Y-m-d'),
|
||||||
|
])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
|
||||||
<x-leenooks::form.file name="file" icon="fa-file" label="Invoice File"/>
|
@include('adminlte::widget.form_file',[
|
||||||
|
'label'=>'Invoice File',
|
||||||
|
'icon'=>'fas fa-file',
|
||||||
|
'id'=>'file',
|
||||||
|
'name'=>'file',
|
||||||
|
])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="col-12">
|
||||||
<div class="col">
|
@can('wholesaler')
|
||||||
<x-leenooks::button.reset/>
|
<button type="submit" name="submit" class="btn btn-success mr-0 float-right">@if ($site->exists)Save @else Add @endif</button>
|
||||||
<x-leenooks::button.submit class="float-right">Save</x-leenooks::button.submit>
|
@endcan
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
<!-- $cso=Cost::class -->
|
<!-- $o = Cost::class -->
|
||||||
@extends('adminlte::layouts.app')
|
@extends('adminlte::layouts.app')
|
||||||
|
|
||||||
@section('htmlheader_title')
|
@section('htmlheader_title')
|
||||||
Cost #{{ $cso->id }}
|
Cost #{{ $o->id }}
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('contentheader_title')
|
@section('contentheader_title')
|
||||||
Cost #{{ $cso->id }}
|
Cost #{{ $o->id }}
|
||||||
@endsection
|
@endsection
|
||||||
@section('contentheader_description')
|
@section('contentheader_description')
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
<!-- $o = App\Models\Costs -->
|
||||||
@php($cost = 0)
|
@php($cost = 0)
|
||||||
@php($charge = 0)
|
@php($charge = 0)
|
||||||
@section('main-content')
|
@section('main-content')
|
||||||
@ -38,57 +39,96 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
<!-- Broadband -->
|
<!-- Broadband -->
|
||||||
@foreach ($cso->broadbands->groupBy('service_broadband_id') as $oo)
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Broadband</td>
|
<td>Broadband</td>
|
||||||
|
<td> </td>
|
||||||
|
<td> </td>
|
||||||
|
<td>{{ $o->broadbands->min('start_at')->format('Y-m-d') }}</td>
|
||||||
|
<td>{{ $o->broadbands->max('end_at')->format('Y-m-d') }}</td>
|
||||||
|
<td class="text-right">${{ number_format($a=$o->broadbands->sum('base'),2) }}</td>
|
||||||
|
<td class="text-right">${{ number_format($o->broadbands->sum('excess'),2) }}</td>
|
||||||
|
<td class="text-right">${{ number_format($x=$o->broadbands->sum('cost'),2) }}</td>
|
||||||
|
<td class="text-right">${{ number_format($b=$o->broadbands->sum('service.billing_monthly_price'),2) }}</td>
|
||||||
|
<td class="text-right {{ $b-$a < 0 ? 'text-danger' : '' }}">${{ number_format($b-$a,2) }}</td>
|
||||||
|
</tr>
|
||||||
|
@php($cost += $x)
|
||||||
|
@php($charge += $b)
|
||||||
|
|
||||||
|
@foreach ($o->broadbands->groupBy('service_broadband_id') as $oo)
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
<td>{{ $oo->first()->service->name }}</td>
|
<td>{{ $oo->first()->service->name }}</td>
|
||||||
<td>{{ $oo->first()->service->active ? 'YES' : 'NO' }}</td>
|
<td>{{ $oo->first()->service->active ? 'YES' : 'NO' }}</td>
|
||||||
<td>{{ $oo->min('start_at')->format('Y-m-d') }}</td>
|
<td>{{ $oo->min('start_at')->format('Y-m-d') }}</td>
|
||||||
<td>{{ $oo->max('end_at')->format('Y-m-d') }}</td>
|
<td>{{ $oo->max('end_at')->format('Y-m-d') }}</td>
|
||||||
<td class="text-right">${{ number_format($a=$oo->sum('base'),2) }}</td>
|
<td class="text-right">${{ number_format($a=$oo->sum('base'),2) }}</td>
|
||||||
<td class="text-right">${{ number_format($oo->sum('excess'),2) }}</td>
|
<td class="text-right">${{ number_format($oo->sum('excess'),2) }}</td>
|
||||||
<td class="text-right">${{ number_format($x=$oo->sum('cost'),2) }}</td>
|
<td class="text-right">${{ number_format($oo->sum('cost'),2) }}</td>
|
||||||
<td class="text-right">${{ number_format($b=$oo->first()->service->billing_charge_normalised,2) }}</td>
|
<td class="text-right">${{ number_format($b=$oo->first()->service->billing_monthly_price,2) }}</td>
|
||||||
<td class="text-right {{ $b-$a < 0 ? 'text-danger' : '' }}">${{ number_format($b-$a,2) }}</td>
|
<td class="text-right {{ $b-$a < 0 ? 'text-danger' : '' }}">${{ number_format($b-$a,2) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@php($cost += $x)
|
|
||||||
@php($charge += $b)
|
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
<!-- Phone -->
|
<!-- Phone -->
|
||||||
@foreach ($cso->phones->groupBy('service_phone_id') as $oo)
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Phone</td>
|
<td>Phone</td>
|
||||||
|
<td> </td>
|
||||||
|
<td> </td>
|
||||||
|
<td>{{ $o->phones->min('start_at')->format('Y-m-d') }}</td>
|
||||||
|
<td>{{ $o->phones->max('end_at')->format('Y-m-d') }}</td>
|
||||||
|
<td class="text-right">${{ number_format($a=$o->phones->sum('base'),2) }}</td>
|
||||||
|
<td class="text-right">${{ number_format($o->phones->sum('excess'),2) }}</td>
|
||||||
|
<td class="text-right">${{ number_format($x=$o->phones->sum('cost'),2) }}</td>
|
||||||
|
<td class="text-right">${{ number_format($b=$o->phones->sum('service.billing_monthly_price'),2) }}</td>
|
||||||
|
<td class="text-right {{ $b-$a < 0 ? 'text-danger' : '' }}">${{ number_format($b-$a,2) }}</td>
|
||||||
|
</tr>
|
||||||
|
@php($cost += $x)
|
||||||
|
@php($charge += $b)
|
||||||
|
|
||||||
|
@foreach ($o->phones->groupBy('service_phone_id') as $oo)
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
<td>{{ $oo->first()->service->name }}</td>
|
<td>{{ $oo->first()->service->name }}</td>
|
||||||
<td>{{ $oo->first()->service->active ? 'YES' : 'NO' }}</td>
|
<td>{{ $oo->first()->service->active ? 'YES' : 'NO' }}</td>
|
||||||
<td>{{ $oo->min('start_at')->format('Y-m-d') }}</td>
|
<td>{{ $oo->min('start_at')->format('Y-m-d') }}</td>
|
||||||
<td>{{ $oo->max('end_at')->format('Y-m-d') }}</td>
|
<td>{{ $oo->max('end_at')->format('Y-m-d') }}</td>
|
||||||
<td class="text-right">${{ number_format($a=$oo->sum('base'),2) }}</td>
|
<td class="text-right">${{ number_format($a=$oo->sum('base'),2) }}</td>
|
||||||
<td class="text-right">${{ number_format($oo->sum('excess'),2) }}</td>
|
<td class="text-right">${{ number_format($oo->sum('excess'),2) }}</td>
|
||||||
<td class="text-right">${{ number_format($x=$oo->sum('cost'),2) }}</td>
|
<td class="text-right">${{ number_format($oo->sum('cost'),2) }}</td>
|
||||||
<td class="text-right">${{ number_format($b=$oo->first()->service->billing_charge_normalised,2) }}</td>
|
<td class="text-right">${{ number_format($b=$oo->first()->service->billing_monthly_price,2) }}</td>
|
||||||
<td class="text-right {{ $b-$a < 0 ? 'text-danger' : '' }}">${{ number_format($b-$a,2) }}</td>
|
<td class="text-right {{ $b-$a < 0 ? 'text-danger' : '' }}">${{ number_format($b-$a,2) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@php($cost += $x)
|
|
||||||
@php($charge += $b)
|
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
<!-- Generic -->
|
<!-- Generic -->
|
||||||
@foreach ($cso->generics->groupBy('service_generic_id') as $oo)
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Generic</td>
|
<td>Generic</td>
|
||||||
<td>{{ ($xx=$oo->first()->service) ? $xx->name : '-' }}</td>
|
<td> </td>
|
||||||
<td>{{ $xx ? ($xx->active ? 'YES' : 'NO') : '-' }}</td>
|
<td> </td>
|
||||||
|
<td>{{ ($x=$o->generics)->count() ? $x->min('start_at')->format('Y-m-d') : '-' }}</td>
|
||||||
|
<td>{{ $x->count() ? $x->max('end_at')->format('Y-m-d') : '-' }}</td>
|
||||||
|
<td class="text-right">${{ number_format($a=$o->generics->sum('base'),2) }}</td>
|
||||||
|
<td class="text-right">${{ number_format($o->generics->sum('excess'),2) }}</td>
|
||||||
|
<td class="text-right">${{ number_format($x=$o->generics->sum('cost'),2) }}</td>
|
||||||
|
<td class="text-right">$0.00</td>
|
||||||
|
<td class="text-right {{ 0-$a < 0 ? 'text-danger' : '' }}">${{ number_format(0-$a,2) }}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
@php($cost += $x)
|
||||||
|
|
||||||
|
@foreach ($o->generics->groupBy('service_generic_id') as $oo)
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
<td>{{ ($x=$oo->first()->service) ? $x->name : '-' }}</td>
|
||||||
|
<td>{{ $x ? ($x->active ? 'YES' : 'NO') : '-' }}</td>
|
||||||
<td>{{ $oo->min('start_at')->format('Y-m-d') }}</td>
|
<td>{{ $oo->min('start_at')->format('Y-m-d') }}</td>
|
||||||
<td>{{ $oo->max('end_at')->format('Y-m-d') }}</td>
|
<td>{{ $oo->max('end_at')->format('Y-m-d') }}</td>
|
||||||
<td class="text-right">${{ number_format($a=$oo->sum('base'),2) }}</td>
|
<td class="text-right">${{ number_format($a=$oo->sum('base'),2) }}</td>
|
||||||
<td class="text-right">${{ number_format($oo->sum('excess'),2) }}</td>
|
<td class="text-right">${{ number_format($oo->sum('excess'),2) }}</td>
|
||||||
<td class="text-right">${{ number_format($x=$oo->sum('cost'),2) }}</td>
|
<td class="text-right">${{ number_format($oo->sum('cost'),2) }}</td>
|
||||||
<td class="text-right">${{ number_format($b=($xx ? $xx->billing_monthly_price : 0),2) }}</td>
|
<td class="text-right">${{ number_format($b=$x ? $x->billing_monthly_price : 0,2) }}</td>
|
||||||
<td class="text-right {{ $b-$a < 0 ? 'text-danger' : '' }}">${{ number_format($b-$a,2) }}</td>
|
<td class="text-right {{ $b-$a < 0 ? 'text-danger' : '' }}">${{ number_format($b-$a,2) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@php($cost += $x)
|
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -107,33 +147,18 @@
|
|||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@pa(datatables,rowgroup)
|
|
||||||
|
|
||||||
@section('page-scripts')
|
@section('page-scripts')
|
||||||
<script>
|
@css(datatables,bootstrap4|rowgroup)
|
||||||
function sum(data) {
|
@js(datatables,bootstrap4|rowgroup)
|
||||||
return parseFloat(data.reduce((a,b)=>a+parseFloat(b.toString().replace(/\$/,'')),0)).toFixed(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#table').DataTable({
|
$('#table').DataTable({
|
||||||
order: [[0,'asc'],[1,'desc']],
|
order: [[0,'asc'],[1,'desc']],
|
||||||
rowGroup: {
|
|
||||||
dataSrc: 0,
|
|
||||||
startRender: function (rows,group) {
|
|
||||||
var allRows = rows.rows().data().filter(function(value) {
|
|
||||||
return value[0] === group;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return $('<tr/>')
|
$('tbody').on('click','tr', function () {
|
||||||
.append('<td colspan="5">Totals for <strong>'+group+'</strong></td>')
|
$(this).toggleClass('selected');
|
||||||
.append('<td class="text-right">$'+sum(allRows.pluck(5))+'</td>')
|
|
||||||
.append('<td class="text-right">$'+sum(allRows.pluck(6))+'</td>')
|
|
||||||
.append('<td class="text-right">$'+sum(allRows.pluck(7))+'</td>')
|
|
||||||
.append('<td class="text-right">$'+sum(allRows.pluck(8))+'</td>')
|
|
||||||
.append('<td class="text-right">$'+sum(allRows.pluck(9))+'</td>');
|
|
||||||
},
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,9 +1,24 @@
|
|||||||
<!-- $spo=Supplier::class -->
|
<!-- $o = Supplier::class -->
|
||||||
@use(App\Models\Cost)
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<x-leenooks::form.select name="cost_id" icon="fa-list" label="Supplier Invoice" helper="Supplier invoice" addnew="Add New" :options="Cost::where('supplier_id',$spo->id)->orderBy('billed_at','DESC')->get()->map(fn($item,$key)=>['id'=>$item->id,'value'=>sprintf('%s: $%s',$item->billed_at->format('Y-m-d'),number_format($item->total,2))])"/>
|
<div class="form-group has-validation">
|
||||||
|
<label for="cost_id">Supplier Invoice</label>
|
||||||
|
<select class="form-control form-control-border" id="cost_id" name="cost_id">
|
||||||
|
<option value=""></option>
|
||||||
|
<option value="">Add New</option>
|
||||||
|
@foreach(\App\Models\Cost::where('supplier_id',$o->id)->orderBy('billed_at','DESC')->get() as $oo)
|
||||||
|
<option value="{{ $oo->id }}">{{ $oo->billed_at->format('Y-m-d') }}: ${{ number_format($oo->total,2) }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
@error('name')
|
||||||
|
{{ $message }}
|
||||||
|
@else
|
||||||
|
Date is required.
|
||||||
|
@enderror
|
||||||
|
</span>
|
||||||
|
<span class="input-helper">Suppliers Invoice</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -12,7 +27,7 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#cost_id')
|
$('#cost_id')
|
||||||
.on('change',function(item) {
|
.on('change',function(item) {
|
||||||
window.location.href = '{{ url('a/supplier/cost') }}/'+(item.target.value !== 'new' ? item.target.value : 'new/'+{{ $spo->id }});
|
window.location.href = '{{ url('a/supplier/cost') }}/'+(item.target.value ? item.target.value : 'new/'+{{ $o->id }});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -102,12 +102,10 @@ Route::group(['middleware'=>['auth','role:wholesaler'],'prefix'=>'a'],function()
|
|||||||
|
|
||||||
// Supplier Setup
|
// Supplier Setup
|
||||||
Route::view('supplier','theme.backend.adminlte.supplier.home');
|
Route::view('supplier','theme.backend.adminlte.supplier.home');
|
||||||
Route::view('supplier/cost/new/{spo}','theme.backend.adminlte.supplier.cost.add')
|
Route::get('supplier/cost/new/{o}',[SupplierController::class,'cost_add']);
|
||||||
->where('spo','[0-9]+');
|
Route::post('supplier/cost/new/{o}',[SupplierController::class,'cost_submit']);
|
||||||
Route::post('supplier/cost/new/{spo}',[SupplierController::class,'cost_submit'])
|
Route::get('supplier/cost/{o}',[SupplierController::class,'cost'])
|
||||||
->where('spo','[0-9]+');
|
->where('o','[0-9]+');
|
||||||
Route::view('supplier/cost/{cso}','theme.backend.adminlte.supplier.cost.view')
|
|
||||||
->where('cso','[0-9]+');
|
|
||||||
Route::view('supplier/details/{spo}','theme.backend.adminlte.supplier.details')
|
Route::view('supplier/details/{spo}','theme.backend.adminlte.supplier.details')
|
||||||
->where('spo','[0-9]+');
|
->where('spo','[0-9]+');
|
||||||
Route::post('supplier/details/{o?}',[SupplierController::class,'addedit'])
|
Route::post('supplier/details/{o?}',[SupplierController::class,'addedit'])
|
||||||
@ -125,8 +123,8 @@ Route::group(['middleware'=>['auth','role:wholesaler'],'prefix'=>'a'],function()
|
|||||||
->whereIn('type',Supplier::offeringTypeKeys()->toArray())
|
->whereIn('type',Supplier::offeringTypeKeys()->toArray())
|
||||||
->where('oo','[0-9]+');
|
->where('oo','[0-9]+');
|
||||||
|
|
||||||
Route::view('report/accounts','theme.backend.adminlte.account.report');
|
Route::get('report/accounts',[ReportController::class,'accounts']);
|
||||||
Route::view('report/products','theme.backend.adminlte.product.report');
|
Route::get('report/products',[ReportController::class,'products']);
|
||||||
Route::view('report/services','theme.backend.adminlte.service.report');
|
Route::view('report/services','theme.backend.adminlte.service.report');
|
||||||
|
|
||||||
// Services
|
// Services
|
||||||
|
Loading…
Reference in New Issue
Block a user