1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-03-18 12:10:17 +01:00

Fix parziale

This commit is contained in:
Thomas Zilio 2018-10-26 19:33:45 +02:00
parent 362764cf18
commit fac977bc12
5 changed files with 114 additions and 72 deletions
modules
anagrafiche/plugins
articoli
primanota
stati_intervento
templates/contratti_cons

@ -50,7 +50,7 @@ echo '
</div>';
// Preventivi
$rsi = $dbo->fetchArray('SELECT co_preventivi.id AS idpreventivo, data_accettazione AS data, ragione_sociale, budget FROM co_preventivi INNER JOIN an_anagrafiche ON co_preventivi.idanagrafica=an_anagrafiche.idanagrafica WHERE co_preventivi.idanagrafica='.prepare($id_record));
$rsi = $dbo->fetchArray('SELECT co_preventivi.id AS idpreventivo, data_accettazione AS data, ragione_sociale, budget FROM co_preventivi INNER JOIN an_anagrafiche ON co_preventivi.idanagrafica=an_anagrafiche.idanagrafica WHERE co_preventivi.idanagrafica='.prepare($id_record).' AND default_revision = 1');
$totale_preventivi = 0;
$data_start = strtotime('now');

@ -18,11 +18,11 @@ unset($_SESSION['superselect']['id_categoria']);
</div>
<div class="col-md-6">
{[ "type": "select", "label": "<?php echo tr('Inserisci la categoria:'); ?>", "name": "categoria", "required": 1, "ajax-source": "categorie", "icon-after": "add|<?php echo Modules::get('Categorie')['id']; ?>" ]}
{[ "type": "select", "label": "<?php echo tr('Inserisci la categoria:'); ?>", "name": "categoria", "required": 1, "ajax-source": "categorie", "icon-after": "add|<?php echo Modules::get('Categorie articoli')['id']; ?>" ]}
</div>
<div class="col-md-6">
{[ "type": "select", "label": "<?php echo tr('Inserisci la sottocategoria:'); ?>", "name": "subcategoria", "id": "subcategoria_add", "ajax-source": "sottocategorie", "icon-after": "add|<?php echo Modules::get('Categorie')['id']; ?>||hide" ]}
{[ "type": "select", "label": "<?php echo tr('Inserisci la sottocategoria:'); ?>", "name": "subcategoria", "id": "subcategoria_add", "ajax-source": "sottocategorie", "icon-after": "add|<?php echo Modules::get('Categorie articoli')['id']; ?>||hide" ]}
</div>
</div>

@ -306,7 +306,7 @@ switch (post('op')) {
$dbo->query("UPDATE co_preventivi SET idstato=(SELECT id FROM co_statipreventivi WHERE descrizione='In attesa di pagamento') WHERE id=".prepare($rs[$i]['idpreventivo']));
// Aggiorno anche lo stato degli interventi collegati ai preventivi
$dbo->query("UPDATE in_interventi SET idstatointervento=(SELECT idstatointervento FROM in_statiintervento WHERE descrizione='Completato') WHERE idpreventivo=".prepare($rs[$i]['idpreventivo']));
$dbo->query("UPDATE in_interventi SET idstatointervento=(SELECT idstatointervento FROM in_statiintervento WHERE descrizione='Completato') WHERE id_preventivo=".prepare($rs[$i]['idpreventivo']));
}
// Aggiorno lo stato degli interventi collegati alla fattura se ce ne sono

@ -9,7 +9,7 @@ switch (post('op')) {
'colore' => post('colore'),
'completato' => post('completato'),
'notifica' => post('notifica'),
'id_email' => post('email'),
'id_email' => post('email') ?: null,
'destinatari' => post('destinatari'),
], ['idstatointervento' => $id_record]);

