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
|
2021-01-20 15:08:51 +01:00
|
|
|
* Copyright (C) DevCode s.r.l.
|
2020-09-07 15:04:06 +02:00
|
|
|
*
|
|
|
|
* 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
|
2024-03-22 17:43:28 +01:00
|
|
|
if ($module->getTranslation('name') != 'Fatture di acquisto' && $module->getTranslation('name') != 'Fatture di vendita') {
|
2018-09-26 12:06:24 +02:00
|
|
|
return;
|
|
|
|
}
|
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
|
2022-01-15 18:21:48 +01:00
|
|
|
$id_rivalsa_inps = ($options['op'] == 'addarticolo') ? '' : setting('Cassa previdenziale predefinita');
|
2018-09-03 16:31:15 +02:00
|
|
|
|
2022-01-15 18:21:48 +01:00
|
|
|
$id_ritenuta_acconto = $options['id_ritenuta_acconto_predefined'] ?: setting("Ritenuta d'acconto predefinita");
|
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");
|
|
|
|
|
2021-07-07 15:00:59 +02:00
|
|
|
echo '
|
2018-09-03 16:31:15 +02:00
|
|
|
<div class="row">';
|
|
|
|
|
2024-01-15 15:30:45 +01:00
|
|
|
// Cassa previdenziale
|
|
|
|
echo '
|
2018-09-03 16:31:15 +02:00
|
|
|
<div class="col-md-4">
|
2022-01-15 18:21:48 +01:00
|
|
|
{[ "type": "select", "label": "'.tr('Cassa previdenziale').'", "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>';
|
|
|
|
|
2024-01-15 15:30:45 +01:00
|
|
|
// Ritenuta d'acconto
|
|
|
|
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>';
|
|
|
|
|
2024-01-15 15:30:45 +01:00
|
|
|
// Calcola ritenuta d'acconto su
|
|
|
|
echo '
|
2018-09-03 16:31:15 +02:00
|
|
|
<div class="col-md-4">
|
2021-07-07 15:00:59 +02: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\""]}
|
2018-09-03 16:31:15 +02:00
|
|
|
</div>';
|
|
|
|
|
2024-01-15 15:30:45 +01:00
|
|
|
echo '
|
2018-09-03 16:31:15 +02:00
|
|
|
</div>';
|
2021-07-07 15:00:59 +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">';
|
|
|
|
|
2022-01-15 18:21:48 +01:00
|
|
|
// Ritenuta previdenziale
|
2019-02-15 12:12:44 +01:00
|
|
|
if (!empty($options['show-ritenuta-contributi'])) {
|
|
|
|
echo '
|
|
|
|
<div class="col-md-'.$width.'">
|
2022-01-15 18:21:48 +01:00
|
|
|
{[ "type": "checkbox", "label": "'.tr('Ritenuta previdenziale').'", "name": "ritenuta_contributi", "value": "'.$result['ritenuta_contributi'].'" ]}
|
2019-02-15 12:12:44 +01:00
|
|
|
</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
|
|
|
}
|
2021-07-07 15:00:59 +02:00
|
|
|
|
|
|
|
echo '
|
|
|
|
<script>
|
|
|
|
$(document).ready(function(){
|
|
|
|
if(input("id_ritenuta_acconto").get()){
|
|
|
|
$("#calcolo_ritenuta_acconto").prop("required", true);
|
|
|
|
} else{
|
|
|
|
$("#calcolo_ritenuta_acconto").prop("required", false);
|
|
|
|
input("calcolo_ritenuta_acconto").set("");
|
|
|
|
}
|
|
|
|
|
|
|
|
$("#id_ritenuta_acconto").on("change", function(){
|
|
|
|
if(input("id_ritenuta_acconto").get()){
|
|
|
|
$("#calcolo_ritenuta_acconto").prop("required", true);
|
|
|
|
|
|
|
|
} else{
|
|
|
|
$("#calcolo_ritenuta_acconto").prop("required", false);
|
|
|
|
input("calcolo_ritenuta_acconto").set("");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2021-07-15 10:58:36 +02:00
|
|
|
</script>';
|