--- a/admin/importUNSPSC.php +++ b/admin/importUNSPSC.php @@ -1,5 +1,29 @@ prepare('select * from "UNSPSCcategories";'); +$unspscresult->execute(); +foreach ($unspscresult->fetchAll() as $row) { + $unspsc[$row['UNSPSC']] = $row['Title']; + +} +$catsresult = $conn->prepare('SELECT substr( "categoryUNSPSC"::text, 0, 2 ) as cat , SUM( "value" ) as value +FROM contractnotice +GROUP BY cat ;'); +echo ""; +$catsresult->execute(); +foreach ($catsresult->fetchAll() as $row) { + $catName = $unspsc[$row['cat']."0000000"].$row['cat']; + if ($row['cat'] == "") $catName = "null"; + + echo ""; +} +// import new from file $success = 0; $fname = "UNSPSC_ECCMA_V13.2_UNDP_V7.csv"; echo " ============== $fname ==============
"; @@ -28,5 +52,6 @@ echo "
$success records successfully created"; flush(); fclose($handle); +} ?>
$catName".$row['value']."