Add cost/price/supplierid to service, update service report to show supplerid and overridden costs (if any)
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
<th>ID</th>
|
||||
<th>Service</th>
|
||||
<th>Product</th>
|
||||
<th>Supplier ID</th>
|
||||
<th class="text-right">Monthly</th>
|
||||
<th class="text-right">Cost</th>
|
||||
<th class="text-right">Usage</th>
|
||||
@@ -38,8 +39,9 @@
|
||||
<td><a href="{{ url('u/service',[$o->id]) }}">{{ $o->id }}</a></td>
|
||||
<td>{{ $o->name }}</td>
|
||||
<td>{{ $o->product->name }}</td>
|
||||
<td>{{ $o->supplierid }}</td>
|
||||
<td class="text-right">{{ number_format($o->billing_charge_normalised,2) }}</td>
|
||||
<td class="text-right">{{ number_format($o->product->cost_normalized(),2) }}</td>
|
||||
<td class="text-right">{{ number_format($o->billing_cost_normalised,2) }}</td>
|
||||
<td class="text-right">{{ $o->product->hasUsage() ? number_format($o->type->usage_summary(0)->sum()/1000,1) : '-' }}</td>
|
||||
<td>{{ $o->product->supplier->name }}</td>
|
||||
</tr>
|
||||
@@ -49,6 +51,7 @@
|
||||
<tr>
|
||||
<td></td>
|
||||
<th>TOTAL:</th>
|
||||
<td></td>
|
||||
<td class="text-right"></td>
|
||||
<td class="text-right"></td>
|
||||
<td></td>
|
||||
@@ -101,22 +104,23 @@
|
||||
// Total over all pages
|
||||
let month = rows
|
||||
.data()
|
||||
.pluck(3)
|
||||
.pluck(4)
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
let cost = rows
|
||||
.data()
|
||||
.pluck(4)
|
||||
.pluck(5)
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
let usage = rows
|
||||
.data()
|
||||
.pluck(5)
|
||||
.pluck(6)
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
return $('<tr/>')
|
||||
.append('<td/>')
|
||||
.append('<td><strong>SUB-TOTAL:</strong></td>')
|
||||
.append('<td/>')
|
||||
.append('<td class="text-right"><strong>'+month.toFixed(2)+'</strong></td>')
|
||||
.append('<td class="text-right"><strong>'+cost.toFixed(2)+'</strong></td>')
|
||||
.append('<td class="text-right"><strong>'+usage.toFixed(2)+'</strong></td>')
|
||||
@@ -129,7 +133,7 @@
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
targets: [0,1,3,4,5],
|
||||
targets: [0,1,4,5,6],
|
||||
searchPanes: {
|
||||
show: false,
|
||||
}
|
||||
@@ -163,31 +167,31 @@
|
||||
|
||||
// Total over all pages
|
||||
month = api
|
||||
.column(3,{ search: 'applied' })
|
||||
.data()
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
// Total over this page
|
||||
monthTotal = api
|
||||
.column(3, { page: 'current' })
|
||||
.data()
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
// Total over all pages
|
||||
cost = api
|
||||
.column(4,{ search: 'applied' })
|
||||
.data()
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
// Total over this page
|
||||
costTotal = api
|
||||
monthTotal = api
|
||||
.column(4, { page: 'current' })
|
||||
.data()
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
// Total over all pages
|
||||
cost = api
|
||||
.column(5,{ search: 'applied' })
|
||||
.data()
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
// Total over this page
|
||||
costTotal = api
|
||||
.column(5, { page: 'current' })
|
||||
.data()
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
// Update footer
|
||||
api.column(3).footer().innerHTML = monthTotal.toFixed(2)+'<br><small>('+month.toFixed(2)+')</small>';
|
||||
api.column(4).footer().innerHTML = costTotal.toFixed(2)+'<br><small>('+cost.toFixed(2)+')</small>';
|
||||
api.column(4).footer().innerHTML = monthTotal.toFixed(2)+'<br><small>('+month.toFixed(2)+')</small>';
|
||||
api.column(5).footer().innerHTML = costTotal.toFixed(2)+'<br><small>('+cost.toFixed(2)+')</small>';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user