1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-24 22:42:33 +01:00
openstamanager/modules/ddt/add_ordine.php

87 lines
3.3 KiB
PHP
Raw Normal View History

<?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/>.
*/
include_once __DIR__.'/../../core.php';
2019-07-24 11:20:40 +02:00
use Modules\DDT\DDT;
use Modules\Ordini\Ordine;
$documento_finale = DDT::find($id_record);
2019-07-24 11:20:40 +02:00
$dir = $documento_finale->direzione;
$id_documento = get('id_documento');
if (!empty($id_documento)) {
$documento = Ordine::find($id_documento);
2019-02-14 17:49:58 +01:00
$options = [
'op' => 'add_ordine',
'button' => tr('Aggiungi'),
2019-07-24 11:20:40 +02:00
'serials' => true,
'documento' => $documento,
'documento_finale' => $documento_finale,
'tipo_documento_finale' => DDT::class,
'superamento_soglia_qta' => setting('Permetti il superamento della soglia quantità dei documenti di origine'),
2019-02-14 17:49:58 +01:00
];
2019-07-24 11:20:40 +02:00
echo App::load('importa.php', [], $options, true);
2019-02-14 17:49:58 +01:00
return;
}
2019-07-24 11:20:40 +02:00
$id_anagrafica = $documento_finale->idanagrafica;
echo '
2019-02-14 17:49:58 +01:00
<div class="row">
<div class="col-md-12">
2024-03-01 11:32:13 +01:00
{[ "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` INNER JOIN `or_tipiordine` ON `or_ordini`.`idtipoordine`=`or_tipiordine`.`id` LEFT JOIN `or_statiordine_lang` ON (`or_statiordine`.`id`=`or_statiordine_lang`.`id_record` AND `or_statiordine_lang`.`id_lang` = '.prepare(setting('Lingua')).') INNER JOIN `or_righe_ordini` ON `or_ordini`.`id` = `or_righe_ordini`.`idordine` WHERE `idanagrafica`='.prepare($id_anagrafica).' AND `or_statiordine_lang`.`name` IN(\'Accettato\', \'Evaso\', \'Parzialmente evaso\', \'Parzialmente fatturato\') AND `dir`='.prepare($dir).' AND (`or_righe_ordini`.`qta` - `or_righe_ordini`.`qta_evasa`) > 0 ORDER BY `data` DESC, `numero` DESC" ]}
2019-02-14 17:49:58 +01:00
</div>
</div>
2019-07-24 11:20:40 +02:00
<div id="righe_documento">
2019-02-14 17:49:58 +01:00
</div>
2019-02-14 17:49:58 +01:00
<div class="alert alert-info" id="box-loading">
<i class="fa fa-spinner fa-spin"></i> '.tr('Caricamento in corso').'...
</div>';
2019-02-14 17:49:58 +01:00
$file = basename(__FILE__);
echo '
2019-07-26 18:05:19 +02:00
<script>$(document).ready(init)</script>
<script>
2019-02-14 17:49:58 +01:00
var content = $("#righe_documento");
var loader = $("#box-loading");
$(document).ready(function() {
2019-02-14 17:49:58 +01:00
loader.hide();
2019-07-24 11:20:40 +02:00
});
$("#id_documento").on("change", function() {
2019-02-14 17:49:58 +01:00
loader.show();
2019-02-14 17:49:58 +01:00
var id = $(this).selectData() ? $(this).selectData().id : "";
2019-07-24 11:20:40 +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();
});
});
2019-02-14 17:49:58 +01:00
</script>';