Distributor Report'; $Round = $_SESSION ['Round']; if ($Round == NULL) { # $Menu,$cancel,$new,$Delete,$Map,$Show DistributorButtons (TRUE,TRUE,TRUE,FALSE,TRUE,FALSE); reportalldistributors ($dbc); } else { $q ='SELECT Title,FullName FROM distributors WHERE Round = "'.$Round.'" ;'; $result = mysqli_query ($dbc, $q); $row= mysqli_fetch_array( $result) ; $FullName = $row ['Title'].' '.$row ['FullName']; #print '
Round '.$Round.' FullName '.$FullName; print '
'; print '
'; # $Menu,$cancel,$new,$Delete,$Map,$Show DistributorButtons (TRUE,TRUE,TRUE,FALSE,FALSE,FALSE); print '
'; printDistributorReport ($dbc,$Round,$FullName); print '
'; } function printDistributorReport ($dbc, $Round,$FullName) { $q = 'SELECT * FROM outlets2 INNER JOIN roundoutlet ON NewoutletRef =idOutlets2 WHERE Round1 = '.$Round.' ORDER BY Townvillage, Postcode ;'; #print '
FullName '.$FullName.' Query '.$q; $result = mysqli_query ($dbc, $q); if (!$result ) {print '
failed to open '.mysqli_error($result);}; $rowcount = mysqli_num_rows ($result); print '

No of outlets : '.$rowcount.'

'; print '

Distributor Name : '.$FullName.'

'; # Create table layout and headers print '
'; while ($row= mysqli_fetch_array ($result)) { $idOutlets2 = $row ['idOutlets2']; $Outletname = $row['Outletname']; $Postaladdress =$row['Postaladdress']; #$Postaladdress2 = $row['Postaladdress2']; $Townvillage =$row['Townvillage']; $Postcode = $row['Postcode']; $County= $row ['County']; $Venue = $row ['Venue']; $Posters =$row['Posters']; $Deliveryn =$row[ 'Deliveryn']; $Outlettype = $row['Outlettype']; $Outletcomment = $row ['Outletcomment']; $Latitude = $row ['Latitude']; $Longitude = $row['Longitude']; # Generate distributors $Distributors =printdistributorlist ($dbc,$idOutlets2); if ($Deliveryn == 'No') {$d = ' style="background-color:lightgray;" '; } else {$d=NULL;}; print ' '; } print '
Ref Outletname Postaladdress Townvillage Postcode Distributors Venue Posters Outlettype Outletcomment
'.$idOutlets2.' '.$Outletname.' '.$Postaladdress.' '.$Townvillage.' '.$Postcode.' '.$Distributors.' '.$Venue.' '.$Posters.' '.$Outlettype.' '.$Outletcomment.'
'; $q = 'SELECT DISTINCT Townvillage FROM outlets2 INNER JOIN roundoutlet ON NewoutletRef = idOutlets2 WHERE Round1 = '.$Round.' ORDER BY Townvillage ;'; print '
Villages Served :'; $result = mysqli_query ($dbc,$q); if( !$result ) { record_session_message ('Failed to access townvillage : '.mysqli_error($dbc));}; while ($row1 = mysqli_fetch_array ($result)) { print ' '.$row1 ['Townvillage'].', ';}; }; ?>