2019-07-15 16:53:18 +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/>.
|
|
|
|
*/
|
2019-07-15 16:53:18 +02:00
|
|
|
|
2019-07-15 18:34:59 +02:00
|
|
|
include_once __DIR__.'/../../../core.php';
|
|
|
|
|
|
|
|
use Modules\Fatture\Fattura;
|
|
|
|
|
2019-07-15 16:53:18 +02:00
|
|
|
$tipi_cessione_prestazione = [
|
|
|
|
[
|
|
|
|
'id' => 'SC',
|
|
|
|
'text' => 'SC - '.tr('Sconto'),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'id' => 'PR',
|
|
|
|
'text' => 'PR - '.tr('Premio'),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'id' => 'AB',
|
|
|
|
'text' => 'AB - '.tr('Abbuono'),
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'id' => 'AC',
|
|
|
|
'text' => 'AC - '.tr('Spesa accessoria'),
|
|
|
|
],
|
|
|
|
];
|
|
|
|
|
|
|
|
$space = str_repeat(' ', 6);
|
|
|
|
|
2019-07-15 18:34:59 +02:00
|
|
|
$documento = Fattura::find($id_record);
|
|
|
|
|
|
|
|
// Dati della riga
|
2020-07-06 13:19:20 +02:00
|
|
|
$id_riga = get('riga_id');
|
|
|
|
$type = get('riga_type');
|
2020-01-17 17:31:07 +01:00
|
|
|
$riga = $documento->getRiga($type, $id_riga);
|
2019-07-15 18:34:59 +02:00
|
|
|
|
|
|
|
$result = $riga->toArray();
|
|
|
|
$result = array_merge($result, $riga->dati_aggiuntivi_fe);
|
|
|
|
|
2019-07-16 09:50:43 +02:00
|
|
|
echo '
|
|
|
|
<link rel="stylesheet" type="text/css" media="all" href="'.$structure->fileurl('fe/style.css').'"/>';
|
|
|
|
|
2019-07-15 18:34:59 +02:00
|
|
|
echo '
|
|
|
|
<form action="" method="post">
|
|
|
|
<input type="hidden" name="op" value="manage_riga_fe">
|
|
|
|
<input type="hidden" name="backto" value="record-edit">
|
|
|
|
<input type="hidden" name="id_module" value="'.$id_module.'">
|
2019-07-16 10:01:16 +02:00
|
|
|
<input type="hidden" name="id_record" value="'.$id_record.'">
|
|
|
|
<input type="hidden" name="id_riga" value="'.$id_riga.'">';
|
2019-07-15 18:34:59 +02:00
|
|
|
|
2019-07-15 16:53:18 +02:00
|
|
|
echo '
|
|
|
|
<table class="table">
|
|
|
|
<tbody>
|
2019-07-16 09:50:43 +02:00
|
|
|
<tr class="first-level">
|
2019-07-15 18:34:59 +02:00
|
|
|
<th colspan="2">
|
|
|
|
2 FatturaElettronicaBody
|
2019-08-27 16:00:49 +02:00
|
|
|
<!--button type="submit" class="btn btn-primary pull-right">
|
2019-07-15 18:34:59 +02:00
|
|
|
<i class="fa fa-edit"></i> '.tr('Salva').'
|
2019-08-27 16:00:49 +02:00
|
|
|
</button-->
|
2019-07-15 18:34:59 +02:00
|
|
|
</th>
|
2019-07-15 16:53:18 +02:00
|
|
|
</tr>
|
2019-07-16 09:50:43 +02:00
|
|
|
<tr class="second-level">
|
2019-07-15 16:53:18 +02:00
|
|
|
<th colspan="2">'.str_repeat($space, 1).'2.2 DatiBeniServizi</th>
|
|
|
|
</tr>
|
2019-07-16 09:50:43 +02:00
|
|
|
<tr class="third-level">
|
2019-07-15 16:53:18 +02:00
|
|
|
<th colspan="2">'.str_repeat($space, 2).'2.2.1 DettaglioLinee</th>
|
|
|
|
</tr>';
|
|
|
|
|
|
|
|
// Tipo Cessione Prestazione
|
2024-01-15 15:30:45 +01:00
|
|
|
echo '
|
2019-07-16 09:50:43 +02:00
|
|
|
<tr class="fourth-level">
|
2019-07-15 16:53:18 +02:00
|
|
|
<td style="vertical-align: middle;">'.str_repeat($space, 3).'2.2.1.2 TipoCessionePrestazione</td>
|
|
|
|
<td>
|
|
|
|
{[ "type": "select", "name": "tipo_cessione_prestazione", "value": "'.$result['tipo_cessione_prestazione'].'", "values": '.json_encode($tipi_cessione_prestazione).' ]}
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
|
2022-05-20 16:13:55 +02:00
|
|
|
if (empty($riga->isDescrizione())) {
|
|
|
|
$placeholder_tipo = $riga->isArticolo() && !empty($riga->codice) ? 'COD' : '';
|
|
|
|
$placeholder_valore = $riga->isArticolo() && !empty($riga->codice) ? $riga->codice : '';
|
2023-08-04 14:54:28 +02:00
|
|
|
// Codice Articolo
|
|
|
|
echo '
|
2022-05-20 16:13:55 +02:00
|
|
|
<tr class="fourth-level">
|
|
|
|
<th colspan="2" style="vertical-align: middle;">'.str_repeat($space, 3).'2.2.1.3 CodiceArticolo</th>
|
|
|
|
</tr>';
|
|
|
|
|
2023-08-04 14:54:28 +02:00
|
|
|
// Codice tipo articolo
|
|
|
|
echo '
|
2022-05-20 16:13:55 +02:00
|
|
|
<tr class="fifth-level">
|
|
|
|
<td style="vertical-align: middle;">'.str_repeat($space, 5).'2.2.1.3.1 CodiceTipo</td>
|
|
|
|
<td>
|
|
|
|
{[ "type": "text", "name": "codice_tipo", "value": "'.$result['codice_tipo'].'", "placeholder": "'.$placeholder_tipo.'" ]}
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
|
2023-08-04 14:54:28 +02:00
|
|
|
// Codice valore articolo
|
|
|
|
echo '
|
2022-05-20 16:13:55 +02:00
|
|
|
<tr class="fifth-level">
|
|
|
|
<td style="vertical-align: middle;">'.str_repeat($space, 5).'2.2.1.3.2 CodiceValore</td>
|
|
|
|
<td>
|
|
|
|
{[ "type": "text", "name": "codice_valore", "value": "'.$result['codice_valore'].'", "placeholder": "'.$placeholder_valore.'" ]}
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
|
2019-07-15 16:53:18 +02:00
|
|
|
// Data inizio periodo
|
|
|
|
echo '
|
2019-07-16 09:50:43 +02:00
|
|
|
<tr class="fourth-level">
|
2019-07-15 16:53:18 +02:00
|
|
|
<td style="vertical-align: middle;">'.str_repeat($space, 3).'2.2.1.7 DataInizioPeriodo</td>
|
|
|
|
<td>
|
|
|
|
{[ "type": "date", "name": "data_inizio_periodo", "value": "'.$result['data_inizio_periodo'].'" ]}
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
|
|
|
|
// Data fine periodo
|
|
|
|
echo '
|
2019-07-16 09:50:43 +02:00
|
|
|
<tr class="fourth-level">
|
2019-07-15 16:53:18 +02:00
|
|
|
<td style="vertical-align: middle;">'.str_repeat($space, 3).'2.2.1.8 DataFinePeriodo</td>
|
|
|
|
<td>
|
|
|
|
{[ "type": "date", "name": "data_fine_periodo", "value": "'.$result['data_fine_periodo'].'" ]}
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
|
|
|
|
// Riferimento amministrazione
|
|
|
|
echo '
|
2019-07-16 09:50:43 +02:00
|
|
|
<tr class="fourth-level">
|
2019-07-15 16:53:18 +02:00
|
|
|
<td style="vertical-align: middle;">'.str_repeat($space, 3).'2.2.1.15 RiferimentoAmministrazione</td>
|
|
|
|
<td>
|
|
|
|
{[ "type": "text", "name": "riferimento_amministrazione", "value": "'.$result['riferimento_amministrazione'].'", "maxlength": 20 ]}
|
|
|
|
</td>
|
2019-07-16 09:50:43 +02:00
|
|
|
</tr>
|
|
|
|
</tbody>';
|
2019-07-15 16:53:18 +02:00
|
|
|
|
|
|
|
if (empty($result['altri_dati'])) {
|
|
|
|
$result['altri_dati'][] = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
$key = 1;
|
|
|
|
foreach ($result['altri_dati'] as $dato) {
|
2019-07-15 18:34:59 +02:00
|
|
|
include __DIR__.'/components/altri_dati.php';
|
2019-07-15 16:53:18 +02:00
|
|
|
|
|
|
|
++$key;
|
|
|
|
}
|
|
|
|
|
2024-01-15 15:30:45 +01:00
|
|
|
echo '
|
2019-07-16 09:50:43 +02:00
|
|
|
|
2019-07-15 16:53:18 +02:00
|
|
|
</table>';
|
|
|
|
|
|
|
|
echo '
|
|
|
|
<script>
|
|
|
|
var n = '.($key - 1).';
|
|
|
|
function add_altri_dati(btn){
|
2019-07-26 17:40:52 +02:00
|
|
|
cleanup_inputs();
|
2020-01-17 17:31:07 +01:00
|
|
|
|
2019-07-16 09:50:43 +02:00
|
|
|
var last = $(btn).closest("table").find("tr[id^=last-altri_dati]").parent().last();
|
2019-07-15 16:53:18 +02:00
|
|
|
|
|
|
|
n++;
|
2020-08-26 14:28:56 +02:00
|
|
|
var text = replaceAll($("#altri_dati-template").html(), "-id-", "" + n);
|
2020-01-17 17:31:07 +01:00
|
|
|
|
2019-07-15 16:53:18 +02:00
|
|
|
last.after(text);
|
2019-07-26 17:40:52 +02:00
|
|
|
restart_inputs();
|
2019-07-15 16:53:18 +02:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
2020-08-26 14:28:56 +02:00
|
|
|
<table class="hide" id="altri_dati-template">';
|
2019-07-15 16:53:18 +02:00
|
|
|
$dato = [];
|
|
|
|
$key = '-id-';
|
|
|
|
|
2019-07-15 18:34:59 +02:00
|
|
|
include __DIR__.'/components/altri_dati.php';
|
2019-07-15 16:53:18 +02:00
|
|
|
|
|
|
|
echo '
|
|
|
|
</table>';
|
2019-07-15 18:34:59 +02:00
|
|
|
|
|
|
|
echo '
|
|
|
|
<!-- PULSANTI -->
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12 text-right">
|
|
|
|
<button type="submit" class="btn btn-primary">
|
|
|
|
<i class="fa fa-edit"></i> '.tr('Salva').'
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>';
|
|
|
|
|
|
|
|
echo '
|
|
|
|
</form>';
|
|
|
|
|
|
|
|
echo '
|
2019-07-26 17:40:52 +02:00
|
|
|
<script>$(document).ready(init)</script>';
|