include ("../common/public.php") ;
// print_r($_GET + $_POST) ; // exit ;
if (isset($azienda) and $azienda != 0)
{
$db->query("select Nome from fornitori where idfornitori = $azienda") ;
while ($db->next_record())
$nome = $db->f("Nome") ;
}
if (isset($azienda))
{
if ($azienda == 0)
$legend = "Prodotti presenti" ;
else
$legend = "Prodotti presenti per l'azienda $nome" ;
}
$str = "" ;
if (isset($azienda) and $azienda != $idsarzi)
{
// NON SARZI
$query = "
select
*,
P.Qutilizzata as UtiP,
F.Nome as NomeFornitore,
P.idprodotti as IdProdotti,
P.Nome as NomeProdotto,
QP.Qassegnata as QuaAss,
QP.Qutilizzata as QuaUti,
I.aliquota as Iva
from
prodotti P
inner join QuantitaProdotti QP on P.IdProdotti = QP.IdProdotto and
QP.Anno = $anno,
fornitori F,
categorie C,
iva I
where
P.Anno = $anno and
P.fornitore = F.IdFornitori and
P.Categoria = IdCategorie and
P.Fornitore = $azienda and
P.idivaprd = I.idiva and
P.attivo = 'Y'
order by
P.CodiceProdotto,
P.Nome,
P.Annata DESC" ;
debug (1, $query) ;
}
else
{
// SARZI
$query = "
select
*,
$tfornitori.Nome as NomeFornitore,
$tsarzi.Nome as NomeProdotto,
$tiva.aliquota as Iva
from
$tsarzi,
$tfornitori,
$tiva
where
$tfornitori.IdFornitori = $idsarzi and
$tsarzi.idivaprd = $tiva.idiva
order by
$tsarzi.Nome" ;
}
debug (0, $query) ;
list($n, $d) = $db->RecuperaDati($query) ;
// print_r($d) ; exit ;
for ($i=0; $i<$n; $i++)
{
$id_prodotto = $d['IdProdotti'][$i] ;
$str .= "" ;
$str .= "| ../imgs/b_edit.png^Modifica^javascript:ModificaProdotto($id_prodotto)^_self | " ;
$str .= "../imgs/b_drop.png^Modifica^javascript:EliminaProdotto($id_prodotto)^_self | " ;
$str .= "" . $d['CodiceProdotto'][$i] . " | " ;
$str .= "" . htmlspecialchars($d['NomeProdotto'][$i]) . " | " ;
$str .= "" . $d['DesCat'][$i] . " | " ;
$str .= "" . $d['Annata'][$i] . " | " ;
$str .= "" . nfe($d['PrezzoUnitario'][$i] + $d['Accisa'][$i]) . " | " ;
$str .= "" . $d['Iva'][$i] . "% | " ;
$str .= "" . $d['QuaAss'][$i] . " | " ;
// $str .= "" . ($d['QuaAss'][$i] - $d['QuaUti'][$i]) . " | " ;
$str .= "" . ($d['QuaAss'][$i] - $d['UtiP'][$i]) . " | " ;
$str .= "" . SiNo($d['Esaurito'][$i]) . " | " ;
$str .= "" . $d['Note'][$i] . " | " ;
$str .= "
" ;
}
$str .= "" ;
$header = ",,CODICE,NOME PRODOTTO,CATEGORIA,ANNATA,PREZZO,IVA,QTA ASS,QTA RES,ESAURITO?,NOTE" ;
$strSort = "na,na,str,str,str,int,euro,int,int,int,str,str" ;
$iniWP = "2,2,6,20,8,7,7,5,7,7,7,20" ;
$setColType = "img,img,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro" ;
$setColAlign = "center, center,left,left,left,center,right,center,center,center,center,center" ;
?>
echo TITLE ?>
if ($profilo < 3) : ?>
endif ?>
if ($azienda != $idsarzi and $profilo < 3) : ?>
endif ?>
if ($from != 'opeprodotti') : ?>
endif ?>
echo $legend ?>
Numero Prodotti: echo $n?>
(per selezionare un prodotto clicca sulla riga corrispondente)