2017-08-04 16:28:16 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
2019-07-23 15:39:00 +02:00
|
|
|
use Modules\Contratti\Contratto;
|
|
|
|
use Modules\Fatture\Fattura;
|
|
|
|
|
|
|
|
$documento_finale = Fattura::find($id_record);
|
|
|
|
$dir = $documento_finale->direzione;
|
|
|
|
|
|
|
|
$id_documento = get('id_documento');
|
|
|
|
if (!empty($id_documento)) {
|
|
|
|
$documento = Contratto::find($id_documento);
|
2017-08-04 16:28:16 +02:00
|
|
|
|
2019-02-14 17:49:58 +01:00
|
|
|
$options = [
|
2019-07-23 15:39:00 +02:00
|
|
|
'op' => 'add_documento',
|
|
|
|
'type' => 'contratto',
|
2019-02-14 17:49:58 +01:00
|
|
|
'button' => tr('Aggiungi'),
|
2019-07-23 15:39:00 +02:00
|
|
|
'documento' => $documento,
|
|
|
|
'documento_finale' => $documento_finale,
|
2019-02-14 17:49:58 +01:00
|
|
|
];
|
|
|
|
|
2019-07-23 15:39:00 +02:00
|
|
|
echo App::load('importa.php', [], $options, true);
|
2019-02-14 17:49:58 +01:00
|
|
|
|
|
|
|
return;
|
2017-08-04 16:28:16 +02:00
|
|
|
}
|
|
|
|
|
2019-07-23 15:39:00 +02:00
|
|
|
$id_anagrafica = $documento_finale->idanagrafica;
|
|
|
|
|
|
|
|
$_SESSION['superselect']['idanagrafica'] = $id_anagrafica;
|
2019-04-12 17:15:28 +02:00
|
|
|
$_SESSION['superselect']['stato'] = 'is_fatturabile';
|
|
|
|
|
2017-08-04 16:28:16 +02:00
|
|
|
echo '
|
2019-02-14 17:49:58 +01:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
|
|
|
{[ "type": "select", "label": "'.tr('Contratto').'", "name": "id_documento", "ajax-source": "contratti" ]}
|
|
|
|
</div>
|
|
|
|
</div>
|
2017-08-04 16:28:16 +02:00
|
|
|
|
2019-07-23 15:39:00 +02:00
|
|
|
<div id="righe_documento">
|
|
|
|
|
2019-02-14 17:49:58 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="alert alert-info" id="box-loading">
|
|
|
|
<i class="fa fa-spinner fa-spin"></i> '.tr('Caricamento in corso').'...
|
|
|
|
</div>';
|
2017-08-04 16:28:16 +02:00
|
|
|
|
2019-02-14 17:49:58 +01:00
|
|
|
$file = basename(__FILE__);
|
2017-08-04 16:28:16 +02:00
|
|
|
echo '
|
2019-07-26 18:05:19 +02:00
|
|
|
<script>$(document).ready(init)</script>
|
2019-02-14 17:49:58 +01:00
|
|
|
|
|
|
|
<script>
|
|
|
|
var content = $("#righe_documento");
|
|
|
|
var loader = $("#box-loading");
|
|
|
|
|
|
|
|
$(document).ready(function(){
|
|
|
|
loader.hide();
|
2019-07-23 15:39:00 +02:00
|
|
|
});
|
2019-02-14 17:49:58 +01:00
|
|
|
|
|
|
|
$("#id_documento").on("change", function(){
|
|
|
|
loader.show();
|
|
|
|
|
|
|
|
var id = $(this).selectData() ? $(this).selectData().id : "";
|
|
|
|
|
2019-07-23 15:39:00 +02:00
|
|
|
content.html("");
|
|
|
|
content.load("'.$structure->fileurl($file).'?id_module='.$id_module.'&id_record='.$id_record.'&id_documento=" + id, function() {
|
2019-02-14 17:49:58 +01:00
|
|
|
loader.hide();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>';
|