$q1 = new DB_Sql_mcplus_main();
$q = new DB_Sql_mcplus();
$q->query($cat_sql);
$tot = $q->num_rows();
$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');
$ent_date = $q->f('ent_date');
$diff = $q->f('diff');
$call_cat = $q->f('cat');
$expiry_date = $q->f('expiry_date');
/*$lastprice = stock_price($scid,"NSE","lastprice","1");
if($stock_name == "")
{
$lastprice = stock_price($scid,"BSE","lastprice","1");
}*/
if(strlen($scid)>0 and $call_cat != "Commodity")
{
$stock_arr = stock_details($scid,"BSE");
$ex = "BSE";
if(count($stock_arr)==0){
$stock_arr = stock_details($scid,"NSE");
$ex= "NSE";
}
$lastprice = $stock_arr['CURRENTCLOSEPRICE'];
$sc_comp = $stock_arr['SC_COMP'];
$prevclose = $stock_arr['PREVCLOSE'];
$pergainloss = $stock_arr['PERGAINLOSS'];
$dttime = $stock_arr['DTTIME'];
$cont_expiry = "";
}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()){
$ex = "MCX";
$lastprice = $q1->f("ltp");
$dttime = $q1->f("ltt");
$sc_comp = $q1->f("cont_symbol");
$cont_expiry = $q1->f("cont_expiry");
$prevclose = $q1->f("close");
$pergainloss = number_format(((($lastprice-$prevclose)/$prevclose)*100),2);
}
}
$rec_price = sprintf("%01.2f",$rec_price,2);
if(($category=='BUY' && $lastprice >= $rec_price) || ($category=='SELL' && $lastprice <= $rec_price)){
if($category=='BUY') {
$sort_price = (($target-$lastprice)/$lastprice)*100;
}else if($category == "SELL"){
$sort_price = (($lastprice-$target)/$lastprice)*100;
}else{
$sort_price = '';
}
//echo'
autono='.$autono.' cat='.$category.' Cpr='.$lastprice.' SL='.$rec_price;
$exp_name = $impact;
$expimg = $expimg_arr[$exp_name];
$powercall_array[0][$ctr] = $autono;
$powercall_array[1][$ctr] = $exp_name;
$powercall_array[2][$ctr] = $expimg;
$powercall_array[3][$ctr] = $expdesig;
$powercall_array[4][$ctr] = $target;
$powercall_array[5][$ctr] = $stop_loss;
$powercall_array[6][$ctr] = $category;
$powercall_array[7][$ctr] = $scid;
$powercall_array[8][$ctr] = $heading;
$powercall_array[9][$ctr] = $summary;
$powercall_array[10][$ctr] = $exp_img_path;
$powercall_array[11][$ctr] = $ent_date;
$powercall_array[12][$ctr] = $sort_price;
$powercall_array[13][$ctr] = $lastprice;
$powercall_array[14][$ctr] = $sc_comp;
$powercall_array[15][$ctr] = $prevclose;
$powercall_array[16][$ctr] = $pergainloss;
$powercall_array[17][$ctr] = $dttime;
$powercall_array[18][$ctr] = $ex;
$powercall_array[19][$ctr] = $cont_expiry;
$ctr++;
}
}//while
############### Sort array here #########################
array_multisort($powercall_array[12],SORT_DESC,SORT_NUMERIC,$powercall_array[0],$powercall_array[1],
$powercall_array[2],$powercall_array[3],$powercall_array[4],$powercall_array[5],$powercall_array[6],
$powercall_array[7],$powercall_array[8],$powercall_array[9],$powercall_array[10],$powercall_array[11],
$powercall_array[13],$powercall_array[14],$powercall_array[15],$powercall_array[16],
$powercall_array[17],$powercall_array[18],$powercall_array[19]);
##########################################################
if($ctr >= 15)$ctr = 15;
for($i=0; $i < $ctr; $i++)
{
$autono = $powercall_array[0][$i];
$exp_name = $powercall_array[1][$i];
$expimg = $powercall_array[2][$i];
$expdesig = $powercall_array[3][$i];
$target = $powercall_array[4][$i];
$stop_loss = $powercall_array[5][$i];
$category = $powercall_array[6][$i];
$scid = $powercall_array[7][$i];
$heading = $powercall_array[8][$i];
$summary = $powercall_array[9][$i];
$exp_img_path = $powercall_array[10][$i];
$ent_date = $powercall_array[11][$i];
$sort_price = $powercall_array[12][$i];
$lastprice = $powercall_array[13][$i];
$sc_comp = $powercall_array[14][$i];
$prevclose = $powercall_array[15][$i];
$pergainloss = $powercall_array[16][$i];
$dttime = $powercall_array[17][$i];
$ex = $powercall_array[18][$i];
$cont_expiry = $powercall_array[19][$i];
if($ex!="MCX")
{
$pass_arr = array("CURRENTCLOSEPRICE"=>$lastprice,"SC_ID"=>$scid,"SC_COMP"=>$sc_comp, "PREVCLOSE"=>$prevclose,"PERGAINLOSS"=>$pergainloss,"DTTIME"=>$dttime);
/*$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";
}
$str = "
".$sc_comp."
".$currentcloseprice."".$image_class."".$pergainloss."".$ex."".$feed_time."
";*/
$stock_name = stock_price_string($pass_arr,$scid);
if($stock_name == "")
{
$stock_name = stock_price_string($pass_arr,$scid);
}
}else if($ex=="MCX"){
if ($pergainloss>0)
{
$image_class="
";
$fontcolor="gr_18";
}
else if ($pergainloss<0)
{
$image_class="
";
$fontcolor="r_18";
}
else
{
$image_class="
";
$fontcolor="b_18";
}
$last_trd_time = explode(" ",$dttime);
$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]));
$stock_name = "
".$sc_comp." ".$cont_expiry."
".number_format($lastprice,2)."".$image_class."".$pergainloss."%MCX ".$feed_time."
";
}
if($news_cat == "powercalls")
{
$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")
{
if(in_array($exp_name,$experts_array))$width = '60px';
else $width = '100px';
$disp_exp_name = "";
$expimg = "

";
$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."
";
}
}//for
if($tot==0){
?>
No Power Calls at the moment.
}
?>
Missed investment opportunities can cost you dearly
Get critical & timely information
on your Stocks on SMS, email
and on our desktop application
$sqlch="select celeb_name, celeb_desgn, celeb_orgn, preface, rank, date_format(chat_date,'%d_%m_%Y') as folderdate, date_format(chat_date,'Day - %D %b. %Y
Time - %H.%ihrs') as cdate, status, file_name cfilename, autono from chat_plus where rank in(1,3,5,7) order by rank ";
$q10->query($sqlch);
$q10->next_record();
$preface = $q10->f("preface");
$cceoname = $q10->f("celeb_name");
$cstatus = $q10->f("status");
$cdesi = $q10->f("celeb_desgn");
$corg = $q10->f("celeb_orgn");
$folderdate = $q10->f("folderdate");
$cceoname = ucwords($cceoname);
if($cceoname != "" && $cdesi != "")
$cdesi = "
".$cceoname .", ". $cdesi;
if($cceoname!="" && $cdesi=="")
$cdesi = "
".$cceoname."";
if(strlen($corg)!=1 && strlen($cdesi)!=0)
{
$corg=$corg;
}
$cdate = $q10->f("cdate");
$cfilename = $q10->f("cfilename");
$tmp = split (' ', $cceoname);
$img = "https://images.moneycontrol.com/images/mcplus_plus/chat/".$tmp[0].".gif";
$imgpath = "

