openstamanager/plugins/dichiarazioni_intento/edit.php

130 lines
5.8 KiB
PHP
Raw Normal View History

2019-09-13 10:07:54 +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-09-13 10:07:54 +02:00
include_once __DIR__.'/../../core.php';
echo '
<form action="" method="post" role="form" id="form_sedi">
<input type="hidden" name="id_plugin" value="'.$id_plugin.'">
<input type="hidden" name="id_parent" value="'.$id_parent.'">
<input type="hidden" name="id_record" value="'.$record['id'].'">
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="update">
<div class="row">
2022-02-10 12:26:44 +01:00
<div class="col-md-4">
{[ "type": "text", "label": "'.tr('Numero protocollo').'", "name": "numero_protocollo", "required": 1, "value": "'.$record['numero_protocollo'].'", "help": "'.tr("Il numero di protocollo della dichiarazione d'intento, rilevabile dalla ricevuta telematica rilasciata dall'Agenzia delle entrate, è composto di due parti:<br><ul><li>la prima, formata da 17 cifre (es. 08060120341234567), che rappresenta il protocollo di ricezione;</li><li>la seconda, di 6 cifre (es. 000001), che rappresenta il progressivo e deve essere separata dalla prima dal segno '-' oppure dal segno '/'</li></ul>").'", "maxlength": "24", "charcounter": 1 ]}
2019-09-13 10:07:54 +02:00
</div>
<div class="col-md-3">
2022-02-10 12:26:44 +01:00
{[ "type": "date", "label": "'.tr('Data protocollo').'", "name": "data_protocollo", "value": "'.$record['data_protocollo'].'", "required": 1 ]}
2019-09-13 10:07:54 +02:00
</div>
2020-09-07 15:04:06 +02:00
2022-02-10 12:26:44 +01:00
<div class="col-md-2">
2023-08-04 14:54:28 +02:00
{[ "type": "text", "label": "'.tr('Progressivo int.').'", "name": "numero_progressivo", "required": 1, "value": "'.$record['numero_progressivo'].'", "help": "'.tr('Progressivo ad uso interno').'" ]}
2022-02-10 12:26:44 +01:00
</div>
<div class="col-md-3">
{[ "type": "date", "label": "'.tr('Data ricezione').'", "name": "data", "required": 1, "value": "'.$record['data'].'" ]}
2019-09-13 10:07:54 +02:00
</div>
2022-02-10 12:26:44 +01:00
2019-09-13 10:07:54 +02:00
</div>
<div class="row">
<div class="col-md-3">
{[ "type": "date", "label": "'.tr('Data inizio').'", "name": "data_inizio", "required": 1, "value": "'.$record['data_inizio'].'" ]}
2019-09-13 10:07:54 +02:00
</div>
2020-09-07 15:04:06 +02:00
<div class="col-md-3">
{[ "type": "date", "label": "'.tr('Data fine').'", "name": "data_fine", "required": 1, "value": "'.$record['data_fine'].'" ]}
2019-09-13 10:07:54 +02:00
</div>
2020-09-07 15:04:06 +02:00
<div class="col-md-3">
2019-09-13 10:07:54 +02:00
{[ "type": "number", "label": "'.tr('Massimale').'", "name": "massimale", "required": 1, "icon-after": "'.currency().'", "value": "'.$record['massimale'].'" ]}
</div>
2020-09-07 15:04:06 +02:00
<div class="col-md-3">
{[ "type": "date", "label": "'.tr('Data emissione').'", "name": "data_emissione", "value": "'.$record['data_emissione'].'", "required": 1 ]}
2019-09-13 10:07:54 +02:00
</div>
</div>
2020-09-07 15:04:06 +02:00
<div class="row">
<div class="col-md-12">
<span class="pull-right" ><b>'.tr('Totale utilizzato').':</b> '.moneyFormat($record['totale']).'</span>
</div>
<div class="clearfix">&nbsp;</div>
</div>
2020-09-07 15:04:06 +02:00
2021-05-25 15:15:16 +02:00
';
echo '
2019-09-13 10:07:54 +02:00
<!-- PULSANTI -->
<div class="row">
<div class="col-md-12">
2021-05-26 10:15:15 +02:00
<a class="btn btn-danger ask '.(!empty($numero_documenti) ? 'disabled' : '').'" data-backto="record-edit" data-op="delete" data-id_record="'.$record['id'].'" data-id_plugin="'.$id_plugin.'" data-id_parent="'.$id_parent.'" '.(!empty($numero_documenti) ? 'disabled' : '').'>
2019-09-13 10:07:54 +02:00
<i class="fa fa-trash"></i> '.tr('Elimina').'
</a>
<button type="submit" class="btn btn-primary pull-right">
<i class="fa fa-edit"></i> '.tr('Modifica').'
2019-09-13 10:07:54 +02:00
</button>
</div>
</div>
</form>';
2022-03-25 16:44:48 +01:00
2024-01-15 15:30:45 +01:00
// Documenti collegati
2024-04-24 12:26:51 +02:00
$elementi = $dbo->fetchArray('SELECT `co_documenti`.`id`, `co_documenti`.`data`, `co_documenti`.`numero`, `co_documenti`.`numero_esterno`, `co_tipidocumento_lang`.`title` AS tipo_documento, `co_tipidocumento`.`dir`, NULL AS `deleted_at` FROM `co_documenti` INNER JOIN `co_tipidocumento` ON `co_tipidocumento`.`id` = `co_documenti`.`idtipodocumento` LEFT JOIN `co_tipidocumento_lang` ON (`co_tipidocumento`.`id` = `co_tipidocumento_lang`.`id_record` AND `co_tipidocumento_lang`.`id_lang` = '.Models\Locale::getDefault()->id.') WHERE `co_documenti`.`id_dichiarazione_intento` = '.prepare($record['id']));
2022-03-25 16:44:48 +01:00
if (!empty($elementi)) {
echo '
<hr>
2024-05-16 18:02:50 +02:00
<div class="card card-warning collapsable collapsed-card">
<div class="card-header with-border">
<h3 class="card-title"><i class="fa fa-warning"></i> '.tr('Documenti collegati: _NUM_', [
2024-03-22 15:52:24 +01:00
'_NUM_' => count($elementi),
]).'</h3>
2024-05-16 18:02:50 +02:00
<div class="card-tools pull-right">
2024-05-23 17:51:21 +02:00
<button type="button" class="btn btn-tool" data-widget="collapse"><i class="fa fa-plus"></i></button>
2022-03-25 16:44:48 +01:00
</div>
</div>
2024-05-16 18:02:50 +02:00
<div class="card-body">
2022-03-25 16:44:48 +01:00
<ul>';
2023-08-04 14:54:28 +02:00
foreach ($elementi as $elemento) {
$descrizione = tr('_DOC_ _NUM_ del _DATE_ _DELETED_AT_', [
'_DOC_' => $elemento['tipo_documento'],
'_NUM_' => !empty($elemento['numero_esterno']) ? $elemento['numero_esterno'] : $elemento['numero'],
'_DATE_' => Translator::dateToLocale($elemento['data']),
'_DELETED_AT_' => (!empty($elemento['deleted_at']) ? tr('Eliminato il:').' '.Translator::dateToLocale($elemento['deleted_at']) : ''),
]);
$modulo = ($elemento['dir'] == 'entrata') ? 'Fatture di vendita' : 'Fatture di acquisto';
$id = $elemento['id'];
echo '
2022-03-25 16:44:48 +01:00
<li>'.Modules::link($modulo, $id, $descrizione).'</li>';
2023-08-04 14:54:28 +02:00
}
2022-03-25 16:44:48 +01:00
2023-08-04 14:54:28 +02:00
echo '
2022-03-25 16:44:48 +01:00
</ul>
</div>
</div>';
2023-08-04 14:54:28 +02:00
}