Aggiunto modal per le quantità impegnate in Ordini cliente
This commit is contained in:
parent
ab82ce291e
commit
c1f89f437c
|
@ -137,8 +137,8 @@ $_SESSION['superselect']['permetti_movimento_a_zero'] = true;
|
|||
<h4 class="panel-title">
|
||||
<?php echo tr('Dati appalto'); ?>
|
||||
|
||||
<div class="box-tools pull-right">
|
||||
<a data-toggle="collapse" href="#dati_appalto"><i class="fa fa-plus" style='color:white;margin-top:2px;'></i></a>
|
||||
<div class="box-tools pull-right">
|
||||
<a data-toggle="collapse" href="#dati_appalto"><i class="fa fa-plus" style='color:white;margin-top:2px;'></i></a>
|
||||
</div>
|
||||
</h4>
|
||||
</div>
|
||||
|
@ -168,18 +168,20 @@ $_SESSION['superselect']['permetti_movimento_a_zero'] = true;
|
|||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
echo '
|
||||
<!-- RIGHE -->
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Righe</h3>
|
||||
<h3 class="panel-title">'.tr('Righe').'</h3>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div class="pull-left">
|
||||
<?php
|
||||
<div class="panel-body">';
|
||||
|
||||
if (!$block_edit) {
|
||||
echo '
|
||||
<div class="pull-left">
|
||||
<a class="btn btn-sm btn-primary" data-href="'.$structure->fileurl('row-add.php').'?id_module='.$id_module.'&id_record='.$id_record.'&is_articolo" data-toggle="tooltip" data-title="'.tr('Aggiungi articolo').'">
|
||||
<i class="fa fa-plus"></i> '.tr('Articolo').'
|
||||
</a>';
|
||||
|
@ -198,17 +200,31 @@ if (!$block_edit) {
|
|||
<a class="btn btn-sm btn-primary" data-href="'.$structure->fileurl('row-add.php').'?id_module='.$id_module.'&id_record='.$id_record.'&is_sconto" data-toggle="tooltip" data-title="'.tr('Aggiungi sconto/maggiorazione').'">
|
||||
<i class="fa fa-plus"></i> '.tr('Sconto/maggiorazione').'
|
||||
</a>';
|
||||
|
||||
echo '
|
||||
</div>';
|
||||
|
||||
if ($dir == 'entrata') {
|
||||
echo '
|
||||
<div class="pull-right">
|
||||
<a class="btn btn-sm btn-info" data-href="'.$structure->fileurl('quantita_impegnate.php').'?id_module='.$id_module.'&id_record='.$id_record.'" data-toggle="tooltip" data-title="'.tr('Controllo sulle quantità impegnate').'">
|
||||
<i class="fa fa-check"></i> '.tr('Quantità impegnate').'
|
||||
</a>
|
||||
</div>';
|
||||
}
|
||||
|
||||
echo '
|
||||
<div class="clearfix"></div>
|
||||
<br>';
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
<br>
|
||||
|
||||
|
||||
echo '
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<?php include $docroot.'/modules/ordini/row-list.php'; ?>
|
||||
<div class="col-md-12">';
|
||||
|
||||
include $module->filepath('row-list.php');
|
||||
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -216,9 +232,8 @@ if (!$block_edit) {
|
|||
|
||||
{( "name": "filelist_and_upload", "id_module": "$id_module$", "id_record": "$id_record$" )}
|
||||
|
||||
{( "name": "log_email", "id_module": "$id_module$", "id_record": "$id_record$" )}
|
||||
{( "name": "log_email", "id_module": "$id_module$", "id_record": "$id_record$" )}';
|
||||
|
||||
<?php
|
||||
// Collegamenti diretti
|
||||
// Fatture o ddt collegati a questo ordine
|
||||
$elementi = $dbo->fetchArray('SELECT `co_documenti`.`id`, `co_documenti`.`data`, `co_documenti`.`numero`, `co_documenti`.`numero_esterno`, `co_tipidocumento`.`descrizione` AS tipo_documento, `co_tipidocumento`.`dir` FROM `co_documenti` JOIN `co_tipidocumento` ON `co_tipidocumento`.`id` = `co_documenti`.`idtipodocumento` WHERE `co_documenti`.`id` IN (SELECT `iddocumento` FROM `co_righe_documenti` WHERE `idordine` = '.prepare($id_record).')
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
<?php
|
||||
|
||||
use Modules\Ordini\Ordine;
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
if (isset($id_record)) {
|
||||
$ordine = Modules\Ordini\Ordine::with('tipo', 'stato')->find($id_record);
|
||||
|
||||
// Aggiornamento stato di questo ordine (?)
|
||||
//if (!empty(get_stato_ordine($id_record)) && setting('Cambia automaticamente stato ordini fatturati')) {
|
||||
// $dbo->query('UPDATE or_ordini SET idstatoordine=(SELECT id FROM or_statiordine WHERE descrizione="'.get_stato_ordine($id_record).'") WHERE id='.prepare($id_record));
|
||||
//}
|
||||
$ordine = Ordine::with('tipo', 'stato')->find($id_record);
|
||||
|
||||
$record = $dbo->fetchOne('SELECT *,
|
||||
or_ordini.note,
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
use Modules\Ordini\Ordine;
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
$ordine = Ordine::find($id_record);
|
||||
$articoli = $ordine->articoli->groupBy('idarticolo');
|
||||
|
||||
if ($articoli->isEmpty()) {
|
||||
echo '
|
||||
<p>'.tr('Il documento non contiene articoli').'.</p>';
|
||||
}
|
||||
|
||||
echo '
|
||||
<table class="table table-striped table-hover table-condensed table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>'.tr('Articolo').'</th>
|
||||
<th class="text-center tip" width="150" title="'.tr('Quantità presente nel documento').'">'.tr('Q.tà').'</th>
|
||||
<th class="text-center tip" width="150" title="'.tr('Quantità presente nel magazzino del gestionale').'">'.tr('Q.tà magazzino').'</th>
|
||||
<th class="text-center tip" width="150" title="'.tr('Quantità impegnata in altri Ordini del gestionale').'">'.tr('Q.tà impegnata').'</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>';
|
||||
|
||||
foreach ($articoli as $elenco) {
|
||||
$qta = $elenco->sum('qta');
|
||||
$articolo = $elenco->first()->articolo;
|
||||
|
||||
$codice = $articolo ? $articolo->codice : tr('Articolo eliminato');
|
||||
$descrizione = $articolo ? $articolo->descrizione : $elenco->first()->descrizione;
|
||||
|
||||
$qta_impegnata = $database->fetchOne("SELECT SUM(qta) as qta
|
||||
FROM or_righe_ordini
|
||||
JOIN or_ordini ON or_ordini.id = or_righe_ordini.idordine
|
||||
WHERE or_ordini.id != '.prepare($ordine->id).'
|
||||
AND idstatoordine = (SELECT id FROM or_statiordine WHERE descrizione = 'Bozza')
|
||||
AND idtipoordine IN (SELECT id FROM or_tipiordine WHERE dir = 'entrata')
|
||||
GROUP BY idarticolo")['qta'];
|
||||
$qta_impegnata = floatval($qta_impegnata);
|
||||
|
||||
$class = $qta_impegnata + $qta > $articolo->qta ? 'danger' : 'success';
|
||||
$descrizione_riga = $codice.' - '.$descrizione;
|
||||
$text = $articolo ? Modules::link('Articoli', $articolo->id, $descrizione_riga) : $descrizione_riga;
|
||||
|
||||
echo '
|
||||
<tr class="'.$class.'">
|
||||
<td>'.$text.'</td>
|
||||
<td class="text-center">'.numberFormat($qta, 'qta').'</td>
|
||||
<td class="text-center">'.numberFormat($articolo->qta, 'qta').'</td>
|
||||
<td class="text-center">'.numberFormat($qta_impegnata, 'qta').'</td>
|
||||
</tr>';
|
||||
}
|
||||
echo '
|
||||
</tbody>
|
||||
</table>';
|
|
@ -8,8 +8,7 @@ echo '
|
|||
<tr>
|
||||
<th width="35" class="text-center" >'.tr('#').'</th>
|
||||
<th>'.tr('Descrizione').'</th>
|
||||
<th class="text-center" width="150">'.tr('Q.tà disponibile').'</th>
|
||||
<th class="text-center tip" width="150" title="'.tr('da evadere').' / '.tr('totale').'">'.tr('Q.tà richiesta').' <i class="fa fa-question-circle-o"></i></th>
|
||||
<th class="text-center tip" width="150" title="'.tr('da evadere').' / '.tr('totale').'">'.tr('Q.tà').' <i class="fa fa-question-circle-o"></i></th>
|
||||
<th class="text-center" width="150">'.tr('Prezzo unitario').'</th>
|
||||
<th class="text-center" width="150">'.tr('Iva unitaria').'</th>
|
||||
<th class="text-center" width="150">'.tr('Importo').'</th>
|
||||
|
@ -65,20 +64,6 @@ foreach ($righe as $riga) {
|
|||
}
|
||||
}
|
||||
|
||||
// Disponibilità articolo
|
||||
$disponibile = $riga->articolo->qta >= ($riga->qta - $riga->qta_evasa);
|
||||
echo '
|
||||
<td class="text-center '.($disponibile ? 'bg-success' : 'bg-danger').'">';
|
||||
|
||||
if ($riga->isArticolo()) {
|
||||
echo($disponibile ? '<i class="fa fa-check text-success"></i> ' : '<i class="fa fa-warning text-danger"></i> ').numberFormat($riga->articolo->qta).' '.$riga->um;
|
||||
} else {
|
||||
echo '-';
|
||||
}
|
||||
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginal()) {
|
||||
echo '
|
||||
|
@ -186,7 +171,7 @@ $totale = abs($ordine->totale);
|
|||
// IMPONIBILE
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="6" class="text-right">
|
||||
<td colspan="5" class="text-right">
|
||||
<b>'.tr('Imponibile', [], ['upper' => true]).':</b>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
|
@ -199,7 +184,7 @@ echo '
|
|||
if (!empty($sconto)) {
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="6" class="text-right">
|
||||
<td colspan="5" class="text-right">
|
||||
<b><span class="tip" title="'.tr('Un importo positivo indica uno sconto, mentre uno negativo indica una maggiorazione').'"> <i class="fa fa-question-circle-o"></i> '.tr('Sconto/maggiorazione', [], ['upper' => true]).':</span></b>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
|
@ -211,7 +196,7 @@ if (!empty($sconto)) {
|
|||
// TOTALE IMPONIBILE
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="6" class="text-right">
|
||||
<td colspan="5" class="text-right">
|
||||
<b>'.tr('Totale imponibile', [], ['upper' => true]).':</b>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
|
@ -224,7 +209,7 @@ if (!empty($sconto)) {
|
|||
// IVA
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="6" class="text-right">
|
||||
<td colspan="5" class="text-right">
|
||||
<b>'.tr('Iva', [], ['upper' => true]).':</b>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
|
@ -236,7 +221,7 @@ echo '
|
|||
// TOTALE
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="6" class="text-right">
|
||||
<td colspan="5" class="text-right">
|
||||
<b>'.tr('Totale', [], ['upper' => true]).':</b>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
|
|
Loading…
Reference in New Issue