@ -112,7 +112,10 @@ if (!empty($interventi)) {
<td class="text-center">
'.Translator::numberToLocale($int['km']).'
</td>
</td>';
if ($options['pricing']) {
echo '
<td class="text-center">
'.Translator::numberToLocale($int['sconto']).' &euro;
@ -120,7 +123,14 @@ if (!empty($interventi)) {
<td class="text-center">
'.Translator::numberToLocale($int['subtotale']).' &euro;
</td>
</td>';
} else {
echo '
<td class="text-center">-</td>
<td class="text-center">-</td>';
}
echo '
</tr>';
// Calcolo il totale delle ore lavorate
@ -162,7 +172,10 @@ if (!empty($interventi)) {
<td class="text-center">
<b>'.Translator::numberToLocale($km).'</b>
</td>
</td>';
if ($options['pricing']) {
echo '
<td class="text-center">
<b>'.Translator::numberToLocale($sconto_int).' &euro;</b>
@ -170,7 +183,14 @@ if (!empty($interventi)) {
<th class="text-center">
<b>'.Translator::numberToLocale($totale_int).' &euro;</b>
</th>
</th>';
} else {
echo '
<td class="text-center">-</td>
<td class="text-center">-</td>';
}
echo '
</tr>';
echo '
@ -247,6 +267,7 @@ if (!empty($interventi)) {
'.Translator::numberToLocale($r['qta'], 'qta').' '.$r['um'].'
</td>';
if ($options['pricing']) {
// Prezzo unitario
echo "
<td class='text-center'>
@ -286,7 +307,15 @@ if (!empty($interventi)) {
}
echo '
</td>
</td>';
} else {
echo '
<td class="text-center">-</td>
<td class="text-center">-</td>';
}
echo '
</tr>';
$sconto_art[] = $r['sconto'];
@ -305,6 +334,7 @@ if (!empty($interventi)) {
$imponibile[] = $imponibile_art;
// Totale spesa articoli
if ($options['pricing']) {
echo '
<tr>
<td colspan="2" class="text-right">
@ -315,6 +345,7 @@ if (!empty($interventi)) {
<b>'.Translator::numberToLocale($totale_art).' &euro;</b>
</th>
</tr>';
}
echo '
</table>';
@ -384,6 +415,7 @@ if (!empty($interventi)) {
'.Translator::numberToLocale($r['qta'], 'qta').' '.$r['um'].'
</td>';
if ($options['pricing']) {
// Prezzo unitario
echo "
<td class='text-center'>
@ -423,7 +455,14 @@ if (!empty($interventi)) {
}
echo '
</td>
</td>';
} else {
echo '
<td class="text-center">-</td>
<td class="text-center">-</td>';
}
echo '
</tr>';
$sconto_spese[] = $r['sconto'];
@ -472,15 +511,17 @@ $totale_ore = $rs[0]['totale_ore'];
$rapporto = $budget - $totale;
//pulisco da informazioni irrilevanti (imponibile,iva)
$show = false;
// Totale imponibile
echo '
<table class="table table-bordered" style="display:none;">';
if ($show) {
echo ' <tr>
if ($options['pricing']) {
// Pulisco da informazioni irrilevanti (imponibile,iva)
$show = false;
if ($show) {
echo '
<tr>
<td colspan="3" class="text-right border-top" >
<b>'.tr('Imponibile', [], ['upper' => true]).':</b>
</td>
@ -535,10 +576,10 @@ if ($show) {
</tr>';
//$totale = sum($totale, $iva);
}
}
// TOTALE
echo '
// TOTALE
echo '
<tr>
<td colspan="3" class="text-right border-top">
<b>'.tr('Totale consuntivo (no IVA)', [], ['upper' => true]).':</b>
@ -548,8 +589,8 @@ echo '
</th>
</tr>';
// BUDGET
echo '
// BUDGET
echo '
<tr>
<td colspan="3" class="text-right border-top">
<b>'.tr('Budget (no IVA)', [], ['upper' => true]).':</b>
@ -559,8 +600,8 @@ echo '
</th>
</tr>';
// RAPPORTO
echo '
// RAPPORTO
echo '
<tr>
<td colspan="3" class="text-right border-top">
<b>'.tr('Rapporto budget/spesa (no IVA)', [], ['upper' => true]).':</b>
@ -569,6 +610,7 @@ echo '
<b>'.Translator::numberToLocale($rapporto).' &euro;</b>
</th>
</tr>';
}
// ORE RESIDUE
if (!empty($totale_ore)) {