Reporters & Researchers Corner
if($category == "PowerCalls" || $category == "commodity")
{
?>
}
if($category == "BrokReco")
$q=new DB_Sql_mcplus_news();
else
$q = new DB_Sql_mcplus();
if($category == "commodity")
{
$q1 = new DB_Sql_mcplus_main();
}
//echo $cat_sql."
";
$q->query($cat_sql);
$tot = $q->num_rows();
if (!$pageno)
{
$st=0;
$pageno=1;
}
else
$st=($pageno-1)*15;
if($next=="" && $prev=="")
{
$next=0;
$nn=$next*10;
$ll=$nn+10;
}
else if($prev>1)
{
$nn=($prev-1)*10;
$ll=$nn+10;
$pre=$prev-1;
$next=$pre;
}
else
{
$nn=$next*10;
$ll=$nn+10;
$pre=$next;
}
if($next=="")
$next=0;
$show_url=strtolower(str_replace(" ","",$showcat));
$show_url=strtolower(str_replace("'","",$show_url));
$total_count=$tot;
$news_count=$total_count;
$total_count=$total_count/15;
$total_count=ceil($total_count)-1;
if(($total_count*15)<$tot)
$total_count++;
$pagecount=0;
$pageall="";
$nex="";
while ($pagecount!=$total_count)
{
$pagecount++;
if($pagecount>$nn && $pagecount<=$ll)
{
if ($pagecount==$pageno)
$pageall .= "
$pagecount\n";
else
{
$pageall .= "
".$pagecount."\n";
}
$last_cc=$pagecount+1;
}
else if($pagecount>$ll)
{
$nex=$next+1;
break;
}
}
if($total_count > 1)
{
if($nex!="")
{
$pageall .= "
Next »\n";
}
else
{
$pageall .= "
Next »\n";
}
}
#$pageall .= "
";
if($total_count > 1)
{
if($nex>1 || $pre>=1)
{
$last_pr=$last_cc-20;
if($last_pr<1)
$last_pr=1;
$pageall = "
« Previous\n".$pageall;
}
else
{
$pageall = "
« Previous\n".$pageall;
}
}
else
{
#$pageall = "
".$pageall;
}
### Code for pagination ends here ####
?>
Note: Information displayed on the section - Heard On The Street - has not been provided to the stock exchanges, and is source-based.
';?>
$cat_sql = $cat_sql . " limit $st,15";
$ctr=0;
$q->query($cat_sql);
while($q->next_record())
{
$news_cat = $q->f('news_cat');
$scid = $q->f('scid');
$autono = $q->f('autono');
$heading = $q->f('heading');
$summary = $q->f('summary');
$impact = $q->f('impact');
$category = $q->f('category');
$exp_img_path = $q->f('exp_img_path');
$target = $q->f('target');
$rec_price = $q->f('recprice');
$stock = $q->f('stock');
$call_cat = $q->f('cat');
if($category == "MultiBaggers" || $category == "MktOutlook")
$ent_date = $q->f('call_date');
else
$ent_date = $q->f('ent_date');
if($news_cat=="commodity_call")
{
$expiry_date = $q->f('expiry_date');
$call_cat = $q->f('cat');
}
$diff = $q->f('diff');
$msg_dat=substr($ent_date,0,10);
$msg_yr=substr($ent_date,0,4);
$curr_dat=date("Y-m-d");
$curr_yr=date("Y");
if($curr_dat!=$msg_dat)
{
$date_all = explode(" ",$ent_date);
$time_xpld = explode(":",$date_all[1]);
$date_xpld = explode("-",$date_all[0]);
if($curr_yr==$msg_yr)
{
$filing_dt = date("g.i A M jS", mktime($time_xpld[0], $time_xpld[1], 0, $date_xpld[1], $date_xpld[2], $date_xpld[0]));
}
else
{
$filing_dt = date("g.i A M jS Y", mktime($time_xpld[0], $time_xpld[1], 0, $date_xpld[1], $date_xpld[2], $date_xpld[0]));
}
}
else
{
$filing_dt = dateTimeDiff($ent_date)." ago";
}
if($news_cat == "stocksigns")
{
if(strlen($scid) == 0)
echo "
";
else
{
if($impact == "positive")
$impact_img = "

";
else if($impact == "negative")
$impact_img = "

";
else
$impact_img = "";
if(strlen($summary) > 200)
{
$summary = substr($summary,0,200)."...";
}
$stock_ret = stock_price($scid,"BSE","split","1");
if($stock_ret == "")
{
$stock_ret = stock_price($scid,"NSE","split","1");
}
$stock_name = explode("|", $stock_ret);
echo "
".$impact_img." ".$stock_name[0]."
".$filing_dt." ".$stock_name[1]."
".$heading."
";
}
}
else if($news_cat == "stockimpact")
{
if(strlen($scid) == 0)
echo "
";
else
{
if($impact == "positive")
$impact_img = "

";
else if($impact == "negative")
$impact_img = "

";
else
$impact_img = "";
$stock_ret = stock_price($scid,"BSE","split","1");
if($stock_ret == "")
{
$stock_ret = stock_price($scid,"NSE","split","1");
}
$stock_name = explode("|", $stock_ret);
echo "
".$impact_img." ".$stock_name[0]."
".$filing_dt." ".$stock_name[1]."
".$heading."
";
}
}
else if($news_cat == "multibaggers")
{
$stock = $q->f('stock');
$target = $q->f('target');
$rec_price = $q->f('recprice');
$exp_imgpath = $q->f('exp_img_path');
//$high_closeprice = $q->f('high_closeprice');
$peakfromrec_txt="";
if($target == "Buy"){
$high_closeprice = $q->f('high_closeprice');
if($high_closeprice>0){
$high_closeprice_chg = round((($high_closeprice - $rec_price)/$rec_price)*100,2);
if($high_closeprice_chg > 0)
{
$gainloss = "Loss";
$gainloss = "
".str_replace("-","",number_format($high_closeprice_chg,2))."%";
}
else
{
$gainloss = "Gain";
$gainloss = "
".number_format($high_closeprice_chg,2)."%";
}
$peakfromrec_txt="
PEAK FROM RECO ".$high_closeprice." ".$gainloss."
";
}
}
else if($target == "Sell")
{
$low_closeprice = $q->f('low_closeprice');
if($low_closeprice>0){
$low_closeprice_chg = round((($rec_price - $low_closeprice)/$rec_price)*100,2);
if($low_closeprice_chg > 0)
{
$gainloss = "Loss";
$gainloss = "
".str_replace("-","",number_format($low_closeprice_chg,2))."%";
}
else
{
$gainloss = "Gain";
$gainloss = "
".number_format($low_closeprice_chg,2)."%";
}
$peakfromrec_txt="
LOW FROM RECO ".$low_closeprice." ".$gainloss."
";
}
}
if(in_array($impact,$experts_array))$width = '60px';
else $width = '100px';
if($exp_imgpath == "")
{
$exp_imgpath = $expimg_arr[$impact];
$exp_imgpath = "

";
}
else
{
$exp_imgpath = "

";
}
$current_closeprice = stock_price($scid,"BSE","lastprice");
if($current_closeprice=="")
{
$current_closeprice = stock_price($scid,"NSE","lastprice");
}
#$chg = (($rec_price - $current_closeprice)/$rec_price)*100;
$chg = round((($current_closeprice - $rec_price)/$rec_price)*100,2);
#echo $rec_price."==".$current_closeprice."
".((($rec_price - $current_closeprice)/$rec_price)*100)."
";
if($target == "Buy")
$buysell_img = "

";
else if($target == "Sell")
$buysell_img = "

";
else if($target == "Hold")
$buysell_img = "

";
else
$buysell_img = "

";
if($chg > 0)
{
$result = "Loss";
$gainloss = "
".$chg."%";
}
else
{
$result = "Gain";
$gainloss = "
".$chg."%";
}
if(strlen($summary) > 100)
{
$summary = substr($summary,0,100)."...";
}
if($peakfromrec_txt=="")
$peakfromrec_txt="
CURRENT PRICE ".$current_closeprice." ".$gainloss."
";
echo "
";
}
else if($news_cat == "mktoutlook")
{
$exp_imgpath = $q->f('exp_img_path');
if($exp_imgpath==''){
$exp_imgpath = $expimg_arr[$impact];
}else{
$exp_imgpath = "https://images.moneycontrol.com/images/".$exp_imgpath."";
}
if(strlen($summary) > 400)
{
$summary = substr($summary,0,400)."...";
}
echo "
";
}
else if($news_cat == "streettalk")
{
if(strlen($scid) == 0)
echo "
";
else
{
$stock_name = stock_price($scid,"BSE","","1");
if($stock_name == "")
{
$stock_name = stock_price($scid,"NSE","","1");
}
echo "

Information displayed on the section - Heard On The Street - has not been provided to the stock exchanges, and is source-based.
".$stock_name."
".$heading."
";
}
}
else if($news_cat == "powercalls")
{
$exp_name = $impact;
$expimg = $expimg_arr[$exp_name];
$expdesig = $expdes_arr[$exp_name];
$rec_price = $q->f('recprice');
$stop_loss = $rec_price;
if(strlen($scid) > 0 and $call_cat != "Commodity")
{
$stock_name = stock_price($scid,"BSE","","1");
if($stock_name == "")
{
$stock_name = stock_price($scid,"NSE","","1");
}
}
else if(strlen($scid) > 0 and $call_cat == "Commodity")
{
$get_mcx_price = "select ltp, ltt, close, cont_symbol, cont_expiry from mcx_commodity where cont_symbol='".$scid."' and expiry_date='".$expiry_date."'";
$q1->query($get_mcx_price);
if($q1->next_record()){
$ltp = $q1->f("ltp");
$last_trd_time = $q1->f("ltt");
$cont_symbol = $q1->f("cont_symbol");
$cont_expiry = $q1->f("cont_expiry");
$close = $q1->f("close");
$last_trd_time = explode(" ",$last_trd_time);
$date = explode("-",$last_trd_time[0]);
$time = explode(":",$last_trd_time[1]);
$feed_time = date("M d, G:i",mktime($time[0],$time[1],$time[2],$date[1],$date[2],$date[0]));
$per = number_format(((($ltp-$close)/$close)*100),2);
if ($per>0)
{
$image_class="
";
$fontcolor="gr_18";
}
else if ($per<0)
{
$image_class="
";
$fontcolor="r_18";
}
else
{
$image_class="
";
$fontcolor="b_18";
}
$stock_name = "
".$cont_symbol." ".$cont_expiry."
".$ltp."".$image_class."".$per."%MCX ".$feed_time."
";
}
}
$disp_exp_name = $exp_name;
if(in_array($exp_name,$experts_array))$width = '60px';
else $width = '100px';
$expimg = "

";
if($category == "BUY")
$image_name = "

";
else if($category == "SELL")
$image_name = "

";
else
$image_name = "

";
$det_flag = 0;
$det_disp = "
";
if($target != "" && $target != 0)
{
$det_flag = 1;
$det_disp .= "
TARGET ".number_format($target,2)."
";
}
if($stop_loss != "" && $stop_loss != 0)
{
$det_flag = 1;
$det_disp .= "
STOP LOSS".number_format($stop_loss,2)."
";
}
if($det_flag == 1)
$det_disp .= "
";
else
$det_disp = "";
echo "
";
}
else if($news_cat == "powercalls_res")
{
$exp_name = $impact;
$expimg = $expimg_arr[$exp_name];
$expdesig = $expdes_arr[$exp_name];
$stop_loss = $rec_price;
if(in_array($exp_name,$experts_array))$width = '60px';
else $width = '100px';
$disp_exp_name = "";
$expimg = "

";
if(strlen($scid) > 0 and $call_cat != "Commodity")
{
if($call_cat=='F&O' || $call_cat=='Currency')
{
$expiry_date = $q->f('expiry_date');
$stock_name = stock_futprice($scid,"NSE",$expiry_date,$call_cat);
}
else
{
$stock_name = stock_price($scid,"BSE","","1");
if($stock_name == "")
{
$stock_name = stock_price($scid,"NSE","","1");
}
}
/*
$stock_name = stock_price($scid,"NSE","","1");
if($stock_name == "")
{
$stock_name = stock_price($scid,"BSE","","1");
} */
}
else if(strlen($scid) > 0 and $call_cat == "Commodity")
{
$get_mcx_price = "select ltp, ltt, close, cont_symbol, cont_expiry from mcx_commodity where cont_symbol='".$scid."' and expiry_date='".$expiry_date."'";
$q1->query($get_mcx_price);
if($q1->next_record()){
$ltp = $q1->f("ltp");
$last_trd_time = $q1->f("ltt");
$cont_symbol = $q1->f("cont_symbol");
$cont_expiry = $q1->f("cont_expiry");
$close = $q1->f("close");
$last_trd_time = explode(" ",$last_trd_time);
$date = explode("-",$last_trd_time[0]);
$time = explode(":",$last_trd_time[1]);
$feed_time = date("M d, G:i",mktime($time[0],$time[1],$time[2],$date[1],$date[2],$date[0]));
$per = number_format(((($ltp-$close)/$close)*100),2);
if ($per>0)
{
$image_class="
";
$fontcolor="gr_18";
}
else if ($per<0)
{
$image_class="
";
$fontcolor="r_18";
}
else
{
$image_class="
";
$fontcolor="b_18";
}
$stock_name = "
".$cont_symbol." ".$cont_expiry."
".$ltp."".$image_class."".$per."%MCX ".$feed_time."
";
}else{
$stock_name = "";
}
}else{
$stock_name = "";
}
$det_flag = 0;
$det_disp = "
";
if($target != "" && $target != 0)
{
$det_flag = 1;
$det_disp .= "
TARGET ".number_format($target,2)."
";
}
if($stop_loss != "" && $stop_loss != 0)
{
$det_flag = 1;
$det_disp .= "
STOP LOSS".number_format($stop_loss,2)."
";
}
if($det_flag == 1)
$det_disp .= "
";
else
$det_disp = "";
if($category == "BUY")
$image_name = "

";
else if($category == "SELL")
$image_name = "

";
else
$image_name = "

";
echo "
".$expimg."
".$disp_exp_name."
".$expdesig."
".$filing_dt."
".$image_name."
".$stock_name."
".$det_disp."
".$heading."
";
}
else if($news_cat == "commodity_call")
{
$exp_name = $impact;
$expimg = $expimg_arr[$exp_name];
$expdesig = $expdes_arr[$exp_name];
$stop_loss = $rec_price;
if($exp_name == 'Karvy Stock Broking'){
$expimg = 'https://images.moneycontrol.com/images/pyt_2010/KarvyCommoditiesBrokingLogoV_EPS-2018.PNG';
}
if(in_array($exp_name,$experts_array))$width = '60px';
else $width = '100px';
$disp_exp_name = "";
$expimg = "

";
$get_mcx_price = "select ltp, ltt, close, cont_symbol, cont_expiry from mcx_commodity where cont_symbol='".$scid."' and expiry_date='".$expiry_date."'";
$q1->query($get_mcx_price);
if($q1->next_record()){
$ltp = $q1->f("ltp");
$last_trd_time = $q1->f("ltt");
$cont_symbol = $q1->f("cont_symbol");
$cont_expiry = $q1->f("cont_expiry");
$close = $q1->f("close");
$last_trd_time = explode(" ",$last_trd_time);
$date = explode("-",$last_trd_time[0]);
$time = explode(":",$last_trd_time[1]);
$feed_time = date("M d, G:i",mktime($time[0],$time[1],$time[2],$date[1],$date[2],$date[0]));
$per = number_format(((($ltp-$close)/$close)*100),2);
if ($per>0)
{
$image_class="
";
$fontcolor="gr_18";
}
else if ($per<0)
{
$image_class="
";
$fontcolor="r_18";
}
else
{
$image_class="
";
$fontcolor="b_18";
}
$stock_name = "
".$cont_symbol." ".$cont_expiry."
".$ltp."".$image_class."".$per."%MCX ".$feed_time."
";
}
else
{
$stock_name = "";
}
$det_flag = 0;
$det_disp = "
";
if($target != "" && $target != 0)
{
$det_flag = 1;
$det_disp .= "
TARGET ".number_format($target,2)."
";
}
if($stop_loss != "" && $stop_loss != 0)
{
$det_flag = 1;
$det_disp .= "
STOP LOSS".number_format($stop_loss,2)."
";
}
if($det_flag == 1)
$det_disp .= "
";
else
$det_disp = "";
if($category == "BUY")
$image_name = "

";
else if($category == "SELL")
$image_name = "

";
else
$image_name = "

";
echo "
".$expimg."
".$disp_exp_name."
".$expdesig."
".$filing_dt."
".$image_name."
".$stock_name."
".$det_disp."
".$heading."
";
}
else if($news_cat == "markettalk" || $news_cat == "morenews")
{
if($news_cat == "markettalk")
{
if(strlen($summary) > 200)
{
$summary = substr($summary,0,200)."...";
}
$display_summary = "
".$summary."
";
}
else
$display_summary = "";
echo "
";
}
else if($news_cat == "rep_corner")
{
$author = $q->f('target');
echo "
";
}
else if($news_cat == "broker_reco")
{
echo "
";
}
$ctr++;
}
?>