include ("../common/public.php") ;
/***************************************************************
* Se $agente == 0 allora vuol dire che si desidera visualizzare gli ordini con pagamento anticipato ma senza assegno di tutti
* gli agenti, altrimenti si desidera la visualizzazione degli stessi per un determinato agente.
* Stesso discorso per $cliente e $fornitore. Eventualmente si puņ scegliere anche la data di spedizione dell'ordine
* VERSIONE 3.0 READY
***************************************************************/
$tit_ag = "Agente = Tutti" ;
$tit_cl = "Cliente = Tutti" ;
$tit_for = "Fornitore = Tutti" ;
if ($agente != 0)
{
$wagente = "O.idagente = $agente" ;
$db->query("select * from agenti where idagenti = $agente") ;
while ($db->next_record())
$nome = $db->f("Nome") ;
$tit_ag = "Agente = $nome" ;
}
else
{
$wagente = "1 = 1" ;
$tit_ag = "Agente = Tutti" ;
}
if ($profilo == 3)
$wagente .= " and O.idagente != 4 and O.idagente != 5 and O.idagente != 9 and O.idagente != 10" ;
if ($cliente != 0)
{
$wcliente = "O.idcliente = $cliente" ;
$db->query("select * from clienti where idclienti = $cliente") ;
while ($db->next_record())
$nomecl = $db->f("Nome") ;
$tit_cl = "Cliente = $nomecl" ;
}
else
{
$wcliente = "1 = 1" ;
$tit_cl = "Cliente = Tutti" ;
}
if ($fornitore != 0)
{
$wfornitore = "O.idfornitore = $fornitore" ;
$db->query("select * from fornitori where idfornitori = $fornitore") ;
while ($db->next_record())
$nomefor = $db->f("Nome") ;
$tit_for = "Fornitore = $nomefor" ;
}
else
{
$wfornitore = "1 = 1" ;
$tit_for = "Fornitore = Tutti" ;
}
if ($datadispedizione != "")
{
$mydata = MySqlDate($datadispedizione) ;
$wdata = "O.dataspedizione <= '$mydata'" ;
$tit_data = "Data di Spedizione <= $datadispedizione" ;
}
else
{
$tit_data = "" ;
$wdata = "1 = 1" ;
}
$titolo = "Ordini con Anticipato senza Assegno: $tit_ag; $tit_cl; $tit_for; $tit_data" ;
$str = "