"; $std_text_font=""; $sql="Select max(recorddate) as date, productid, subprodid from ynfx_mis_pricewatchglobal where approve='Y' and visibility='Y' group by productid, subprodid order by classification, date desc"; $result=mysql_db_query($DATABASE,$sql); echo mysql_error(); if(mysql_num_rows($result)) { $table =""; $table .=""; $table .=""; $table .="
"; $table .=""; while($row=mysql_fetch_row($result)) { $show1=0; $dateval=substr($row[0],0,8); $date=date("d - M Y",mysqltime_to_mktime($row[0])); //$country=stripslashes($row[1]); $pid1=stripslashes($row[1]); $sqlprice="Select id, recorddate, country, price, comments, outlook, graphimage, country, company, source, dateupdate, productid, subprodid, unit, region, classification from ynfx_mis_pricewatchglobal where approve='Y' and visibility='Y' and productid=$pid1 and subprodid='$row[2]' and SUBSTRING(recorddate,1,8)='$dateval' group by productid,subprodid order by recorddate desc "; $resultp=mysql_db_query($DATABASE,$sqlprice); if(mysql_num_rows($resultp)) { for($i=0;$i 0 ? "u_p":($deviation == 0 ? "tild_green":""))); if(!$prev_price) {$img="spacer"; $dev="";} $prod_name=get_product_name($pid); if($sid) $subprod_name=get_subproduct_name($sid); if($sid) $prod_name=$subprod_name; //$prod_name=wrap_text($prod_name,10); if($ct%2!=0) $bgcolor="#E0E0E0"; else $bgcolor=''; //$table .=""; //********************************************************************************************** if($prod_name != "") { $table .=""; $table .=""; $table .=""; $table .=""; $table .=""; //$table .=""; break; //case "2": // $text=" Current Prices "; //break; //case "3": // $text="Subcribe Now!"; //break; case "6": //$text=" Click here "; $table .=""; break; //case "7": // $text=" for "; //break; //case "8": // $text="Latest Postings!"; //break; case "11": //$text="Get the best deal"; $table .=""; break; //case "12": // $text=" out of "; //break; //case "13": // $text="ODD LOTS!"; //break; default: //$text=""; //$table .=""; break; } //$table.="$text"; $table .=""; } //********************************************************************************************** $ct++; } } } $table .="
 $prod_name Trend "; switch($ct) { case "1": //$text=" For "; #D0D0BB #E6E7C7 $table .="  For

Current Prices

Subscribe Now!
  Click here

for

Latest Posting!
  Get the best deal

out of

