2018-09-03 16:31:15 +02:00
|
|
|
<?php
|
2020-09-07 15:04:06 +02:00
|
|
|
/*
|
|
|
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
|
|
|
* Copyright (C) DevCode s.n.c.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2018-09-03 16:31:15 +02:00
|
|
|
|
|
|
|
// Informazioni aggiuntive per Fatture
|
2018-09-26 12:06:24 +02:00
|
|
|
if ($module['name'] != 'Fatture di acquisto' && $module['name'] != 'Fatture di vendita') {
|
|
|
|
return;
|
|
|
|
}
|
2018-09-03 16:31:15 +02:00
|
|
|
|
2018-09-26 12:06:24 +02:00
|
|
|
if ($options['dir'] == 'entrata') {
|
2019-01-30 16:42:28 +01:00
|
|
|
$show_rivalsa = ((setting('Percentuale rivalsa') != '') or (!empty($result['idrivalsainps'])));
|
|
|
|
$show_ritenuta_acconto = ((setting("Percentuale ritenuta d'acconto") != '') or (!empty($result['idritenutaacconto'])));
|
2018-09-26 15:37:46 +02:00
|
|
|
$show_ritenuta_acconto |= !empty($options['id_ritenuta_acconto_predefined']);
|
2018-09-26 12:06:24 +02:00
|
|
|
} else {
|
2019-01-30 16:42:28 +01:00
|
|
|
$show_rivalsa = 1;
|
2018-09-26 12:06:24 +02:00
|
|
|
$show_ritenuta_acconto = 1;
|
|
|
|
}
|
2018-09-03 16:31:15 +02:00
|
|
|
|
2019-01-22 15:07:09 +01:00
|
|
|
// Percentuale rivalsa e Percentuale ritenuta d'acconto
|
2018-09-26 12:06:24 +02:00
|
|
|
if ($options['action'] == 'edit') {
|
|
|
|
$id_rivalsa_inps = $result['idrivalsainps'];
|
|
|
|
$id_ritenuta_acconto = $result['idritenutaacconto'];
|
2018-12-29 11:15:34 +01:00
|
|
|
$calcolo_ritenuta_acconto = $result['calcolo_ritenuta_acconto'];
|
2018-09-26 12:06:24 +02:00
|
|
|
} elseif ($options['action'] == 'add') {
|
|
|
|
// Fattura di acquisto
|
|
|
|
if ($options['dir'] == 'uscita') {
|
|
|
|
// TODO: Luca S. questi campi non dovrebbero essere definiti all'interno della scheda fornitore?
|
|
|
|
$id_rivalsa_inps = '';
|
|
|
|
$id_ritenuta_acconto = '';
|
2018-09-03 16:31:15 +02:00
|
|
|
}
|
2018-09-26 12:06:24 +02:00
|
|
|
// Fattura di vendita
|
|
|
|
elseif ($options['dir'] == 'entrata') {
|
|
|
|
// Caso particolare per aggiunta articolo
|
2019-01-22 15:07:09 +01:00
|
|
|
$id_rivalsa_inps = ($options['op'] == 'addarticolo') ? '' : setting('Percentuale rivalsa');
|
2018-09-03 16:31:15 +02:00
|
|
|
|
2018-09-26 15:37:46 +02:00
|
|
|
$id_ritenuta_acconto = $options['id_ritenuta_acconto_predefined'] ?: setting("Percentuale ritenuta d'acconto");
|
2018-09-26 12:06:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-26 15:37:46 +02:00
|
|
|
$calcolo_ritenuta_acconto = $calcolo_ritenuta_acconto ?: setting("Metodologia calcolo ritenuta d'acconto predefinito");
|
|
|
|
|
2019-01-30 16:42:28 +01:00
|
|
|
if ($show_rivalsa == 1 || $show_ritenuta_acconto == 1) {
|
2018-09-26 15:37:46 +02:00
|
|
|
echo '
|
2018-09-03 16:31:15 +02:00
|
|
|
<div class="row">';
|
|
|
|
|
2018-09-26 15:37:46 +02:00
|
|
|
// Rivalsa INPS
|
2019-01-30 16:42:28 +01:00
|
|
|
if ($show_rivalsa == 1) {
|
2018-09-26 15:37:46 +02:00
|
|
|
echo '
|
2018-09-03 16:31:15 +02:00
|
|
|
<div class="col-md-4">
|
2019-04-14 00:19:01 +02:00
|
|
|
{[ "type": "select", "label": "'.tr('Rivalsa').'", "name": "id_rivalsa_inps", "value": "'.$id_rivalsa_inps.'", "values": "query=SELECT * FROM co_rivalse", "help": "'.(($options['dir'] == 'entrata') ? setting('Tipo Cassa Previdenziale') : null).'" ]}
|
2018-09-03 16:31:15 +02:00
|
|
|
</div>';
|
2018-09-26 15:37:46 +02:00
|
|
|
}
|
2018-09-03 16:31:15 +02:00
|
|
|
|
2018-09-26 15:37:46 +02:00
|
|
|
// Ritenuta d'acconto
|
|
|
|
if ($show_ritenuta_acconto == 1) {
|
|
|
|
echo '
|
2018-09-03 16:31:15 +02:00
|
|
|
<div class="col-md-4">
|
2018-09-26 15:37:46 +02:00
|
|
|
{[ "type": "select", "label": "'.tr("Ritenuta d'acconto").'", "name": "id_ritenuta_acconto", "value": "'.$id_ritenuta_acconto.'", "values": "query=SELECT * FROM co_ritenutaacconto" ]}
|
2018-09-03 16:31:15 +02:00
|
|
|
</div>';
|
2018-09-26 15:37:46 +02:00
|
|
|
}
|
2018-09-03 16:31:15 +02:00
|
|
|
|
2018-09-26 15:37:46 +02:00
|
|
|
// Calcola ritenuta d'acconto su
|
2020-01-22 11:46:08 +01:00
|
|
|
if ($show_ritenuta_acconto == 1) {
|
2018-09-26 15:37:46 +02:00
|
|
|
echo '
|
2018-09-03 16:31:15 +02:00
|
|
|
<div class="col-md-4">
|
2019-01-22 15:07:09 +01:00
|
|
|
{[ "type": "select", "label": "'.tr("Calcola ritenuta d'acconto su").'", "name": "calcolo_ritenuta_acconto", "value": "'.$calcolo_ritenuta_acconto.'", "values": "list=\"IMP\":\"Imponibile\", \"IMP+RIV\":\"Imponibile + rivalsa\"", "required": "1" ]}
|
2018-09-03 16:31:15 +02:00
|
|
|
</div>';
|
2018-09-26 15:37:46 +02:00
|
|
|
}
|
2018-09-03 16:31:15 +02:00
|
|
|
|
2018-09-26 15:37:46 +02:00
|
|
|
echo '
|
2018-09-03 16:31:15 +02:00
|
|
|
</div>';
|
2018-09-26 15:37:46 +02:00
|
|
|
}
|
2018-09-03 16:31:15 +02:00
|
|
|
|
2019-02-15 12:12:44 +01:00
|
|
|
if (!empty($options['show-ritenuta-contributi']) || empty($options['hide_conto'])) {
|
|
|
|
$width = !empty($options['show-ritenuta-contributi']) && empty($options['hide_conto']) ? 6 : 12;
|
|
|
|
|
2018-09-03 16:31:15 +02:00
|
|
|
echo '
|
2019-02-15 12:12:44 +01:00
|
|
|
<div class="row">';
|
|
|
|
|
|
|
|
// Ritenuta contributi
|
|
|
|
if (!empty($options['show-ritenuta-contributi'])) {
|
|
|
|
echo '
|
|
|
|
<div class="col-md-'.$width.'">
|
|
|
|
{[ "type": "checkbox", "label": "'.tr('Ritenuta contributi').'", "name": "ritenuta_contributi", "value": "'.$result['ritenuta_contributi'].'" ]}
|
|
|
|
</div>';
|
|
|
|
}
|
|
|
|
|
|
|
|
// Conto
|
|
|
|
if (empty($options['hide_conto'])) {
|
|
|
|
echo '
|
|
|
|
<div class="col-md-'.$width.'">
|
|
|
|
{[ "type": "select", "label": "'.tr('Conto').'", "name": "idconto", "required": 1, "value": "'.$result['idconto'].'", "ajax-source": "'.$options['conti'].'" ]}
|
2018-09-03 16:31:15 +02:00
|
|
|
</div>';
|
2019-02-15 12:12:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
|
|
|
</div>';
|
2018-09-26 15:37:46 +02:00
|
|
|
}
|