<table >
<tr class="dark">
<th align="center">Sl No.</th>
<th align="center">Name,Emp Code, Designation</th>';
$year = date("Y");
$month = '10';
for ($i=0; $i<12; $i++)
{
$month--;
if ($month < 1)
{ $month = 12; $year--;}
if($month=='01')
{
$month1='Jan';
}else if($month=='02')
{
$month1='Feb';
}else if($month==3)
{
$month1='Mar';
}else if($month==4)
{
$month1='Apr';
}else if($month==5)
{
$month1='May';
}else if($month==6)
{
$month1='Jun';
}else if($month==7)
{
$month1='July';
}else if($month==8)
{
$month1='Aug';
}else if($month==9)
{
$month1='Sept';
}else if($month==10)
{
$month1='Oct';
}else if($month==11)
{
$month1='Nov';
}else if($month==12)
{
$month1='Dec';
}
print"<td>";
echo $month1."<br>".$month."<br>".$year ;echo "</td>";
}
echo' </thead>';
print"<tr>";
$year1 = date("Y");
$month1 = '10';
for ($i=0; $i<12; $i++)
{
$month1--;
if ($month1 < 1)
{ $month1 = 12; $year1--;}
$quer="select apm.emp_code as emp_code1,emp_name,desg_desc,year,apply_amount,agency_detail,bill_date,
app_no,entitlement,eligible_amount,month,sl_no
from gcs.bill_master_news bm left join admin_pers_mast apm
on bm.emp_code=apm.emp_code
left join desg_mast dm
on dm.desg_code=apm.desg_code
where bm.flag='2'and is_active=true and esign='false' and month=$month1 and year=$year1
order by apm.desg_code,apm.emp_code,year,month";
$query2=pg_query($pgconn,$quer);
$so=1;
while($row2=pg_fetch_assoc($query2))
{
$emp_code1=$row2['emp_code1'];
$emp_name=$row2['emp_name'];
$desg_desc=$row2['desg_desc'];
print"<td>$so</td><td>$emp_name,$emp_code1,$desg_desc</td>";
$year_new = date("Y");
$month_new = '10';
for ($i=0; $i<12; $i++)
{
$quer11="select eligible_amount,month
from gcs.bill_master_news
where emp_code=$emp_code1";
$quer112=pg_query($pgconn,$quer11);
$c=1;
while($row211=pg_fetch_assoc($quer112))
{
$month_new--;
if ($month_new < 1)
{ $month_new = 12; $year_new--;}
$eligible_amount=$row211['eligible_amount'];
$month_db=$row211['month'];
print"<td>";
if($month_db==$month_new)
{
echo "$eligible_amount";
}
else{
echo $month_new."<br>".$year_new ;
}
echo "</td>";
}
}
}
$so++;
}
Is there a question here? What is happening that should not, or what is not happening that should? Need a bit more information.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.