1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-17 03:51:06 +01:00

Aggiunto elenco righe evase in importazione

This commit is contained in:
Dasc3er 2021-07-20 09:28:37 +02:00
parent 20ca61c5d3
commit 1e6833e80f

View File

@ -34,15 +34,21 @@ $final_module = Modules::get($name);
// IVA predefinita
$id_iva = $id_iva ?: setting('Iva predefinita');
$righe_totali = $documento->getRighe();
if ($final_module['name'] == 'Interventi') {
$righe = $documento->getRighe()->where('qta_rimanente', '>', 0)->where('is_descrizione', '=', 0);
$righe = $righe_totali->where('is_descrizione', '=', 0)
->where('qta_rimanente', '>', 0);
$righe_evase = $righe_totali->where('is_descrizione', '=', 0)
->where('qta_rimanente', '=', 0);
} elseif ($final_module['name'] == 'Ordini fornitore') {
$righe = $documento->getRighe();
$righe = $righe_totali;
$righe_evase = collect();
} else {
$righe = $documento->getRighe()->where('qta_rimanente', '>', 0);
$righe = $righe_totali->where('qta_rimanente', '>', 0);
$righe_evase = $righe_totali->where('qta_rimanente', '=', 0);
}
if (empty($righe)) {
if ($righe->isEmpty()) {
echo '
<p>'.tr('Non ci sono elementi da evadere').'...</p>';
@ -355,6 +361,41 @@ echo '
</table>
</div>';
// Elenco righe evase completametne
if (!$righe_evase->isEmpty()) {
echo '
<div class="box box-info collapsable collapsed-box">
<div class="box-header with-border">
<h3 class="box-title">' . tr('Righe evase completamente') . '</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i></button>
</div>
</div>
<table class="box-body table table-striped table-hover table-condensed">
<thead>
<tr>
<th>'.tr('Descrizione').'</th>
<th width="10%" class="text-center">'.tr('Q.').'</th>
</tr>
</thead>
<tbody>';
foreach ($righe_evase as $riga) {
echo '
<tr>
<td>'.$riga->descrizione.'</td>
<td class="text-center">'.numberFormat($riga->qta, 'qta').' '.$riga->um.'</td>
</tr>';
}
echo '
</tbody>
</table>
</div>';
}
// Gestione articolo sottoscorta
echo '
<div class="alert alert-warning hidden" id="articoli_sottoscorta">
<table class="table table-condensed">
@ -386,10 +427,7 @@ echo '
echo '
<script>$(document).ready(init)</script>';
echo '
<script type="text/javascript">
';
// Individuazione scorte
$articoli = $documento->articoli->groupBy('idarticolo');
$scorte = [];
foreach ($articoli as $elenco) {
@ -407,7 +445,9 @@ foreach ($articoli as $elenco) {
}
echo '
<script type="text/javascript">
var scorte = '.json_encode($scorte).';
var permetti_documento_vuoto = '.intval(!empty($options['allow-empty'])).';
var abilita_scorte = '.intval(!$documento::$movimenta_magazzino && !empty($options['tipo_documento_finale']) && $options['tipo_documento_finale']::$movimenta_magazzino).';
function controllaMagazzino() {
@ -526,18 +566,16 @@ function ricalcolaTotale() {
totale_qta += qta;
});
$("#totale").html((totale.toLocale()) + " " + globals.currency);';
$("#totale").html((totale.toLocale()) + " " + globals.currency);
if (empty($options['allow-empty'])) {
echo '
if (!permetti_documento_vuoto) {
if (totale_qta > 0) {
$("#submit_btn").show();
} else {
$("#submit_btn").hide();
}';
}
}
echo '
controllaMagazzino();
}
@ -554,7 +592,6 @@ ricalcolaTotale();
$("#id_ritenuta_acconto").on("change", function(){
if(input("id_ritenuta_acconto").get()) {
$("#calcolo_ritenuta_acconto").prop("required", true);
} else{
$("#calcolo_ritenuta_acconto").prop("required", false);
input("calcolo_ritenuta_acconto").set("");