set_file("file","returns.htm");
$conn_read1 = Open_Connection("main_read");
$t->set_block("file","dd1","d1block");
$t->set_block("file","yy1","y1block");
$t->set_block("file","dd2","d2block");
$t->set_block("file","yy2","y2block");
if($ff_id!="")
$sel_ffid=$ff_id;
$amcsql="select ff_id, ff_desc from fundfamily order by ff_desc";
$t->set_block("file","amcblock","amcbuf");
$rec = mysql_query($amcsql, $conn_read1);
while($row = mysql_fetch_array($rec,MYSQL_ASSOC))
{
$ff_id = $row["ff_id"];
$ff_desc = $row["ff_desc"];
if($ff_id==$sel_ffid)
$sel="";
else
$sel="";
$t->set_var(array("SEL"=>$sel, "SEL_FFID"=>$sel_ffid, "FF_ID"=>$ff_id, "FF_DESC"=>$ff_desc, "IM_DESC"=>"Select", "DATEBLOCK"=>"", "RETCALC"=>"", "RETBLOCK"=>""));
$t->parse("amcbuf","amcblock","true");
}
if($im_id!="")
$sel_imid=$im_id;
$schemesql="select im_ffid, im_id, im_desc from invmall where im_ffid='$sel_ffid' order by im_desc";
$t->set_block("file","schemeblock","schemebuf");
$rec = mysql_query($schemesql, $conn_read1);
while($row = mysql_fetch_array($rec,MYSQL_ASSOC))
{
$ff_id = $row["im_ffid"];
$im_id = $row["im_id"];
$im_desc = $row["im_desc"];
if($im_id==$sel_imid)
$sel_sch="";
else
$sel_sch="";
$t->set_var(array("SEL_SCH"=>$sel_sch, "SEL_FFID"=>$sel_ffid, "SEL_IMID"=>$sel_imid, "IM_ID"=>$im_id, "FF_ID"=>$ff_id, "IM_DESC"=>$im_desc, "DATEBLOCK"=>"", "DATEBLOCKE"=>"", "RETCALC"=>"", "RETBLOCK"=>""));
$t->parse("schemebuf","schemeblock","true");
}
if($sel_ffid == "" || $sel_imid == "")
{
$retblock="";
}
else
{
$retblock="";
$retblocke="";
}
if($im_id != "" && $sel_ffid != "")
{
$t->set_var(array("IMID1"=>$im_id,"IMDESC1"=>$im_desc,"FFDESC1"=>$ff_desc, "DATEBLOCK"=>"", "DATEBLOCKE"=>"", "SEL_FFID"=>$sel_ffid, "RETBLOCK"=>$retblock, "RETBLOCKE"=>$retblocke, "SEL_IMID"=>$sel_imid));
$month=array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$im_desc=preg_replace("/ /","%20",$im_desc);
$im_desc=str_replace("&","%26",$im_desc);
$ff_desc=preg_replace("/ /","%20",$ff_desc);
$ff_desc=str_replace("&","%26",$ff_desc);
$im_ffid=preg_replace("/ /","%20",$im_ffid);
$im_ffid=str_replace("&","%26",$im_ffid);
$t->set_var(array("FNAME"=>$fname));
$sql="select ifnull(date_format(im_navdate,'%d-%m-%Y'),'N.A') im_navdate, ifnull(format(im_hist1wk*100,1),'999') im_hist1wk, ifnull(format(im_hist1mth*100,1),'999') im_hist1mth, ifnull(format(im_hist3mth*100,1),'999') im_hist3mth, ifnull(format(im_hist6mth*100,1),'999') im_hist6mth, ifnull(format(im_hist1yr*100,1),'999') im_hist1yr, ifnull(format(im_hist2yr*100,1),'999') im_hist2yr, ifnull(format(im_hist3yr*100,1),'999') im_hist3yr, ifnull(format(im_hist5yr*100,1),'999') im_hist5yr, ifnull(format(im_abshist1wk*100,1),'999') im_abshist1wk, ifnull(format(im_abshist1mth*100,1),'999') im_abshist1mth, ifnull(format(im_abshist3mth*100,1),'999') im_abshist3mth, ifnull(format(im_abshist6mth*100,1),'999') im_abshist6mth, ifnull(format(im_abshist1yr*100,1),'999') im_abshist1yr, ifnull(format(im_abshist2yr*100,1),'999') im_abshist2yr, ifnull(format(im_abshist3yr*100,1),'999') im_abshist3yr, ifnull(format(im_abshist5yr*100,1),'999') im_abshist5yr, ifnull(format(im_rankcat1wk,0),'N.A') im_rankcat1wk, ifnull(format(im_rankcat1mth,0),'N.A') im_rankcat1mth, ifnull(format(im_rankcat3mth,0),'N.A') im_rankcat3mth, ifnull(format(im_rankcat6mth,0),'N.A') im_rankcat6mth, ifnull(format(im_rankcat1yr,0),'N.A') im_rankcat1yr, ifnull(format(im_rankcat2yr,0),'N.A') im_rankcat2yr, ifnull(format(im_rankcat3yr,0),'N.A') im_rankcat3yr, ifnull(format(im_rankcat5yr,0),'N.A') im_rankcat5yr, im_fundclass, ifnull(io_desc,'N.A') io_desc, ifnull(fc_desc,'N.A') fc_desc from invmall, invobj, fundclass where im_id='$sel_imid' and io_id=im_invobj and fc_id=im_fundclass";
//echo $sql;
$datesql="select date_format(min(int_date),'%d-%m-%Y') first_date, date_format(max(int_date),'%d-%m-%Y') last_date from imnavtrans where int_imid='$sel_imid'";
$count=0;
$rec = mysql_query($sql, $conn_read1);
while($row = mysql_fetch_array($rec,MYSQL_ASSOC))
{
$count++;
$im_navdate = $row["im_navdate"];
$im_hist1wk = $row["im_hist1wk"];
if($im_hist1wk=="999")
$im_hist1wk="N.A";
$im_hist1mth = $row["im_hist1mth"];
if($im_hist1mth=="999")
$im_hist1mth="N.A";
$im_hist3mth = $row["im_hist3mth"];
if($im_hist3mth=="999")
$im_hist3mth="N.A";
$im_hist6mth = $row["im_hist6mth"];
if($im_hist6mth=="999")
$im_hist6mth="N.A";
$im_hist1yr = $row["im_hist1yr"];
if($im_hist1yr=="999")
$im_hist1yr="N.A";
$im_hist2yr = $row["im_hist2yr"];
if($im_hist2yr==0)
$im_hist2yr="N.A";
$im_hist3yr = $row["im_hist3yr"];
if($im_hist3yr=="999")
$im_hist3yr="N.A";
$im_hist5yr = $row["im_hist5yr"];
if($im_hist5yr=="999")
$im_hist5yr="N.A";
$im_abshist1wk = $row["im_abshist1wk"];
if($im_abshist1wk=="999")
$im_abshist1wk="N.A";
$im_abshist1mth = $row["im_abshist1mth"];
if($im_abshist1mth=="999")
$im_abshist1mth="N.A";
$im_abshist3mth = $row["im_abshist3mth"];
if($im_abshist3mth=="999")
$im_abshist3mth="N.A";
$im_abshist6mth = $row["im_abshist6mth"];
if($im_abshist6mth=="999" )
$im_abshist6mth="N.A";
$im_abshist1yr = $row["im_abshist1yr"];
if($im_abshist1yr=="999")
$im_abshist1yr="N.A";
$im_abshist2yr = $row["im_abshist2yr"];
if($im_abshist2yr=="999")
$im_abshist2yr="N.A";
$im_abshist3yr = $row["im_abshist3yr"];
if($im_abshist3yr=="999")
$im_abshist3yr="N.A";
$im_abshist5yr = $row["im_abshist5yr"];
if($im_abshist5yr=="999")
$im_abshist5yr="N.A";
$im_rankcat1wk = $row["im_rankcat1wk"];
$im_rankcat1mth = $row["im_rankcat1mth"];
$im_rankcat3mth = $row["im_rankcat3mth"];
$im_rankcat6mth = $row["im_rankcat6mth"];
$im_rankcat1yr = $row["im_rankcat1yr"];
$im_rankcat2yr = $row["im_rankcat2yr"];
$im_rankcat3yr = $row["im_rankcat3yr"];
$im_rankcat5yr = $row["im_rankcat5yr"];
if (preg_match("/-/",$im_hist1wk))
$wk1color="#d60614";
else if($im_hist1wk != "N.A")
$wk1color="#0F6C02";
else
$wk1color="#000000";
if (preg_match("/-/",$im_hist1mth))
$m1color="#d60614";
else if($im_hist1mth != "N.A")
$m1color="#0F6C02";
else
$m1color="#000000";
if (preg_match("/-/",$im_hist3mth))
$m3color="#d60614";
else if($im_hist3mth != "N.A")
$m3color="#0F6C02";
else
$m3color="#000000";
if (preg_match("/-/",$im_hist6mth))
$m6color="#d60614";
else if($im_hist6mth != "N.A")
$m6color="#0F6C02";
else
$m6color="#000000";
if (preg_match("/-/",$im_hist1yr))
$y1color="#d60614";
else if($im_hist1yr != "N.A")
$y1color="#0F6C02";
else
$y1color="#000000";
if (preg_match("/-/",$im_hist2yr))
$y2color="#d60614";
else if($im_hist2yr != "N.A")
$y2color="#0F6C02";
else
$y2color="#000000";
if (preg_match("/-/",$im_hist3yr))
$y3color="#d60614";
else if($im_hist3yr != "N.A")
$y3color="#0F6C02";
else
$y3color="#000000";
if (preg_match("/-/",$im_hist5yr))
$y5color="#d60614";
else if($im_hist5yr != "N.A")
$y5color="#0F6C02";
else
$y5color="#000000";
if (preg_match("/-/",$im_abshist1wk))
$abswk1color="#d60614";
else if($im_abshist1wk != "N.A")
$abswk1color="#0F6C02";
else
$abswk1color="#000000";
if (preg_match("/-/",$im_abshist1mth))
$absm1color="#d60614";
else if($im_abshist1mth != "N.A")
$absm1color="#0F6C02";
else
$absm1color="#000000";
if (preg_match("/-/",$im_abshist3mth))
$absm3color="#d60614";
else if($im_abshist3mth != "N.A")
$absm3color="#0F6C02";
else
$absm3color="#000000";
if (preg_match("/-/",$im_abshist6mth))
$absm6color="#d60614";
else if($im_abshist6mth != "N.A")
$absm6color="#0F6C02";
else
$absm6color="#000000";
if (preg_match("/-/",$im_abshist1yr))
$absy1color="#d60614";
else if($im_abshist1yr != "N.A")
$absy1color="#0F6C02";
else
$absy1color="#000000";
if (preg_match("/-/",$im_abshist2yr))
$absy2color="#d60614";
else if($im_abshist2yr != "N.A")
$absy2color="#0F6C02";
else
$absy2color="#000000";
if (preg_match("/-/",$im_abshist3yr))
$absy3color="#d60614";
else if($im_abshist3yr != "N.A")
$absy3color="#0F6C02";
else
$absy3color="#000000";
if (preg_match("/-/",$im_abshist5yr))
$absy5color="#d60614";
else if($im_abshist5yr != "N.A")
$absy5color="#0F6C02";
else
$absy5color="#000000";
$io_desc = $row["io_desc"];
$fc_desc = $row["fc_desc"];
$fundclass = $row["im_fundclass"];
$rec1 = mysql_query($datesql, $conn_read1);
while($row1 = mysql_fetch_array($rec1, MYSQL_ASSOC))
{
$firstdt = $row1["first_date"];
$lastdt = $row1["last_date"];
$fdd = substr($firstdt, 0, 2);
$fmm = substr($firstdt, 3, 2);
$fyy = substr($firstdt, 6, 4);
$fdt = substr($firstdt,6,4) . substr($firstdt,3,2) . substr($firstdt,0,2);
$ldd = substr($lastdt, 0, 2);
$lmm = substr($lastdt, 3, 2);
$lyy = substr($lastdt, 6, 4);
$ldt = substr($lastdt,6,4) . substr($lastdt,3,2) . substr($lastdt,0,2);
}
$fromdt1 = "";
$fmon=$month[number_format($fmm,0)-1];
$fromdt2 = "";
$fromdt3 = "";
for($i=1; $i<=31; $i++)
{
$i=str_pad($i, 2, "0", STR_PAD_LEFT);
$t->set_var(array("D1"=>$i));
$t->parse("d1block","dd1","true");
}
for($i=$fyy; $i<=$lyy; $i++)
{
$t->set_var(array("Y1"=>$i));
$t->parse("y1block","yy1","true");
}
for($i=1; $i<=31; $i++)
{
$i=str_pad($i, 2, "0", STR_PAD_LEFT);
$t->set_var(array("D2"=>$i));
$t->parse("d2block","dd2","true");
}
for($i=$fyy; $i<=$lyy; $i++)
{
$t->set_var(array("Y2"=>$i));
$t->parse("y2block","yy2","true");
}
$todt1 = "";
$tmon=$month[number_format($lmm,0)-1];
$todt2 = "";
$todt3 = "";
$t->set_var(array("FROMDT1"=>$fromdt1, "FROMDT2"=>$fromdt2, "FROMDT3"=>$fromdt3, "TODT1"=>$todt1, "TODT2"=>$todt2, "TODT3"=>$todt3, "SEL_FFID"=>$sel_ffid, "SEL_IMID"=>$sel_imid));
$sqql="select count(*)as total from invmall where im_fundclass='$fundclass' and im_rnkflg='Y'";
$rec1 = mysql_query($sqql, $conn_read1);
while($row1 = mysql_fetch_array($rec1, MYSQL_ASSOC))
{
$total = $row1["total"];
}
if(!isset($total))
$total="N.A";
}
if($count==0)
{
$im_navdate="N.A";
$im_hist3mth="N.A";
$im_hist6mth="N.A";
$im_hist1yr="N.A";
$im_hist2yr="N.A";
$im_hist3yr="N.A";
$im_abshist3mth="N.A";
$im_abshist6mth="N.A";
$im_abshist1yr="N.A";
$im_abshist2yr="N.A";
$im_abshist3yr="N.A";
$im_rankcat3mth="N.A";
$im_rankcat6mth="N.A";
$im_rankcat1yr="N.A";
$im_rankcat2yr="N.A";
$im_rankcat3yr="N.A";
$io_desc="N.A";
$fc_desc="N.A";
}
$retcal="";
$t->set_var(array("IODESC"=>$io_desc, "FCDESC"=>$fc_desc, "NAVDATE"=>$im_navdate, "HIST1WK"=>$im_hist1wk, "ABSHIST1WK"=>$im_abshist1wk, "RANKCAT1WK"=>$im_rankcat1wk, "HIST1M"=>$im_hist1mth, "ABSHIST1M"=>$im_abshist1mth, "RANKCAT1M"=>$im_rankcat1mth, "HIST3M"=>$im_hist3mth, "ABSHIST3M"=>$im_abshist3mth, "RANKCAT3M"=>$im_rankcat3mth, "HIST6M"=>$im_hist6mth, "ABHIST6M"=>$im_abshist6mth, "RANCAT6M"=>$im_rankcat6mth, "HIST1Y"=>$im_hist1yr, "ABHIST1Y"=>$im_abshist1yr, "RANKCAT1Y"=>$im_rankcat1yr, "HIST2Y"=>$im_hist2yr, "ABHIST2Y"=>$im_abshist2yr, "RANKCAT2Y"=>$im_rankcat2yr, "HIST3Y"=>$im_hist3yr, "ABHIST3Y"=>$im_abshist3yr, "RANKCAT3Y"=>$im_rankcat3yr, "HIST5Y"=>$im_hist5yr, "ABHIST5Y"=>$im_abshist5yr, "RANKCAT5Y"=>$im_rankcat5yr, "IMDESC"=>$im_desc, "FFDESC"=>$ff_desc, "IM_ID"=>$im_id, "FF_ID"=>$sel_ffid, "TOTAL"=>$total, "RETCALC"=>$retcal, "RETCALCE"=>$retcale, "WK1COLOR"=>$wk1color, "M1COLOR"=>$m1color, "M3COLOR"=>$m3color, "M6COLOR"=>$m6color, "Y1COLOR"=>$y1color, "Y2COLOR"=>$y2color, "Y3COLOR"=>$y3color, "Y5COLOR"=>$y5color, "ABSWK1COLOR"=>$abswk1color, "ABSM1COLOR"=>$absm1color, "ABSM3COLOR"=>$absm3color, "ABSM6COLOR"=>$absm6color, "ABSY1COLOR"=>$absy1color, "ABSY2COLOR"=>$absy2color, "ABSY3COLOR"=>$absy3color, "ABSY5COLOR"=>$absy5color, "FDT"=>$fdt, "LDT"=>$ldt, "FIRSTDT"=>$firstdt, "LASTDT"=>$lastdt));
}
else
{
if($ff_id=="")
{
}
else
{
if($im_id=="")
{
}
else
{
$retcal="";
$retcale="";
$keyidsql="select im_keyid from invmall where im_ffid='$sel_ffid' and im_id='$sel_imid'";
#$startnavsql="select to_char(a.int_date, 'DD-Mon-YYYY') int_date, a.int_value from imnavtrans a where a.int_ffid='$sel_ffid' and a.int_imid='$sel_imid' and a.int_date=(select min(b.int_date) from imnavtrans b where b.int_ffid=a.int_ffid and b.int_imid=a.int_imid and to_char(int_date,'yyyymmdd')>='$frdate')";
$startnavsql="select date_format(int_date, '%d-%b-%Y') int_date, int_value from imnavtrans where int_ffid='$sel_ffid' and int_imid='$sel_imid' and int_date=(select min(int_date) from imnavtrans where int_ffid='$sel_ffid' and int_imid='$sel_imid' and date_format(int_date,'%Y%m%d')>='$frdate')";
#$endnavsql="select to_char(a.int_date, 'DD-Mon-YYYY') int_date, a.int_value from imnavtrans a where a.int_ffid='$sel_ffid' and a.int_imid='$sel_imid' and a.int_date=(select max(b.int_date) from imnavtrans b where b.int_ffid=a.int_ffid and b.int_imid=a.int_imid and to_char(int_date,'yyyymmdd')<='$todate')";
$endnavsql="select date_format(int_date, '%d-%b-%Y') int_date, int_value from imnavtrans where int_ffid='$sel_ffid' and int_imid='$sel_imid' and int_date=(select max(int_date) from imnavtrans where int_ffid='$sel_ffid' and int_imid='$sel_imid' and date_format(int_date,'%Y%m%d')<='$todate')";
$fromdt3 = substr($frdate,0,4);
$fromdt2 = substr($frdate,4,2);
$fromdt1 = substr($frdate,6,2);
$frommon=$month[number_format($fromdt2,0)-1];
$fromdt1="";
$fromdt2="";
$fromdt3="";
$todt3 = substr($todate,0,4);
$todt2 = substr($todate,4,2);
$todt1 = substr($todate,6,2);
$tomon=$month[number_format($todt2,0)-1];
$todt1="";
$todt2="";
$todt3="";
$rec = mysql_query($startnavsql, $conn_read1);
while($row = mysql_fetch_array($rec, MYSQL_ASSOC))
{
$startdt = $row["int_date"];
$startval = $row["int_value"];
}
$rec = mysql_query($endnavsql, $conn_read1);
while($row = mysql_fetch_array($rec, MYSQL_ASSOC))
{
$enddt = $row["int_date"];
$endval = $row["int_value"];
}
$rec = mysql_query($keyidsql, $conn_read1);
while($row = mysql_fetch_array($rec, MYSQL_ASSOC))
{
$keyid = $row["im_keyid"];
}
$keyflg="";
if($keyid!="")
{
$keyflg="T";
$stnavsql="select int_value from imnavtrans where int_ffid='$ff_id' and int_imid='$keyid' and date_format(int_date,'%d-%b-%Y')='$startdt'";
$ennavsql="select int_value from imnavtrans where int_ffid='$ff_id' and int_imid='$keyid' and date_format(int_date,'%d-%b-%Y')='$enddt'";
$rec = mysql_query($stnavsql, $conn_read1);
while($row = mysql_fetch_array($rec, MYSQL_ASSOC))
{
$stval = $row["int_value"];
}
$rec = mysql_query($ennavsql, $conn_read1);
while($row = mysql_fetch_array($rec, MYSQL_ASSOC))
{
$enval = $row["int_value"];
}
$absret=(($enval-$stval)/$stval)*100;
}
else
$absret=(($endval-$startval)/$startval)*100;
$absret=number_format($absret,1);
if (preg_match("/-/",$absret))
$retcolor="#d60614";
else
$retcolor="#0F6C02";
$t->set_var(array("STARTDT"=>$startdt, "ENDDT"=>$enddt, "STARTVAL"=>$startval, "ENDVAL"=>$endval, "ABSRET"=>$absret, "RETCALC"=>$retcal, "RETCALCE"=>$retcale, "RETCOLOR"=>$retcolor, "FROMDT1"=>$fromdt1, "FROMDT2"=>$fromdt2, "FROMDT3"=>$fromdt3, "TODT1"=>$todt1, "TODT2"=>$todt2, "TODT3"=>$todt3, "DATEBLOCK"=>"", "DATEBLOCKE"=>"", "RETBLOCK"=>"", "RETBLOCKE"=>""));
}
}
}
if($retcalc=="true")
{
$retcal="";
$retcale="";
$keyidsql="select im_keyid from invmall where im_ffid='$sel_ffid' and im_id='$sel_imid'";
#$startnavsql="select to_char(a.int_date, 'DD-Mon-YYYY') int_date, a.int_value from imnavtrans a where a.int_ffid='$sel_ffid' and a.int_imid='$sel_imid' and a.int_date=(select min(b.int_date) from imnavtrans b where b.int_ffid=a.int_ffid and b.int_imid=a.int_imid and to_char(int_date,'yyyymmdd')>='$frdate')";
$startnavsql="select date_format(int_date, '%d-%b-%Y') int_date, int_value from imnavtrans where int_ffid='$sel_ffid' and int_imid='$sel_imid' and int_date=(select min(int_date) from imnavtrans where int_ffid='$sel_ffid' and int_imid='$sel_imid' and date_format(int_date,'%Y%m%d')>='$frdate')";
#$endnavsql="select to_char(a.int_date, 'DD-Mon-YYYY') int_date, a.int_value from imnavtrans a where a.int_ffid='$sel_ffid' and a.int_imid='$sel_imid' and a.int_date=(select max(b.int_date) from imnavtrans b where b.int_ffid=a.int_ffid and b.int_imid=a.int_imid and to_char(int_date,'yyyymmdd')<='$todate')";
$endnavsql="select date_format(int_date, '%d-%b-%Y') int_date, int_value from imnavtrans where int_ffid='$sel_ffid' and int_imid='$sel_imid' and int_date=(select max(int_date) from imnavtrans where int_ffid='$sel_ffid' and int_imid='$sel_imid' and date_format(int_date,'%Y%m%d')<='$todate')";
$fromdt3 = substr($frdate,0,4);
$fromdt2 = substr($frdate,4,2);
$fromdt1 = substr($frdate,6,2);
$frommon=$month[number_format($fromdt2,0)-1];
$fromdt1="";
$fromdt2="";
$fromdt3="";
$todt3 = substr($todate,0,4);
$todt2 = substr($todate,4,2);
$todt1 = substr($todate,6,2);
$tomon=$month[number_format($todt2,0)-1];
$todt1="";
$todt2="";
$todt3="";
$rec = mysql_query($startnavsql, $conn_read1);
while($row = mysql_fetch_array($rec, MYSQL_ASSOC))
{
$startdt = $row["int_date"];
$startval = $row["int_value"];
}
$rec = mysql_query($endnavsql, $conn_read1);
while($row = mysql_fetch_array($rec, MYSQL_ASSOC))
{
$enddt = $row["int_date"];
$endval = $row["int_value"];
}
$rec = mysql_query($keyidsql, $conn_read1);
while($row = mysql_fetch_array($rec, MYSQL_ASSOC))
{
$keyid = $row["im_keyid"];
}
$keyflg="";
if($keyid!="")
{
$keyflg="T";
$stnavsql="select int_value from imnavtrans where int_ffid='$sel_ffid' and int_imid='$keyid' and int_date=(select min(int_date) from imnavtrans where int_ffid='$sel_ffid' and int_imid='$keyid' and date_format(int_date,'%Y%m%d')>='$frdate')";
$ennavsql="select int_value from imnavtrans where int_ffid='$sel_ffid' and int_imid='$keyid' and int_date=(select max(int_date) from imnavtrans where int_ffid='$sel_ffid' and int_imid='$keyid' and date_format(int_date,'%Y%m%d')<='$todate')";
$rec = mysql_query($stnavsql, $conn_read1);
while($row = mysql_fetch_array($rec, MYSQL_ASSOC))
{
$stval = $row["int_value"];
}
$rec = mysql_query($ennavsql, $conn_read1);
while($row = mysql_fetch_array($rec, MYSQL_ASSOC))
{
$enval = $row["int_value"];
}
$absret=(($enval-$stval)/$stval)*100;
}
else
$absret=(($endval-$startval)/$startval)*100;
$absret=number_format($absret,1);
if (preg_match("/-/",$absret))
$retcolor="#d60614";
else
$retcolor="#0F6C02";
$t->set_var(array("STARTDT"=>$startdt, "ENDDT"=>$enddt, "STARTVAL"=>$startval, "ENDVAL"=>$endval, "ABSRET"=>$absret, "RETCALC"=>$retcal, "RETCALCE"=>$retcale, "RETCOLOR"=>$retcolor, "FROMDT1"=>$fromdt1, "FROMDT2"=>$fromdt2, "FROMDT3"=>$fromdt3, "TODT1"=>$todt1, "TODT2"=>$todt2, "TODT3"=>$todt3));
}
$pageheight=0;
$secheight=$rtableheight[$section];
$text_to_display = urlencode(" Returns Calculator");
$youarehere = join("",file("http://127.0.0.1/easymf/tools/yourhere.php?text_to_display=$text_to_display"));
$right=join("",file("http://127.0.0.1/mf/mfright.php"));
//$footer=join("",file("http://127.0.0.1/easymf/footer.html"));
$t->set_var(array("SECHEIGHT"=>$secheight, "FOOTER"=>$footer, "RIGHT"=>$right, "YOUAREHERE"=>$youarehere));
$t->pparse("OUT","file");
require_once("commonfiles/footer_inside.php");
Close_Connection($conn_read1);
?>