RecuperaDati($qnumClienti) ; $totClienti = count($arrNumCli['Nome']) ; /********************************************************************************* * per il calcolo del totale dei prodotti venduti e dei prodotti in sconto merce *********************************************************************************/ $qtot = " select sum(TT.TotDettV) as TotBottV, sum(TT.TotDettSM) as TotBottSM from (select sum(D.NumCartoni * D.ConfezioniDa) as TotDettV, 0 as TotDettSM from dettagli D inner join ordini O on O.idordini = D.idordine and O.idfornitore != $idsarzi and O.Anno = $anno inner join prodotti P on P.idprodotti = D.idprodotto $where_pro $where_ag $where_cl $where_fo where P.Anno = $anno and D.Anno = $anno union select 0 as TotDettV, sum(D.NumCartoni * D.ConfezioniDa) as TotDettSM from scontomerce D inner join ordini O on O.idordini = D.idordine and O.idfornitore != $idsarzi and O.Anno = $anno inner join prodotti P on P.idprodotti = D.idprodotto $where_pro $where_ag $where_cl $where_fo where P.Anno = $anno and D.Anno = $anno ) as TT " ; debug (0, $qtot) ; list ($nt, $d) = $db->RecuperaDati($qtot) ; $TotBottV = nfl($d['TotBottV'][0]) ; $TotBottSM = nfl($d['TotBottSM'][0]) ; $TotBottGen = nfl($d['TotBottV'][0] + $d['TotBottSM'][0]) ; if (($d['TotBottV'][0] + $d['TotBottSM'][0]) > 0) $TotPercSM = nfp($d['TotBottSM'][0] / ($d['TotBottV'][0] + $d['TotBottSM'][0]) * 100) ; else $TotPercSM = nfp(0) ; $arrAgenti = array() ; $arrClienti = array() ; $arrFornitori = array() ; $qf = " select distinct A.idagenti as IdAgente, A.nome as NomeAgente, C.idclienti as IdCliente, C.nome as NomeCliente, F.idfornitori as IdFornitore, F.nome as NomeFornitore from agenti A inner join ordini O on O.idagente = A.idagenti and O.Anno = $anno inner join clienti C on C.idclienti = O.idcliente inner join fornitori F on F.idfornitori = O.idfornitore where $wagente order by A.nome " ; debug (0, "PUNTO = $qf") ; list($n, $d) = $db->RecuperaDati($qf) ; for ($i=0; $i<$n; $i++) { if (!@array_key_exists($d['IdAgente'][$i], $arrAgenti)) $arrAgenti[$d['IdAgente'][$i]] = $d["NomeAgente"][$i] ; if (!@array_key_exists($d['IdCliente'][$i], $arrClienti)) $arrClienti[$d['IdCliente'][$i]] = $d["NomeCliente"][$i] ; if (!@array_key_exists($d['IdFornitore'][$i], $arrFornitori)) $arrFornitori[$d['IdFornitore'][$i]] = $d["NomeFornitore"][$i] ; } @asort($arrAgenti) ; @asort($arrClienti) ; @asort($arrFornitori) ; $header = "AGENTE,CLIENTE,FORNITORE,PRODOTTO,Totale,Venduto,Sconto Merce,% SM" ; $label = explode(",", $header) ; $attHeaderStyle = "background-color:#ffffaa;border-bottom:1px solid silver;padding:2px 2px 0px 2px" ; $attH = "
,
,
,
, , , , " ; $attHS = "$attHeaderStyle,$attHeaderStyle,$attHeaderStyle,$attHeaderStyle,$attHeaderStyle,$attHeaderStyle,$attHeaderStyle,$attHeaderStyle" ; $footer = "TOTALI PARZIALI:-#cspan-#cspan-#cspan-
-
-
-
" ; $strSort = "str,,str,str,str,int,int,int,int" ; $iniWP = "10,20,20,22,8,6,9,5" ; $setColType = "ro,ro,ro,ro,ro,ro,ro,ro" ; $setColAlign = "left,left,left,left,center,center,center,center" ; /******************************************************************************* * controllo se devo eseguire degli ordinamenti e qual è la colonna da ordinare *******************************************************************************/ if (! isset($colToSort) or $colToSort == '') $colToSort = 1 ; if (! isset($direction) or $direction == '') $direction = "ASC" ; $strLoadXml = "LoadListaClientiProdotti.php?ordinaper=$colToSort&direction=$direction" ; /****************************************************************** * controllo se provengo da una operazione di filtraggio. Questo si * verifica quando rag_sociale vale qualcosa ******************************************************************/ if ($agente != '') $strLoadXml .= "&selage=$agente" ; if ($cliente != '') $strLoadXml .= "&selcli=$cliente" ; if ($fornitore != '') $strLoadXml .= "&selfor=$fornitore" ; if ($prodotto != '') $strLoadXml .= "&selpro=$prodotto" ; debug (0, $strLoadXml) ; ?> New Document

Nessun elemento presente
Totale Clienti = ; (Per selezionare un ordine clicca sulla riga corrispondente)