mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-03-18 04:00:12 +01:00
feat: visualizzazione in row-list dei documenti in cui sono state evase le righe
This commit is contained in:
parent
fab1ede7b2
commit
e3e46a3399
@ -424,6 +424,8 @@ elseif (post('op') == 'send-email') {
|
||||
}
|
||||
} elseif (filter('op') == 'visualizza_righe_riferimenti') {
|
||||
include_once base_dir().'/include/riferimenti/riferimenti.php';
|
||||
} elseif (filter('op') == 'visualizza_documenti_collegati') {
|
||||
include_once base_dir().'/include/riferimenti/documenti_collegati.php';
|
||||
} elseif (filter('op') == 'visualizza_righe_documento') {
|
||||
include_once base_dir().'/include/riferimenti/righe_documento.php';
|
||||
} elseif (filter('op') == 'salva_riferimento_riga') {
|
||||
|
88
include/riferimenti/documenti_collegati.php
Normal file
88
include/riferimenti/documenti_collegati.php
Normal file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
||||
* Copyright (C) DevCode s.r.l.
|
||||
*
|
||||
* 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';
|
||||
|
||||
use Modules\Articoli\Articolo;
|
||||
|
||||
// Informazioni generali sulla riga
|
||||
$source_type = filter('riga_type');
|
||||
$source_id = filter('riga_id');
|
||||
if (empty($source_type) || empty($source_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$source = $source_type::find($source_id);
|
||||
$documenti_destinazione = getDestinationComponents($source);
|
||||
|
||||
echo '
|
||||
<div class="card card-primary collapsable">
|
||||
<div class="card-header with-border">
|
||||
<h3 class="card-title">';
|
||||
if ($source->isArticolo()) {
|
||||
$articolo_riga = Articolo::find($source->idarticolo);
|
||||
echo $articolo_riga->codice.' - '.$source->descrizione;
|
||||
} else {
|
||||
echo nl2br($source->descrizione);
|
||||
}
|
||||
echo '
|
||||
</h3>
|
||||
<div class="card-tools pull-right">
|
||||
'.tr('Quantità evasa / Totale').': <b>'.numberFormat($source->qta_evasa, 'qta').' / '.numberFormat($source->qta, 'qta').'</b>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">';
|
||||
if ($documenti_destinazione) {
|
||||
echo '
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="90%">'.tr('Documento').'</th>
|
||||
<th class="text-center">'.tr('Q.tà').'</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>';
|
||||
|
||||
$documenti_destinazione = getDestinationComponents($source);
|
||||
foreach ($documenti_destinazione['documento'] as $key => $destinazione) {
|
||||
echo '
|
||||
<tr>
|
||||
<td>
|
||||
'.reference($destinazione).'
|
||||
</td>
|
||||
<td class="text-right">
|
||||
'.numberFormat($documenti_destinazione['qta'][$key], 'qta').'
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
echo '
|
||||
</tbody>
|
||||
</table>';
|
||||
} else {
|
||||
echo '
|
||||
<div class="alert alert-info">
|
||||
<i class="fa fa-info-circle"></i> '.tr('Nessun documento collegato').'.
|
||||
</div>';
|
||||
}
|
||||
echo '
|
||||
</div>
|
||||
</div>';
|
@ -24,6 +24,11 @@
|
||||
* @since 2.4.2
|
||||
*/
|
||||
use Common\Components\Accounting;
|
||||
use Modules\Contratti\Contratto;
|
||||
use Modules\DDT\DDT;
|
||||
use Modules\Fatture\Fattura;
|
||||
use Modules\Interventi\Intervento;
|
||||
use Modules\Ordini\Ordine;
|
||||
|
||||
/**
|
||||
* Esegue una somma precisa tra due interi/array.
|
||||
@ -194,6 +199,39 @@ function reference($document, $text = null)
|
||||
return Modules::link($module_id, $document_id, $description, $description, $extra);
|
||||
}
|
||||
|
||||
function getDestinationComponents($riga)
|
||||
{
|
||||
$documents = [];
|
||||
|
||||
$contratti = database()->table('co_righe_contratti')->where('original_id', $riga->id)->where('original_type', $riga::class)->get();
|
||||
foreach ($contratti as $contratto) {
|
||||
$documents['documento'][] = Contratto::find($contratto->idcontratto);
|
||||
$documents['qta'][] = $contratto->qta;
|
||||
}
|
||||
$fatture = database()->table('co_righe_documenti')->where('original_id', $riga->id)->where('original_type', $riga::class)->get();
|
||||
foreach ($fatture as $fattura) {
|
||||
$documents['documento'][] = Fattura::find($fattura->iddocumento);
|
||||
$documents['qta'][] = $fattura->qta;
|
||||
}
|
||||
$ddts = database()->table('dt_righe_ddt')->where('original_id', $riga->id)->where('original_type', $riga::class)->get();
|
||||
foreach ($ddts as $ddt) {
|
||||
$documents['documento'][] = Ddt::find($ddt->idddt);
|
||||
$documents['qta'][] = $ddt->qta;
|
||||
}
|
||||
$interventi = database()->table('in_righe_interventi')->where('original_id', $riga->id)->where('original_type', $riga::class)->get();
|
||||
foreach ($interventi as $intervento) {
|
||||
$documents['documento'][] = Intervento::find($intervento->idintervento);
|
||||
$documents['qta'][] = $intervento->qta;
|
||||
}
|
||||
$ordini = database()->table('or_righe_ordini')->where('original_id', $riga->id)->where('original_type', $riga::class)->get();
|
||||
foreach ($ordini as $ordine) {
|
||||
$documents['documento'][] = Ordine::find($ordine->idordine);
|
||||
$documents['qta'][] = $ordine->qta;
|
||||
}
|
||||
|
||||
return $documents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Funzione che gestisce il parsing di uno sconto combinato e la relativa trasformazione in sconto fisso.
|
||||
* Esempio: (40 + 10) % = 44 %.
|
||||
|
@ -75,7 +75,7 @@ if (!empty($id_record)) {
|
||||
WHERE (`in_righe_interventi`.`original_document_id` = '.prepare($id_record).' AND `in_righe_interventi`.`original_document_type` = \'Modules\\\\Contratti\\\\Contratto\') OR `in_interventi`.`id_contratto` = '.prepare($id_record).'
|
||||
GROUP BY id
|
||||
|
||||
ORDER BY `data`');
|
||||
ORDER BY `modulo`');
|
||||
|
||||
$is_anagrafica_deleted = !$contratto->anagrafica;
|
||||
|
||||
|
@ -25,7 +25,7 @@ use Models\Plugin;
|
||||
$block_edit = $record['is_completato'];
|
||||
$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
|
||||
$righe = $order_row_desc ? $contratto->getRighe()->sortByDesc('created_at') : $contratto->getRighe();
|
||||
$colspan = '7';
|
||||
$colspan = '8';
|
||||
|
||||
$evasione_bar = [
|
||||
'Fatture di vendita' => 'success',
|
||||
@ -46,6 +46,7 @@ echo '
|
||||
</th>
|
||||
<th width="35" class="text-center">'.tr('#').'</th>
|
||||
<th>'.tr('Descrizione').'</th>
|
||||
<th width="100">'.tr('Documenti').'</th>
|
||||
<th class="text-center tip" width="150">'.tr('Q.tà').'</th>
|
||||
<th class="text-center" width="150">'.tr('Costo unitario').'</th>
|
||||
<th class="text-center" width="180">'.tr('Prezzo unitario').'</th>
|
||||
@ -93,12 +94,6 @@ foreach ($righe as $riga) {
|
||||
|
||||
<td>';
|
||||
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginalComponent()) {
|
||||
echo '
|
||||
<small class="pull-right text-right text-muted">'.reference($riga->getOriginalComponent()->getDocument(), tr('Origine')).'</small>';
|
||||
}
|
||||
|
||||
// Descrizione
|
||||
$descrizione = nl2br($riga->descrizione);
|
||||
if ($riga->isArticolo()) {
|
||||
@ -131,6 +126,17 @@ foreach ($righe as $riga) {
|
||||
<br><span class="right badge badge-default">'.nl2br($riga->note).'</small>';
|
||||
}
|
||||
echo '
|
||||
</td>
|
||||
|
||||
<td>';
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginalComponent()) {
|
||||
echo '
|
||||
<button type="button" class="btn btn-xs btn-default btn-block">
|
||||
<i class="fa fa-file-text-o"></i> '.reference($riga->getOriginalComponent()->getDocument(), tr('Origine')).'
|
||||
</button>';
|
||||
}
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
if ($riga->isDescrizione()) {
|
||||
@ -144,8 +150,10 @@ foreach ($righe as $riga) {
|
||||
// Quantità e unità di misura
|
||||
echo '
|
||||
<td>
|
||||
{[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "decimals": "qta", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-after": "<span class=\'tip\' title=\''.tr('Quantità evasa').' / '.tr('totale').': '.tr('_QTA_ / _TOT_', ['_QTA_' => numberFormat($riga->qta_evasa, 'qta'), '_TOT_' => numberFormat($riga->qta, 'qta')]).'\'>'.$riga->um.' <small><i class=\'text-muted fa fa-info-circle\'></i></small></span>", "disabled": "'.($riga->isSconto() ? 1 : 0).'", "disabled": "'.($block_edit || $riga->isSconto()).'" ]}
|
||||
<div class="progress" style="height:4px;">';
|
||||
{[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "decimals": "qta", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-before": "'.$riga->um.'", "disabled": "'.($riga->isSconto() ? 1 : 0).'", "disabled": "'.($block_edit || $riga->isSconto()).'" ]}
|
||||
|
||||
<span class="tip" title="'.tr('Quantità evasa').' / '.tr('totale').': '.tr('_QTA_ / _TOT_', ['_QTA_' => numberFormat($riga->qta_evasa, 'qta'), '_TOT_' => numberFormat($riga->qta, 'qta')]).'">
|
||||
<div class="progress clickable" style="height:4px;" onclick="apriDocumenti(this)">';
|
||||
// Visualizzazione evasione righe per documento
|
||||
$color = '';
|
||||
$valore_evaso = 0;
|
||||
@ -164,13 +172,14 @@ foreach ($righe as $riga) {
|
||||
$perc_ev = $valore_evaso * 100 / ($riga->qta ?: 1);
|
||||
if ($perc_ev > 0) {
|
||||
echo '
|
||||
<div class="progress-bar bg-'.$color.'" style="width:'.$perc_ev.'%"></div>';
|
||||
<div class="progress-bar bg-'.$color.'" style="width:'.$perc_ev.'%"></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
</td>';
|
||||
|
||||
if ($riga->isArticolo()) {
|
||||
@ -662,4 +671,12 @@ if (Plugin::where('name', 'Distinta base')->first()->id) {
|
||||
}';
|
||||
}
|
||||
echo '
|
||||
|
||||
function apriDocumenti(div) {
|
||||
let riga = $(div).closest("tr");
|
||||
let id = riga.data("id");
|
||||
let type = riga.data("type");
|
||||
|
||||
openModal("'.tr('Documenti collegati').'", globals.rootdir + "/actions.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&op=visualizza_documenti_collegati&riga_id=" + id + "&riga_type=" + type)
|
||||
}
|
||||
</script>';
|
||||
|
@ -100,7 +100,7 @@ if (!empty($id_record)) {
|
||||
GROUP BY
|
||||
id
|
||||
|
||||
ORDER BY `data`');
|
||||
ORDER BY `modulo`');
|
||||
|
||||
$is_anagrafica_deleted = !$ddt->anagrafica;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ use Models\Plugin;
|
||||
$block_edit = $record['flag_completato'];
|
||||
$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
|
||||
$righe = $order_row_desc ? $ddt->getRighe()->sortByDesc('created_at') : $ddt->getRighe();
|
||||
$colspan = $dir == 'entrata' ? '7' : '6';
|
||||
$colspan = $dir == 'entrata' ? '8' : '7';
|
||||
|
||||
$evasione_bar = [
|
||||
'Fatture di vendita' => 'success',
|
||||
@ -46,6 +46,7 @@ echo '
|
||||
</th>
|
||||
<th width="35" class="text-center">'.tr('#').'</th>
|
||||
<th>'.tr('Descrizione').'</th>
|
||||
<th width="100">'.tr('Documenti').'</th>
|
||||
<th class="text-center tip" width="150">'.tr('Q.tà').'</th>';
|
||||
if ($dir == 'entrata') {
|
||||
echo '<th class="text-center" width="150">'.tr('Costo unitario').'</th>';
|
||||
@ -100,26 +101,7 @@ foreach ($righe as $riga) {
|
||||
'.$num.'
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<small class="pull-right text-right text-muted">';
|
||||
|
||||
$numero_riferimenti_riga = $riga->referenceTargets()->count();
|
||||
$numero_riferimenti_collegati = $riga->referenceSources()->count();
|
||||
$riferimenti_presenti = $numero_riferimenti_riga;
|
||||
$testo_aggiuntivo = $riferimenti_presenti ? $numero_riferimenti_riga : '';
|
||||
echo '
|
||||
<button type="button" class="btn btn-xs btn-'.($riferimenti_presenti ? 'primary' : 'info').'" onclick="apriRiferimenti(this)">
|
||||
<i class="fa fa-chevron-right"></i> '.tr('Riferimenti').' '.$testo_aggiuntivo.'
|
||||
</button>';
|
||||
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginalComponent()) {
|
||||
echo '
|
||||
<br>'.reference($riga->getOriginalComponent()->getDocument(), tr('Origine'));
|
||||
}
|
||||
echo '
|
||||
</small>';
|
||||
|
||||
<td>';
|
||||
if ($riga->isArticolo()) {
|
||||
echo Modules::link('Articoli', $riga->idarticolo, $riga->codice.' - '.$riga->descrizione);
|
||||
} else {
|
||||
@ -151,6 +133,26 @@ foreach ($righe as $riga) {
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
$numero_riferimenti_riga = $riga->referenceTargets()->count();
|
||||
$numero_riferimenti_collegati = $riga->referenceSources()->count();
|
||||
$riferimenti_presenti = $numero_riferimenti_riga;
|
||||
$testo_aggiuntivo = $riferimenti_presenti ? '<span class="badge bg-info">'.$numero_riferimenti_riga.'</span>' : '';
|
||||
echo '
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-default btn-block" onclick="apriRiferimenti(this)">
|
||||
<i class="fa fa-chevron-right"></i> '.tr('Riferimenti').' '.$testo_aggiuntivo.'
|
||||
</button>';
|
||||
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginalComponent()) {
|
||||
echo '
|
||||
<button type="button" class="btn btn-xs btn-default btn-block">
|
||||
<i class="fa fa-file-text-o"></i> '.reference($riga->getOriginalComponent()->getDocument(), tr('Origine')).'
|
||||
</button>';
|
||||
}
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
if ($riga->isDescrizione()) {
|
||||
echo '
|
||||
<td></td>';
|
||||
@ -165,8 +167,10 @@ foreach ($righe as $riga) {
|
||||
// Quantità e unità di misura
|
||||
echo '
|
||||
<td>
|
||||
{[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-after": "<span class=\'tip\' title=\''.tr('Quantità evasa').' / '.tr('totale').': '.tr('_QTA_ / _TOT_', ['_QTA_' => numberFormat($riga->qta_evasa, 'qta'), '_TOT_' => numberFormat($riga->qta, 'qta')]).'\'>'.$riga->um.' <small><i class=\'text-muted fa fa-info-circle\'></i></small></span>", "disabled": "'.($riga->isSconto() ? 1 : 0).'", "disabled": "'.($block_edit || $riga->isSconto()).'", "decimals": "qta" ]}
|
||||
<div class="progress" style="height:4px;">';
|
||||
{[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-before": "'.$riga->um.'", "disabled": "'.($block_edit || $riga->isSconto()).'", "decimals": "qta" ]}
|
||||
|
||||
<span class="tip" title="'.tr('Quantità evasa').' / '.tr('totale').': '.tr('_QTA_ / _TOT_', ['_QTA_' => numberFormat($riga->qta_evasa, 'qta'), '_TOT_' => numberFormat($riga->qta, 'qta')]).'">
|
||||
<div class="progress clickable" style="height:4px;" onclick="apriDocumenti(this)">';
|
||||
// Visualizzazione evasione righe per documento
|
||||
$color = '';
|
||||
$valore_evaso = 0;
|
||||
@ -185,13 +189,14 @@ foreach ($righe as $riga) {
|
||||
$perc_ev = $valore_evaso * 100 / ($riga->qta ?: 1);
|
||||
if ($perc_ev > 0) {
|
||||
echo '
|
||||
<div class="progress-bar bg-'.$color.'" style="width:'.$perc_ev.'%"></div>';
|
||||
<div class="progress-bar bg-'.$color.'" style="width:'.$perc_ev.'%"></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
</td>';
|
||||
|
||||
if ($riga->isArticolo()) {
|
||||
@ -596,6 +601,14 @@ function apriRiferimenti(button) {
|
||||
openModal("'.tr('Riferimenti riga').'", globals.rootdir + "/actions.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&op=visualizza_righe_riferimenti&riga_id=" + id + "&riga_type=" + type)
|
||||
}
|
||||
|
||||
function apriDocumenti(div) {
|
||||
let riga = $(div).closest("tr");
|
||||
let id = riga.data("id");
|
||||
let type = riga.data("type");
|
||||
|
||||
openModal("'.tr('Documenti collegati').'", globals.rootdir + "/actions.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&op=visualizza_documenti_collegati&riga_id=" + id + "&riga_type=" + type)
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
sortable(".sortable", {
|
||||
axis: "y",
|
||||
|
@ -45,5 +45,24 @@ if (!empty($id_record)) {
|
||||
WHERE
|
||||
`in_interventi`.`id`='.prepare($id_record));
|
||||
|
||||
$elementi = $dbo->fetchArray('SELECT
|
||||
`co_documenti`.`id`,
|
||||
`co_documenti`.`data`,
|
||||
`co_documenti`.`numero`,
|
||||
`co_documenti`.`numero_esterno`,
|
||||
`co_tipidocumento_lang`.`title` AS tipo_documento,
|
||||
IF(`co_tipidocumento`.`dir` = \'entrata\', \'Fatture di vendita\', \'Fatture di acquisto\') AS modulo,
|
||||
GROUP_CONCAT(CONCAT(`original_id`, " - ", `qta`) SEPARATOR ", ") AS righe
|
||||
FROM
|
||||
`co_documenti`
|
||||
INNER JOIN `co_righe_documenti` ON `co_righe_documenti`.`iddocumento` = `co_documenti`.`id`
|
||||
INNER JOIN `co_tipidocumento` ON `co_tipidocumento`.`id` = `co_documenti`.`idtipodocumento`
|
||||
LEFT JOIN `co_tipidocumento_lang` ON (`co_tipidocumento_lang`.`id_record` = `co_tipidocumento`.`id` AND `co_tipidocumento_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).')
|
||||
WHERE
|
||||
(`co_righe_documenti`.`original_document_id` = '.prepare($id_record).' AND `co_righe_documenti`.`original_document_type` = \'Modules\\\\Interventi\\\\Intervento\')
|
||||
GROUP BY
|
||||
id
|
||||
ORDER BY `modulo`');
|
||||
|
||||
$is_anagrafica_deleted = !$intervento->anagrafica;
|
||||
}
|
||||
|
@ -24,10 +24,14 @@ use Models\Plugin;
|
||||
|
||||
$block_edit = $record['flag_completato'];
|
||||
$righe = $intervento->getRighe();
|
||||
$colspan = '6';
|
||||
$colspan = '7';
|
||||
|
||||
$show_prezzi = Auth::user()['gruppo'] != 'Tecnici' || (Auth::user()['gruppo'] == 'Tecnici' && setting('Mostra i prezzi al tecnico'));
|
||||
|
||||
$evasione_bar = [
|
||||
'Fatture di vendita' => 'success'
|
||||
];
|
||||
|
||||
echo '
|
||||
<div class="table-responsive row-list">
|
||||
<table class="table table-striped table-hover table-sm table-bordered">
|
||||
@ -41,6 +45,7 @@ if (!$block_edit && sizeof($righe) > 0) {
|
||||
echo '
|
||||
</th>
|
||||
<th>'.tr('Descrizione').'</th>
|
||||
<th width="100">'.tr('Documenti').'</th>
|
||||
<th class="text-center" width="150">'.tr('Q.tà').'</th>';
|
||||
|
||||
if ($show_prezzi) {
|
||||
@ -51,7 +56,7 @@ if ($show_prezzi) {
|
||||
<th class="text-center" width="130">'.tr('Importo').'</th>';
|
||||
}
|
||||
echo '
|
||||
<th class="text-center" width="60" class="text-center">'.tr(' ').'</th>';
|
||||
<th class="text-center" width="80" class="text-center">'.tr(' ').'</th>';
|
||||
echo '
|
||||
</tr>
|
||||
</thead>
|
||||
@ -77,22 +82,7 @@ foreach ($righe as $riga) {
|
||||
echo '
|
||||
</td>
|
||||
<td>';
|
||||
|
||||
// Informazioni aggiuntive sulla destra
|
||||
echo '
|
||||
<small class="pull-right text-right text-muted">';
|
||||
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginalComponent()) {
|
||||
echo '
|
||||
'.reference($riga->getOriginalComponent()->getDocument(), tr('Origine'));
|
||||
}
|
||||
|
||||
echo '
|
||||
</small>';
|
||||
|
||||
echo '
|
||||
'.Modules::link($riga->isArticolo() ? 'Articoli' : null, $riga->isArticolo() ? $riga['idarticolo'] : null, $descrizione);
|
||||
echo Modules::link($riga->isArticolo() ? 'Articoli' : null, $riga->isArticolo() ? $riga['idarticolo'] : null, $descrizione);
|
||||
|
||||
if ($riga->isArticolo()) {
|
||||
if (!empty($mancanti)) {
|
||||
@ -118,13 +108,53 @@ foreach ($righe as $riga) {
|
||||
echo '
|
||||
<br><span class="right badge badge-default">'.nl2br($riga->note).'</small>';
|
||||
}
|
||||
echo '
|
||||
</td>
|
||||
|
||||
<td>';
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginalComponent()) {
|
||||
echo '
|
||||
<button type="button" class="btn btn-xs btn-default btn-block">
|
||||
<i class="fa fa-file-text-o"></i> '.reference($riga->getOriginalComponent()->getDocument(), tr('Origine')).'
|
||||
</button>';
|
||||
}
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
// Quantità e unità di misura
|
||||
echo '
|
||||
<td>
|
||||
{[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-after": "'.($riga->um ?: ' ').'", "disabled": "'.($riga->isSconto() ? 1 : 0).'", "disabled": "'.($block_edit || $riga->isSconto()).'","decimals": "qta" ]}
|
||||
{[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-before": "'.$riga->um.'", "disabled": "'.($block_edit || $riga->isSconto()).'","decimals": "qta" ]}
|
||||
|
||||
<span class="tip" title="'.tr('Quantità evasa').' / '.tr('totale').': '.tr('_QTA_ / _TOT_', ['_QTA_' => numberFormat($riga->qta_evasa, 'qta'), '_TOT_' => numberFormat($riga->qta, 'qta')]).'">
|
||||
<div class="progress clickable" style="height:4px;" onclick="apriDocumenti(this)">';
|
||||
// Visualizzazione evasione righe per documento
|
||||
$color = '';
|
||||
$valore_evaso = 0;
|
||||
foreach ($elementi as $elemento) {
|
||||
$righe_evase = explode(', ', (string) $elemento['righe']);
|
||||
$righe_evase_array = array_reduce($righe_evase, function ($carry, $riga_evasa) {
|
||||
[$id, $qta] = explode(' - ', $riga_evasa);
|
||||
$carry[$id] = $qta;
|
||||
|
||||
return $carry;
|
||||
}, []);
|
||||
foreach ($righe_evase_array as $id => $qta) {
|
||||
if ($id == $riga->id) {
|
||||
$color = $evasione_bar[$elemento['modulo']];
|
||||
$valore_evaso = $qta;
|
||||
$perc_ev = $valore_evaso * 100 / ($riga->qta ?: 1);
|
||||
if ($perc_ev > 0) {
|
||||
echo '
|
||||
<div class="progress-bar bg-'.$color.'" style="width:'.$perc_ev.'%"></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '
|
||||
</div>
|
||||
</span>
|
||||
</td>';
|
||||
|
||||
if ($show_prezzi) {
|
||||
@ -299,6 +329,17 @@ if (!$block_edit && sizeof($righe) > 0) {
|
||||
}
|
||||
echo '
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<h5>'.tr('Quantità evasa in').':</h5>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<span class="pull-left icon" style="background-color:#28a745;"></span>
|
||||
<span class="text"> '.tr('Fattura').'</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
async function modificaRiga(button) {
|
||||
@ -535,5 +576,13 @@ if (Plugin::where('name', 'Distinta base')->first()->id) {
|
||||
openModal("'.tr('Distinta base').'", "'.Plugin::where('name', 'Distinta base')->first()->fileurl('view.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&id_articolo=" + id_articolo);
|
||||
}';
|
||||
}
|
||||
|
||||
echo '
|
||||
function apriDocumenti(div) {
|
||||
let riga = $(div).closest("tr");
|
||||
let id = riga.data("id");
|
||||
let type = riga.data("type");
|
||||
|
||||
openModal("'.tr('Documenti collegati').'", globals.rootdir + "/actions.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&op=visualizza_documenti_collegati&riga_id=" + id + "&riga_type=" + type)
|
||||
}
|
||||
</script>';
|
||||
|
@ -118,7 +118,7 @@ if (!empty($id_record)) {
|
||||
GROUP BY id
|
||||
|
||||
ORDER BY
|
||||
`data`');
|
||||
`modulo`');
|
||||
|
||||
$is_anagrafica_deleted = !$ordine->anagrafica;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ $block_edit = $record['flag_completato'];
|
||||
$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
|
||||
$righe = $order_row_desc ? $ordine->getRighe()->sortByDesc('created_at') : $ordine->getRighe();
|
||||
$dir = $ordine->direzione;
|
||||
$colspan = $dir == 'entrata' ? '8' : '7';
|
||||
$colspan = $dir == 'entrata' ? '9' : '8';
|
||||
|
||||
$evasione_bar = [
|
||||
'Ddt in entrata' => 'info',
|
||||
@ -53,6 +53,7 @@ echo '
|
||||
</th>
|
||||
<th width="35" class="text-center" >'.tr('#').'</th>
|
||||
<th>'.tr('Descrizione').'</th>
|
||||
<th width="100">'.tr('Documenti').'</th>
|
||||
<th width="105">'.tr('Prev. evasione').'</th>
|
||||
<th class="text-center tip" width="160">'.tr('Q.tà').'</th>';
|
||||
if ($dir == 'entrata') {
|
||||
@ -111,22 +112,6 @@ foreach ($righe as $riga) {
|
||||
|
||||
<td>';
|
||||
|
||||
$numero_riferimenti_riga = $riga->referenceTargets()->count();
|
||||
$numero_riferimenti_collegati = $riga->referenceSources()->count();
|
||||
$riferimenti_presenti = $numero_riferimenti_riga;
|
||||
$testo_aggiuntivo = $riferimenti_presenti ? $numero_riferimenti_riga : '';
|
||||
|
||||
echo '
|
||||
<button type="button" class="btn btn-xs btn-'.($riferimenti_presenti ? 'primary' : 'info').' pull-right text-right" onclick="apriRiferimenti(this)">
|
||||
<i class="fa fa-chevron-right"></i> '.tr('Riferimenti').' '.$testo_aggiuntivo.'
|
||||
</button>';
|
||||
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginalComponent()) {
|
||||
echo '
|
||||
<small class="pull-right text-right text-muted">'.reference($riga->getOriginalComponent()->getDocument(), tr('Origine')).'</small>';
|
||||
}
|
||||
|
||||
if ($riga->isArticolo()) {
|
||||
$articolo_riga = Articolo::find($riga->idarticolo);
|
||||
|
||||
@ -171,6 +156,26 @@ foreach ($righe as $riga) {
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
$numero_riferimenti_riga = $riga->referenceTargets()->count();
|
||||
$numero_riferimenti_collegati = $riga->referenceSources()->count();
|
||||
$riferimenti_presenti = $numero_riferimenti_riga;
|
||||
$testo_aggiuntivo = $riferimenti_presenti ? '<span class="badge bg-info">'.$numero_riferimenti_riga.'</span>' : '';
|
||||
echo '
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-default btn-block" onclick="apriRiferimenti(this)">
|
||||
<i class="fa fa-chevron-right"></i> '.tr('Riferimenti').' '.$testo_aggiuntivo.'
|
||||
</button>';
|
||||
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginalComponent()) {
|
||||
echo '
|
||||
<button type="button" class="btn btn-xs btn-default btn-block">
|
||||
<i class="fa fa-file-text-o"></i> '.reference($riga->getOriginalComponent()->getDocument(), tr('Origine')).'
|
||||
</button>';
|
||||
}
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
// Data prevista evasione
|
||||
$info_evasione = '';
|
||||
if (!empty($riga->data_evasione)) {
|
||||
@ -222,8 +227,10 @@ foreach ($righe as $riga) {
|
||||
// Quantità e unità di misura
|
||||
echo '
|
||||
<td>
|
||||
{[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-before": "<span class=\'tip\' title=\''.($riga->confermato ? tr('Articolo confermato') : tr('Articolo non confermato')).'\'><i class=\''.($riga->confermato ? 'fa fa-check text-success' : 'fa fa-clock-o text-warning').'\'></i></span>", "icon-after": "<span class=\'tip\' title=\''.tr('Quantità evasa').' / '.tr('totale').': '.tr('_QTA_ / _TOT_', ['_QTA_' => numberFormat($riga->qta_evasa, 'qta'), '_TOT_' => numberFormat($riga->qta, 'qta')]).'\'>'.$riga->um.' <small><i class=\'text-muted fa fa-info-circle\'></i></small></span>", "disabled": "'.($riga->isSconto() ? 1 : 0).'", "disabled": "'.($block_edit || $riga->isSconto()).'", "decimals": "qta" ]}
|
||||
<div class="progress" style="height:4px;">';
|
||||
{[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-after": "<span class=\'tip\' title=\''.($riga->confermato ? tr('Articolo confermato') : tr('Articolo non confermato')).'\'><i class=\''.($riga->confermato ? 'fa fa-check text-success' : 'fa fa-clock-o text-warning').'\'></i></span>", "icon-before": "'.$riga->um.'", "disabled": "'.($block_edit || $riga->isSconto()).'", "decimals": "qta" ]}
|
||||
|
||||
<span class="tip" title="'.tr('Quantità evasa').' / '.tr('totale').': '.tr('_QTA_ / _TOT_', ['_QTA_' => numberFormat($riga->qta_evasa, 'qta'), '_TOT_' => numberFormat($riga->qta, 'qta')]).'">
|
||||
<div class="progress clickable" style="height:4px;" onclick="apriDocumenti(this)">';
|
||||
// Visualizzazione evasione righe per documento
|
||||
$color = '';
|
||||
$valore_evaso = 0;
|
||||
@ -242,13 +249,14 @@ foreach ($righe as $riga) {
|
||||
$perc_ev = $valore_evaso * 100 / ($riga->qta ?: 1);
|
||||
if ($perc_ev > 0) {
|
||||
echo '
|
||||
<div class="progress-bar bg-'.$color.'" style="width:'.$perc_ev.'%"></div>';
|
||||
<div class="progress-bar bg-'.$color.'" style="width:'.$perc_ev.'%"></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
</td>';
|
||||
|
||||
if ($riga->isArticolo()) {
|
||||
@ -553,10 +561,6 @@ echo '
|
||||
<span class="pull-left icon" style="background-color:#ffc107;"></span>
|
||||
<span class="text"> '.tr('Attività').'</span>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<span class="pull-left icon" style="background-color:#007bff;;"></span>
|
||||
<span class="text"> '.tr('Ordine').'</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -698,6 +702,14 @@ function apriRiferimenti(button) {
|
||||
openModal("'.tr('Riferimenti riga').'", globals.rootdir + "/actions.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&op=visualizza_righe_riferimenti&riga_id=" + id + "&riga_type=" + type)
|
||||
}
|
||||
|
||||
function apriDocumenti(div) {
|
||||
let riga = $(div).closest("tr");
|
||||
let id = riga.data("id");
|
||||
let type = riga.data("type");
|
||||
|
||||
openModal("'.tr('Documenti collegati').'", globals.rootdir + "/actions.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&op=visualizza_documenti_collegati&riga_id=" + id + "&riga_type=" + type)
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
sortable(".sortable", {
|
||||
axis: "y",
|
||||
|
@ -120,7 +120,7 @@ if (!empty($id_record)) {
|
||||
WHERE `co_righe_contratti`.`original_document_id` = '.prepare($id_record).' AND `co_righe_contratti`.`original_document_type` = \'Modules\\\\Preventivi\\\\Preventivo\'
|
||||
GROUP BY id
|
||||
|
||||
ORDER BY `data`');
|
||||
ORDER BY `modulo`');
|
||||
|
||||
$is_anagrafica_deleted = !$preventivo->anagrafica;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ use Models\Plugin;
|
||||
$block_edit = $record['is_completato'];
|
||||
$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
|
||||
$righe = $order_row_desc ? $preventivo->getRighe()->sortByDesc('created_at') : $preventivo->getRighe();
|
||||
$colspan = '8';
|
||||
$colspan = '9';
|
||||
|
||||
echo '
|
||||
<div class="table-responsive row-list">
|
||||
@ -41,6 +41,7 @@ echo '
|
||||
</th>
|
||||
<th width="35" class="text-center" >'.tr('#').'</th>
|
||||
<th>'.tr('Descrizione').'</th>
|
||||
<th width="100">'.tr('Documenti').'</th>
|
||||
<th width="105">'.tr('Prev. evasione').'</th>
|
||||
<th class="text-center tip" width="160">'.tr('Q.tà').'</th>
|
||||
<th class="text-center" width="150">'.tr('Costo unitario').'</th>
|
||||
@ -103,12 +104,6 @@ foreach ($righe as $key => $riga) {
|
||||
|
||||
<td '.$colspan_titolo.'>';
|
||||
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginalComponent()) {
|
||||
echo '
|
||||
<small class="pull-right text-right text-muted">'.reference($riga->getOriginalComponent()->getDocument(), tr('Origine')).'</small>';
|
||||
}
|
||||
|
||||
// Descrizione
|
||||
$descrizione = nl2br($riga->descrizione);
|
||||
if ($riga->isArticolo()) {
|
||||
@ -126,9 +121,21 @@ foreach ($righe as $key => $riga) {
|
||||
echo '
|
||||
<br><span class="right badge badge-default">'.nl2br($riga->note).'</small>';
|
||||
}
|
||||
echo '
|
||||
</td>
|
||||
|
||||
<td>';
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginalComponent()) {
|
||||
echo '
|
||||
<button type="button" class="btn btn-xs btn-default btn-block">
|
||||
<i class="fa fa-file-text-o"></i> '.reference($riga->getOriginalComponent()->getDocument(), tr('Origine')).'
|
||||
</button>';
|
||||
}
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
|
||||
// Data prevista evasione
|
||||
$info_evasione = '';
|
||||
if (!empty($riga->data_evasione)) {
|
||||
@ -180,9 +187,10 @@ foreach ($righe as $key => $riga) {
|
||||
// Quantità e unità di misura
|
||||
echo '
|
||||
<td class="text-center">
|
||||
{[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-before": "<span class=\'tip\' title=\''.($riga->confermato ? tr('Articolo confermato') : tr('Articolo non confermato')).'\'><i class=\''.($riga->confermato ? 'fa fa-check text-success' : 'fa fa-clock-o text-warning').'\'></i></span>", "icon-after": "<span class=\'tip\' title=\''.tr('Quantità evasa').' / '.tr('totale').': '.tr('_QTA_ / _TOT_', ['_QTA_' => numberFormat($riga->qta_evasa, 'qta'), '_TOT_' => numberFormat($riga->qta, 'qta')]).'\'>'.$riga->um.' <small><i class=\'text-muted fa fa-info-circle\'></i></small></span>", "disabled": "'.($riga->isSconto() ? 1 : 0).'", "disabled": "'.($block_edit || $riga->isSconto()).'", "decimals": "qta" ]}
|
||||
<div class="progress" style="height:4px;">';
|
||||
{[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-after": "<span class=\'tip\' title=\''.($riga->confermato ? tr('Articolo confermato') : tr('Articolo non confermato')).'\'><i class=\''.($riga->confermato ? 'fa fa-check text-success' : 'fa fa-clock-o text-warning').'\'></i></span>", "icon-before": "'.$riga->um.'", "disabled": "'.($block_edit || $riga->isSconto()).'", "decimals": "qta" ]}
|
||||
|
||||
<span class="tip" title="'.tr('Quantità evasa').' / '.tr('totale').': '.tr('_QTA_ / _TOT_', ['_QTA_' => numberFormat($riga->qta_evasa, 'qta'), '_TOT_' => numberFormat($riga->qta, 'qta')]).'">
|
||||
<div class="progress clickable" style="height:4px;" onclick="apriDocumenti(this)">';
|
||||
// Visualizzazione evasione righe per documento
|
||||
$color = '';
|
||||
$valore_evaso = 0;
|
||||
@ -204,14 +212,15 @@ foreach ($righe as $key => $riga) {
|
||||
|
||||
if ($perc_ev > 0) {
|
||||
echo '
|
||||
<div class="progress-bar bg-'.$color.'" style="width:'.$perc_ev.'%"></div>';
|
||||
<div class="progress-bar bg-'.$color.'" style="width:'.$perc_ev.'%"></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
</td>';
|
||||
|
||||
if ($riga->isArticolo()) {
|
||||
@ -760,5 +769,13 @@ if (Plugin::where('name', 'Distinta base')->first()) {
|
||||
openModal("'.tr('Distinta base').'", "'.Plugin::where('name', 'Distinta base')->first()->fileurl('view.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&id_articolo=" + id_articolo);
|
||||
}';
|
||||
}
|
||||
|
||||
echo '
|
||||
function apriDocumenti(div) {
|
||||
let riga = $(div).closest("tr");
|
||||
let id = riga.data("id");
|
||||
let type = riga.data("type");
|
||||
|
||||
openModal("'.tr('Documenti collegati').'", globals.rootdir + "/actions.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&op=visualizza_documenti_collegati&riga_id=" + id + "&riga_type=" + type)
|
||||
}
|
||||
</script>';
|
||||
|
Loading…
x
Reference in New Issue
Block a user