openstamanager/modules/fatture/fe/components/dati_documento.php

146 lines
5.7 KiB
PHP
Raw Normal View History

2019-07-15 18:34:59 +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 18:34:59 +02:00
// Altri dati gestionali
echo '
2019-07-16 09:50:43 +02:00
<tbody>
<tr class="fourth-level">
2019-07-15 18:34:59 +02:00
<th colspan="2">
'.str_repeat($space, 3).$info['code'].' '.$info['name'].' - '.tr('Riga _NUM_', [
'_NUM_' => $key,
]);
if ($key == 1) {
echo '
<button type="button" class="btn btn-xs btn-info pull-right" onclick="add_blocco(this, \''.$nome.'\')">
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
</button>';
}
echo '
</th>
</tr>';
// RiferimentoNumeroLinea
if (empty($dato['riferimento_linea'])) {
$dato['riferimento_linea'][] = 0;
}
$index = 1;
foreach ($dato['riferimento_linea'] as $linea) {
echo '
2019-07-16 09:50:43 +02:00
<tr class="fifth-level" title="RiferimentoNumeroLinea-'.$nome.'-'.$key.'">
2019-07-15 18:34:59 +02:00
<td style="vertical-align: middle;">
'.str_repeat($space, 4).$info['code'].'.1 RiferimentoNumeroLinea - '.tr('Riga _NUM_', [
'_NUM_' => $index,
]);
if ($index == 1) {
echo '
<button type="button" class="btn btn-xs btn-info pull-right" onclick="add_riferimento(this, \''.$nome.'\', \''.$key.'\')">
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
</button>';
}
2020-09-07 15:04:06 +02:00
echo '
2019-07-15 18:34:59 +02:00
</td>
<td>
{[ "type": "number", "name": "'.$nome.'['.$key.'][riferimento_linea][]", "value": "'.$linea.'", "maxlength": 4, "decimals": 0, "extra": " title=\"\" " ]}
2019-07-15 18:34:59 +02:00
</td>
</tr>';
++$index;
}
// IdDocumento
echo '
2019-07-16 09:50:43 +02:00
<tr class="fifth-level">
2019-07-15 18:34:59 +02:00
<td style="vertical-align: middle;">'.str_repeat($space, 4).$info['code'].'.2 IdDocumento</td>
<td>
{[ "type": "text", "name": "'.$nome.'['.$key.'][id_documento]", "value": "'.$dato['id_documento'].'", "maxlength": 20 ]}
</td>
</tr>';
// Data
echo '
2019-07-16 09:50:43 +02:00
<tr class="fifth-level">
2019-07-15 18:34:59 +02:00
<td style="vertical-align: middle;">'.str_repeat($space, 4).$info['code'].'.3 Data</td>
<td>
2020-10-16 08:31:10 +02:00
{[ "type": "date", "name": "'.$nome.'['.$key.'][data]", "value": "'.$dato['data'].'", "readonly": '.(empty($dato['id_documento']) ? 1 : 0).' ]}
2019-07-15 18:34:59 +02:00
</td>
</tr>';
// NumItem
echo '
2019-07-16 09:50:43 +02:00
<tr class="fifth-level">
2019-07-15 18:34:59 +02:00
<td style="vertical-align: middle;">'.str_repeat($space, 4).$info['code'].'.4 NumItem</td>
<td>
2020-10-16 08:31:10 +02:00
{[ "type": "text", "name": "'.$nome.'['.$key.'][num_item]", "value": "'.$dato['num_item'].'", "maxlength": 20, "readonly": '.(empty($dato['id_documento']) ? 1 : 0).' ]}
2019-07-15 18:34:59 +02:00
</td>
</tr>';
// CodiceCommessaConvenzione
echo '
2019-07-16 09:50:43 +02:00
<tr class="fifth-level">
2019-07-15 18:34:59 +02:00
<td style="vertical-align: middle;">'.str_repeat($space, 4).$info['code'].'.5 CodiceCommessaConvenzione</td>
<td>
2020-10-16 08:31:10 +02:00
{[ "type": "text", "name": "'.$nome.'['.$key.'][codice_commessa]", "value": "'.$dato['codice_commessa'].'", "maxlength": 100, "readonly": '.(empty($dato['id_documento']) ? 1 : 0).' ]}
2019-07-15 18:34:59 +02:00
</td>
</tr>';
// CodiceCUP
echo '
2019-07-16 09:50:43 +02:00
<tr class="fifth-level">
2019-07-15 18:34:59 +02:00
<td style="vertical-align: middle;">'.str_repeat($space, 4).$info['code'].'.6 CodiceCUP</td>
<td>
2020-10-16 08:31:10 +02:00
{[ "type": "text", "name": "'.$nome.'['.$key.'][codice_cup]", "value": "'.$dato['codice_cup'].'", "maxlength": 15, "readonly": '.(empty($dato['id_documento']) ? 1 : 0).' ]}
2019-07-15 18:34:59 +02:00
</td>
</tr>';
// CodiceCIG
echo '
2019-07-16 09:50:43 +02:00
<tr class="fifth-level" id="last-'.$nome.'-'.$key.'">
2019-07-15 18:34:59 +02:00
<td style="vertical-align: middle;">'.str_repeat($space, 4).$info['code'].'.7 CodiceCIG</td>
<td>
2020-10-16 08:31:10 +02:00
{[ "type": "text", "name": "'.$nome.'['.$key.'][codice_cig]", "value": "'.$dato['codice_cig'].'", "maxlength": 15, "readonly": '.(empty($dato['id_documento']) ? 1 : 0).' ]}
2019-07-15 18:34:59 +02:00
</td>
2019-07-16 09:50:43 +02:00
</tr>
</tbody>';
echo '
<script type="text/javascript">
$( document ).ready(function() {
$(\'input[name="'.$nome.'['.$key.'][id_documento]"]\').keyup(function() {
if ( $(\'input[name="'.$nome.'['.$key.'][id_documento]"]\').val() != ""){
$(\'input[name="'.$nome.'['.$key.'][data]"]\').prop("readonly", false);
$(\'input[name="'.$nome.'['.$key.'][num_item]"]\').prop("readonly", false);
$(\'input[name="'.$nome.'['.$key.'][codice_commessa]"]\').prop("readonly", false);
$(\'input[name="'.$nome.'['.$key.'][codice_cup]"]\').prop("readonly", false);
$(\'input[name="'.$nome.'['.$key.'][codice_cig]"]\').prop("readonly", false);
}else{
$(\'input[name="'.$nome.'['.$key.'][data]"]\').prop("readonly", true);
$(\'input[name="'.$nome.'['.$key.'][num_item]"]\').prop("readonly", true);
$(\'input[name="'.$nome.'['.$key.'][codice_commessa]"]\').prop("readonly", true);
$(\'input[name="'.$nome.'['.$key.'][codice_cup]"]\').prop("readonly", true);
$(\'input[name="'.$nome.'['.$key.'][codice_cig]"]\').prop("readonly", true);
}
});
});
2020-10-16 08:31:10 +02:00
</script>';