2017-08-04 16:28:16 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
2017-09-22 15:19:59 +02:00
|
|
|
$module = Modules::get($id_module);
|
2017-08-04 16:28:16 +02:00
|
|
|
|
2019-02-14 17:49:58 +01:00
|
|
|
if (get('op')) {
|
|
|
|
$options = [
|
|
|
|
'op' => 'add_contratto',
|
|
|
|
'id_importazione' => 'id_contratto',
|
|
|
|
'final_module' => $module['name'],
|
|
|
|
'original_module' => 'Contratti',
|
|
|
|
'sql' => [
|
|
|
|
'table' => 'co_contratti',
|
|
|
|
'rows' => 'co_righe_contratti',
|
|
|
|
'id_rows' => 'idcontratto',
|
|
|
|
],
|
|
|
|
'serials' => false,
|
|
|
|
'button' => tr('Aggiungi'),
|
2019-04-05 05:14:53 +02:00
|
|
|
'dir' => 'entrata',
|
2019-02-14 17:49:58 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
$result = [
|
|
|
|
'id_record' => $id_record,
|
|
|
|
'id_documento' => get('iddocumento'),
|
|
|
|
];
|
|
|
|
|
|
|
|
echo App::load('importa.php', $result, $options, true);
|
|
|
|
|
|
|
|
return;
|
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-02-14 17:49:58 +01:00
|
|
|
<div class="box" id="info-box">
|
|
|
|
<div class="box-header with-border">
|
|
|
|
<h3 class="box-title">'.tr('Informazioni di importazione').'</h3>
|
|
|
|
</div>
|
|
|
|
<div class="box-body" id="righe_documento">
|
2017-08-04 16:28:16 +02:00
|
|
|
</div>
|
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-02-14 17:49:58 +01:00
|
|
|
<script src="'.$rootdir.'/lib/init.js"></script>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
var box = $("#info-box");
|
|
|
|
var content = $("#righe_documento");
|
|
|
|
var loader = $("#box-loading");
|
|
|
|
|
|
|
|
$(document).ready(function(){
|
|
|
|
box.hide();
|
|
|
|
loader.hide();
|
|
|
|
})
|
|
|
|
|
|
|
|
$("#id_documento").on("change", function(){
|
|
|
|
loader.show();
|
|
|
|
box.hide();
|
|
|
|
|
|
|
|
var id = $(this).selectData() ? $(this).selectData().id : "";
|
|
|
|
|
|
|
|
content.html("<i>'.tr('Caricamento in corso').'...</i>");
|
|
|
|
content.load("'.$structure->fileurl($file).'?id_module='.$id_module.'&id_record=" + id + "&documento=fattura&op=add_ordine&iddocumento='.$id_record.'", function() {
|
|
|
|
if(content.html() != ""){
|
|
|
|
box.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
loader.hide();
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
</script>';
|