|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione |
| 5 | + * Copyright (C) DevCode s.r.l. |
| 6 | + * |
| 7 | + * This program is free software: you can redistribute it and/or modify |
| 8 | + * it under the terms of the GNU General Public License as published by |
| 9 | + * the Free Software Foundation, either version 3 of the License, or |
| 10 | + * (at your option) any later version. |
| 11 | + * |
| 12 | + * This program is distributed in the hope that it will be useful, |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | + * GNU General Public License for more details. |
| 16 | + * |
| 17 | + * You should have received a copy of the GNU General Public License |
| 18 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 19 | + */ |
| 20 | + |
| 21 | +include_once __DIR__.'/../../core.php'; |
| 22 | + |
| 23 | +use Modules\Interventi\Intervento; |
| 24 | +use Modules\Ordini\Ordine; |
| 25 | + |
| 26 | +$documento_finale = Intervento::find($id_record); |
| 27 | +$dir = $documento_finale->direzione; |
| 28 | + |
| 29 | +$id_documento = get('id_documento'); |
| 30 | +if (!empty($id_documento)) { |
| 31 | + $documento = Ordine::find($id_documento); |
| 32 | + |
| 33 | + $options = [ |
| 34 | + 'op' => 'add_documento', |
| 35 | + 'type' => 'ordine', |
| 36 | + 'serials' => true, |
| 37 | + 'button' => tr('Aggiungi'), |
| 38 | + 'documento' => $documento, |
| 39 | + 'documento_finale' => $documento_finale, |
| 40 | + 'tipo_documento_finale' => Intervento::class, |
| 41 | + 'superamento_soglia_qta' => setting('Permetti il superamento della soglia quantità dei documenti di origine'), |
| 42 | + ]; |
| 43 | + |
| 44 | + echo App::load('importa.php', [], $options, true); |
| 45 | + |
| 46 | + return; |
| 47 | +} |
| 48 | + |
| 49 | +$id_anagrafica = $documento_finale->idanagrafica; |
| 50 | + |
| 51 | +echo ' |
| 52 | +<div class="row"> |
| 53 | + <div class="col-md-12"> |
| 54 | + {[ "type": "select", "label": "'.tr('Ordine').'", "name": "id_documento", "values": "query=SELECT `or_ordini`.`id`, CONCAT(IF(`numero_esterno` != \'\', `numero_esterno`, `numero`), \' del \', DATE_FORMAT(`data`, \'%d-%m-%Y\')) AS descrizione FROM `or_ordini` INNER JOIN `or_statiordine` ON `or_ordini`.`idstatoordine` = `or_statiordine`.`id` LEFT JOIN `or_statiordine_lang` ON (`or_statiordine`.`id` = `or_statiordine_lang`.`id_record` AND `or_statiordine_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') INNER JOIN `or_tipiordine` ON `or_ordini`.`idtipoordine` = `or_tipiordine`.`id` INNER JOIN `or_righe_ordini` ON `or_ordini`.`id` = `or_righe_ordini`.`idordine` WHERE `or_statiordine_lang`.`title` IN(\'Accettato\') AND (`or_righe_ordini`.`qta` - `or_righe_ordini`.`qta_evasa`) > 0 AND ((`or_tipiordine`.`dir` = \"entrata\" AND `idanagrafica`='.prepare($id_anagrafica).') OR `or_tipiordine`.`dir` = \"uscita\") GROUP BY or_ordini.id ORDER BY `data` DESC, `numero` DESC " ]} |
| 55 | + </div> |
| 56 | +</div> |
| 57 | +
|
| 58 | +<div id="righe_documento"> |
| 59 | +
|
| 60 | +</div> |
| 61 | +
|
| 62 | +<div class="alert alert-info" id="card-loading"> |
| 63 | + <i class="fa fa-spinner fa-spin"></i> '.tr('Caricamento in corso').'... |
| 64 | +</div>'; |
| 65 | + |
| 66 | +$file = basename(__FILE__); |
| 67 | +echo ' |
| 68 | +<script>$(document).ready(init)</script> |
| 69 | +
|
| 70 | +<script> |
| 71 | + var content = $("#righe_documento"); |
| 72 | + var loader = $("#card-loading"); |
| 73 | +
|
| 74 | + $(document).ready(function() { |
| 75 | + loader.hide(); |
| 76 | + }); |
| 77 | +
|
| 78 | + $("#id_documento").on("change", function() { |
| 79 | + loader.show(); |
| 80 | +
|
| 81 | + var id = $(this).selectData() ? $(this).selectData().id : ""; |
| 82 | +
|
| 83 | + content.html(""); |
| 84 | + content.load("'.$structure->fileurl($file).'?id_module='.$id_module.'&id_record='.$id_record.'&id_documento=" + id, function() { |
| 85 | + loader.hide(); |
| 86 | + }); |
| 87 | + }); |
| 88 | +</script>'; |
0 commit comments