2020-05-26 15:24:25 +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/>.
|
|
|
|
*/
|
2020-05-26 15:24:25 +02:00
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
|
|
|
use Modules\Contratti\Contratto;
|
|
|
|
use Modules\Preventivi\Preventivo;
|
|
|
|
|
|
|
|
$documento_finale = Contratto::find($id_record);
|
|
|
|
|
|
|
|
$id_documento = get('id_documento');
|
|
|
|
if (!empty($id_documento)) {
|
|
|
|
$documento = Preventivo::find($id_documento);
|
|
|
|
|
|
|
|
$options = [
|
|
|
|
'op' => 'add_preventivo',
|
|
|
|
'type' => 'preventivo',
|
|
|
|
'button' => tr('Aggiungi'),
|
|
|
|
'documento' => $documento,
|
|
|
|
'documento_finale' => $documento_finale,
|
2020-09-24 11:36:47 +02:00
|
|
|
'tipo_documento_finale' => Contratto::class,
|
2021-07-07 13:01:54 +02:00
|
|
|
'superamento_soglia_qta' => setting('Permetti il superamento della soglia quantità dei documenti di origine'),
|
2020-05-26 15:24:25 +02:00
|
|
|
];
|
|
|
|
|
2020-12-31 16:13:28 +01:00
|
|
|
echo AppLegacy::load('importa.php', [], $options, true);
|
2020-05-26 15:24:25 +02:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$id_anagrafica = $documento_finale->idanagrafica;
|
|
|
|
|
|
|
|
echo '
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
2020-08-17 16:25:01 +02:00
|
|
|
{[ "type": "select", "label": "'.tr('Preventivo').'", "name": "id_documento", "ajax-source": "preventivi", "select-options": {"idanagrafica": '.$id_anagrafica.', "stato": "is_fatturabile"} ]}
|
2020-05-26 15:24:25 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="righe_documento">
|
2020-07-27 16:29:40 +02:00
|
|
|
|
2020-05-26 15:24:25 +02:00
|
|
|
</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>
|
2020-07-27 16:29:40 +02:00
|
|
|
|
2020-05-26 15:24:25 +02:00
|
|
|
<script>
|
|
|
|
var content = $("#righe_documento");
|
|
|
|
var loader = $("#box-loading");
|
2020-07-27 16:29:40 +02:00
|
|
|
|
2020-07-31 14:25:50 +02:00
|
|
|
$(document).ready(function() {
|
2020-05-26 15:24:25 +02:00
|
|
|
loader.hide();
|
|
|
|
});
|
2020-07-27 16:29:40 +02:00
|
|
|
|
2020-07-31 14:25:50 +02:00
|
|
|
$("#id_documento").on("change", function() {
|
2020-05-26 15:24:25 +02:00
|
|
|
loader.show();
|
|
|
|
|
|
|
|
var id = $(this).selectData() ? $(this).selectData().id : "";
|
2020-07-27 16:29:40 +02:00
|
|
|
|
2020-05-26 15:24:25 +02:00
|
|
|
content.html("");
|
|
|
|
content.load("'.$structure->fileurl($file).'?id_module='.$id_module.'&id_record='.$id_record.'&id_documento=" + id, function() {
|
|
|
|
loader.hide();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>';
|