if($type == 'instock')
$sSQL = "SELECT * FROM tenderstock LEFT OUTER JOIN soldreport on carid = soldcarid
LEFT OUTER JOIN tenderinvoice ON ivcarid = carid AND ivvalid = 1
WHERE ((ivuserid = 9322 AND coalesce(acsolddate , current_date) > '".date("Y-m-d" ,strtotime("-30 day"))."' ) OR show_uae = '1')
ORDER BY rno desc ";
if($type == 'onboard')
$sSQL = "SELECT * FROM tenderstock LEFT OUTER JOIN soldreport on carid = soldcarid
LEFT OUTER JOIN tenderinvoice ON ivcarid = carid AND ivvalid = 1
WHERE ivuserid = 9322 AND ivshipdate >= '2012-01-01' AND ivshipdate <= '".date("Y-m-d")."' AND ivarrivedate >= current_date
ORDER BY buydate desc , rno desc";
if($type == 'readyship')
$sSQL = "SELECT * FROM tenderstock LEFT OUTER JOIN soldreport on carid = soldcarid
LEFT OUTER JOIN tenderinvoice ON ivcarid = carid AND ivvalid = 1
WHERE ivuserid = 9322 AND (ivshipdate is NULL or ivshipdate >'".date("Y-m-d")."') ORDER BY rno desc ";
$result = pg_query($db,$sSQL) or die(pg_last_error());
$icc = 0;
while ( $line = pg_fetch_array($result, null, PGSQL_ASSOC))
{
$direct = CryptMsg($line['rno'] . ":-1" ,"2ulf1q@r");
$url = $line[carmaker]."-".$line[carname]."_".$line[color]."-Color_". $SHORT_MONTH[$line['nensikim']]."-".$line[nensikiy]."_".$fuellist[$line[carfuel]]."_".$line[carcc]."CC_Points-".$line[hyouka];
echo '
';
echo '
';
echo '
";
echo '
'.$line[katasiki] ."
".$line[nensikiy] ." ".$line['transmission'] . " " .$line[carcc]."-". $line[carfuel] . "
" ;
/* if($line[estsale])
echo "
PKR ".number_format($line[estsale])." ";
elseif($line[pkr_price])
echo "
PKR ".number_format($line[pkr_price])." ";
*/
if($line[acsolddate])
print "
";
echo '
';
echo '
';
$icc++;
}
?>