@extends('adminlte::layouts.app') @section('htmlheader_title') Cost #{{ $o->id }} @endsection @section('contentheader_title') Cost #{{ $o->id }} @endsection @section('contentheader_description') @endsection @php($cost = 0) @php($charge = 0) @section('main-content')
@php($cost += $a) @php($charge += $b) @foreach ($o->broadbands->groupBy('service_broadband_id') as $oo) @endforeach @php($cost += $a) @php($charge += $b) @foreach ($o->phones->groupBy('service_phone_id') as $oo) @endforeach @php($cost += $a) @php($charge += $b) @foreach ($o->generics->groupBy('service_generic_id') as $oo) @endforeach
Category Service Active From To Base Excess Cost Charge Profit
Broadband     {{ $o->broadbands->min('start_at')->format('Y-m-d') }} {{ $o->broadbands->max('end_at')->format('Y-m-d') }} ${{ number_format($a=$o->broadbands->sum('base'),2) }} ${{ number_format($o->broadbands->sum('excess'),2) }} ${{ number_format($o->broadbands->sum('cost'),2) }} ${{ number_format($b=$o->broadbands->sum('service.billing_monthly_price'),2) }} ${{ number_format($b-$a,2) }}
  {{ $oo->first()->service->name }} {{ $oo->first()->service->active ? 'YES' : 'NO' }} {{ $oo->min('start_at')->format('Y-m-d') }} {{ $oo->max('end_at')->format('Y-m-d') }} ${{ number_format($a=$oo->sum('base'),2) }} ${{ number_format($oo->sum('excess'),2) }} ${{ number_format($oo->sum('cost'),2) }} ${{ number_format($b=$oo->first()->service->billing_monthly_price,2) }} ${{ number_format($b-$a,2) }}
Phone     {{ $o->phones->min('start_at')->format('Y-m-d') }} {{ $o->phones->max('end_at')->format('Y-m-d') }} ${{ number_format($a=$o->phones->sum('base'),2) }} ${{ number_format($o->phones->sum('excess'),2) }} ${{ number_format($o->phones->sum('cost'),2) }} ${{ number_format($b=$o->phones->sum('service.billing_monthly_price'),2) }} ${{ number_format($b-$a,2) }}
  {{ $oo->first()->service->name }} {{ $oo->first()->service->active ? 'YES' : 'NO' }} {{ $oo->min('start_at')->format('Y-m-d') }} {{ $oo->max('end_at')->format('Y-m-d') }} ${{ number_format($a=$oo->sum('base'),2) }} ${{ number_format($oo->sum('excess'),2) }} ${{ number_format($oo->sum('cost'),2) }} ${{ number_format($b=$oo->first()->service->billing_monthly_price,2) }} ${{ number_format($b-$a,2) }}
Generic     {{ $o->generics->min('start_at')->format('Y-m-d') }} {{ $o->generics->max('end_at')->format('Y-m-d') }} ${{ number_format($a=$o->generics->sum('base'),2) }} ${{ number_format($o->generics->sum('excess'),2) }} ${{ number_format($o->generics->sum('cost'),2) }} $0.00 ${{ number_format(0-$a,2) }}
  {{ ($x=$oo->first()->service) ? $x->name : '-' }} {{ $x ? ($x->active ? 'YES' : 'NO') : '-' }} {{ $oo->min('start_at')->format('Y-m-d') }} {{ $oo->max('end_at')->format('Y-m-d') }} ${{ number_format($a=$oo->sum('base'),2) }} ${{ number_format($oo->sum('excess'),2) }} ${{ number_format($oo->sum('cost'),2) }} ${{ number_format($b=$x ? $x->billing_monthly_price : 0,2) }} ${{ number_format($b-$a,2) }}
TOTAL ${{ number_format($cost,2) }} ${{ number_format($charge,2) }} ${{ number_format($charge-$cost,2) }}
@endsection @section('page-scripts') @css(datatables,bootstrap4|rowgroup) @js(datatables,bootstrap4|rowgroup) @append