";
if($cstatus=="live")
{
$chatgif="

";
$ctrtime="";
$ctrname=$cceoname;
$joinnow="

";
$currentchat="";
}
else if($cstatus=="next")
{
$chatgif="

";
$ctrtime=$cdate;
$ctrname="
".$cceoname."";
$joinnow="";
}
else if($cstatus=="transcript")
{
$chatgif="

";
$ctrtime=$cdate;
$ctrname=$cceoname;
$currentchat="
";
$joinnow="";
}
else if($cstatus=="upcoming")
{
$chatgif="

";
$ctrname=$cceoname;
$currentchat="
";
$joinnow="";
}
?>
INDIAN INDICES
$index_sql="select bridgesymbol, shortname, lastprice, (lastprice-close) `change`, close, entdate, (CASE bridgesymbol WHEN 'IN;aox' THEN 0 WHEN 'IN;bkx' THEN 1 WHEN 'in;nbx' THEN 2 WHEN 'IN;CGX' THEN 3 WHEN 'IN;CDX' THEN 4 WHEN 'IN;FMX' THEN 5 WHEN 'IN;HAX' THEN 6 WHEN 'IN;ifx' THEN 7 WHEN 'IN;MLX' THEN 8 WHEN 'IN;ogx' THEN 9 WHEN 'in;pbx' THEN 10 WHEN 'in;tkx' THEN 11 WHEN 'in;BCX' THEN 12 WHEN 'in;bmx' THEN 13 WHEN 'in;ccx' THEN 14 end) sortorder from cnbc_indices where bridgesymbol in ('IN;aox','IN;bkx','in;nbx','IN;CGX','IN;CDX','IN;FMX','IN;HAX','IN;ifx','IN;MLX','IN;ogx','in;pbx','in;tkx','in;BCX','in;bmx','in;ccx') order by sortorder";
$disp_ind=array(array("20", "BSE Auto"),array("18", "BANKEX"),array("23", "Bank Nifty"),array("13", "Capital Goods"),array("16", "Consumer Durables"),array("14", "BSE FMCG"),array("15", "BSE Healthcare"),array("17", "BSE IT"),array("21", "BSE Metals"),array("22", "Oil and Gas"),array("11", "BSE PSU"),array("10", "BSE TECk"),array("26", "BSE Small Cap"),array("25", "BSE Mid-Cap"),array("27", "CNX Midcap"));
$ar = 0;
$rec = mysqli_query($main_read, $index_sql);
while($row = mysqli_fetch_array($rec))
{
$shortname = $row[1];
$index_value = $disp_ind[$ar];
$index_name = str_replace(' ', '-', strtolower($index_value[1]));
$index_link = "".$index_value[1]."";
$lastprice = $row[2];
$change = $row[3];
$chan = str_replace('-','',$change);
if($change > 0)
$color = "gr_12";
elseif($change < 0)
$color = "r_12";
else
$color = "b_12";
echo "| ".$index_link." | ".$lastprice." | ".$change." |
";
$ar++;
}
?>
GLOBAL INDICES
#$sql="select bridgesymbol, shortname, lastprice, (lastprice-close) `change`, close, entdate, (CASE bridgesymbol WHEN 'US;dji' THEN 0 WHEN 'us;COMP' THEN 1 WHEN 'JP;N225' THEN 2 WHEN 'sg;STII' THEN 3 WHEN 'cn;hsi' THEN 4 WHEN 'tw;IXTA' THEN 5 WHEN 'kr;KSPI' THEN 6 WHEN 'cn;shi' THEN 7 WHEN 'gb;FTSE' THEN 8 WHEN 'fr;CAC' THEN 9 WHEN 'de;qx' THEN 10 end) sortorder, date_format(ENTDATE,'%b %e') entrydate, ENTDATE, ENTTIME from cnbc_indices where bridgesymbol in ('US;dji','us;COMP','JP;N225','sg;STII','cn;hsi','tw;IXTA','kr;KSPI', 'cn;shi','gb;FTSE','fr;CAC','de;qx') order by sortorder";
$sql="select bridgesymbol, shortname, lastprice, (lastprice-close) `change`, close, entdate, (CASE bridgesymbol WHEN 'US;dji' THEN 0 WHEN 'us;COMP' THEN 1 WHEN 'JP;N225' THEN 2 WHEN 'sg;STII' THEN 3 WHEN 'cn;hsi' THEN 4 WHEN 'tw;IXTA' THEN 5 WHEN 'kr;KSPI' THEN 6 WHEN 'cn;shi' THEN 7 WHEN 'gb;FTSE' THEN 8 WHEN 'fr;CAC' THEN 9 WHEN 'de;qx' THEN 10 end) sortorder, date_format(ENTDATE,'%b %e') entrydate, ENTDATE, ENTTIME from cnbc_indices where bridgesymbol in ('us;COMP','JP;N225','sg;STII','cn;hsi','tw;IXTA','kr;KSPI', 'cn;shi','gb;FTSE','fr;CAC','de;qx') order by sortorder";
$rec = mysqli_query($main_read, $sql);
$cc=0;
while($row = mysqli_fetch_array($rec))
{
$shortname = $row[1];
if($shortname=="Dow Jones")
$index_link = "".$shortname."";
elseif($shortname=="Nasdaq")
$index_link = "".$shortname."";
elseif($shortname=="FTSE")
$index_link = "".$shortname."";
elseif($shortname=="CAC")
$index_link = "".$shortname."";
elseif($shortname=="DAX")
$index_link = "".$shortname."";
elseif($shortname=="Nikkei 225")
$index_link = "".$shortname."";
elseif($shortname=="Straits Times")
$index_link = "".$shortname."";
elseif($shortname=="Hang Seng")
$index_link = "".$shortname."";
elseif($shortname=="Taiwan Index")
$index_link = "".$shortname."";
elseif($shortname=="KOSPI")
$index_link = "".$shortname."";
elseif($shortname=="Shanghai Composite")
$index_link = "".$shortname."";
else
$index_link = $shortname;
$lastprice = $row[2];
$sort_no = $row[6];
$change = $row[3];
$chan = str_replace('-','',$change);
if($change > 0)
$color = "gr_12";
else if($change < 0)
$color = "r_12";
else
$color = "b_12";
$entrydate_main = $row[7];
if(($shortname=="Dow Jones") || ($shortname=="Nasdaq"))
{
$entrydate_full = $row[8];
$entry_time = $row[9];
$entry_date_time=$entrydate_full." ".$entry_time;
$start_time=strtotime($entry_date_time);
$deduct_time=(60*60*9)+(60*30);
$time_difference=$start_time-$deduct_time;
//echo date('d-M-Y h:i:s',$time_difference);
$entrydate=" (".date('M d',$time_difference).")";
}
else
{
$entrydate=" (".$entrydate_main.")";
}
$index_link.=$entrydate;
$mkt_txt="";
if($sort_no=='0')
{
$mkt_txt="| US |
";
}
elseif($sort_no=='2')
{
$mkt_txt="| Asia |
";
}
elseif($sort_no=='8')
{
$mkt_txt="| Europe |
";
}
echo $mkt_txt;
?>
|
|
|
unset($index_link);
$cc++;
}
?>
COMMODITY PRICES
$sql_com = "select (case bridgesymbol when 'GOLD0Y' then 1 when 'SILVER0Y' then 2 when 'COPPER0Y' then 3 when 'NICKEL0Y' then 4 when 'ALUMINIUM0Y' then 5 when 'CRUDEOIL0Y' then 6 when 'ZINC0Y' then 6 end) sortorder1, shortname, lastprice, close, `change`, percentchange, bridgesymbol from cnbc_indices where bridgesymbol in ('GOLD0Y','SILVER0Y','COPPER0Y','NICKEL0Y','ALUMINIUM0Y','CRUDEOIL0Y','ZINC0Y') order by sortorder1";
$rec = mysqli_query($main_read, $sql_com);
while($row = mysqli_fetch_array($rec))
{
$change=$row['lastprice']-$row['close'];
$change = number_format($change,2);
if($change > 0)
$class = "gr_12";
else if($change < 0)
$class = "r_12";
else
$class = "b_12";
if($row['bridgesymbol'] == "ALUMINIUM0Y")
$shortname = "Aluminium";
elseif($row['bridgesymbol'] == "NICKEL0Y")
$shortname = "Nickel";
elseif($row['bridgesymbol'] == "ZINC0Y")
$shortname = "Zinc MCX";
else $shortname = $row['shortname'];
#echo $shortname."==
";
echo "| ".$shortname." | ".$row['lastprice']." | ".$change." |
";
}
?>
BROKERAGE RECCOS
$sql_rec = "Select ent_date, autono, heading,video_path,video_flag from NEWS_PUBLISH where category in ('Recommendations','FIIs on Results','Brokerage Recos') and (related_scid<>'NULL' and related_scid is not NULL) and publish='Y'order by ent_date desc limit 0,5";
$result_rec = mysqli_query($main_read, $sql_rec);
$cntt = 0;
while($row_rec = mysqli_fetch_array($result_rec))
{
$cntt++;
$heading_rec = $row_rec['heading'];
$autono_rec = $row_rec['autono'];
echo "- ".$heading_rec."
";
}
?>
Read All
IPO NEWS
$sql = "Select ent_date, autono, heading,video_path,video_flag from NEWS_PUBLISH where category like ('IPO%') and publish='Y'order by ent_date desc limit 0,3";
$result = mysqli_query($main_read, $sql);
while($row1=mysqli_fetch_array($result))
{
$heading = $row1['heading'];
$autono = $row1['autono'];
echo "- ".$heading."
";
}
?>
Read All
Close_Connection($main_read);
?>