Correzione avvisi e direzione Confronta prezzi
This commit is contained in:
parent
f6a1be5217
commit
8b289a0eec
|
@ -667,6 +667,7 @@ switch (post('op')) {
|
|||
|
||||
case 'edit-price':
|
||||
$righe = $post['righe'];
|
||||
$numero_totale = 0;
|
||||
|
||||
foreach ($righe as $riga) {
|
||||
if (($riga['id']) != null) {
|
||||
|
@ -676,11 +677,25 @@ switch (post('op')) {
|
|||
$articolo = Articolo::build($fattura, $originale);
|
||||
$articolo->id_dettaglio_fornitore = post('id_dettaglio_fornitore') ?: null;
|
||||
}
|
||||
|
||||
$articolo->setPrezzoUnitario($riga['price'], $articolo->idiva);
|
||||
$articolo->save();
|
||||
|
||||
if ($articolo['prezzo_unitario'] != $riga['price']) {
|
||||
$articolo->setPrezzoUnitario($riga['price'], $articolo->idiva);
|
||||
$articolo->save();
|
||||
++$numero_totale;
|
||||
}
|
||||
}
|
||||
|
||||
if ($numero_totale > 1) {
|
||||
flash()->info(tr('_NUM_ prezzi modificati!', [
|
||||
'_NUM_' => $numero_totale,
|
||||
]));
|
||||
} else if ($numero_totale == 1) {
|
||||
flash()->info(tr('_NUM_ prezzo modificato!', [
|
||||
'_NUM_' => $numero_totale,
|
||||
]));
|
||||
} else {
|
||||
flash()->warning(tr('Nessun prezzo modificato!'));
|
||||
}
|
||||
|
||||
flash()->info(tr('Prezzi aggiornati!'));
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@ include_once __DIR__.'/init.php';
|
|||
|
||||
$block_edit = $record['is_completato'];
|
||||
$righe = $contratto->getRighe();
|
||||
$direzione = $contratto->direzione;
|
||||
$colspan = ($block_edit ? '5' : '6');
|
||||
|
||||
echo '
|
||||
|
@ -325,11 +326,13 @@ if (!$block_edit && sizeof($righe) > 0) {
|
|||
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="elimina_righe" onclick="rimuoviRiga(getSelectData());">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="confronta_righe" onclick="confrontaRighe(getSelectData());">
|
||||
Confronta prezzi
|
||||
</button>
|
||||
</button>';
|
||||
if ($direzione == 'entrata') {
|
||||
echo'
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="confronta_righe" onclick="confrontaRighe(getSelectData());">
|
||||
Confronta prezzi
|
||||
</button>';
|
||||
} echo'
|
||||
</div>';
|
||||
}
|
||||
echo '
|
||||
|
|
|
@ -692,6 +692,7 @@ switch (filter('op')) {
|
|||
|
||||
case 'edit-price':
|
||||
$righe = $post['righe'];
|
||||
$numero_totale = 0;
|
||||
|
||||
foreach ($righe as $riga) {
|
||||
if (($riga['id']) != null) {
|
||||
|
@ -702,14 +703,29 @@ switch (filter('op')) {
|
|||
$articolo->id_dettaglio_fornitore = post('id_dettaglio_fornitore') ?: null;
|
||||
}
|
||||
|
||||
$articolo->setPrezzoUnitario($riga['price'], $articolo->idiva);
|
||||
$articolo->save();
|
||||
if ($articolo['prezzo_unitario'] != $riga['price']) {
|
||||
$articolo->setPrezzoUnitario($riga['price'], $articolo->idiva);
|
||||
$articolo->save();
|
||||
++$numero_totale;
|
||||
}
|
||||
}
|
||||
|
||||
if ($numero_totale > 1) {
|
||||
flash()->info(tr('_NUM_ prezzi modificati!', [
|
||||
'_NUM_' => $numero_totale,
|
||||
]));
|
||||
} else if ($numero_totale == 1) {
|
||||
flash()->info(tr('_NUM_ prezzo modificato!', [
|
||||
'_NUM_' => $numero_totale,
|
||||
]));
|
||||
} else {
|
||||
flash()->warning(tr('Nessun prezzo modificato!'));
|
||||
}
|
||||
|
||||
flash()->info(tr('Prezzi aggiornati!'));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Aggiornamento stato degli ordini presenti in questa fattura in base alle quantità totali evase
|
||||
if (!empty($id_record) && setting('Cambia automaticamente stato ordini fatturati')) {
|
||||
$rs = $dbo->fetchArray('SELECT idordine FROM dt_righe_ddt WHERE idddt='.prepare($id_record).' AND idordine!=0');
|
||||
|
|
|
@ -22,6 +22,7 @@ include_once __DIR__.'/init.php';
|
|||
$block_edit = $record['flag_completato'];
|
||||
$righe = $ddt->getRighe();
|
||||
$colspan = ($block_edit ? '5' : '6');
|
||||
$direzione = $ddt->direzione;
|
||||
|
||||
echo '
|
||||
<div class="table-responsive row-list">
|
||||
|
@ -371,11 +372,13 @@ if (!$block_edit && sizeof($righe) > 0) {
|
|||
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="elimina_righe" onclick="rimuoviRiga(getSelectData());">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="confronta_righe" onclick="confrontaRighe(getSelectData());">
|
||||
Confronta prezzi
|
||||
</button>
|
||||
</button>';
|
||||
if ($dir == 'entrata') {
|
||||
echo'
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="confronta_righe" onclick="confrontaRighe(getSelectData());">
|
||||
Confronta prezzi
|
||||
</button>';
|
||||
} echo'
|
||||
</div>';
|
||||
}
|
||||
echo '
|
||||
|
|
|
@ -1066,6 +1066,7 @@ switch (post('op')) {
|
|||
|
||||
case 'edit-price':
|
||||
$righe = $post['righe'];
|
||||
$numero_totale = 0;
|
||||
|
||||
foreach ($righe as $riga) {
|
||||
if (($riga['id']) != null) {
|
||||
|
@ -1076,11 +1077,25 @@ switch (post('op')) {
|
|||
$articolo->id_dettaglio_fornitore = post('id_dettaglio_fornitore') ?: null;
|
||||
}
|
||||
|
||||
$articolo->setPrezzoUnitario($riga['price'], $articolo->idiva);
|
||||
$articolo->save();
|
||||
if ($articolo['prezzo_unitario'] != $riga['price']) {
|
||||
$articolo->setPrezzoUnitario($riga['price'], $articolo->idiva);
|
||||
$articolo->save();
|
||||
++$numero_totale;
|
||||
}
|
||||
}
|
||||
|
||||
if ($numero_totale > 1) {
|
||||
flash()->info(tr('_NUM_ prezzi modificati!', [
|
||||
'_NUM_' => $numero_totale,
|
||||
]));
|
||||
} else if ($numero_totale == 1) {
|
||||
flash()->info(tr('_NUM_ prezzo modificato!', [
|
||||
'_NUM_' => $numero_totale,
|
||||
]));
|
||||
} else {
|
||||
flash()->warning(tr('Nessun prezzo modificato!'));
|
||||
}
|
||||
|
||||
flash()->info(tr('Prezzi aggiornati!'));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ use Modules\Interventi\Intervento;
|
|||
|
||||
include_once __DIR__.'/init.php';
|
||||
|
||||
$direzione = $fattura->direzione;
|
||||
$block_edit = !empty($note_accredito) || in_array($record['stato'], ['Emessa', 'Pagato', 'Parzialmente pagato']) || !$abilita_genera;
|
||||
$righe = $fattura->getRighe();
|
||||
|
||||
|
@ -505,10 +506,13 @@ if (!$block_edit && sizeof($righe) > 0) {
|
|||
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="elimina_righe" onclick="rimuoviRiga(getSelectData());">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="confronta_righe" onclick="confrontaRighe(getSelectData());">
|
||||
Confronta prezzi
|
||||
</button>
|
||||
</button>';
|
||||
if ($direzione == 'entrata') {
|
||||
echo'
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="confronta_righe" onclick="confrontaRighe(getSelectData());">
|
||||
Confronta prezzi
|
||||
</button>';
|
||||
} echo'
|
||||
</div>';
|
||||
}
|
||||
echo '
|
||||
|
|
|
@ -1160,6 +1160,7 @@ switch (post('op')) {
|
|||
|
||||
case 'edit-price':
|
||||
$righe = $post['righe'];
|
||||
$numero_totale = 0;
|
||||
|
||||
foreach ($righe as $riga) {
|
||||
if (($riga['id']) != null) {
|
||||
|
@ -1170,10 +1171,24 @@ switch (post('op')) {
|
|||
$articolo->id_dettaglio_fornitore = post('id_dettaglio_fornitore') ?: null;
|
||||
}
|
||||
|
||||
$articolo->setPrezzoUnitario($riga['price'], $articolo->idiva);
|
||||
$articolo->save();
|
||||
if ($articolo['prezzo_unitario'] != $riga['price']) {
|
||||
$articolo->setPrezzoUnitario($riga['price'], $articolo->idiva);
|
||||
$articolo->save();
|
||||
++$numero_totale;
|
||||
}
|
||||
}
|
||||
|
||||
if ($numero_totale > 1) {
|
||||
flash()->info(tr('_NUM_ prezzi modificati!', [
|
||||
'_NUM_' => $numero_totale,
|
||||
]));
|
||||
} else if ($numero_totale == 1) {
|
||||
flash()->info(tr('_NUM_ prezzo modificato!', [
|
||||
'_NUM_' => $numero_totale,
|
||||
]));
|
||||
} else {
|
||||
flash()->warning(tr('Nessun prezzo modificato!'));
|
||||
}
|
||||
|
||||
flash()->info(tr('Prezzi aggiornati!'));
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ include_once __DIR__.'/init.php';
|
|||
$block_edit = $record['flag_completato'];
|
||||
$righe = $intervento->getRighe();
|
||||
$colspan = ($block_edit ? '5' : '6');
|
||||
$direzione = $intervento->direzione;
|
||||
|
||||
$show_prezzi = Auth::user()['gruppo'] != 'Tecnici' || (Auth::user()['gruppo'] == 'Tecnici' && setting('Mostra i prezzi al tecnico'));
|
||||
|
||||
|
@ -280,10 +281,13 @@ if (!$block_edit && sizeof($righe) > 0) {
|
|||
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="elimina_righe" onclick="rimuoviRiga(getSelectData());">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="confronta_righe" onclick="confrontaRighe(getSelectData());">
|
||||
Confronta prezzi
|
||||
</button>
|
||||
</button>';
|
||||
if ($direzione == 'entrata') {
|
||||
echo'
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="confronta_righe" onclick="confrontaRighe(getSelectData());">
|
||||
Confronta prezzi
|
||||
</button>';
|
||||
} echo'
|
||||
</div>';
|
||||
}
|
||||
echo '
|
||||
|
|
|
@ -724,7 +724,8 @@ switch (post('op')) {
|
|||
|
||||
case 'edit-price':
|
||||
$righe = $post['righe'];
|
||||
|
||||
$numero_totale = 0;
|
||||
|
||||
foreach ($righe as $riga) {
|
||||
if (($riga['id']) != null) {
|
||||
$articolo = Articolo::find($riga['id']);
|
||||
|
@ -734,10 +735,24 @@ switch (post('op')) {
|
|||
$articolo->id_dettaglio_fornitore = post('id_dettaglio_fornitore') ?: null;
|
||||
}
|
||||
|
||||
$articolo->setPrezzoUnitario($riga['price'], $articolo->idiva);
|
||||
$articolo->save();
|
||||
if ($articolo['prezzo_unitario'] != $riga['price']) {
|
||||
$articolo->setPrezzoUnitario($riga['price'], $articolo->idiva);
|
||||
$articolo->save();
|
||||
++$numero_totale;
|
||||
}
|
||||
}
|
||||
|
||||
if ($numero_totale > 1) {
|
||||
flash()->info(tr('_NUM_ prezzi modificati!', [
|
||||
'_NUM_' => $numero_totale,
|
||||
]));
|
||||
} else if ($numero_totale == 1) {
|
||||
flash()->info(tr('_NUM_ prezzo modificato!', [
|
||||
'_NUM_' => $numero_totale,
|
||||
]));
|
||||
} else {
|
||||
flash()->warning(tr('Nessun prezzo modificato!'));
|
||||
}
|
||||
|
||||
flash()->info(tr('Prezzi aggiornati!'));
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -24,6 +24,7 @@ use Modules\Articoli\Articolo;
|
|||
$block_edit = $record['flag_completato'];
|
||||
$righe = $ordine->getRighe();
|
||||
$colspan = ($block_edit ? '6' : '7');
|
||||
$direzione = $ordine->direzione;
|
||||
|
||||
echo '
|
||||
<div class="table-responsive row-list">
|
||||
|
@ -416,11 +417,13 @@ if (!$block_edit && sizeof($righe) > 0) {
|
|||
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="elimina_righe" onclick="rimuoviRiga(getSelectData());">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="confronta_righe" onclick="confrontaRighe(getSelectData());">
|
||||
Confronta prezzi
|
||||
</button>
|
||||
</button>';
|
||||
if ($direzione == 'entrata') {
|
||||
echo'
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="confronta_righe" onclick="confrontaRighe(getSelectData());">
|
||||
Confronta prezzi
|
||||
</button>';
|
||||
} echo'
|
||||
</div>';
|
||||
}
|
||||
echo '
|
||||
|
|
|
@ -542,7 +542,8 @@ switch (post('op')) {
|
|||
|
||||
case 'edit-price':
|
||||
$righe = $post['righe'];
|
||||
|
||||
$numero_totale = 0;
|
||||
|
||||
foreach ($righe as $riga) {
|
||||
if (($riga['id']) != null) {
|
||||
$articolo = Articolo::find($riga['id']);
|
||||
|
@ -551,12 +552,25 @@ switch (post('op')) {
|
|||
$articolo = Articolo::build($fattura, $originale);
|
||||
$articolo->id_dettaglio_fornitore = post('id_dettaglio_fornitore') ?: null;
|
||||
}
|
||||
|
||||
$articolo->setPrezzoUnitario($riga['price'], $articolo->idiva);
|
||||
$articolo->save();
|
||||
|
||||
if ($articolo['prezzo_unitario'] != $riga['price']) {
|
||||
$articolo->setPrezzoUnitario($riga['price'], $articolo->idiva);
|
||||
$articolo->save();
|
||||
++$numero_totale;
|
||||
}
|
||||
}
|
||||
|
||||
flash()->info(tr('Prezzi aggiornati!'));
|
||||
break;
|
||||
if ($numero_totale > 1) {
|
||||
flash()->info(tr('_NUM_ prezzi modificati!', [
|
||||
'_NUM_' => $numero_totale,
|
||||
]));
|
||||
} else if ($numero_totale == 1) {
|
||||
flash()->info(tr('_NUM_ prezzo modificato!', [
|
||||
'_NUM_' => $numero_totale,
|
||||
]));
|
||||
} else {
|
||||
flash()->warning(tr('Nessun prezzo modificato!'));
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
|
@ -22,6 +22,7 @@ include_once __DIR__.'/init.php';
|
|||
$block_edit = $record['is_completato'];
|
||||
$righe = $preventivo->getRighe();
|
||||
$colspan = ($block_edit ? '6' : '7');
|
||||
$direzione = $preventivo->direzione;
|
||||
|
||||
echo '
|
||||
<div class="table-responsive row-list">
|
||||
|
@ -384,10 +385,13 @@ if (!$block_edit && sizeof($righe) > 0) {
|
|||
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="elimina_righe" onclick="rimuoviRiga(getSelectData());">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="confronta_righe" onclick="confrontaRighe(getSelectData());">
|
||||
Confronta prezzi
|
||||
</button>
|
||||
</button>';
|
||||
if ($direzione == 'entrata') {
|
||||
echo'
|
||||
<button type="button" class="btn btn-xs btn-default disabled" id="confronta_righe" onclick="confrontaRighe(getSelectData());">
|
||||
Confronta prezzi
|
||||
</button>';
|
||||
} echo'
|
||||
</div>';
|
||||
}
|
||||
echo '
|
||||
|
|
Loading…
Reference in New Issue