mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-03-18 04:00:12 +01:00
Fix parziale #338
This commit is contained in:
parent
362764cf18
commit
fac977bc12
@ -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']).' €
|
||||
@ -120,7 +123,14 @@ if (!empty($interventi)) {
|
||||
|
||||
<td class="text-center">
|
||||
'.Translator::numberToLocale($int['subtotale']).' €
|
||||
</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).' €</b>
|
||||
@ -170,7 +183,14 @@ if (!empty($interventi)) {
|
||||
|
||||
<th class="text-center">
|
||||
<b>'.Translator::numberToLocale($totale_int).' €</b>
|
||||
</th>
|
||||
</th>';
|
||||
} else {
|
||||
echo '
|
||||
<td class="text-center">-</td>
|
||||
<td class="text-center">-</td>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</tr>';
|
||||
|
||||
echo '
|
||||
@ -247,46 +267,55 @@ if (!empty($interventi)) {
|
||||
'.Translator::numberToLocale($r['qta'], 'qta').' '.$r['um'].'
|
||||
</td>';
|
||||
|
||||
// Prezzo unitario
|
||||
echo "
|
||||
if ($options['pricing']) {
|
||||
// Prezzo unitario
|
||||
echo "
|
||||
<td class='text-center'>
|
||||
".Translator::numberToLocale($r['prezzo_vendita']).' €';
|
||||
|
||||
if ($r['sconto'] > 0) {
|
||||
echo "
|
||||
<br><small class='text-muted'>- ".tr('sconto _TOT_ _TYPE_', [
|
||||
if ($r['sconto'] > 0) {
|
||||
echo "
|
||||
<br><small class='text-muted'>- ".tr('sconto _TOT_ _TYPE_', [
|
||||
'_TOT_' => Translator::numberToLocale($r['sconto_unitario']),
|
||||
'_TYPE_' => ($r['tipo_sconto'] == 'PRC' ? '%' : '€'),
|
||||
]).'</small>';
|
||||
|
||||
if ($count <= 1) {
|
||||
$count += 0.4;
|
||||
if ($count <= 1) {
|
||||
$count += 0.4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
// Netto
|
||||
$netto = $r['prezzo_vendita'] * $r['qta'];
|
||||
echo '
|
||||
// Netto
|
||||
$netto = $r['prezzo_vendita'] * $r['qta'];
|
||||
echo '
|
||||
<td class="text-center">
|
||||
'.Translator::numberToLocale($netto).' €';
|
||||
'.Translator::numberToLocale($netto).' €';
|
||||
|
||||
if ($r['sconto'] > 0) {
|
||||
echo "
|
||||
<br><small class='text-muted'>- ".tr('sconto _TOT_ _TYPE_', [
|
||||
'_TOT_' => Translator::numberToLocale($r['sconto']),
|
||||
'_TYPE_' => '€',
|
||||
]).'</small>';
|
||||
if ($r['sconto'] > 0) {
|
||||
echo "
|
||||
<br><small class='text-muted'>- ".tr('sconto _TOT_ _TYPE_', [
|
||||
'_TOT_' => Translator::numberToLocale($r['sconto']),
|
||||
'_TYPE_' => '€',
|
||||
]).'</small>';
|
||||
|
||||
if ($count <= 1) {
|
||||
$count += 0.4;
|
||||
if ($count <= 1) {
|
||||
$count += 0.4;
|
||||
}
|
||||
}
|
||||
|
||||
echo '
|
||||
</td>';
|
||||
} else {
|
||||
echo '
|
||||
<td class="text-center">-</td>
|
||||
<td class="text-center">-</td>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</td>
|
||||
|
||||
</tr>';
|
||||
|
||||
$sconto_art[] = $r['sconto'];
|
||||
@ -305,7 +334,8 @@ if (!empty($interventi)) {
|
||||
$imponibile[] = $imponibile_art;
|
||||
|
||||
// Totale spesa articoli
|
||||
echo '
|
||||
if ($options['pricing']) {
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="2" class="text-right">
|
||||
<b>'.tr('Totale materiale utilizzato', [], ['upper' => true]).':</b>
|
||||
@ -315,6 +345,7 @@ if (!empty($interventi)) {
|
||||
<b>'.Translator::numberToLocale($totale_art).' €</b>
|
||||
</th>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</table>';
|
||||
@ -384,46 +415,54 @@ if (!empty($interventi)) {
|
||||
'.Translator::numberToLocale($r['qta'], 'qta').' '.$r['um'].'
|
||||
</td>';
|
||||
|
||||
// Prezzo unitario
|
||||
echo "
|
||||
if ($options['pricing']) {
|
||||
// Prezzo unitario
|
||||
echo "
|
||||
<td class='text-center'>
|
||||
".Translator::numberToLocale($r['prezzo_vendita']).' €';
|
||||
|
||||
if ($r['sconto'] > 0) {
|
||||
echo "
|
||||
if ($r['sconto'] > 0) {
|
||||
echo "
|
||||
<br><small class='text-muted'>- ".tr('sconto _TOT_ _TYPE_', [
|
||||
'_TOT_' => Translator::numberToLocale($r['sconto_unitario']),
|
||||
'_TYPE_' => ($r['tipo_sconto'] == 'PRC' ? '%' : '€'),
|
||||
]).'</small>';
|
||||
|
||||
if ($count <= 1) {
|
||||
$count += 0.4;
|
||||
if ($count <= 1) {
|
||||
$count += 0.4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
// Netto
|
||||
$netto = $r['prezzo_vendita'] * $r['qta'];
|
||||
echo '
|
||||
// Netto
|
||||
$netto = $r['prezzo_vendita'] * $r['qta'];
|
||||
echo '
|
||||
<td class="text-center">
|
||||
'.Translator::numberToLocale($netto).' €';
|
||||
|
||||
if ($r['sconto'] > 0) {
|
||||
echo "
|
||||
if ($r['sconto'] > 0) {
|
||||
echo "
|
||||
<br><small class='text-muted'>- ".tr('sconto _TOT_ _TYPE_', [
|
||||
'_TOT_' => Translator::numberToLocale($r['sconto']),
|
||||
'_TYPE_' => '€',
|
||||
]).'</small>';
|
||||
|
||||
if ($count <= 1) {
|
||||
$count += 0.4;
|
||||
if ($count <= 1) {
|
||||
$count += 0.4;
|
||||
}
|
||||
}
|
||||
|
||||
echo '
|
||||
</td>';
|
||||
} else {
|
||||
echo '
|
||||
<td class="text-center">-</td>
|
||||
<td class="text-center">-</td>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</td>
|
||||
</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>
|
||||
@ -490,9 +531,9 @@ if ($show) {
|
||||
</th>
|
||||
</tr>';
|
||||
|
||||
// Eventuale sconto incondizionato
|
||||
if (!empty($sconto)) {
|
||||
echo '
|
||||
// Eventuale sconto incondizionato
|
||||
if (!empty($sconto)) {
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="3" class="text-right border-top">
|
||||
<b>'.tr('Sconto', [], ['upper' => true]).':</b>
|
||||
@ -503,8 +544,8 @@ if ($show) {
|
||||
</th>
|
||||
</tr>';
|
||||
|
||||
// Imponibile scontato
|
||||
echo '
|
||||
// Imponibile scontato
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="3" class="text-right border-top">
|
||||
<b>'.tr('Imponibile scontato', [], ['upper' => true]).':</b>
|
||||
@ -514,14 +555,14 @@ if ($show) {
|
||||
<b>'.Translator::numberToLocale($totale).' €</b>
|
||||
</th>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// IVA
|
||||
$rs = $dbo->fetchArray('SELECT * FROM co_iva WHERE co_iva.id = '.prepare(setting('Iva predefinita')));
|
||||
$percentuale_iva = $rs[0]['percentuale'];
|
||||
$iva = $totale / 100 * $percentuale_iva;
|
||||
// IVA
|
||||
$rs = $dbo->fetchArray('SELECT * FROM co_iva WHERE co_iva.id = '.prepare(setting('Iva predefinita')));
|
||||
$percentuale_iva = $rs[0]['percentuale'];
|
||||
$iva = $totale / 100 * $percentuale_iva;
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="3" class="text-right border-top">
|
||||
<b>'.tr('Iva (_PRC_%)', [
|
||||
@ -534,11 +575,11 @@ if ($show) {
|
||||
</th>
|
||||
</tr>';
|
||||
|
||||
//$totale = sum($totale, $iva);
|
||||
}
|
||||
//$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).' €</b>
|
||||
</th>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
// ORE RESIDUE
|
||||
if (!empty($totale_ore)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user