$liner) { $qfr = "SELECT * FROM stk_freight WHERE buy_country = '".$buy_country."' AND liner = '".$liner."' AND ship_country = '".$line_customer['country']."' AND ship_port = '".$line_customer['port']."' "; $result = pg_query($db, $qfr ) or die(pg_last_error()); $row = pg_fetch_array($result); $freight_list[$buy_country] = $row; } if($_POST['apply_filter']) { $_SESSION['vash_filters'] = $_POST; } if($_REQUEST['rem_session']) { $carmaker = $_SESSION['vash_filters']['carmaker']; $carname = $_SESSION['vash_filters']['carname']; $global_search = $_SESSION['vash_filters']['global_search']; $nensikiy1 = $_SESSION['vash_filters']['nensikiy1']; $nensikim1 = $_SESSION['vash_filters']['nensikim1']; $nensikiy2 = $_SESSION['vash_filters']['nensikiy2']; $nensikim2 = $_SESSION['vash_filters']['nensikim2']; $place = $_SESSION['vash_filters']['place']; $stockno = $_SESSION['vash_filters']['stockno']; $stockno2 = $_SESSION['vash_filters']['stockno2']; $mileage1 = $_SESSION['vash_filters']['mileage1']; $mileage2 = $_SESSION['vash_filters']['mileage2']; $transmission = $_SESSION['vash_filters']['transmission']; $color = $_SESSION['vash_filters']['color']; $cc_from = $_SESSION['vash_filters']['cc_from']; $cc_to = $_SESSION['vash_filters']['cc_to']; $price_from = str_replace(',','',$_SESSION['vash_filters']['price_from']); $price_to = str_replace(',','',$_SESSION['vash_filters']['price_to']); $carfuel = $_SESSION['vash_filters']['carfuel']; $drivetype = $_SESSION['vash_filters']['drivetype']; $drivetype2 = $_SESSION['vash_filters']['drivetype2']; $discount_tag = $_SESSION['vash_filters']['discount_tag']; $bodytype = $_SESSION['vash_filters']['bodytype']; $stype = $_SESSION['vash_filters']['stype']; $currency = $_SESSION['vash_filters']['currency']; $sort1 = $_SESSION['vash_filters']['sort1']; $sort2 = $_SESSION['vash_filters']['sort2']; } if(!$currency) $currency = 'usd'; $price_curr = 'rate'.$currency; ?>
current_date OR coalesce(exotic_super,'') = '1' ) "; //AND (buytype != 'JAPAN' OR (buytype = 'JAPAN' AND coalesce(customer.country , 'JAPAN') NOT IN ('UNITED ARAB EMIRATES'))) if($type == 'new') $whereSQL .= " AND ( tenderstock.buydate > '".date("Y-m-d" , strtotime("-120 days"))."') "; if($type == 'discount') $whereSQL .= " AND hotsw=1 "; if($type == 'offerable') $whereSQL .= " AND oasw=1 "; if($type == 'super') $whereSQL .= " AND rno > 71000 AND coalesce(exotic_super,'') = '1' "; if($type == 'exotics') $whereSQL .= " AND ( coalesce(exotic_super,'') = '1' OR ivuserid IN ( 30132 ) )"; if($type == 'brand_new') $whereSQL .= " AND cartype = 'Brand New' "; if($type == 'machinery') $whereSQL .= " AND bodytype = '28' "; if($type == 'dutytrucks') $whereSQL .= " AND bodytype IN ('7' , '17' , '4', '3' ,'19', '20', '9' , '30', '31', '32', '33') "; if($type == 'special_offer') $whereSQL .= " AND (place1 = 'AU' or special_offer = '1' ) "; /* if($type == 'executive') $whereSQL .= " AND executive_class = '1' "; //AND bodytype IN ('1' , '8') AND biddingprice > 2000000 */ if($type == 'easter') $whereSQL .= " AND (( tenderstock.discount_tag = 'Easter Sale' AND (tenderstock.deletedate IS NULL or tenderstock.eff_deletedate > current_date ) )) "; if($type == 'christmas') $whereSQL .= " AND (( tenderstock.discount_tag = 'Christmas Sale' AND (tenderstock.deletedate IS NULL or tenderstock.eff_deletedate > current_date ) )) "; if($type == 'executive') $whereSQL .= " AND (show_fake_stock = '1' OR (executive_class = '1' AND (tenderstock.deletedate IS NULL or tenderstock.eff_deletedate > current_date ) )) "; if($type == 'motorcycle') $whereSQL .= " AND bodytype IN ('6') "; if($type == 'commercial') $whereSQL .= " AND bodytype IN ('2' , '15' , '24') "; if($type == 'lhd') $whereSQL .= " AND drivetype = 'left' "; if($type == 'accidental') $whereSQL .= " AND accidentsw= '1' "; elseif($type == 'kfz') $whereSQL .= " AND tenderinvoice.ivuserid = 27153 AND tenderstock.deletedate is null "; if(strpos(strtoupper($global_search) , 'ORDER') !== FALSE) $whereSQL .= " AND ivorderdate is not null "; elseif($global_search) $whereSQL .= " AND upper(tenderstock.carmaker || tenderstock.carname || coalesce(bodytype,0) || coalesce(chassis,'') || nensikiy || tenderstock.color || coalesce(carmodel,'') || place1 || '-' || rno) LIKE '%".strtoupper($global_search)."%' "; if(countphp($carmaker) > 0) $whereSQL .= " AND carmaker IN ('".implode("','" , $carmaker)."')"; if(countphp($carname) > 0) $whereSQL .= " AND carname IN ('".implode("','" , $carname)."')"; if(countphp($carcode) > 0) $whereSQL .= " AND katasiki IN ('".implode("','" , $carcode)."')"; if(countphp($caryear) > 0) $whereSQL .= " AND nensikiy IN ('".implode("','" , $caryear)."')"; if(countphp($place_list)) $whereSQL .= " AND place1 IN ('".implode("','" , $place_list)."') "; if(countphp($transmission_list)) $whereSQL .= " AND transmission IN ('".implode("','" , $transmission_list)."') "; if(countphp($bodytype_list)) $whereSQL .= " AND bodytype IN ('".implode("','" , $bodytype_list)."') "; if(countphp($color_list)) $whereSQL .= " AND tenderstock.color IN ('".implode("','" , $color_list)."') "; if(countphp($carfuel)) $whereSQL .= " AND carfuel IN ('".implode("','" , $carfuel)."') "; if(countphp($drivetype)) $whereSQL .= " AND drivetype IN ('".implode("','" , $drivetype)."') "; if(countphp($drivetype2)) $whereSQL .= " AND drivetype2 IN ('".implode("','" , $drivetype2)."') "; if(countphp($discount_tag)) $whereSQL .= " AND tenderstock.discount_tag IN ('".implode("','" , $discount_tag)."') "; if($stockno && !$stockno2) $whereSQL .= " AND rno = '$stockno' "; if($stockno) $whereSQL .= " AND rno >= '$stockno' "; if($stockno2) $whereSQL .= " AND rno <= '$stockno2' "; /* if($cc_from) $whereSQL .= " AND carcc >= '$cc_from' "; if($cc_to) $whereSQL .= " AND carcc <= '$cc_to' "; */ $cc_ranges = array(); for($i=1;$i<=5;$i++) { $ccfrom = $_POST['cc_from'.$i]; $ccto = $_POST['cc_to'.$i]; if($ccfrom && $ccto) { $cc_ranges[] = array($ccfrom,$ccto); } } if(countphp($cc_ranges)) { $cc_clause = ''; foreach($cc_ranges as $range) { $cc_clause .= " OR (tenderstock.carcc >= '".intval($range[0]) ."' AND tenderstock.carcc <= '".intval($range[1]) ."') "; } if($cc_clause) $whereSQL .= " AND ( FALSE ".$cc_clause.") "; } if(countphp($sel_rec)) $whereSQL .= " AND carid IN (".implode(',',$sel_rec).") "; if($_SESSION['ipcountry'] == 'JAPAN') $whereSQL .= " AND coalesce(show_japan,'') = '1' "; if($stock_status == 'arrived') $whereSQL .= " AND tenderinvoice.ivarrivedate <= current_date "; if($stock_status == 'shipped') $whereSQL .= " AND tenderinvoice.ivshipdate <= current_date AND tenderinvoice.ivarrivedate > current_date "; if($stock_status == 'waitingship') $whereSQL .= " AND (tenderinvoice.ivshipdate is null OR tenderinvoice.ivshipdate > current_date) "; if($supercar_sql ) $whereSQL .= " $supercar_sql "; if($submit == 'inspected_direct') $whereSQL .= " AND tenderinvoice.ivinsp_status = 'Pass' "; if($submit == 'promotion_stock') $whereSQL .= " AND tenderstock.discount_tag != '' "; if($submit == 'kingston_stock') $whereSQL .= " AND ivuserid = 27153 "; $whereSQL .= " AND coalesce(hide_customer,'') != '1' "; //print $whereSQL; $SLISTPAGE = $page_size?:90; $SPAGE = 1; if ( strlen($page) > 0 ) { $SPAGE = $page; } $sql = "SELECT count(rno) as cnt FROM tenderstock LEFT JOIN dealer_stock ON id = carid::text AND source = 'zm' LEFT JOIN tenderinvoice ON carid=ivcarid AND ivvalid=1 LEFT JOIN customer on tenderinvoice.ivuserid = userid WHERE true $whereSQL $supercar_sql "; $result = pg_query($db,$sql); if ( $line = pg_fetch_array($result, null, PGSQL_ASSOC)) { $cartotal = $line['cnt']; if ( $SLISTPAGE > 0 ) { $cnt = $cartotal / $SLISTPAGE; } } if($payment_discount_units || $submit == 'discounted_stock' ) $cartotal = -1; $paging_html = getPaginationString($SPAGE , $cartotal, $SLISTPAGE , 2 , 'view_all_stock_home.php' , '?type='.$type.'&cartype='.$cartype.'&rem_session=1&page=' ); ?>
Maker
Name
Code
Year