2020-07-06 13:19:20 +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-07-06 13:19:20 +02:00
|
|
|
|
2020-07-06 14:16:16 +02:00
|
|
|
include_once __DIR__.'/../../core.php';
|
2020-07-06 13:19:20 +02:00
|
|
|
|
|
|
|
// Generazione della tabella per l'aggiunta dei riferimenti
|
|
|
|
$id_documento = filter('id_documento');
|
|
|
|
$tipo_documento = filter('tipo_documento');
|
|
|
|
if (empty($tipo_documento) || empty($id_documento)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
$documento = $tipo_documento::find($id_documento);
|
|
|
|
|
|
|
|
// Informazioni sulla riga
|
|
|
|
$source_type = filter('source_type');
|
|
|
|
$source_id = filter('source_id');
|
2020-10-16 17:23:44 +02:00
|
|
|
$riferimenti = (array) filter('riferimenti');
|
2020-07-06 13:19:20 +02:00
|
|
|
|
|
|
|
echo '
|
2024-10-16 15:48:50 +02:00
|
|
|
<table class="table table-striped table-hover table-sm table-bordered">
|
2020-07-06 13:19:20 +02:00
|
|
|
<tr>
|
|
|
|
<th>'.tr('Descrizione').'</th>
|
|
|
|
<th>'.tr('Q.tà').' <i title="'.tr('da evadere').' / '.tr('totale').'" class="tip fa fa-question-circle-o"></i></th>
|
|
|
|
<th class="text-center">#</th>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tbody>';
|
|
|
|
|
2024-01-15 15:30:45 +01:00
|
|
|
$righe = $documento->getRighe();
|
|
|
|
foreach ($righe as $riga) {
|
2024-05-23 11:36:25 +02:00
|
|
|
$riga_class = $riga::class;
|
2020-07-06 13:19:20 +02:00
|
|
|
|
2024-01-15 15:30:45 +01:00
|
|
|
$riferimento_locale = $riga_class.'|'.$riga->id;
|
|
|
|
$presente = in_array($riferimento_locale, $riferimenti);
|
2020-07-06 13:19:20 +02:00
|
|
|
|
2024-01-15 15:30:45 +01:00
|
|
|
echo '
|
2020-07-06 13:19:20 +02:00
|
|
|
<tr data-id="'.$riga->id.'" data-type="'.$riga_class.'">
|
|
|
|
<td>'.$riga->descrizione.'</td>
|
|
|
|
<td>'.numberFormat($riga->qta_rimanente, 'qta').' / '.numberFormat($riga->qta, 'qta').'</td>
|
|
|
|
<td class="text-center">
|
2020-07-06 14:16:16 +02:00
|
|
|
<button type="button" class="btn btn-'.($presente ? 'success' : 'info').' btn-xs" '.($presente ? '' : 'onclick="salvaRiferimento(this, \''.addslashes($source_type).'\',\''.$source_id.'\')"').'>
|
2020-07-06 13:19:20 +02:00
|
|
|
<i class="fa fa-check"></i>
|
|
|
|
</button>
|
|
|
|
</td>
|
|
|
|
</tr>';
|
2024-01-15 15:30:45 +01:00
|
|
|
}
|
2020-07-06 13:19:20 +02:00
|
|
|
|
2024-01-15 15:30:45 +01:00
|
|
|
echo '
|
2020-07-06 13:19:20 +02:00
|
|
|
</tbody>
|
|
|
|
</table>';
|