SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list
//$name=date('M Y', strtotime ( "-$_GET[month]-01" ) );
$name=$month_array[$_GET[month]]." $_GET[year]";
// LOAD a stylesheet
//$stylesheet = file_get_contents('mpdfstyletables.css');
$stylesheet = file_get_contents('../css/print_pdf.css');
$mpdf->WriteHTML($stylesheet,1); // The parameter 1 tells that this is css/style only and no body/html/text
$od=array();
$fd=array();
$q="SELECT * FROM leave_allot WHERE $d_gap ";
$res1=mysql_query($q);
while($r=mysql_fetch_assoc($res1))
{
$dnm=(int)substr($r[date],8,2);
$leave_allot[$dnm]=$r[desc];
$fd[]=$dnm;
}
$q="SELECT * FROM leave_record WHERE $d_gap AND (type='cl' OR type='el' OR type='sl' )";
$res1=mysql_query($q);
while($r=mysql_fetch_assoc($res1))
{
$dm=explode('-',$r[date]);
$emp_leave[$r[emp_id]][$dm[2]]+=$r[cnt];
$emp_lvs[$r[emp_id]][$r[type]]+=$r[cnt];
if($r[cnt]==0.5)
$emp_half[$r[emp_id]][$dm[2]]=$r[half];
}
//print_r($emp_lvs);
$head = "Factory Attendance Register of ".FIRM.", ".ADDRESS."
From No. 52 (Prescribed Under Rule 110)
| Yearly Reg. No. | Serial No. | Employee Name Father/Husband Name ___________________________________________________ |
Certified Surgeon Certificate No. | Designation | Nature of Work | "; for($im=1;$im<32;$im++) $head.="$im | "; $head.="Days Actually worked | Weekly and Festival Holidays entitled | Accident or Sick Leave | Leave with Wages | Days Absent | Total Days | Total Days Absent | Total Days Worked | Remarks | |||||||||||||
| $desc ($dt_od) | "; if($desc=='WEEKLY OFF') $nxt= date('Y-m-d',strtotime("next Sunday", strtotime ( "$nxt" ) )); $od[]=$dnow; } else $head.="1st Period | 2nd Period | "; } $head.="||||||||||||||||||||||||||
| $rw[emp_code] | $cnt | $rw[name] / $rw[fname] | "; $q="SELECT * FROM sal_attend WHERE mon_id=$_GET[month] AND emp_id='$rw[emp_code]' AND session='$session'"; //if($_GET[dep]!='') //$q="SELECT * FROM sal_attend WHERE mon_id=$mon_num AND emp_id IN (SELECT emp_code FROM employee WHERE unit='$_GET[dep]')"; $res1=mysql_query($q); if($att_num=mysql_num_rows($res1)>0) { $r=mysql_fetch_assoc($res1); //echo $q; $pr=0; $shrtlv=explode(',',str_replace(' ','',$m[short_dtl])); $leaves_now=explode(',',str_replace(' ','',$m[lv_dtl])); $limita=$days_array[$num]+3; $limita=31+3; $p=0; foreach($r as $key=>$value) { if($p>3&&$p<=$limita) { $kk=substr($key,1); $dnow="$_GET[year]-$_GET[month]-$kk"; if(in_array($dnow,$od)) { $p++; continue; } $today_is=date('l', strtotime($dnow)); if($today_is==$r[woff]) { $html.=" | W OFF | "; $nxt= date('Y-m-d',strtotime("next Sunday", strtotime ( "$nxt" ) )); //$od[]=$dnow; } else { if((int)$kk>$daycnt) { $html.=""; $p++; continue; } if($r[$key]!='') { $shf=explode(':',$r[$key]); if($emp_half[$rw[emp_code]][$kk]=='') $html.=" | P | P | "; else { if($emp_half[$rw[emp_code]][$kk]=='f') $html.="L | P | "; else $html.="P | L | "; } $pr++; } else { if($emp_leave[$rw[emp_code]][$kk]=='') { $st1="A"; $st2="A"; } else { $st1="L"; $st2="L"; if($emp_leave[$rw[emp_code]][$kk]==0.5) { if(trim($emp_half[$rw[emp_code]][$kk])=='f') $st2="P"; if(trim($emp_half[$rw[emp_code]][$kk])=='s') $st1="P"; } } $html.="$st1 | $st2 | "; } } } $p++; } } else for($im=1;$im<$wdays;$im++) $html.=""; $q="SELECT * FROM sal_made WHERE mon_id=$_GET[month] AND emp_id='$rw[emp_code]' AND session='$session'"; $res1=mysql_query($q); $s=mysql_fetch_assoc($res1); $absent=$days_array[$_GET[month]]-$s[att_day]; $day_bal=$s[att_day]-$s[worked]-$s[cl]; $html.=" | $s[worked] | $day_bal | ".$emp_lvs[$s[emp_id]][sl]." | ".($emp_lvs[$s[emp_id]][cl]+$emp_lvs[$s[emp_id]][el])." | $absent | $s[att_day] | $absent | $s[att_day] | "; unset($pr); $mpdf->WriteHTML($html,2); if($cnt%17==0) { $head1=" | |||||
"; $mpdf->WriteHTML($html,2); //$mpdf->Output('mpdf.pdf','I'); //$mpdf->Output('mpdf.pdf','D'); //$name="test.pdf"; $now = time(); //$mpdf->Output("$now.pdf",'F'); //$mpdf->Output("$name.pdf",'D'); $mpdf->Output("name.pdf",'I'); exit; ?>