2024-10-16 08:49:02 +02:00
< ? 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' ;
$immagine_articolo = $articolo -> immagine ? base_path () . '/files/articoli/' . $articolo -> immagine : App :: getPaths ()[ 'img' ] . '/logo_header.png' ;
echo '
< hr >
< div class = " row " >
2024-10-16 16:06:04 +02:00
< div class = " col-md-6 " >
2024-10-16 08:49:02 +02:00
< div class = " card card-info card-outline shadow " >
< div class = " card-header " >
< h3 class = " card-title " >< i class = " fa fa-vcard " ></ i > '.tr(' Articolo ').' </ h3 >
</ div >
< div class = " card-body " >
< div class = " row " >
2024-10-16 16:06:04 +02:00
< div class = " col-md-3 " >
2024-10-16 08:49:02 +02:00
< img src = " '. $immagine_articolo .' " " class= " img - fluid " >
</ div >
2024-10-16 16:06:04 +02:00
< div class = " col-md-9 " > ' ;
2024-11-06 09:45:50 +01:00
// Articolo
if ( $articolo -> marchio || $articolo -> modello ) {
echo '
< p class = " float-right " >< i class = " fa fa-tag " ></ i >
'.($articolo->marchio ? ($articolo->marchio->link ? ' < a href = " '. $articolo->marchio ->link.' " target = " _blank " rel = " noopener noreferrer " > '.$articolo->marchio->name.' </ a > ' : $articolo->marchio->name.' ') : ' ' ) .
( $articolo -> modello ? ' <small><i class="fa fa-chevron-right"></i></small> ' . $articolo -> modello . ' ' : '' )
. '</p>' ;
}
if ( $articolo -> id_categoria ) {
echo '
< p class = " text-muted " > '.$articolo->categoria->getTranslation(' title ' ) .
( $articolo -> sottocategoria ? ' <small><i class="fa fa-chevron-right"></i></small> ' . $articolo -> sottocategoria -> getTranslation ( 'title' ) : '' ) .
'</p>' ;
}
echo '
< p >< h4 >< b > '.$articolo->getTranslation(' title ').' </ b > '.($articolo->attivo ? ' < i class = " fa fa-check text-success " ></ i > ' : ' < i class = " fa fa-times text-danger " ></ i > ').' </ h4 ></ p >
2024-10-16 16:06:04 +02:00
< p >< b > '.$articolo->codice.' </ b > '.($articolo->barcode ? ' - < i class = " fa fa-barcode " ></ i > '.$articolo->barcode.' </ p > ' : ' ').' </ p >
2024-10-16 14:48:47 +02:00
'.($articolo->note ? ' < p class = " text-danger " >< i class = " fa fa-pencil-square-o " ></ i > '.$articolo->note.' </ p > ' : ' ').'
2024-10-16 08:49:02 +02:00
</ div >
</ div >
</ div >
</ div >
</ div > ' ;
if ( $user -> is_admin ) {
2024-11-18 18:14:59 +01:00
$sedi = $dbo -> fetchArray ( 'SELECT * FROM ((SELECT "0" AS id, "Sede legale" AS nomesede) UNION (SELECT id, nomesede FROM an_sedi WHERE idanagrafica=' . prepare ( setting ( 'Azienda predefinita' )) . ')) sedi WHERE id IN(SELECT idsede FROM mg_movimenti WHERE idarticolo=' . prepare ( $articolo -> id ) . ')' );
2024-10-16 08:49:02 +02:00
} else {
2024-11-18 18:14:59 +01:00
$sedi = $dbo -> fetchArray ( 'SELECT * FROM ((SELECT "0" AS id, "Sede legale" AS nomesede) UNION (SELECT id, nomesede FROM an_sedi WHERE idanagrafica=' . prepare ( setting ( 'Azienda predefinita' )) . ')) sedi WHERE id IN(SELECT idsede FROM mg_movimenti WHERE idarticolo=' . prepare ( $articolo -> id ) . ') AND id IN(SELECT idsede FROM zz_user_sedi WHERE id_user=' . prepare ( $user [ 'id' ]) . ')' );
2024-10-16 08:49:02 +02:00
}
$giacenze = $articolo -> getGiacenze ();
// Giacenze
echo '
< div class = " col-md-4 " >
< div class = " card card-info card-outline shadow " >
< div class = " card-header " >
< h3 class = " card-title " >< i class = " fa fa-archive " ></ i > '.tr(' Giacenze ').' </ h3 >
</ div >
< div class = " card-body " > ' ;
2024-10-16 14:48:47 +02:00
if ( $articolo -> servizio ) {
echo '
2024-10-16 16:06:04 +02:00
< tr >< td >< p class = " text-center " >< i class = " fa fa-info " ></ i > '.tr(' Questo articolo è un servizio ').' </ td ></ tr > ' ;
2024-10-16 14:48:47 +02:00
} else {
echo '
2024-10-16 16:06:04 +02:00
< table class = " table table-sm " >
2024-10-16 14:48:47 +02:00
< thead >
< tr >
2024-11-18 18:14:59 +01:00
< th > '.tr(' Sede ').' </ th >
< th class = " text-right " > '.tr(' Giacenza ').' </ th >
2024-10-16 16:06:04 +02:00
'.($articolo->fattore_um_secondaria != 0 ? ' < th class = " text-right " > '.tr(' U . m . secondaria ').' </ th > ' : ' ').'
2024-10-16 14:48:47 +02:00
</ tr >
</ thead >
< tbody > ' ;
foreach ( $sedi as $sede ) {
2024-11-18 18:14:59 +01:00
echo '
< tr class = " '.( $giacenze[$sede['id'] ][0]< $articolo->threshold_qta ? 'text-danger' : '').' " >
< td > '.$sede[' nomesede '].' </ td >
< td class = " text-right " > '.numberFormat($giacenze[$sede[' id ']][0], ' qta ').' '.$articolo->um.' </ td >
'.($articolo->fattore_um_secondaria != 0 ? ' < td class = " text-right " >< i class = " fa fa-chevron-right pull-left " ></ i > '.$giacenze[$sede[' id ']][0] * $articolo->fattore_um_secondaria.' '.$articolo->um_secondaria.' </ td > ' : ' ').'
</ tr > ' ;
2024-10-16 14:48:47 +02:00
}
echo '
</ tbody >
</ table > ' ;
}
echo '
2024-10-16 08:49:02 +02:00
</ div >
</ div >
2024-10-16 16:06:04 +02:00
</ div > ' ;
// Panoramica
echo '
< div class = " col-md-2 " >
< div class = " card card-info card-outline shadow " >
< div class = " card-header " >
< h3 class = " card-title " >< i class = " fa fa-info-circle " ></ i > '.tr(' Informazioni ').' </ h3 >
</ div >
< div class = " card-body " >
< table class = " table table-sm " >
< tbody >
< tr >
< td > '. tr(' Garanzia ') .' </ td >
< td class = " text-right " > '. ($articolo->gg_garanzia ? $articolo->gg_garanzia.' giorni ' : ' ') .' </ td >
</ tr >
< tr >
< td > '. tr(' Serial number ') .' </ td >
< td class = " text-right " > '. ($articolo->abilita_serial ? ' < i class = " fa fa-check text-success " ></ i > ' : ' < i class = " fa fa-times text-danger " ></ i > ') .' </ td >
</ tr >
< tr >
< td > '. tr(' Ubicazione ') .' </ td >
< td class = " text-right " > '. ($articolo->ubicazione ? $articolo->ubicazione : ' ') .' </ td >
</ tr >
< tr >
< td > '. tr(' Peso lordo ') .' </ td >
< td class = " text-right " > '. ($articolo->peso_lordo ? numberFormat($articolo->peso_lordo, $decimals).' '.tr(' kg ') : ' ') .' </ td >
</ tr >
< tr >
< td > '. tr(' Volume ') .' </ td >
< td class = " text-right " > '. ($articolo->volume ? numberFormat($articolo->volume, $decimals).' '.tr(' m³ ') : ' ') .' </ td >
</ tr >
</ tbody >
</ table >
</ div >
</ div >
</ div >
2024-10-16 08:56:08 +02:00
</ div > ' ;