Fix calcolo ore intervento + controlli per tempo standard tipi intervento

This commit is contained in:
Luca 2018-05-24 19:08:25 +02:00
parent 4d7c0c2d3e
commit 8985560ca1
4 changed files with 11 additions and 7 deletions

View File

@ -79,8 +79,12 @@ switch (post('op')) {
$orario_fine = post('orario_fine')[$idriga];
$km = post('km')[$idriga];
$ore = post('ore')[$idriga];
//$ore = post('ore')[$idriga];
//per sicurezza ricalcolo ore lavorate da php
$diff = date_diff(date_create($orario_inizio), date_create($orario_fine));
$ore = ($diff->h + ($diff->i / 60));
// Lettura tariffe in base al tipo di intervento ed al tecnico
$idtipointervento_tecnico = $post['idtipointerventot'][$idriga];
$rs = $dbo->fetchArray('SELECT * FROM in_interventi_tecnici WHERE idtecnico='.prepare($post['idtecnico'][$idriga]).' AND idintervento='.prepare($id_record));

View File

@ -13,8 +13,8 @@ switch (post('op')) {
$costo_km_tecnico = post('costo_km_tecnico');
$costo_diritto_chiamata_tecnico = post('costo_diritto_chiamata_tecnico');
$tempo_standard = (empty(post('tempo_standard'))) ? 'NULL' : prepare(post('tempo_standard'));
$tempo_standard = (empty(post('tempo_standard'))) ? 'NULL' : prepare(round((force_decimal($_POST['tempo_standard'])*2),1)/2);
$query = 'UPDATE in_tipiintervento SET'.
' descrizione='.prepare($descrizione).','.
' costo_orario='.prepare($costo_orario).','.
@ -35,7 +35,7 @@ switch (post('op')) {
$idtipointervento = post('idtipointervento');
$descrizione = post('descrizione');
$tempo_standard = (empty(post('tempo_standard'))) ? 'NULL' : prepare(post('tempo_standard'));
$tempo_standard = (empty(post('tempo_standard'))) ? 'NULL' : prepare(round((force_decimal($_POST['tempo_standard'])*2),1)/2);
$query = 'INSERT INTO in_tipiintervento(idtipointervento, descrizione, costo_orario, costo_km, tempo_standard) VALUES ('.prepare($idtipointervento).', '.prepare($descrizione).', 0.00, 0.00, '.$tempo_standard.')';
$dbo->query($query);

View File

@ -17,7 +17,7 @@ include_once __DIR__.'/../../core.php';
</div>
<div class="col-md-2">
{[ "type": "number", "label": "<small><?php echo tr('Tempo standard'); ?></small>", "name": "tempo_standard", "help": "<?php echo tr('Valore compreso tra 0,25 - 24 ore. <br><small>Esempi: <em><ul><li>60 minuti = 1 ora</li><li>30 minuti = 0,5 ore</li><li>15 minuti = 0,25 ore</li></ul></em></small>'); ?>", "maxlength": 4, "min-value": "undefined", "max-value": "24", "class": "text-center", "value": "$tempo_standard$", "icon-after": "ore" ]}
{[ "type": "number", "label": "<small><?php echo tr('Tempo standard'); ?></small>", "name": "tempo_standard", "help": "<?php echo tr('Valore compreso tra 0,25 - 24 ore. <br><small>Esempi: <em><ul><li>60 minuti = 1 ora</li><li>30 minuti = 0,5 ore</li><li>15 minuti = 0,25 ore</li></ul></em></small>'); ?>", "maxlength": 5, "min-value": "0", "max-value": "24", "class": "text-center", "value": "$tempo_standard$", "icon-after": "ore" ]}
</div>
</div>

View File

@ -17,7 +17,7 @@ include_once __DIR__.'/../../core.php';
</div>
<div class="col-md-2">
{[ "type": "number", "label": "<?php echo tr('Tempo standard'); ?>", "name": "tempo_standard", "help": "<?php echo tr('Valore compreso tra 0,25 - 24 ore. <br><small>Esempi: <em><ul><li>60 minuti = 1 ora</li><li>30 minuti = 0,5 ore</li><li>15 minuti = 0,25 ore</li></ul></em></small>'); ?>", "maxlength": 4, "min-value": "undefined", "max-value": "24", "class": "text-center", "value": "$tempo_standard$", "icon-after": "ore" ]}
{[ "type": "number", "label": "<?php echo tr('Tempo standard'); ?>", "name": "tempo_standard", "help": "<?php echo tr('Valore compreso tra 0,25 - 24 ore. <br><small>Esempi: <em><ul><li>60 minuti = 1 ora</li><li>30 minuti = 0,5 ore</li><li>15 minuti = 0,25 ore</li></ul></em></small>'); ?>", "maxlength": 5, "min-value": "0", "max-value": "24", "class": "text-center", "value": "$tempo_standard$", "icon-after": "ore" ]}
</div>
</div>