2021-01-25 12:37:53 +01:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
|
|
|
* Copyright (C) DevCode s.r.l.
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
|
|
|
use Modules\DDT\DDT;
|
|
|
|
|
|
|
|
$documento_finale = DDT::find($id_record);
|
|
|
|
$dir = $documento_finale->direzione;
|
|
|
|
|
|
|
|
$id_documento = get('id_documento');
|
|
|
|
if (!empty($id_documento)) {
|
|
|
|
$documento = DDT::find($id_documento);
|
|
|
|
|
|
|
|
$options = [
|
|
|
|
'op' => 'add_documento',
|
|
|
|
'button' => tr('Aggiungi'),
|
|
|
|
'serials' => true,
|
|
|
|
'documento' => $documento,
|
|
|
|
'documento_finale' => $documento_finale,
|
|
|
|
'tipo_documento_finale' => DDT::class,
|
2021-07-07 13:01:54 +02:00
|
|
|
'superamento_soglia_qta' => setting('Permetti il superamento della soglia quantità dei documenti di origine'),
|
2021-01-25 12:37:53 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
echo App::load('importa.php', [], $options, true);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$id_anagrafica = $documento_finale->idanagrafica;
|
|
|
|
|
|
|
|
echo '
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
2024-02-27 12:55:27 +01:00
|
|
|
{[ "type": "select", "label": "'.tr('Ddt').'", "name": "id_documento", "values": "query=SELECT `dt_ddt`.`id`, CONCAT(IF(`numero_esterno` != \'\', `numero_esterno`, `numero`), \' del \', DATE_FORMAT(`data`, \'%d-%m-%Y\')) AS descrizione FROM `dt_ddt` INNER JOIN `dt_statiddt` ON `ddt`.`idstato` = `dt_statiddt`.`id` LEFT JOIN `dt_statiddt_lang` ON (`dt_statiddt`.`id` = `dt_statiddt_lang`.`id_record` AND `dt_statiddt_lang`.`id_lang` = '.prepare(setting('Lingua')).') INNER JOIN `dt_tipiddt` ON `dt_ddt`.`idtipoddt` = `dt_tipiddt`.`id` INNER JOIN `dt_righe_ddt` ON `dt_ddt`.`id` = `dt_righe_ddt`.`idddt` WHERE `dt_statiddt_lang`.`name` IN("Evaso", "Parzialmente evaso", "Parzialmente fatturato") AND `dt_tipiddt`.`dir`=\''.($dir == 'entrata' ? 'uscita' : 'entrata').'\' AND (`dt_righe_ddt`.`qta` - `dt_righe_ddt`.`qta_evasa`) > 0 ORDER BY `data` DESC, `numero` DESC" ]}
|
2021-01-25 12:37:53 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="righe_documento">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="alert alert-info" id="box-loading">
|
|
|
|
<i class="fa fa-spinner fa-spin"></i> '.tr('Caricamento in corso').'...
|
|
|
|
</div>';
|
|
|
|
|
|
|
|
$file = basename(__FILE__);
|
|
|
|
echo '
|
|
|
|
<script>$(document).ready(init)</script>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
var content = $("#righe_documento");
|
|
|
|
var loader = $("#box-loading");
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
loader.hide();
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#id_documento").on("change", function() {
|
|
|
|
loader.show();
|
|
|
|
|
|
|
|
var id = $(this).selectData() ? $(this).selectData().id : "";
|
|
|
|
|
|
|
|
content.html("");
|
|
|
|
content.load("'.$structure->fileurl($file).'?id_module='.$id_module.'&id_record='.$id_record.'&id_documento=" + id, function() {
|
|
|
|
loader.hide();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>';
|