mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-16 19:40:44 +01:00
Aggiunta fallback selezione iva su natura
This commit is contained in:
parent
136730a696
commit
b5e99dcfe3
@ -300,9 +300,15 @@ if (!empty($righe)) {
|
||||
|
||||
foreach ($righe as $key => $riga) {
|
||||
$query = "SELECT id, IF(codice IS NULL, descrizione, CONCAT(codice, ' - ', descrizione)) AS descrizione FROM co_iva WHERE deleted_at IS NULL AND percentuale = ".prepare($riga['AliquotaIVA']);
|
||||
$start_query = $query;
|
||||
|
||||
if (!empty($riga['Natura'])) {
|
||||
$query .= ' AND codice_natura_fe = '.prepare($riga['Natura']);
|
||||
|
||||
// Fallback per natura iva mancante
|
||||
if( empty($dbo->fetchArray($query)) ){
|
||||
$query = $start_query;
|
||||
}
|
||||
}
|
||||
|
||||
$query .= ' ORDER BY descrizione ASC';
|
||||
|
Loading…
x
Reference in New Issue
Block a user