ODD LOTS!
"; //$table .=" 
"; $table .="
"; $table .=""; $table .=""; $table .=""; //$table .=""; //$table .=""; //$table .=""; } return($table.$tbl_rem); } //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ function is_service_taken($login,$service) { global $DATABASE; $date=substr(mktime_to_mysqltime(time()),0,8); $query="Select * from serviceaccess where login='$login' and expdate>$date and status='Paid' and serviceid='$service'"; $result=mysql_db_query($DATABASE,$query); if(mysql_error()) error("Unexpected Error".mysql_error()); return (mysql_num_rows($result)); } function get_product_name($id) { global $DATABASE; //print "SELECT name FROM ynfx_mis_product where id='$id'
"; $sql_prod = "SELECT name FROM ynfx_mis_product where id='$id'"; // Commented by Tejas //$sql_prod = "SELECT name FROM ynfx_mis_product where id='$id' and enable=1"; // Added by Tejas $result=mysql_db_query($DATABASE,$sql_prod); //print mysql_num_rows($result)."
"; if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) return mysql_result($result, 0, "name"); } function get_subproduct_name($id) { global $DATABASE; //$sql="SELECT name FROM ynfx_mis_subproducts where id='$id'"; // ============= Commeneted by Tejas $sql="SELECT name FROM ynfx_mis_subproducts where id='$id' and enable=1"; // ============= Added by Tejas //print $sql; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) return mysql_result($result, 0, "name"); } function get_product_chkboxes($sel_list) { global $DATABASE; global $std_text_font; global $login; $std_text_font=""; $query="SELECT distinct productid, subprodid FROM ynfx_mis_pricewatchglobal where visibility = 'Y'"; $result=mysql_db_query($DATABASE,$query); if(mysql_error()) error("Unexpected Error".mysql_error()); if(@mysql_num_rows($result)) { $tbl =""; $k = 1; for($i=0;$i"; if($sid) $subprod_name=get_subproduct_name($sid); if($sid) $prod_name=$subprod_name; $val=$pid."#".$sid; $checked=""; // @@@@@@@@@@@@@@@@@@@@@@@ Checking if product name is blank or not if blank then do not display the product @@@@@@@@@ if($prod_name != "") { //################################################ if (is_array($sel_list)) { if(in_array ($val, $sel_list)) $checked="CHECKED"; } //$n=$i+1; if($k%2) { $tbl .=""; } else { $tbl .=""; } //################################################ $k = $k + 1; } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ } $tbl .="
$std_text_font $prod_name$std_text_font $prod_name
"; return $tbl; } } // show date menu function print_date_selection ( $prefix, $date ) { $thisyear = $year = substr ( $date, 0, 4 ); $thismonth = $month = substr ( $date, 4, 2 ); $thisday = $day = substr ( $date, 6, 2 ); echo "\n\n\n"; } function month_short_name ( $m ) { switch ( $m ) { case 0: return "Jan"; case 1: return "Feb"; case 2: return "Mar"; case 3: return "Apr"; case 4: return "May"; case 5: return "Jun"; case 6: return "Jul"; case 7: return "Aug"; case 8: return "Sep"; case 9: return "Oct"; case 10: return "Nov"; case 11: return "Dec"; } return "unknown-month($m)"; } // Return the full month name // params: // $m - month (0-11) function month_name ( $m ) { switch ( $m ) { case 0: return "January"; case 1: return "February"; case 2: return "March"; case 3: return "April"; case 4: return "May_"; // needs to be different than "May" case 5: return "June"; case 6: return "July"; case 7: return "August"; case 8: return "September"; case 9: return "October"; case 10: return "November"; case 11: return "December"; } return "unknown-month($m)"; } function get_whois_online($login) { global $DATABASE,$tbl_logindata,$tbl_usermast; global $std_text_font_date; global $std_title_font; global $nav_font_big ; global $tbl_mis_news; global $std_text_font; global $std_text_font,$std_font_date; $std_newsheader_font = ""; $std_text_font=""; $time=time(); $time=mktime_to_mysqltime($time); $i=0; $flag="n"; $time1=time(); $time2=$time1-86400; $time2=mktime_to_mysqltime($time2); $array_demo=array(); for($j=0;$j<7;$j++) { if($j!=0) $array_demo[$j]="demo$j"; else $array_demo[$j]="demo"; } $array_demo[$j]="demoynfx"; $sql="select memberlogin from logindata where logindate>$time2 order by logindate desc"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); while($row=mysql_fetch_row($result)) { $login2=stripslashes($row[0]); if($i==5) break; if(!in_array($login2,$array_demo)) { if($i==0) { $arr[$i]=$login2; $i++; } if($i!=0)//means not the first time { for($j=0;$j<=$i;$j++) { $login1=$arr[$j]; if($login2==$login1)//means it is present in the array { $flag="p"; }//end of if($login) }//end of for if($flag=="n")//means not present { $arr[$i]=$login2; $i++; } $flag="n"; }//end of if }//end of if(in_array) }//end of while $login_plan="select plan from member where login='$login'"; $result_plan=mysql_db_query($DATABASE,$login_plan); $loginplan=mysql_result($result_plan,0,0); for($i=0;$i<=4;$i++) { $sqld="select companyname, plan, id,login from member where login='$arr[$i]'"; $resultd=mysql_db_query($DATABASE,$sqld); //if($i%2==0) $bgcolor="#FFF7E0"; //else $bgcolor=""; $bgcolor="#FFFFFF"; if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($resultd)) { $companyname=mysql_result($resultd,0,0); $userplan=mysql_result($resultd,0,1); $id=mysql_result($resultd,0,2); $memberlogin=mysql_result($resultd,0,3); } if($userplan == '2~12' || $userplan == '2~6' || $userplan == '2~07') { $memberplan = "BP"; }elseif($userplan == '4~12' || $userplan == '4~6' || $userplan == '4~07'){ $memberplan = "PS"; }else { $memberplan = "Free"; } if($memberplan=="BP")//means he is a preferred member { $t.=""; $t.=""; $t.="$std_text_font $companyname "; $t.=""; }else if($memberplan=="PS") { //means the person online is pref show him $t.=""; $t.=""; $t.="$std_text_font $companyname"; $t.=""; }else if($memberplan == "Free") { $t.=""; $t.=""; $t.="$std_text_font $companyname
"; $t.=""; } else { $t.=""; $t.="$std_text_font $companyname
"; $t.=""; } } $t.=" $std_text_font see all "; return($t); }//end of function function new_get_user_pref($login) { global $DATABASE; $query= "SELECT mis_setting, mis_value FROM ynfx_mis_user_pref WHERE mis_login='".$login."'"; $result=mysql_db_query($DATABASE,$query); if(mysql_error()) error("Unexpected Error".mysql_error()); $user_pref[]=""; while ($row=mysql_fetch_row($result)) { $setting=$row[0]; $value=$row[1]; $user_pref[$setting] =$value; } return $user_pref; } function new_get_admin_pref($login) { global $DATABASE; $query= "SELECT mis_setting, mis_value FROM ynfx_mis_admin_pref WHERE mis_login='".$login."'"; $result=mysql_db_query($DATABASE,$query); if(mysql_error()) error("Unexpected Error".mysql_error()); while ($row=mysql_fetch_row($result)) { $setting=$row[0]; $value=$row[1]; $admin_pref[$setting]=$value; } return $admin_pref; } function get_classification_name($id) { global $DATABASE; global $tbl_mis_classification; $result=mysql_db_query($DATABASE,"SELECT name FROM ynfx_mis_classification where id='$id'"); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) return mysql_result($result, 0, "name");echo mysql_error(); } function get_country_name($id) { global $DATABASE; global $tbl_mis_country; $result=mysql_db_query($DATABASE,"SELECT name FROM ynfx_mis_country where id='$id'"); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) return mysql_result($result, 0, "name"); } function get_prev_price($pid,$sid,$country) { global $DATABASE; $condition=($sid?" AND subprodid='$sid' ":" AND subprodid='0'"); $sql="SELECT price FROM ynfx_mis_pricewatchglobal WHERE approve='Y' AND visibility='Y' AND country='$country' AND productid='$pid' $condition ORDER BY recorddate DESC LIMIT 2"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)>1) return mysql_result($result,1,"price"); else return 0; } function get_measure_name($uid) { GLOBAL $DATABASE,$tbl_mis_units; $result1=@mysql_db_query($DATABASE,"SELECT name FROM ynfx_mis_units WHERE id='$uid'"); if(mysql_num_rows($result1)) { $name=stripslashes(mysql_result($result1,0,0)); if(mysql_error()) error("Unexpected Error".mysql_error()); }//end of if return($name); }//end of function function get_pricewatch_table($login) { global $view_font1, $DATABASE, $tbl_mis_product, $tbl_mis_subproduct, $tbl_mis_pricewatchglobal, $std_maroon_font, $std_title_font, $MSG_185, $MSG_103, $MSG_022, $MSG_102, $MSG_100, $std_text_font, $tbl_admin_pref, $tbl_user_pref, $print, $HTTP_HOST; global $pref_TEXTCOLOR,$pref_BANDCOLOR; $std_newsheader_font = ""; $std_text_font=""; $pref_usr_arr=new_get_user_pref($login); $pref_admin_arr=new_get_admin_pref($login); $sql="Select * from ynfx_mis_admin_pref where mis_Setting like 'pw_%'"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) { if ($pref_usr_arr["pw_pref_SOURCE"]) { $pw_pref_SOURCE=unserialize($pref_usr_arr["pw_pref_SOURCE"]); } else { $pw_pref_SOURCE=unserialize($pref_admin_arr["pw_pref_SOURCE"]); } if ($pref_usr_arr["pw_pref_SUBPRODUCT"]) { $pw_pref_SUBPRODUCT=unserialize($pref_usr_arr["pw_pref_SUBPRODUCT"]); } else $pw_pref_SUBPRODUCT=unserialize($pref_admin_arr["pw_pref_SUBPRODUCT"]); if ($pref_usr_arr["pw_pref_CATEGORY"]) { $pw_pref_CATEGORY=unserialize($pref_usr_arr["pw_pref_CATEGORY"]); } else $pw_pref_CATEGORY=unserialize($pref_admin_arr["pw_pref_CATEGORY"]); if ($pref_usr_arr["pw_pref_PRODUCT"]) { $pw_pref_PRODUCT=unserialize($pref_usr_arr["pw_pref_PRODUCT"]); } else $pw_pref_PRODUCT=unserialize($pref_admin_arr["pw_pref_PRODUCT"]); if($pref_usr_arr["pw_pref_COUNTRY"]) { $pw_pref_COUNTRY=unserialize($pref_usr_arr["pw_pref_COUNTRY"]); } else $pw_pref_COUNTRY=unserialize($pref_admin_arr["pw_pref_COUNTRY"]); if($pref_usr_arr["pw_pref_COMPANY"]) { $pw_pref_COMPANY=unserialize($pref_usr_arr["pw_pref_COMPANY"]); } else $pw_pref_COMPANY=unserialize($pref_admin_arr["pw_pref_COMPANY"]); if(is_array($pw_pref_SUBPRODUCT)) $subproduct= "(\"".@join( $pw_pref_SUBPRODUCT , "\",\"" )."\")"; if(is_array($pw_pref_PRODUCT)) $product= "(\"".@join( $pw_pref_PRODUCT , "\",\"" )."\")"; $country = "(\"".@join( $pw_pref_COUNTRY , "\",\"" )."\")"; $source= "(\"".@join( $pw_pref_SOURCE , "\",\"" )."\")"; if(($product)||($subproduct)) $cond_product.="("; if($product) $cond_product.=" productid in ".$product; if($subproduct) { if($product) { $cond_product.=" or "; $cond_product.=" subprodid in ".$subproduct; } } if(($product)||($subproduct)) $cond_product.=")"; $sql="Select max(recorddate) as date, productid, subprodid from ynfx_mis_pricewatchglobal where approve='Y' and visibility='Y' and country in $country and $cond_product group by productid, subprodid order by classification, date desc"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) { $k="0"; $table = ""; while($row=mysql_fetch_row($result)) { $show1=0; $dateval=substr($row[0],0,8); $date=date("d - M Y",mysqltime_to_mktime($row[0])); //$country=stripslashes($row[1]); $pid1=stripslashes($row[1]); $sqlprice="Select id, recorddate, country, price, comments, outlook, graphimage, country, company, source, dateupdate, productid, subprodid, unit, region, classification, terms from ynfx_mis_pricewatchglobal where approve='Y' and visibility='Y' and productid=$pid1 and subprodid='$row[2]' and SUBSTRING(recorddate,1,8)='$dateval' group by productid, subprodid order by recorddate desc "; $resultp=mysql_db_query($DATABASE,$sqlprice); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($resultp)) { for($i=0;$i 0 ? "u_p":($deviation == 0 ? "tild_green":""))); if(!$prev_price) { $img="spacer"; $dev="";} $comments=trim(stripslashes(mysql_result($resultp,$i,"comments"))); $comment_small=substr($comments,0,50)."..."; $comments=eregi_replace("'", ",", $comments); $comments=eregi_replace('"', ",", $comments); $comments=eregi_replace("(\r\n|\n|\r)", "
", $comments); $outlook=trim(stripslashes(mysql_result($resultp,$i,"outlook"))); if(!$outlook) $outlook="Not available"; $outlook=eregi_replace("'", ",", $outlook); $outlook=eregi_replace('"', ",", $outlook); $outlook=eregi_replace("(\r\n|\n|\r)", "
", $outlook); $unitdb=mysql_result($resultp,$i,"unit"); $unit=get_measure_name($unitdb); if(($unitdb==3)&&($pid==8)&&($sid==0)) $currency="US Cents" ; else $currency="USD"; $region=stripslashes(mysql_result($resultp,$i,"region")); $r=urlencode($region); $terms = stripslashes(mysql_result($resultp,$i,"terms")); $prod_name=get_product_name($pid); if($sid) $subprod_name=get_subproduct_name($sid); if($sid) $prod_name=$subprod_name; //$prod_name = $prod_name." - Dtd : ".$date; //$prod_name=wrap_text($prod_name,10); $id1="RM".$id; if((get_classification_name($cid)!='Spun Yarn')&&(get_classification_name($cid)!='Others')) { if(can_print($cid)) { //$bgColor="#E0E0E0"; $bgColor="#EFEFEF"; if(get_classification_name($cid)!='Fiber Intermediates') { //$table.="
"; //$table.=""; } //$table.='
'; $table.='
'.get_classification_name($cid).''; //if(get_classification_name($cid)=='Fiber Intermediates') /* if($k==0) { $table.=''; $table.=''; $table.=''; $table.=''; $table.=''; $table.=''; $table.=''; $table.=''; $table.=''; $table.=''; $table.=''; $table.='
 Product Price  Movement Terms Region Graph
'; $table.=''; $table.=''; } */ }//end of if can print if($prod_name != "") { $table.=''; $table.=''; if($k==0) { $table.=''; $table.=''; $table.=''; $table.=''; $table.=''; $table.=''; $table.=''; $table.=''; $table.=''; $table.='
ProductPriceMovementTermsRegionGraph
'; } $k++; $table.=''; $table .= ""; $table.=""; //$table.=""; $table.=""; $table.=""; $table.=""; //$table.=""; $table.=""; //$table.=""; $table.=""; $table.=""; $table.="
$std_text_font $prod_name
Dated : $date
$std_text_font $currency $price/$unit $std_text_font $currency $price/$unit $std_text_font $dev \"Trend\"$std_text_font $terms $std_text_font $region$std_text_font $region$std_text_fontGraph$std_text_font
"; $table.=""; $table.=""; } }//end of if spun and others } } } //end of outer while $table .= ""; }//end of if } return($table.$tbl_rem); } function get_pricewatch_table_temp($login) { global $view_font1, $DATABASE,$tbl_mis_product,$tbl_mis_subproduct,$tbl_mis_pricewatchglobal,$std_maroon_font,$std_title_font,$MSG_185,$MSG_103,$MSG_022,$MSG_102,$MSG_100,$std_text_font,$tbl_admin_pref,$tbl_user_pref, $print, $HTTP_HOST; global $pref_TEXTCOLOR,$pref_BANDCOLOR; $std_newsheader_font = ""; $std_text_font=""; $pref_usr_arr=new_get_user_pref($login); $pref_admin_arr=new_get_admin_pref($login); $sql="Select * from ynfx_mis_admin_pref where mis_Setting like 'pw_%'"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) { if ($pref_usr_arr["pw_pref_SOURCE"]){ $pw_pref_SOURCE=unserialize($pref_usr_arr["pw_pref_SOURCE"]); } else { $pw_pref_SOURCE=unserialize($pref_admin_arr["pw_pref_SOURCE"]); } if ($pref_usr_arr["pw_pref_SUBPRODUCT"]){ $pw_pref_SUBPRODUCT=unserialize($pref_usr_arr["pw_pref_SUBPRODUCT"]); } else $pw_pref_SUBPRODUCT=unserialize($pref_admin_arr["pw_pref_SUBPRODUCT"]); if ($pref_usr_arr["pw_pref_CATEGORY"]){ $pw_pref_CATEGORY=unserialize($pref_usr_arr["pw_pref_CATEGORY"]); } else $pw_pref_CATEGORY=unserialize($pref_admin_arr["pw_pref_CATEGORY"]); if ($pref_usr_arr["pw_pref_PRODUCT"]){ $pw_pref_PRODUCT=unserialize($pref_usr_arr["pw_pref_PRODUCT"]); } else $pw_pref_PRODUCT=unserialize($pref_admin_arr["pw_pref_PRODUCT"]); if($pref_usr_arr["pw_pref_COUNTRY"]){ $pw_pref_COUNTRY=unserialize($pref_usr_arr["pw_pref_COUNTRY"]); } else $pw_pref_COUNTRY=unserialize($pref_admin_arr["pw_pref_COUNTRY"]); if($pref_usr_arr["pw_pref_COMPANY"]){ $pw_pref_COMPANY=unserialize($pref_usr_arr["pw_pref_COMPANY"]); } else $pw_pref_COMPANY=unserialize($pref_admin_arr["pw_pref_COMPANY"]); if(is_array($pw_pref_SUBPRODUCT)) $subproduct= "(\"".@join( $pw_pref_SUBPRODUCT , "\",\"" )."\")"; if(is_array($pw_pref_PRODUCT)) $product= "(\"".@join( $pw_pref_PRODUCT , "\",\"" )."\")"; $country = "(\"".@join( $pw_pref_COUNTRY , "\",\"" )."\")"; $source= "(\"".@join( $pw_pref_SOURCE , "\",\"" )."\")"; if(($product)||($subproduct)) $cond_product.="("; if($product) $cond_product.=" productid in ".$product; if($subproduct) { if($product) $cond_product.=" or "; $cond_product.=" subprodid in ".$subproduct; } if(($product)||($subproduct)) $cond_product.=")"; $sql="Select max(recorddate) as date, productid,subprodid from ynfx_mis_pricewatchglobal where approve='Y' and visibility='Y' and country in $country and $cond_product group by productid,subprodid order by classification,date desc"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) { $table .= ""; while($row=mysql_fetch_row($result)) { $show1=0; $dateval=substr($row[0],0,8); $date=date("d - M Y",mysqltime_to_mktime($row[0])); //$country=stripslashes($row[1]); $pid1=stripslashes($row[1]); $sqlprice="Select id, recorddate,country,price,comments,outlook,graphimage,country,company,source,dateupdate,productid,subprodid,unit,region,classification,terms from ynfx_mis_pricewatchglobal where approve='Y' and visibility='Y' and productid=$pid1 and subprodid='$row[2]' and SUBSTRING(recorddate,1,8)='$dateval' group by productid,subprodid order by recorddate desc "; $resultp=mysql_db_query($DATABASE,$sqlprice); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($resultp)) { for($i=0;$i 0 ? "u_p":($deviation == 0 ? "tild_green":""))); if(!$prev_price) { $img="spacer"; $dev="";} $comments=trim(stripslashes(mysql_result($resultp,$i,"comments"))); $comment_small=substr($comments,0,50)."..."; $comments=eregi_replace("'", ",", $comments); $comments=eregi_replace('"', ",", $comments); $comments=eregi_replace("(\r\n|\n|\r)", "
", $comments); $outlook=trim(stripslashes(mysql_result($resultp,$i,"outlook"))); if(!$outlook) $outlook="Not available"; $outlook=eregi_replace("'", ",", $outlook); $outlook=eregi_replace('"', ",", $outlook); $outlook=eregi_replace("(\r\n|\n|\r)", "
", $outlook); $unitdb=mysql_result($resultp,$i,"unit"); $unit=get_measure_name($unitdb); if(($unitdb==3)&&($pid==8)&&($sid==0)) $currency="US Cents" ; else $currency="USD"; $region=stripslashes(mysql_result($resultp,$i,"region")); $r=urlencode($region); $prod_name=get_product_name($pid); if($sid) $subprod_name=get_subproduct_name($sid); if($sid) $prod_name=$subprod_name; $prod_name=wrap_text($prod_name,10); $id1="RM".$id; if((get_classification_name($cid)!='Spun Yarn')&&(get_classification_name($cid)!='Others')) { if(can_print($cid)) { $bgColor="#E0E0E0"; if(get_classification_name($cid)!='Fiber Intermediates') { $table.="
"; } $table.='
'.get_classification_name($cid).'
'; if(get_classification_name($cid)=='Fiber Intermediates') { $table.=''; } }//end of if can print $table .= ""; }//end of if spun and others } } } //end of outer while $table .= "
 Product Price  Movement Terms Region Graph
$std_text_font $prod_name $std_text_font $currency $price/$unit $view_font1 $dev \"Trend\" $std_text_font $terms $std_text_font $region Graph
"; }//end of if } return($table.$tbl_rem); } function wrap_text($str,$wrap_length){ $pat=" "; $arr=split($pat,$str); for($i=0;$i$wrap_length) $arr[$i]=wordwrap($arr[$i],$wrap_length,$pat,1); } return implode($pat,$arr); } function can_print($id){ static $val="--"; if($val!=$id){$val=$id; return true;} else return false; } //this function gets the highlights for a free member to be displayed on the center page function get_high_free() { global $DATABASE,$colorbg,$colorbgrow; ///////getting the details of the highlights from the pricewatch table $array=array(); $sql = "select id from ynfx_mis_pricewatchglobal order by id desc limit 20"; $result=mysql_db_query($DATABASE,$sql); if(mysql_num_rows($result)) { $count=mysql_num_rows($result); for($i=0;$i<$count;$i++) { $id .= mysql_result($result,$i,0).", "; } $id = substr($id,0,-2); } $sql = "SELECT id, productid, subprodid, id*0+rand() as randcol FROM ynfx_mis_pricewatchglobal where id in ($id) and approve='Y' and visibility='Y' and highlights!='' order by randcol LIMIT 6"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) { $count=mysql_num_rows($result); for($i=0;$i<$count;$i++) { $id = mysql_result($result,$i,0); $prod = mysql_result($result,$i,1); $sub_prod = mysql_result($result,$i,2); //echo $id."-".$prod."-".$sub_prod."
"; if($sub_prod) { $sql="select a.highlights, a.recorddate, b.name from ynfx_mis_pricewatchglobal a, ynfx_mis_subproducts b where a.id = $id and a.productid = '$prod' and a.subprodid = '$sub_prod' and a.approve='Y' and a.visibility='Y' and a.subprodid=b.id order by recorddate desc limit 1"; } else { $sql="select a.highlights, a.recorddate, b.name from ynfx_mis_pricewatchglobal a, ynfx_mis_product b where a.id = $id and a.productid = '$prod' and a.approve='Y' and a.visibility='Y' and a.productid=b.id order by recorddate desc limit 1"; } $rs=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); $high=stripslashes(mysql_result($rs,0,0)); $rdateh=date("d M, Y",mysqltime_to_mktime(stripslashes(mysql_result($rs,0,1)))); $name=stripslashes(mysql_result($rs,0,2)); //if($high) $highlights.="
$name
$high
"; if($high) { if(($i==0)||($i==2)||($i==4)) { $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.="
$name
$high
"; $highlights.=""; } elseif(($i==1)||($i==3)||($i==5)) { $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.="
$name
$high
"; $highlights.=""; $highlights.=""; $highlights.="
"; } } } } /* $sql="select id from ynfx_mis_subproducts where name like '%Acrylonitrile%' and enable='1'"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) { $idacn=mysql_result($result,0,0); $array[]=$idacn; } $sql="select id from ynfx_mis_subproducts where name like '%Monoethylene Glycol%' and enable='1'"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) { $idmg=mysql_result($result,0,0); $array[]=$idmg; } $sql="select id from ynfx_mis_subproducts where name like '%Purified Terephthalic Acid%' and enable='1'"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) { $idpta=mysql_result($result,0,0); $array[]=$idpta; } $sql="select id from ynfx_mis_subproducts where name like '%Polyester Chips%' and enable='1'"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) { $idpc=mysql_result($result,0,0); $array[]=$idpc; } $array_p=array(); $sql="select id from ynfx_mis_product where name like '%PSF%' and enable='1'"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) { $idmg=mysql_result($result,0,0); $array_p[]=$idpsf; } $sql="select id from ynfx_mis_product where name like '%PFY%' and enable='1'"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) { $idpta=mysql_result($result,0,0); $array_p[]=$idpfy; } for($i=0;$i
$name
$high
"; if($high) $highlights.="
$name
$high
"; } for($i=0;$i
$name
$high
"; if($high) $highlights.="
$name
$high
"; } */ return($highlights); } //the below function gets a dropdown for the reports uploaded by the admin on the leftbanner function pw_report_dropdown() { global $DATABASE; $date=mktime_to_mysqltime(time()); $yy=substr($date,0,4); $mm=substr($date,4,2); $dd=substr($date,6,2); if($dd<15) { if(($mm==1)||($mm==2)||$mm==3) { if($mm==1) { $mm="10"; $yy_to=$yy-2; $yy=$yy-1; } elseif($mm==2) { $mm="11"; $yy_to=$yy-2; $yy=$yy-1; } elseif($mm==3) { $mm="12"; $yy_to=$yy-2; $yy=$yy-1; } } else { $mm=$mm-3; $yy_to=$yy-1; } $mm1=$mm; switch($mm) { case "1": $mm1="01"; break; case "2": $mm1="02"; break; case "3": $mm1="03"; break; case "4": $mm1="04"; break; case "5": $mm1="05"; break; case "6": $mm1="06"; break; case "7": $mm1="07"; break; case "8": $mm1="08"; break; case "9": $mm1="09"; break; } $dd='15'; } else { if(($mm==1)||($mm==2)||$mm==3) { if($mm==1) { $mm="11"; $yy_to=$yy-2; $yy=$yy-1; } elseif($mm==2) { $mm="12"; $yy_to=$yy-2; $yy=$yy-1; } elseif($mm==3) { $mm="1"; $yy_to=$yy-1; $yy=$yy-1; } } else { $mm=$mm-3; $yy_to=$yy-1; } //$mm=$mm-2; $mm1=$mm; switch($mm) { case "1": $mm1="01"; break; case "2": $mm1="02"; break; case "3": $mm1="03"; break; case "4": $mm1="04"; break; case "5": $mm1="05"; break; case "6": $mm1="06"; break; case "7": $mm1="07"; break; case "8": $mm1="08"; break; case "9": $mm1="09"; break; } $dd='01'; } //$yy_to=$yy-1; //$fromdate=$yy.$mm1."01"; //$todate=$yy_to.$mm1."01"; //$fromdate=$yy.$mm1.$dd; $todate=$yy_to.$mm1.$dd; $todaydate = mktime(0, 0, 0, date("m") , date("d")-35, date("Y")); $fromdate = date("Ymd",$todaydate); $sql="Select name, path from pw_reports where enable='Y' and date>=$todate and date<=$fromdate order by date desc"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) { $table.=""; $table.="  "; }//end of if return($table); } ######################################################## ############## Encrypting the key ##################### ######################################################## function keyED($txt,$encrypt_key) { $encrypt_key = md5($encrypt_key); $ctr=0; $tmp = ""; for ($i=0;$i$name$new
"; else $table.="$name$new
"; } else $table.="$name
"; $table.=""; $i++; } }//end of if return($table); } //function for latest 3 pw news function get_pw_news_nonlogged() { global $DATABASE; //getting the latest 3 news pricewatch $sql="Select id from ynfx_mis_classification where section='IN' and name='Pricewatch'"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); $cid=mysql_result($result,0,0); $cdate=mktime(); $query="Select header, id from ynfx_mis_news WHERE visibility='1' AND status ='a' AND company !='1' AND date_display_from < '$cdate' AND date_display_to >'$cdate' and classification='$cid' order by date_news desc limit 3" ; $result=mysql_db_query($DATABASE,$query); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) { while($row=mysql_fetch_row($result)) { //if($bgcolor=="#F1F1F1") {$bgcolor="#FFFFFF"; } //else {$bgcolor="#F1F1F1";} $header=stripslashes($row[0]); $id=stripslashes($row[1]); //$news.="$header

"; $news.="$header

"; }//end of while //$news.="

"; //$news.=""; } return $news; } //function to get latest 3 stats function get_stats_nonlogged() { global $DATABASE; $cdate=mktime(); $query="Select header,id from ynfx_mis_istats WHERE visibility='1' AND status ='a' AND company !='1' AND date_display_from < '$cdate' AND date_display_to >'$cdate' order by date desc limit 3" ; $result=mysql_db_query($DATABASE,$query); if(mysql_error()) error("Unexpected Error".mysql_error()); $bgcolor=="#ffffff"; if(mysql_num_rows($result)) { while($row=mysql_fetch_row($result)) { //if($bgcolor=="#F1F1F1") {$bgcolor="#FFFFFF"; } //else {$bgcolor="#F1F1F1";} $header=stripslashes($row[0]); $id=stripslashes($row[1]); $stats.=""; //$stats.="$header"; $stats.="$header"; $stats.=""; $stats.=""; $stats.=""; //$stats.="view table"; $stats.="view table"; $stats.=""; $stats.=""; $stats.=""; $stats.=""; }//end of while }//end of if if($stats) { $stats.="
"; $stats.=""; } return $stats; } //function to get the latest highlights function get_highlights_nonlogged() { global $DATABASE, $colorbgrow; ///////getting the details of the highlights from the pricewatch table $array=array(); $sql="select id from ynfx_mis_subproducts where name like '%Acrylonitrile%' and enable='1'"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) { $idacn=mysql_result($result,0,0); $array[]=$idacn; } $sql="select id from ynfx_mis_subproducts where name like '%Monoethylene Glycol%' and enable='1'"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) { $idmg=mysql_result($result,0,0); $array[]=$idmg; } $sql="select id from ynfx_mis_subproducts where name like '%Purified Terephthalic Acid%' and enable='1'"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) { $idpta=mysql_result($result,0,0); $array[]=$idpta; } $highlights=""; $highlights.=""; $highlights.=""; for($i=0;$i
$name:
$high
"; //$highlights.="
$name:
$high
"; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.="
$name:

$high

"; $highlights.=""; $highlights.=""; $highlights.=""; } } $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; return $highlights; } //function to get the latest highlights /* function get_highlights_nonlogged() { global $DATABASE,$colorbgrow; ///////getting the details of the highlights from the pricewatch table $array=array(); $sql="select id from ynfx_mis_subproducts where name like '%Acrylonitrile%' and enable='1'"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)){ $idacn=mysql_result($result,0,0); $array[]=$idacn; } $sql="select id from ynfx_mis_subproducts where name like '%Monoethylene Glycol%' and enable='1'"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)){ $idmg=mysql_result($result,0,0); $array[]=$idmg; } $sql="select id from ynfx_mis_subproducts where name like '%Purified Terephthalic Acid%' and enable='1'"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)){ $idpta=mysql_result($result,0,0); $array[]=$idpta; } for($i=0;$i
$name:
$high
"; } } return $highlights; } */ function get_productlist_dropdown($cid,$pid,$sid) { global $DATABASE; global $pw_pref_CATEGORY,$pw_pref_PRODUCT,$pw_pref_SUBPRODUCT,$pw_pref_PRODUCT_copy; global $tbl_mis_category,$std_text_font; $ct=count($pw_pref_CATEGORY); for ($i=0; $i<$ct ; $i++) { $catid=$pw_pref_CATEGORY[$i]; if(!is_category_visible($catid)) continue; for($j=0;$j".get_product_name($prodid).""; //getting for subproduct for($k=0;$k|__".get_subproduct_name($subprodid).""; } }//end of for }//end of if check_category function }//end of for } return $list; } function get_array_product($subproduct) { global $DATABASE,$tbl_mis_subproduct; if($subproduct) { $subproduct= "(\"".join( $subproduct , "\",\"" )."\")"; $sql="Select distinct cat_id from ynfx_mis_subproducts where id in $subproduct"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error"); if(mysql_num_rows($result)) { while($row=mysql_fetch_row($result)) { $pid=$row[0]; if($pid) $product_arr[]=$pid; } } } return($product_arr); } function is_category_visible($id) { global $DATABASE,$tbl_mis_category; $sql="select enable from ynfx_mis_category where id='$id'"; $result=@mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error"); return @mysql_result($result,0,0); } function is_product_visible($id) { global $DATABASE,$tbl_mis_product; $sql="select enable from ynfx_mis_product where id='$id'"; $result=@mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error"); return @mysql_result($result,0,0); } function is_subproduct_visible($id) { global $DATABASE,$tbl_mis_subproduct; $sql="select enable from ynfx_mis_subproducts where id='$id'"; $result=@mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error"); return @mysql_result($result,0,0); } function check_category($id,$pid) { global $DATABASE; global $tbl_mis_product; if($pid!='') { $result=mysql_db_query($DATABASE,"SELECT cat_id FROM ynfx_mis_product where id='$pid'"); if(mysql_error()) error("Unexpected Error"); if((mysql_result($result,0,0)==$id))//means belongs to the smae category return true; } } function check_product($pid,$sid) { global $DATABASE; global $tbl_mis_subproduct; $result=mysql_db_query($DATABASE,"SELECT cat_id FROM ynfx_mis_subproducts where id='$sid'"); if(mysql_error()) error("Unexpected Error"); if(mysql_num_rows($result)) { if((mysql_result($result,0,0)==$pid))//means belongs to the smae category return true; } } function country_dropdown($login,$cid) { global $tbl_admin_pref,$DATABASE; $result=mysql_db_query($DATABASE,"select mis_value from ynfx_mis_admin_pref where mis_setting='pw_pref_COUNTRY' and mis_login='$login'"); if(mysql_error()) error("Unexpected Error"); if(mysql_num_rows($result))//only if any rows are selected { $country=unserialize(mysql_result($result,0,0)); for($i=0;$i".$name.""; }//end of for }//end of if return($list); }//end of function function measure_dropdown($uid) { GLOBAL $DATABASE,$tbl_mis_units; $measure.=""; return $measure; } function get_classification_pw($sid) { //$sid parameters is a mixed type variable i.e it can be an array or simple data global $DATABASE; $sql="SELECT * FROM ynfx_mis_classification where enable='1' and section='PW' order by name"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error"); for ($i=0; $i".$name.""; }//end of if }//end of for if(count($subproduct)) $list.=""; }//end of if return($list); }//end of function function get_years_subscribe() { $tdate=time(); $tdate=mktime_to_mysqltime($tdate); $yy=substr($tdate,0,4); $mm=substr($tdate,4,2); $dd=substr($tdate,6,2); $j=0; for($i=1;$i<10;$i++) { $edate=mktime(00,00,00,$mm-$i,$dd,$yy); //$val=date("M Y",$edate)."~100"; if(($j==0)||($j==1)||($j==2)) { $val=date("M Y",$edate)."~100"; } elseif(($j==3)||($j==4)||($j==5)) { $val=date("M Y",$edate)."~75"; } elseif(($j==6)||($j==7)||($j==8)) { $val=date("M Y",$edate)."~50"; } $val1 = split("~", $val); $val_disp = $val1[0]; $val_amt = $val1[1]; if($i==1) $checked="checked"; else $checked=""; $table.="$val_dispEuro $val_amt"; $j++; } return($table); } function get_color($login) { global $theader3; $default_TEXTCOLOR="black"; $default_BANDCOLOR=$theader3; $pref_user_arr=new_get_user_pref($login); $pref_TEXTCOLOR=$pref_user_arr["pref_TEXTCOLOR"]; $pref_BANDCOLOR=$pref_user_arr["pref_BANDCOLOR"]; $pref_TEXTCOLOR=($pref_TEXTCOLOR?$pref_TEXTCOLOR:$default_TEXTCOLOR); $pref_BANDCOLOR=($pref_BANDCOLOR?$pref_BANDCOLOR:$default_BANDCOLOR); return array($pref_TEXTCOLOR,$pref_BANDCOLOR); } function get_high_free_all() { global $DATABASE,$colorbg,$colorbgrow; ///////getting the details of the highlights from the pricewatch table $array=array(); $sql = "select id from ynfx_mis_pricewatchglobal order by id desc limit 20"; $result=mysql_db_query($DATABASE,$sql); if(mysql_num_rows($result)) { $count=mysql_num_rows($result); for($i=0;$i<$count;$i++) { $id .= mysql_result($result,$i,0).", "; } $id = substr($id,0,-2); } $sql = "SELECT id, productid, subprodid, id*0+rand() as randcol FROM ynfx_mis_pricewatchglobal where id in ($id) and approve='Y' and visibility='Y' and highlights!='' order by randcol"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) { $count=mysql_num_rows($result); $k=0; for($i=0;$i<$count;$i++) { $id = mysql_result($result,$i,0); $prod = mysql_result($result,$i,1); $sub_prod = mysql_result($result,$i,2); //echo $id."-".$prod."-".$sub_prod."
"; if($sub_prod) { $sql="select a.highlights, a.recorddate, b.name from ynfx_mis_pricewatchglobal a, ynfx_mis_subproducts b where a.id = $id and a.productid = '$prod' and a.subprodid = '$sub_prod' and a.approve='Y' and a.visibility='Y' and a.subprodid=b.id order by recorddate desc limit 1"; } else { $sql="select a.highlights, a.recorddate, b.name from ynfx_mis_pricewatchglobal a, ynfx_mis_product b where a.id = $id and a.productid = '$prod' and a.approve='Y' and a.visibility='Y' and a.productid=b.id order by recorddate desc limit 1"; } $rs=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); $high=stripslashes(mysql_result($rs,0,0)); $rdateh=date("d M, Y",mysqltime_to_mktime(stripslashes(mysql_result($rs,0,1)))); $name=stripslashes(mysql_result($rs,0,2)); //echo $sql." $name
"; //if($high) $highlights.="
$name
$high
"; if($high) { if($k==0) { $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.="
$name

$high

"; $highlights.=""; } else { $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.=""; $highlights.="
$name

$high

"; $highlights.=""; $highlights.=""; $highlights.="
"; } $k++; if($k==2) $k=0; } } } return($highlights); } // checks if user can access pricewatch function access2pw($login) { global $DATABASE; //global $tbl_userpath, $tbl_usermast; $date=mktime_to_mysqltime(time()); $date=substr($date,0,8); $sql="SELECT a.* FROM serviceaccess a, member b where a.login='$login' AND a.expdate>$date and a.status='Paid' and a.serviceid='12' and a.login=b.login and b.status='Approved'"; return mysql_num_rows(mysql_db_query($DATABASE,$sql)); } function trapuser($login,$page) { global $DATABASE; $date=mktime_to_mysqltime(time()); $sql="insert into user_visit values(null,'$login','$page','$date')"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error(mysql_error()); } // Murthy - Get random header for title - SEO function get_pricewatch_header() { global $DATABASE,$colorbg,$colorbgrow; ///////getting the details of the highlights from the pricewatch table $array=array(); $sql = "select id from ynfx_mis_pricewatchglobal order by id desc limit 20"; $result=mysql_db_query($DATABASE,$sql); if(mysql_num_rows($result)) { $count=mysql_num_rows($result); for($i=0;$i<$count;$i++) { $id .= mysql_result($result,$i,0).", "; } $id = substr($id,0,-2); } $sql = "SELECT id, productid, subprodid, id*0+rand() as randcol FROM ynfx_mis_pricewatchglobal where id in ($id) and approve='Y' and visibility='Y' and highlights!='' order by randcol LIMIT 1"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) { $count=mysql_num_rows($result); for($i=0;$i<$count;$i++) { $id = mysql_result($result,$i,0); $prod = mysql_result($result,$i,1); $sub_prod = mysql_result($result,$i,2); if($sub_prod) { $sql="select a.highlights, a.recorddate, b.name from ynfx_mis_pricewatchglobal a, ynfx_mis_subproducts b where a.id = $id and a.productid = '$prod' and a.subprodid = '$sub_prod' and a.approve='Y' and a.visibility='Y' and a.subprodid=b.id order by recorddate desc limit 1"; } else { $sql="select a.highlights, a.recorddate, b.name from ynfx_mis_pricewatchglobal a, ynfx_mis_product b where a.id = $id and a.productid = '$prod' and a.approve='Y' and a.visibility='Y' and a.productid=b.id order by recorddate desc limit 1"; } $rs=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); $high=stripslashes(mysql_result($rs,0,0)); $rdateh=date("d M, Y",mysqltime_to_mktime(stripslashes(mysql_result($rs,0,1)))); $name=stripslashes(mysql_result($rs,0,2)); if($high) { $pw_header = $name; } } } return($pw_header); } function get_pricewatch_body() { global $DATABASE,$colorbg,$colorbgrow; ///////getting the details of the highlights from the pricewatch table $array=array(); $sql = "select id from ynfx_mis_pricewatchglobal order by id desc limit 20"; $result=mysql_db_query($DATABASE,$sql); if(mysql_num_rows($result)) { $count=mysql_num_rows($result); for($i=0;$i<$count;$i++) { $id .= mysql_result($result,$i,0).", "; } $id = substr($id,0,-2); } $sql = "SELECT id, productid, subprodid, id*0+rand() as randcol FROM ynfx_mis_pricewatchglobal where id in ($id) and approve='Y' and visibility='Y' and highlights!='' order by randcol LIMIT 1"; $result=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); if(mysql_num_rows($result)) { $count=mysql_num_rows($result); for($i=0;$i<$count;$i++) { $id = mysql_result($result,$i,0); $prod = mysql_result($result,$i,1); $sub_prod = mysql_result($result,$i,2); if($sub_prod) { $sql="select a.highlights, a.recorddate, b.name from ynfx_mis_pricewatchglobal a, ynfx_mis_subproducts b where a.id = $id and a.productid = '$prod' and a.subprodid = '$sub_prod' and a.approve='Y' and a.visibility='Y' and a.subprodid=b.id order by recorddate desc limit 1"; } else { $sql="select a.highlights, a.recorddate, b.name from ynfx_mis_pricewatchglobal a, ynfx_mis_product b where a.id = $id and a.productid = '$prod' and a.approve='Y' and a.visibility='Y' and a.productid=b.id order by recorddate desc limit 1"; } $rs=mysql_db_query($DATABASE,$sql); if(mysql_error()) error("Unexpected Error".mysql_error()); $high=stripslashes(mysql_result($rs,0,0)); $rdateh=date("d M, Y",mysqltime_to_mktime(stripslashes(mysql_result($rs,0,1)))); $name=stripslashes(mysql_result($rs,0,2)); if($high) { $pw_body = $high; } } } return($pw_body); } ?>