|
| 1 | +@inject('Service', 'App\Service') |
| 2 | + |
1 | 3 | @extends('layouts.app')
|
2 | 4 |
|
3 | 5 | @section('meta_title', 'Report')
|
|
11 | 13 | 'header' => 'Report',
|
12 | 14 | 'subtext' => 'Yearly report of services, clients and categories.'
|
13 | 15 | ])
|
| 16 | + <dl> |
| 17 | + <dt>Date</dt> |
| 18 | + <dd>{{ date('d.m.Y') }}</dd> |
| 19 | + <dt>User</dt> |
| 20 | + <dd>{{ auth()->user()->name }}</dd> |
| 21 | + </dl> |
14 | 22 | </div>
|
15 | 23 | </div>
|
16 | 24 |
|
|
29 | 37 | $total += ($service->cost / 100) * $service->exchange_rate;
|
30 | 38 | }
|
31 | 39 | ?>
|
32 |
| - <span class="badge">{{ number_format($total, 2, ',', '.') }} USD</span> |
| 40 | + <span class="badge">{{ $Service->getSum($services) }}</span> |
33 | 41 | TOTAL INCOME
|
34 | 42 | </li>
|
35 | 43 | <li class="list-group-item">
|
|
51 | 59 | </div>
|
52 | 60 |
|
53 | 61 | <div class="row">
|
54 |
| - <div class="col-md-6"> |
| 62 | + <div class="col-md-6 col-xs-6"> |
55 | 63 | <div class="panel panel-default">
|
56 | 64 | <div class="panel-heading">
|
57 | 65 | <h3 class="panel-title">Categories</h3>
|
|
68 | 76 | <tr>
|
69 | 77 | <td>{{ $category->name }}</td>
|
70 | 78 | <td>{{ $category->services->count() }}</td>
|
71 |
| - <?php |
72 |
| - $total = 0; |
73 |
| - foreach($category->services as $service) { |
74 |
| - $total += ($service->cost / 100) * $service->exchange_rate; |
75 |
| - } |
76 |
| - ?> |
77 |
| - <td class="text-right">{{ number_format($total, 2, ',', '.') }} USD</td> |
| 79 | + <td class="text-right">{{ $Service->getSum($category->services) }}</td> |
78 | 80 | </tr>
|
79 | 81 | @endforeach
|
80 | 82 | </table>
|
81 | 83 | </div>
|
82 | 84 | </div>
|
83 | 85 | </div>
|
84 | 86 | </div>
|
85 |
| - <div class="col-md-6"> |
| 87 | + <div class="col-md-6 col-xs-6"> |
86 | 88 | <div class="panel panel-default">
|
87 | 89 | <div class="panel-heading">
|
88 | 90 | <h3 class="panel-title">Clients</h3>
|
|
99 | 101 | <tr>
|
100 | 102 | <td>{{ $client->name }}</td>
|
101 | 103 | <td>{{ $client->services->count() }}</td>
|
102 |
| - <?php |
103 |
| - $total = 0; |
104 |
| - foreach($client->services as $service) { |
105 |
| - $total += ($service->cost / 100) * $service->exchange_rate; |
106 |
| - } |
107 |
| - ?> |
108 |
| - <td class="text-right">{{ number_format($total, 2, ',', '.') }} USD</td> |
| 104 | + <td class="text-right">{{ $Service->getSum($client->services) }}</td> |
109 | 105 | </tr>
|
110 | 106 | @endforeach
|
111 | 107 | </table>
|
|
120 | 116 |
|
121 | 117 | <div class="panel panel-default">
|
122 | 118 | <div class="panel-heading">
|
123 |
| - <h3 class="panel-title">Services</h3> |
| 119 | + <h3 class="panel-title">Services by month</h3> |
124 | 120 | </div>
|
125 | 121 | <div class="panel-body">
|
126 | 122 | @for($i = 1; $i <= 12; $i++)
|
127 | 123 | @if($services->where('month', $i)->count() > 0)
|
128 | 124 |
|
129 |
| - <?php |
130 |
| - $usd_sum = 0; |
131 |
| - foreach($services->where('month', $i) as $service) { |
132 |
| - $usd_sum+= ($service->cost / 100) * $service->exchange_rate; |
133 |
| - } |
134 |
| - $usd_sum = ceil($usd_sum); |
135 |
| - ?> |
136 |
| - |
137 | 125 | <h3>
|
138 | 126 | {{ date('F', mktime(0, 0, 0, $i)) }}
|
139 | 127 | <small>{{ $i }}</small>
|
140 | 128 | <small class="pull-right" style="margin-top: 15px;">
|
141 |
| - TOTAL {{ number_format($usd_sum, 2, ',', '.') }} USD |
| 129 | + TOTAL {{ $Service->getSumForMonth($i, true) }} |
142 | 130 | </small>
|
143 | 131 | </h3>
|
144 | 132 |
|
|
0 commit comments