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)
Group __________
Raily __________                                                                                                                                                                      $name
"; for($im=1;$im<32;$im++) $head.=""; $head.=""; // $nxt= date('Y-m-d',strtotime("next Sunday", strtotime ( "$_GET[year]-$_GET[month]-01" ) )); //$today_is=date('l', strtotime($nwdt)); $nxt= date('Y-m-d',strtotime("next Sunday", strtotime ( "$_GET[year]-$_GET[month]-01" ) )); for($im=1;$im<32;$im++) { $kk=($im>9)?$im:"0".$im; $dnow="$_GET[year]-$_GET[month]-$kk"; if(in_array($dnow,$od)) { $im++; continue; } // if(strtotime($dnow)==strtotime($nxt)||(in_array($kk,$fd))) if((in_array($kk,$fd))) { $dt_od=date('D - d M Y',strtotime ( "$dnow" ) ); $desc=(!in_array($kk,$fd))?"WEEKLY OFF":"$leave_allot[$kk]"; $head.=""; if($desc=='WEEKLY OFF') $nxt= date('Y-m-d',strtotime("next Sunday", strtotime ( "$nxt" ) )); $od[]=$dnow; } else $head.=""; } $head.=""; $mpdf->WriteHTML($head,2); $wdays=32-count($od); $cnt=1; $daycnt= cal_days_in_month(CAL_GREGORIAN, $_GET[month], $_GET[year]); //SELECT * FROM table $q="SELECT * FROM employee WHERE lvdt='0000-00-00' ORDER BY job_type='Sr' DESC , job_type='Jr' DESC ,job_type='Wr' DESC ,job_type='Tr' DESC, emp_code "; //$q="SELECT * FROM employee WHERE lvdt='0000-00-00' AND emp_code='9041' Order BY name"; //$q="SELECT * FROM employee_24feb Order BY name"; $res=mysql_query($q); while($rw=mysql_fetch_array($res)) { if($cnt>100) break; $html=""; $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.=""; $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.=""; else { if($emp_half[$rw[emp_code]][$kk]=='f') $html.=""; else $html.=""; } $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.=""; } } } $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.=""; unset($pr); $mpdf->WriteHTML($html,2); if($cnt%17==0) { $head1="
Yearly Reg. No. Serial No.



 Employee Name

 Father/Husband Name    




___________________________________________________
Certified Surgeon Certificate No. Designation Nature of Work$imDays 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)1st Period2nd Period
$rw[emp_code]$cnt $rw[name] / $rw[fname]W OFFPPLPPL$st1$st2$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]

 

$head"; $mpdf->WriteHTML($head1,2); } $cnt++; } $html="

 

"; $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; ?>