mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-16 19:40:44 +01:00
Gestione margine/ricarico
This commit is contained in:
parent
d85de431ee
commit
a06746774c
@ -83,12 +83,13 @@ if ($options['dir'] == 'entrata') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var guadagno = prezzo - sconto - provvigione - costo_unitario;
|
var guadagno = prezzo - sconto - provvigione - costo_unitario;
|
||||||
var margine = (((prezzo - sconto) * 100) / (costo_unitario + provvigione)) - 100;
|
var ricarico = (((prezzo - sconto) / costo_unitario) - 1) * 100;
|
||||||
var parent = $("#costo_unitario").closest("div").parent();
|
var margine = (1 - (costo_unitario / (prezzo - sconto))) * 100; var parent = $("#costo_unitario").closest("div").parent();
|
||||||
var div = $(".margine");
|
var div = $(".margine");
|
||||||
var mediaponderata = 0;
|
var mediaponderata = 0;
|
||||||
|
|
||||||
margine = isNaN(margine) || !isFinite(margine) ? 0: margine; // Fix per magine NaN
|
margine = isNaN(margine) || !isFinite(margine) ? 0: margine; // Fix per magine NaN
|
||||||
|
ricarico = isNaN(ricarico) || !isFinite(ricarico) ? 0: ricarico; // Fix per ricarico NaN
|
||||||
|
|
||||||
if ($("#idarticolo").val()) {
|
if ($("#idarticolo").val()) {
|
||||||
mediaponderata = parseFloat($("#idarticolo").selectData().media_ponderata);
|
mediaponderata = parseFloat($("#idarticolo").selectData().media_ponderata);
|
||||||
@ -117,6 +118,17 @@ if ($options['dir'] == 'entrata') {
|
|||||||
<small> %<small>\
|
<small> %<small>\
|
||||||
</td>\
|
</td>\
|
||||||
</tr>\
|
</tr>\
|
||||||
|
<tr>\
|
||||||
|
<td>\
|
||||||
|
<small> '.tr('Ricarico').':</small>\
|
||||||
|
</td>\
|
||||||
|
<td align=\"right\">\
|
||||||
|
<small>" + ricarico.toLocale() + "<small>\
|
||||||
|
</td>\
|
||||||
|
<td align=\"center\">\
|
||||||
|
<small> %<small>\
|
||||||
|
</td>\
|
||||||
|
</tr>\
|
||||||
<tr>\
|
<tr>\
|
||||||
<td>\
|
<td>\
|
||||||
<small> '.tr('Costo medio').':</small>\
|
<small> '.tr('Costo medio').':</small>\
|
||||||
|
@ -336,12 +336,14 @@ if (empty($totale_ore_contratto)) {
|
|||||||
<th width="10%">'.tr('Ore').'</th>
|
<th width="10%">'.tr('Ore').'</th>
|
||||||
<th width="16%">'.tr('Costo').'</th>
|
<th width="16%">'.tr('Costo').'</th>
|
||||||
<th width="16%">'.tr('Ricavo').'</th>
|
<th width="16%">'.tr('Ricavo').'</th>
|
||||||
<th width="23%">'.tr('Margine').'</th>
|
<th width="10%">'.tr('Margine').'</th>
|
||||||
|
<th width="10%">'.tr('Ricarico').'</th>
|
||||||
</tr>';
|
</tr>';
|
||||||
ksort($tipologie);
|
ksort($tipologie);
|
||||||
foreach ($tipologie as $key => $tipologia){
|
foreach ($tipologie as $key => $tipologia){
|
||||||
$margine = $tipologia['ricavo'] - $tipologia['costo'];
|
$margine = $tipologia['ricavo'] - $tipologia['costo'];
|
||||||
$margine_prc = ($tipologia['ricavo'] && $tipologia['costo']) ? (int)((($tipologia['ricavo'] / $tipologia['costo']) - 1) * 100) : 100;
|
$margine_prc = (int)(1 - ($tipologia['costo'] / $tipologia['ricavo'])) * 100;
|
||||||
|
$ricarico_prc = ($tipologia['ricavo'] && $tipologia['costo']) ? (int)((($tipologia['ricavo'] / $tipologia['costo']) - 1) * 100) : 100;
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td>'.$key.'</td>
|
<td>'.$key.'</td>
|
||||||
@ -349,6 +351,7 @@ if (empty($totale_ore_contratto)) {
|
|||||||
<td class="text-right">'.Translator::numberToLocale($tipologia['costo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($tipologia['costo']).' €</td>
|
||||||
<td class="text-right">'.Translator::numberToLocale($tipologia['ricavo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($tipologia['ricavo']).' €</td>
|
||||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||||
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
@ -359,16 +362,18 @@ if (empty($totale_ore_contratto)) {
|
|||||||
<table class="table text-left table-striped table-bordered">
|
<table class="table text-left table-striped table-bordered">
|
||||||
<tr>
|
<tr>
|
||||||
<th>'.tr('Tecnici').'</th>
|
<th>'.tr('Tecnici').'</th>
|
||||||
<th width="10%">'.tr('Ore').'</th>
|
|
||||||
<th width="7%">'.tr('km').'</th>
|
<th width="7%">'.tr('km').'</th>
|
||||||
|
<th width="10%">'.tr('Ore').'</th>
|
||||||
<th width="16%">'.tr('Costo').'</th>
|
<th width="16%">'.tr('Costo').'</th>
|
||||||
<th width="16%">'.tr('Ricavo').'</th>
|
<th width="16%">'.tr('Ricavo').'</th>
|
||||||
<th width="23%">'.tr('Margine').'</th>
|
<th width="10%">'.tr('Margine').'</th>
|
||||||
|
<th width="10%">'.tr('Ricarico').'</th>
|
||||||
</tr>';
|
</tr>';
|
||||||
ksort($tecnici);
|
ksort($tecnici);
|
||||||
foreach ($tecnici as $key => $tecnico){
|
foreach ($tecnici as $key => $tecnico){
|
||||||
$margine = $tecnico['ricavo'] - $tecnico['costo'];
|
$margine = $tecnico['ricavo'] - $tecnico['costo'];
|
||||||
$margine_prc = ($tecnico['ricavo'] && $tecnico['costo']) ? (int)((($tecnico['ricavo'] / $tecnico['costo']) - 1) * 100) : 100;
|
$margine_prc = (int)(1 - ($tecnico['costo'] / $tecnico['ricavo'])) * 100;
|
||||||
|
$ricarico_prc = ($tecnico['ricavo'] && $tecnico['costo']) ? (int)((($tecnico['ricavo'] / $tecnico['costo']) - 1) * 100) : 100;
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td>'.$key.'</td>
|
<td>'.$key.'</td>
|
||||||
@ -377,6 +382,7 @@ if (empty($totale_ore_contratto)) {
|
|||||||
<td class="text-right">'.Translator::numberToLocale($tecnico['costo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($tecnico['costo']).' €</td>
|
||||||
<td class="text-right">'.Translator::numberToLocale($tecnico['ricavo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($tecnico['ricavo']).' €</td>
|
||||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||||
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
@ -392,12 +398,14 @@ if (empty($totale_ore_contratto)) {
|
|||||||
<th width="10%">'.tr('Ore').'</th>
|
<th width="10%">'.tr('Ore').'</th>
|
||||||
<th width="16%">'.tr('Costo').'</th>
|
<th width="16%">'.tr('Costo').'</th>
|
||||||
<th width="16%">'.tr('Ricavo').'</th>
|
<th width="16%">'.tr('Ricavo').'</th>
|
||||||
<th width="23%">'.tr('Margine').'</th>
|
<th width="10%">'.tr('Margine').'</th>
|
||||||
|
<th width="10%">'.tr('Ricarico').'</th>
|
||||||
</tr>';
|
</tr>';
|
||||||
ksort($stati_intervento);
|
ksort($stati_intervento);
|
||||||
foreach ($stati_intervento as $key => $stato){
|
foreach ($stati_intervento as $key => $stato){
|
||||||
$margine = $stato['ricavo'] - $stato['costo'];
|
$margine = $stato['ricavo'] - $stato['costo'];
|
||||||
$margine_prc = ($stato['ricavo'] && $stato['costo']) ? (int)((($stato['ricavo'] / $stato['costo']) - 1) * 100) : 100;
|
$margine_prc = (int)(1 - ($stato['costo'] / $stato['ricavo'])) * 100;
|
||||||
|
$ricarico_prc = ($stato['ricavo'] && $stato['costo']) ? (int)((($stato['ricavo'] / $stato['costo']) - 1) * 100) : 100;
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td><div class="img-circle" style="width:18px; height:18px; position:relative; bottom:-2px; background:'.$stato['colore'].'; float:left;"></div> '.$key.'</td>
|
<td><div class="img-circle" style="width:18px; height:18px; position:relative; bottom:-2px; background:'.$stato['colore'].'; float:left;"></div> '.$key.'</td>
|
||||||
@ -405,6 +413,7 @@ if (empty($totale_ore_contratto)) {
|
|||||||
<td class="text-right">'.Translator::numberToLocale($stato['costo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($stato['costo']).' €</td>
|
||||||
<td class="text-right">'.Translator::numberToLocale($stato['ricavo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($stato['ricavo']).' €</td>
|
||||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||||
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
@ -418,14 +427,16 @@ if (empty($totale_ore_contratto)) {
|
|||||||
<th width="8%">'.tr('Qtà').'</th>
|
<th width="8%">'.tr('Qtà').'</th>
|
||||||
<th width="16%">'.tr('Costo').'</th>
|
<th width="16%">'.tr('Costo').'</th>
|
||||||
<th width="16%">'.tr('Ricavo').'</th>
|
<th width="16%">'.tr('Ricavo').'</th>
|
||||||
<th width="23%">'.tr('Margine').'</th>
|
<th width="10%">'.tr('Margine').'</th>
|
||||||
|
<th width="10%">'.tr('Ricarico').'</th>
|
||||||
</tr>';
|
</tr>';
|
||||||
ksort($materiali_art);
|
ksort($materiali_art);
|
||||||
foreach ($materiali_art as $key => $materiali_array1){
|
foreach ($materiali_art as $key => $materiali_array1){
|
||||||
foreach ($materiali_array1 as $materiali_array2){
|
foreach ($materiali_array1 as $materiali_array2){
|
||||||
foreach ($materiali_array2 as $materiale){
|
foreach ($materiali_array2 as $materiale){
|
||||||
$margine = $materiale['ricavo'] - $materiale['costo'];
|
$margine = $materiale['ricavo'] - $materiale['costo'];
|
||||||
$margine_prc = ($materiale['ricavo'] && $materiale['costo']) ? (int)((($materiale['ricavo'] / $materiale['costo']) - 1) * 100) : 100;
|
$margine_prc = (int)(1 - ($materiale['costo'] / $materiale['ricavo'])) * 100;
|
||||||
|
$ricarico_prc = ($materiale['ricavo'] && $materiale['costo']) ? (int)((($materiale['ricavo'] / $materiale['costo']) - 1) * 100) : 100;
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td>'.Modules::link('Articoli', $materiale['id'], $key).'</td>
|
<td>'.Modules::link('Articoli', $materiale['id'], $key).'</td>
|
||||||
@ -433,6 +444,7 @@ if (empty($totale_ore_contratto)) {
|
|||||||
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' €</td>
|
||||||
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' €</td>
|
||||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||||
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -441,7 +453,8 @@ if (empty($totale_ore_contratto)) {
|
|||||||
ksort($materiali_righe);
|
ksort($materiali_righe);
|
||||||
foreach ($materiali_righe as $key => $materiale){
|
foreach ($materiali_righe as $key => $materiale){
|
||||||
$margine = $materiale['ricavo'] - $materiale['costo'];
|
$margine = $materiale['ricavo'] - $materiale['costo'];
|
||||||
$margine_prc = ($materiale['ricavo'] && $materiale['costo']) ? (int)((($materiale['ricavo'] / $materiale['costo']) - 1) * 100) : 100;
|
$margine_prc = (int)(1 - ($materiale['costo'] / $materiale['ricavo'])) * 100;
|
||||||
|
$ricarico_prc = ($materiale['ricavo'] && $materiale['costo']) ? (int)((($materiale['ricavo'] / $materiale['costo']) - 1) * 100) : 100;
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td>'.$key.'</td>
|
<td>'.$key.'</td>
|
||||||
@ -449,6 +462,7 @@ if (empty($totale_ore_contratto)) {
|
|||||||
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' €</td>
|
||||||
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' €</td>
|
||||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||||
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
|
@ -404,6 +404,16 @@ class Sessione extends Model
|
|||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function getMarginePercentualeAttribute()
|
public function getMarginePercentualeAttribute()
|
||||||
|
{
|
||||||
|
return (1 - ($this->spesa / ($this->totale_imponibile))) * 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restituisce il ricarico percentuale del documento.
|
||||||
|
*
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public function getRicaricoPercentualeAttribute()
|
||||||
{
|
{
|
||||||
return $this->imponibile ? (($this->imponibile / $this->spesa) - 1) * 100 : 100;
|
return $this->imponibile ? (($this->imponibile / $this->spesa) - 1) * 100 : 100;
|
||||||
}
|
}
|
||||||
|
@ -282,12 +282,14 @@ if ($diff > 0) {
|
|||||||
<th width="10%">'.tr('Ore').'</th>
|
<th width="10%">'.tr('Ore').'</th>
|
||||||
<th width="16%">'.tr('Costo').'</th>
|
<th width="16%">'.tr('Costo').'</th>
|
||||||
<th width="16%">'.tr('Ricavo').'</th>
|
<th width="16%">'.tr('Ricavo').'</th>
|
||||||
<th width="23%">'.tr('Margine').'</th>
|
<th width="10%">'.tr('Margine').'</th>
|
||||||
|
<th width="10%">'.tr('Ricarico').'</th>
|
||||||
</tr>';
|
</tr>';
|
||||||
ksort($tipologie);
|
ksort($tipologie);
|
||||||
foreach ($tipologie as $key => $tipologia){
|
foreach ($tipologie as $key => $tipologia){
|
||||||
$margine = $tipologia['ricavo'] - $tipologia['costo'];
|
$margine = $tipologia['ricavo'] - $tipologia['costo'];
|
||||||
$margine_prc = ($tipologia['ricavo'] && $tipologia['costo']) ? (int)((($tipologia['ricavo'] / $tipologia['costo']) - 1) * 100) : 100;
|
$margine_prc = (int)(1 - ($tipologia['costo'] / $tipologia['ricavo'])) * 100;
|
||||||
|
$ricarico_prc = ($tipologia['ricavo'] && $tipologia['costo']) ? (int)((($tipologia['ricavo'] / $tipologia['costo']) - 1) * 100) : 100;
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td>'.$key.'</td>
|
<td>'.$key.'</td>
|
||||||
@ -295,6 +297,7 @@ if ($diff > 0) {
|
|||||||
<td class="text-right">'.Translator::numberToLocale($tipologia['costo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($tipologia['costo']).' €</td>
|
||||||
<td class="text-right">'.Translator::numberToLocale($tipologia['ricavo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($tipologia['ricavo']).' €</td>
|
||||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||||
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
@ -305,16 +308,18 @@ if ($diff > 0) {
|
|||||||
<table class="table text-left table-striped table-bordered">
|
<table class="table text-left table-striped table-bordered">
|
||||||
<tr>
|
<tr>
|
||||||
<th>'.tr('Tecnici').'</th>
|
<th>'.tr('Tecnici').'</th>
|
||||||
<th width="10%">'.tr('Ore').'</th>
|
|
||||||
<th width="7%">'.tr('km').'</th>
|
<th width="7%">'.tr('km').'</th>
|
||||||
|
<th width="10%">'.tr('Ore').'</th>
|
||||||
<th width="16%">'.tr('Costo').'</th>
|
<th width="16%">'.tr('Costo').'</th>
|
||||||
<th width="16%">'.tr('Ricavo').'</th>
|
<th width="16%">'.tr('Ricavo').'</th>
|
||||||
<th width="23%">'.tr('Margine').'</th>
|
<th width="10%">'.tr('Margine').'</th>
|
||||||
|
<th width="10%">'.tr('Ricarico').'</th>
|
||||||
</tr>';
|
</tr>';
|
||||||
ksort($tecnici);
|
ksort($tecnici);
|
||||||
foreach ($tecnici as $key => $tecnico){
|
foreach ($tecnici as $key => $tecnico){
|
||||||
$margine = $tecnico['ricavo'] - $tecnico['costo'];
|
$margine = $tecnico['ricavo'] - $tecnico['costo'];
|
||||||
$margine_prc = ($tecnico['ricavo'] && $tecnico['costo']) ? (int)((($tecnico['ricavo'] / $tecnico['costo']) - 1) * 100) : 100;
|
$margine_prc = (int)(1 - ($tecnico['costo'] / $tecnico['ricavo'])) * 100;
|
||||||
|
$ricarico_prc = ($tecnico['ricavo'] && $tecnico['costo']) ? (int)((($tecnico['ricavo'] / $tecnico['costo']) - 1) * 100) : 100;
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td>'.$key.'</td>
|
<td>'.$key.'</td>
|
||||||
@ -323,6 +328,7 @@ if ($diff > 0) {
|
|||||||
<td class="text-right">'.Translator::numberToLocale($tecnico['costo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($tecnico['costo']).' €</td>
|
||||||
<td class="text-right">'.Translator::numberToLocale($tecnico['ricavo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($tecnico['ricavo']).' €</td>
|
||||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||||
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
@ -338,12 +344,14 @@ if ($diff > 0) {
|
|||||||
<th width="10%">'.tr('Ore').'</th>
|
<th width="10%">'.tr('Ore').'</th>
|
||||||
<th width="16%">'.tr('Costo').'</th>
|
<th width="16%">'.tr('Costo').'</th>
|
||||||
<th width="16%">'.tr('Ricavo').'</th>
|
<th width="16%">'.tr('Ricavo').'</th>
|
||||||
<th width="23%">'.tr('Margine').'</th>
|
<th width="10%">'.tr('Margine').'</th>
|
||||||
|
<th width="10%">'.tr('Ricarico').'</th>
|
||||||
</tr>';
|
</tr>';
|
||||||
ksort($stati_intervento);
|
ksort($stati_intervento);
|
||||||
foreach ($stati_intervento as $key => $stato){
|
foreach ($stati_intervento as $key => $stato){
|
||||||
$margine = $stato['ricavo'] - $stato['costo'];
|
$margine = $stato['ricavo'] - $stato['costo'];
|
||||||
$margine_prc = ($stato['ricavo'] && $stato['costo']) ? (int)((($stato['ricavo'] / $stato['costo']) - 1) * 100) : 100;
|
$margine_prc = (int)(1 - ($stato['costo'] / $stato['ricavo'])) * 100;
|
||||||
|
$ricarico_prc = ($stato['ricavo'] && $stato['costo']) ? (int)((($stato['ricavo'] / $stato['costo']) - 1) * 100) : 100;
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td><div class="img-circle" style="width:18px; height:18px; position:relative; bottom:-2px; background:'.$stato['colore'].'; float:left;"></div> '.$key.'</td>
|
<td><div class="img-circle" style="width:18px; height:18px; position:relative; bottom:-2px; background:'.$stato['colore'].'; float:left;"></div> '.$key.'</td>
|
||||||
@ -351,6 +359,7 @@ if ($diff > 0) {
|
|||||||
<td class="text-right">'.Translator::numberToLocale($stato['costo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($stato['costo']).' €</td>
|
||||||
<td class="text-right">'.Translator::numberToLocale($stato['ricavo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($stato['ricavo']).' €</td>
|
||||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||||
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
@ -364,14 +373,16 @@ if ($diff > 0) {
|
|||||||
<th width="8%">'.tr('Qtà').'</th>
|
<th width="8%">'.tr('Qtà').'</th>
|
||||||
<th width="16%">'.tr('Costo').'</th>
|
<th width="16%">'.tr('Costo').'</th>
|
||||||
<th width="16%">'.tr('Ricavo').'</th>
|
<th width="16%">'.tr('Ricavo').'</th>
|
||||||
<th width="23%">'.tr('Margine').'</th>
|
<th width="10%">'.tr('Margine').'</th>
|
||||||
|
<th width="10%">'.tr('Ricarico').'</th>
|
||||||
</tr>';
|
</tr>';
|
||||||
ksort($materiali_art);
|
ksort($materiali_art);
|
||||||
foreach ($materiali_art as $key => $materiali_array1){
|
foreach ($materiali_art as $key => $materiali_array1){
|
||||||
foreach ($materiali_array1 as $materiali_array2){
|
foreach ($materiali_array1 as $materiali_array2){
|
||||||
foreach ($materiali_array2 as $materiale){
|
foreach ($materiali_array2 as $materiale){
|
||||||
$margine = $materiale['ricavo'] - $materiale['costo'];
|
$margine = $materiale['ricavo'] - $materiale['costo'];
|
||||||
$margine_prc = ($materiale['ricavo'] && $materiale['costo']) ? (int)((($materiale['ricavo'] / $materiale['costo']) - 1) * 100) : 100;
|
$margine_prc = (int)(1 - ($materiale['costo'] / $materiale['ricavo'])) * 100;
|
||||||
|
$ricarico_prc = ($materiale['ricavo'] && $materiale['costo']) ? (int)((($materiale['ricavo'] / $materiale['costo']) - 1) * 100) : 100;
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td>'.Modules::link('Articoli', $materiale['id'], $key).'</td>
|
<td>'.Modules::link('Articoli', $materiale['id'], $key).'</td>
|
||||||
@ -379,6 +390,7 @@ if ($diff > 0) {
|
|||||||
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' €</td>
|
||||||
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' €</td>
|
||||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||||
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -387,7 +399,8 @@ if ($diff > 0) {
|
|||||||
ksort($materiali_righe);
|
ksort($materiali_righe);
|
||||||
foreach ($materiali_righe as $key => $materiale){
|
foreach ($materiali_righe as $key => $materiale){
|
||||||
$margine = $materiale['ricavo'] - $materiale['costo'];
|
$margine = $materiale['ricavo'] - $materiale['costo'];
|
||||||
$margine_prc = ($materiale['ricavo'] && $materiale['costo']) ? (int)((($materiale['ricavo'] / $materiale['costo']) - 1) * 100) : 100;
|
$margine_prc = (int)(1 - ($materiale['costo'] / $materiale['ricavo'])) * 100;
|
||||||
|
$ricarico_prc = ($materiale['ricavo'] && $materiale['costo']) ? (int)((($materiale['ricavo'] / $materiale['costo']) - 1) * 100) : 100;
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td>'.$key.'</td>
|
<td>'.$key.'</td>
|
||||||
@ -395,6 +408,7 @@ if ($diff > 0) {
|
|||||||
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' €</td>
|
||||||
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' €</td>
|
||||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||||
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
|
@ -281,12 +281,14 @@ if ($diff > 0) {
|
|||||||
<th width="10%">'.tr('Ore').'</th>
|
<th width="10%">'.tr('Ore').'</th>
|
||||||
<th width="16%">'.tr('Costo').'</th>
|
<th width="16%">'.tr('Costo').'</th>
|
||||||
<th width="16%">'.tr('Ricavo').'</th>
|
<th width="16%">'.tr('Ricavo').'</th>
|
||||||
<th width="23%">'.tr('Margine').'</th>
|
<th width="10%">'.tr('Margine').'</th>
|
||||||
|
<th width="10%">'.tr('Ricarico').'</th>
|
||||||
</tr>';
|
</tr>';
|
||||||
ksort($tipologie);
|
ksort($tipologie);
|
||||||
foreach ($tipologie as $key => $tipologia){
|
foreach ($tipologie as $key => $tipologia){
|
||||||
$margine = $tipologia['ricavo'] - $tipologia['costo'];
|
$margine = $tipologia['ricavo'] - $tipologia['costo'];
|
||||||
$margine_prc = ($tipologia['ricavo'] && $tipologia['costo']) ? (int)((($tipologia['ricavo'] / $tipologia['costo']) - 1) * 100) : 100;
|
$margine_prc = (int)(1 - ($tipologia['costo'] / $tipologia['ricavo'])) * 100;
|
||||||
|
$ricarico_prc = ($tipologia['ricavo'] && $tipologia['costo']) ? (int)((($tipologia['ricavo'] / $tipologia['costo']) - 1) * 100) : 100;
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td>'.$key.'</td>
|
<td>'.$key.'</td>
|
||||||
@ -294,6 +296,7 @@ if ($diff > 0) {
|
|||||||
<td class="text-right">'.Translator::numberToLocale($tipologia['costo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($tipologia['costo']).' €</td>
|
||||||
<td class="text-right">'.Translator::numberToLocale($tipologia['ricavo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($tipologia['ricavo']).' €</td>
|
||||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||||
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
@ -304,16 +307,18 @@ if ($diff > 0) {
|
|||||||
<table class="table text-left table-striped table-bordered">
|
<table class="table text-left table-striped table-bordered">
|
||||||
<tr>
|
<tr>
|
||||||
<th>'.tr('Tecnici').'</th>
|
<th>'.tr('Tecnici').'</th>
|
||||||
<th width="10%">'.tr('Ore').'</th>
|
|
||||||
<th width="7%">'.tr('km').'</th>
|
<th width="7%">'.tr('km').'</th>
|
||||||
|
<th width="10%">'.tr('Ore').'</th>
|
||||||
<th width="16%">'.tr('Costo').'</th>
|
<th width="16%">'.tr('Costo').'</th>
|
||||||
<th width="16%">'.tr('Ricavo').'</th>
|
<th width="16%">'.tr('Ricavo').'</th>
|
||||||
<th width="23%">'.tr('Margine').'</th>
|
<th width="10%">'.tr('Margine').'</th>
|
||||||
|
<th width="10%">'.tr('Ricarico').'</th>
|
||||||
</tr>';
|
</tr>';
|
||||||
ksort($tecnici);
|
ksort($tecnici);
|
||||||
foreach ($tecnici as $key => $tecnico){
|
foreach ($tecnici as $key => $tecnico){
|
||||||
$margine = $tecnico['ricavo'] - $tecnico['costo'];
|
$margine = $tecnico['ricavo'] - $tecnico['costo'];
|
||||||
$margine_prc = ($tecnico['ricavo'] && $tecnico['costo']) ? (int)((($tecnico['ricavo'] / $tecnico['costo']) - 1) * 100) : 100;
|
$margine_prc = (int)(1 - ($tecnico['costo'] / $tecnico['ricavo'])) * 100;
|
||||||
|
$ricarico_prc = ($tecnico['ricavo'] && $tecnico['costo']) ? (int)((($tecnico['ricavo'] / $tecnico['costo']) - 1) * 100) : 100;
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td>'.$key.'</td>
|
<td>'.$key.'</td>
|
||||||
@ -322,6 +327,7 @@ if ($diff > 0) {
|
|||||||
<td class="text-right">'.Translator::numberToLocale($tecnico['costo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($tecnico['costo']).' €</td>
|
||||||
<td class="text-right">'.Translator::numberToLocale($tecnico['ricavo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($tecnico['ricavo']).' €</td>
|
||||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||||
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
@ -337,12 +343,14 @@ if ($diff > 0) {
|
|||||||
<th width="10%">'.tr('Ore').'</th>
|
<th width="10%">'.tr('Ore').'</th>
|
||||||
<th width="16%">'.tr('Costo').'</th>
|
<th width="16%">'.tr('Costo').'</th>
|
||||||
<th width="16%">'.tr('Ricavo').'</th>
|
<th width="16%">'.tr('Ricavo').'</th>
|
||||||
<th width="23%">'.tr('Margine').'</th>
|
<th width="10%">'.tr('Margine').'</th>
|
||||||
|
<th width="10%">'.tr('Ricarico').'</th>
|
||||||
</tr>';
|
</tr>';
|
||||||
ksort($stati_intervento);
|
ksort($stati_intervento);
|
||||||
foreach ($stati_intervento as $key => $stato){
|
foreach ($stati_intervento as $key => $stato){
|
||||||
$margine = $stato['ricavo'] - $stato['costo'];
|
$margine = $stato['ricavo'] - $stato['costo'];
|
||||||
$margine_prc = ($stato['ricavo'] && $stato['costo']) ? (int)((($stato['ricavo'] / $stato['costo']) - 1) * 100) : 100;
|
$margine_prc = (int)(1 - ($stato['costo'] / $stato['ricavo'])) * 100;
|
||||||
|
$ricarico_prc = ($stato['ricavo'] && $stato['costo']) ? (int)((($stato['ricavo'] / $stato['costo']) - 1) * 100) : 100;
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td><div class="img-circle" style="width:18px; height:18px; position:relative; bottom:-2px; background:'.$stato['colore'].'; float:left;"></div> '.$key.'</td>
|
<td><div class="img-circle" style="width:18px; height:18px; position:relative; bottom:-2px; background:'.$stato['colore'].'; float:left;"></div> '.$key.'</td>
|
||||||
@ -350,6 +358,7 @@ if ($diff > 0) {
|
|||||||
<td class="text-right">'.Translator::numberToLocale($stato['costo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($stato['costo']).' €</td>
|
||||||
<td class="text-right">'.Translator::numberToLocale($stato['ricavo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($stato['ricavo']).' €</td>
|
||||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||||
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
@ -363,14 +372,16 @@ if ($diff > 0) {
|
|||||||
<th width="8%">'.tr('Qtà').'</th>
|
<th width="8%">'.tr('Qtà').'</th>
|
||||||
<th width="16%">'.tr('Costo').'</th>
|
<th width="16%">'.tr('Costo').'</th>
|
||||||
<th width="16%">'.tr('Ricavo').'</th>
|
<th width="16%">'.tr('Ricavo').'</th>
|
||||||
<th width="23%">'.tr('Margine').'</th>
|
<th width="10%">'.tr('Margine').'</th>
|
||||||
|
<th width="10%">'.tr('Ricarico').'</th>
|
||||||
</tr>';
|
</tr>';
|
||||||
ksort($materiali_art);
|
ksort($materiali_art);
|
||||||
foreach ($materiali_art as $key => $materiali_array1){
|
foreach ($materiali_art as $key => $materiali_array1){
|
||||||
foreach ($materiali_array1 as $materiali_array2){
|
foreach ($materiali_array1 as $materiali_array2){
|
||||||
foreach ($materiali_array2 as $materiale){
|
foreach ($materiali_array2 as $materiale){
|
||||||
$margine = $materiale['ricavo'] - $materiale['costo'];
|
$margine = $materiale['ricavo'] - $materiale['costo'];
|
||||||
$margine_prc = ($materiale['ricavo'] && $materiale['costo']) ? (int)((($materiale['ricavo'] / $materiale['costo']) - 1) * 100) : 100;
|
$margine_prc = (int)(1 - ($materiale['costo'] / $materiale['ricavo'])) * 100;
|
||||||
|
$ricarico_prc = ($materiale['ricavo'] && $materiale['costo']) ? (int)((($materiale['ricavo'] / $materiale['costo']) - 1) * 100) : 100;
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td>'.Modules::link('Articoli', $materiale['id'], $key).'</td>
|
<td>'.Modules::link('Articoli', $materiale['id'], $key).'</td>
|
||||||
@ -378,6 +389,7 @@ if ($diff > 0) {
|
|||||||
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' €</td>
|
||||||
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' €</td>
|
||||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||||
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -386,7 +398,8 @@ if ($diff > 0) {
|
|||||||
ksort($materiali_righe);
|
ksort($materiali_righe);
|
||||||
foreach ($materiali_righe as $key => $materiale){
|
foreach ($materiali_righe as $key => $materiale){
|
||||||
$margine = $materiale['ricavo'] - $materiale['costo'];
|
$margine = $materiale['ricavo'] - $materiale['costo'];
|
||||||
$margine_prc = ($materiale['ricavo'] && $materiale['costo']) ? (int)((($materiale['ricavo'] / $materiale['costo']) - 1) * 100) : 100;
|
$margine_prc = (int)(1 - ($materiale['costo'] / $materiale['ricavo'])) * 100;
|
||||||
|
$ricarico_prc = ($materiale['ricavo'] && $materiale['costo']) ? (int)((($materiale['ricavo'] / $materiale['costo']) - 1) * 100) : 100;
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td>'.$key.'</td>
|
<td>'.$key.'</td>
|
||||||
@ -394,6 +407,7 @@ if ($diff > 0) {
|
|||||||
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' €</td>
|
||||||
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' €</td>
|
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' €</td>
|
||||||
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$margine_prc.'%)</td>
|
||||||
|
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' € ('.$ricarico_prc.'%)</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
|
@ -306,8 +306,12 @@ if ($totale != $netto_a_pagare) {
|
|||||||
|
|
||||||
// Margine
|
// Margine
|
||||||
$margine = $preventivo->margine;
|
$margine = $preventivo->margine;
|
||||||
$margine_class = ($margine <= 0 and $preventivo->totale > 0) ? 'danger' : 'success';
|
$margine_class = ($margine <= 0 && $preventivo->totale > 0) ? 'danger' : 'success';
|
||||||
$margine_icon = ($margine <= 0 and $preventivo->totale > 0) ? 'warning' : 'check';
|
$margine_icon = ($margine <= 0 && $preventivo->totale > 0) ? 'warning' : 'check';
|
||||||
|
|
||||||
|
// Ricarico
|
||||||
|
$ricarico_class = ($margine <= 0 && $preventivo->totale > 0) ? 'danger' : 'success';
|
||||||
|
$ricarico_icon = ($margine <= 0 && $preventivo->totale > 0) ? 'warning' : 'check';
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
@ -345,6 +349,18 @@ echo '
|
|||||||
<i class="fa fa-'.$margine_icon.' text-'.$margine_class.'"></i> '.moneyFormat($preventivo->margine).'
|
<i class="fa fa-'.$margine_icon.' text-'.$margine_class.'"></i> '.moneyFormat($preventivo->margine).'
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="7" class="text-right">
|
||||||
|
'.tr('Ricarico (_PRC_%)', [
|
||||||
|
'_PRC_' => numberFormat($preventivo->ricarico_percentuale),
|
||||||
|
]).':
|
||||||
|
</td>
|
||||||
|
<td class="text-right" class="'.$ricarico_class.'">
|
||||||
|
<i class="fa fa-'.$ricarico_icon.' text-'.$ricarico_class.'"></i> '.moneyFormat($preventivo->margine).'
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
</tr>';
|
</tr>';
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
|
@ -350,11 +350,21 @@ abstract class Accounting extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restituisce il margine percentuale relativo all'elemento.
|
* Restituisce il margine percentuale del documento.
|
||||||
*
|
*
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function getMarginePercentualeAttribute()
|
public function getMarginePercentualeAttribute()
|
||||||
|
{
|
||||||
|
return (1 - (($this->spesa + $this->provvigione) / ($this->totale_imponibile))) * 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restituisce il ricarico percentuale del documento.
|
||||||
|
*
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public function getRicaricoPercentualeAttribute()
|
||||||
{
|
{
|
||||||
return ($this->totale_imponibile && ($this->spesa || $this->provvigione)) ? (($this->totale_imponibile / ($this->spesa + $this->provvigione)) - 1) * 100 : 100;
|
return ($this->totale_imponibile && ($this->spesa || $this->provvigione)) ? (($this->totale_imponibile / ($this->spesa + $this->provvigione)) - 1) * 100 : 100;
|
||||||
}
|
}
|
||||||
|
@ -236,6 +236,16 @@ abstract class Document extends Model implements ReferenceInterface, DocumentInt
|
|||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function getMarginePercentualeAttribute()
|
public function getMarginePercentualeAttribute()
|
||||||
|
{
|
||||||
|
return (1 - ($this->spesa / ($this->totale_imponibile))) * 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restituisce il ricarico percentuale del documento.
|
||||||
|
*
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public function getRicaricoPercentualeAttribute()
|
||||||
{
|
{
|
||||||
return ($this->totale_imponibile && ($this->spesa || $this->provvigione)) ? (($this->totale_imponibile / ($this->spesa + $this->provvigione)) - 1) * 100 : 100;
|
return ($this->totale_imponibile && ($this->spesa || $this->provvigione)) ? (($this->totale_imponibile / ($this->spesa + $this->provvigione)) - 1) * 100 : 100;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user