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 // IVA predefinita
$id_iva = $id_iva ?: setting('Iva predefinita'); $id_iva = $id_iva ?: setting('Iva predefinita');
$righe_totali = $documento->getRighe();
if ($final_module['name'] == 'Interventi') { 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') { } elseif ($final_module['name'] == 'Ordini fornitore') {
$righe = $documento->getRighe(); $righe = $righe_totali;
$righe_evase = collect();
} else { } 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 ' echo '
<p>'.tr('Non ci sono elementi da evadere').'...</p>'; <p>'.tr('Non ci sono elementi da evadere').'...</p>';
@ -355,6 +361,41 @@ echo '
</table> </table>
</div>'; </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 ' echo '
<div class="alert alert-warning hidden" id="articoli_sottoscorta"> <div class="alert alert-warning hidden" id="articoli_sottoscorta">
<table class="table table-condensed"> <table class="table table-condensed">
@ -386,10 +427,7 @@ echo '
echo ' echo '
<script>$(document).ready(init)</script>'; <script>$(document).ready(init)</script>';
echo ' // Individuazione scorte
<script type="text/javascript">
';
$articoli = $documento->articoli->groupBy('idarticolo'); $articoli = $documento->articoli->groupBy('idarticolo');
$scorte = []; $scorte = [];
foreach ($articoli as $elenco) { foreach ($articoli as $elenco) {
@ -407,7 +445,9 @@ foreach ($articoli as $elenco) {
} }
echo ' echo '
<script type="text/javascript">
var scorte = '.json_encode($scorte).'; 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).'; var abilita_scorte = '.intval(!$documento::$movimenta_magazzino && !empty($options['tipo_documento_finale']) && $options['tipo_documento_finale']::$movimenta_magazzino).';
function controllaMagazzino() { function controllaMagazzino() {
@ -526,18 +566,16 @@ function ricalcolaTotale() {
totale_qta += qta; totale_qta += qta;
}); });
$("#totale").html((totale.toLocale()) + " " + globals.currency);'; $("#totale").html((totale.toLocale()) + " " + globals.currency);
if (empty($options['allow-empty'])) { if (!permetti_documento_vuoto) {
echo '
if (totale_qta > 0) { if (totale_qta > 0) {
$("#submit_btn").show(); $("#submit_btn").show();
} else { } else {
$("#submit_btn").hide(); $("#submit_btn").hide();
}'; }
} }
echo '
controllaMagazzino(); controllaMagazzino();
} }
@ -554,7 +592,6 @@ ricalcolaTotale();
$("#id_ritenuta_acconto").on("change", function(){ $("#id_ritenuta_acconto").on("change", function(){
if(input("id_ritenuta_acconto").get()) { if(input("id_ritenuta_acconto").get()) {
$("#calcolo_ritenuta_acconto").prop("required", true); $("#calcolo_ritenuta_acconto").prop("required", true);
} else{ } else{
$("#calcolo_ritenuta_acconto").prop("required", false); $("#calcolo_ritenuta_acconto").prop("required", false);
input("calcolo_ritenuta_acconto").set(""); input("calcolo_ritenuta_acconto").set("");