<?php  error_reporting(0);
$PageSecurity = 3;
include ('includes/session.inc');
include ('includes/function_lib.php');
include('includes/fun-php.php');
include('includes/fun-HRClass.php');
$years=$_SESSION['payyear'];
$month=$_SESSION['paymonth'];	
$_SESSION['payyear']=$years;
$_SESSION['paymonth']=$month;
$_REQUEST['site']=$_SESSION['emp_salprocess_site'];

global $db;
  echo '<link href="'.$rootpath. '/css/'. $_SESSION['Theme'] .'/default.css" rel="stylesheet" type="text/css" />';
?>
<script type="text/javascript" language="javascript">
  function toggle_visibility(id) {
       var e = document.getElementById(id);
	       e.style.display = 'none';
		       //alert(e.style.display);
			   window.print();
    }
</script>
<?php 
$html='<h2><center>'.stripslashes($_SESSION['CompanyRecord']['CompanyName']).'<br />Register of Wages<br/>Salary Sheet For The M/O '.GetMonth($month).',&nbsp;'.$years.'</center></h2>';
 $html.='<table width="100%" border="0" align="right">
  	<tr>
	<td width="80%"><div align="center">&nbsp;</div></td>
	<td width="10%"><div align="left">Run Date:</div></td>
    <td width="10%" >'. date('d/m/Y').'</td></tr>
	<tr><td></td>
	<td><div align="left">Run Time:</div></td>
	<td >'.date("H:i:s").'</td>
  </tr>
</table>
  <table width="100%" border="1" cellspacing="1" cellpadding="3">
	<tr style="background-color:#999999"><td colspan="8">&nbsp;</td>';
		 $q4 =DB_query("Select * from allowmaster",$db); 
	 	 $all_rows=DB_num_rows($q4);
		 
		 $html.='<td colspan='.($all_rows+1).'><b>EARNINGS</b></td>
		<td  rowspan="2" valign="top"><b>GROSS WAGES </b></td>';
		 
		$q3 =DB_query("Select * from deduction_master   ",$db); 
		$ded_rows=DB_num_rows($q3) ;
		 
		$html.='<td colspan='.($ded_rows+3).'><b>DEDUCTIONS</b>	    </td>
		
		<td><b>TOTAL</b></td>';
		if($_SESSION['emptype']=='Temporary')
		{ 
		$html.=$colspan='colspan=4';
		}
		 
		$html.='<td '.$colspan.'>';
		 if($_REQUEST['emptype']=='Temporary'){ 
		  $html.='<div align="center"><b>OT</b>';
		     }else 
	      $html.='&nbsp;</div></td>';
		 
	 $html.='</tr>
        <tr style="background-color:#999999">
        <td><strong> Sr. No.</strong></td>
        <td><strong> Emp Code</strong></td>
        <td><strong>Emp Name</strong></td>
        <td><strong>Designation </strong></td>
        <td ><strong>Month<br>
          Days</strong></td>
        <td><strong>Sal Days</strong></td>
        <td><strong>P.F.<br>
          No</strong></td>
		   <td><strong>E.S.I.<br>
	       No</strong></td>

        <!-- <td >Monthly Salary</td> -->
        <td ><strong>Payable  Basic</strong></td>';
 
	  $net_earning=0;
	  $query_allowances =DB_query("Select * from allowmaster   ",$db); 
	  $j=1;
	  $n=DB_num_rows($query_allowances);
	  $nx= round(70/$n,2);
	  while($row_allowances=DB_fetch_array($query_allowances))
	  { 		  

    	$html.='<td><strong>'.$row_allowances['allowcode'];
		$html.='<input name="allowmasterid[]" type="hidden"  value='.$row_allowances['id'].'/>
    	</strong></td>';         
      }  
     
     $query_allowances =DB_query("Select * from deduction_master   ",$db); 
	 	   $n=DB_num_rows($query_allowances);
	   	   $nx1= round(70/($n+3),1);
	  while($row_allowances=DB_fetch_array($query_allowances))
	  {	  
	   
    	$html.='<td ><strong>'.$row_allowances['code'];
          $html.='<input name="deductionid[]" type="hidden"  value='.$row_allowances['id'].'/>		
	      </strong></td>';         
      }  
	 
    $html.='<td><strong>Adv Loan </strong></td>      <td><strong>Adv Bal </strong></td>    
     <td><strong>Total Deduction</strong></td>
      <td><strong>';
         if($_SESSION['emptype']=='Temporary')
		  $html.='Gross Wages'; 
		  else 
		   $html.= "Net Pay"; 
      $html.='</strong></td>';
      if($_SESSION['emptype']=='Temporary'){
	  $html.='<td><strong>OT Hours</strong></td>
    <td><strong>OT amount</strong></td>';
     } 
     if($_SESSION['emptype']=='Temporary'){ 
	 $html.='<td><strong>Net Pay</strong></td>';
	 } 
      $html.='<td ><strong>Signature</strong></td>  
        </tr>';
        
		
       $filter=$_SESSION['filter1'];
	   $acg_total_allownace=array();
	   $acg_total_deduction=array();
	   $arr_OT_amount=array();
		$arr_OTnetpay=array();
		
	    $getDepart="SELECT DISTINCT department FROM empmaster WHERE $filter and department!='000'";
		$departRes=DB_query($getDepart,$db);
		
		
		
		while($departRow=DB_fetch_array($departRes))
		{
			$dept_basic=array();
			$dept_hra=array();
			$dept_ded=array();
			$dept_adv_loan=array();
			$dept_advbalance=array();
			$dept_total_ded=array();
			$dept_netpay=array();
			$dept_OT_amt=array();
			$dept_net_pay=array();
			$dep_name=$s->getField('deptmaster','deptcode',$departRow['department'],'deptname');
			
			$html.='<tr bgcolor="#676767">';
  	  		$html.='<td colspan="26" height="10px"><b><font color="FFFFFF">'.$dep_name.'</font></b></td>';
			$html.='</tr>';
			//echo $departRow['department'];
				
	  $GetRecord = "Select * from empmaster where  $filter  and department='".$departRow['department']."'";
  	  //echo "<br>".$GetRecord;
     $ResultData = DB_query($GetRecord,$db);
	  // echo DB_num_rows($ResultData);
	  $fstatus=1;
	  $i=1;$kl=0;
   	  while($RowData = DB_fetch_array($ResultData))
   	  {
	  $CHKDailyEntry =DB_query("Select * from daily_attendance where  employee='".$RowData['id']."'  and month(attendance_date)='".$month."' and year(attendance_date)='".$years."'",$db);
	  
	   //echo "<br>Select * from daily_attendance where  employee='".$RowData['id']."'  and month(attendance_date)='".$month."' and year(attendance_date)='".$years."'";
		// echo  DB_num_rows($CHKDailyEntry);
	 if(DB_num_rows($CHKDailyEntry)>0)
	 {
    	  
		  
		  
		  $emp_id=	$RowData['id'];
	  $condition="payslip_month='".$month."' and payslip_year='".$years."' and emp_id='".$emp_id."'";
 	   $Locked= $s->GetFieldValue('master_process_salary',$condition ,'locked');
	   if($Locked=='Y')
	    $fstatus=0;
 	 //($Locked=='' || $Locked=='N')
	 {
	    $fstatus=1;
		  $lt=0;	
	  	  $emp_id=	$RowData['id'];
		  $gross_sal=$RowData['gross_sal'];
		  $basic_sal=$RowData['basic_salary'];
		  $basic_perc=$RowData['basic_perc'];
		 $over_timestatus= $RowData['over_time'];
		 $emp_weekly_off = $RowData['emp_weekly_off'];
   	      $workingdays= cal_days_in_month(CAL_GREGORIAN, $month, $years);
	      $one_day_sal= round(($basic_sal/$workingdays),2)		;   	  			
   	  	 $payable_day = payable_day($emp_id,$month, $years,'P');
   	  	 $holiday=Count_Holidays($month, $years );	
		 
		   
   $leave_sql="Select * from leavemaster";
   $leave_res=DB_query($leave_sql,$db);  
   while($leave_row=DB_fetch_array($leave_res))
   {
    $leave_val=payable_day_leavetype($emp_id,$month, $years,$leave_row['leavecode']);
	$lt=$lt+$leave_val;   
    }  
   	 $weeklyoff= CountSatSun($month, $years,$emp_weekly_off );
	 $lt=$lt+$weeklyoff;	   
	        $absent= payable_day($emp_id,$month, $years,'A');    
        	 $absent_total_days =$workingdays-$absent-($payable_day+$holiday+$lt ); 
             $absent_withoutinfo=$workingdays -($payable_day+$holiday+$lt );  
	          $ACGpaydays=$workingdays- $absent_withoutinfo;
  $ACGpaydays =  Calculate_EmpSalaryDays($emp_id,$month, $years,'P',$emp_weekly_off);
if($workingdays<$ACGpaydays)
$ACGpaydays=$workingdays  ;
 $paid_gross=$ACGpaydays*$one_day_sal;
 
  
         
      $html.='<tr bgcolor="#FFFFFF">
        <td>'.$i.
		'</td>
        <td >'.$RowData['emp_code'].'&nbsp;</td>
       <td >'.$RowData['emp_name'].'<br/><br/>'.$RowData['bank_name']." A/C No. ".$RowData['bank_account'].'&nbsp;</td>';
       $html.='<td>'.$s->getField('desigmaster','desigcode',$RowData['designation'],'designame').'&nbsp;</td>';
        $html.='<td >'.$workingdays= cal_days_in_month(CAL_GREGORIAN, $month, $years);
        $html.=' </td>
        <td >'.$ACGpaydays.'</td>
           <td >'.$RowData['PFno'].'&nbsp;</td>
              <td >'.$RowData['ESIno'].'&nbsp;</td>';
       
         $html.='<td >'. 
		 $RowData['basic_salary'].'<br>-----<br>';
		$html.= $gbasic= round(($paid_gross));
		$arr_basic[]=$gbasic;
		$dept_basic[]=$gbasic;
		 $html.='</td>';
       
       
       	  $deduction_amount=array();$allowance_amount=array();
       	
		
  	$q1 =DB_query("Select * from allowmaster   ",$db); 
	  while($rq1=DB_fetch_array($q1))
	  { 
		
		//echo "<br><br>Select * from emp_salary where emp_id='".$emp_id."' and allowance_deduction='".$rq1['id']."' and all_ded_prefix='A'";
		
	    $query =DB_query("Select * from emp_salary where emp_id='".$emp_id."' and allowance_deduction='".$rq1['id']."' and all_ded_prefix='A'",$db);
		if(DB_num_rows($query))
		{
       	 while($row=DB_fetch_array($query))
	 	 {
       	 
       	 $html.='<td>';
 	//echo	 $row['all_ded_prefix'];
       	if($row['percentage']==0.00 )
       	{
       	$allowance=($row['percentage_value']/$workingdays)*$ACGpaydays;
		}
		else {
				$allowance=.01*$gbasic*$row['percentage']*$ACGpaydays;	
		}
		 
		  $html.= $row['percentage_value'].'<br>-----<br>';
		 $html.= (round($allowance)!=0?round($allowance):'-');
		 //if($row['all_ded_prefix']=='A') 
		$allowance_amount[]=round($allowance);
		
		/*	else
		$deduction_amount[]=round($allowance);*/
	
		
 		$html.='</td>';
       	  }
		}else{$html.= '<td>-</td>';}
	  }	 
	  
	  	$dept_hra[]=$allowance_amount;
		$acg_total_allownace[]=$allowance_amount;
 
$html.='<td>'.$RowData['gross_sal'].'<br>-----<br>';
$html.=$gbasic+array_sum($allowance_amount).'</td>';
 
//------------------------------------------------------------------------------------------
		
  	$q2 =DB_query("Select * from deduction_master   ",$db); 
	  while($rq2=DB_fetch_array($q2))
	  { 
	//	echo "Select * from emp_salary where emp_id='".$emp_id."' and allowance_deduction='".$rq2['id']."' and all_ded_prefix='D'<br>";
	    $query =DB_query("Select * from emp_salary where emp_id='".$emp_id."' and allowance_deduction='".$rq2['id']."' and all_ded_prefix='D'",$db);
		if(DB_num_rows($query))
		{
       	 while($row=DB_fetch_array($query))
	 	 {
     $html.='<td >';
 
 	// echo	 '==>'.$row['percentage'];
       	if($row['percentage']==0.00 )
       	{
			$allowance=($row['percentage_value']/$workingdays)*$ACGpaydays;
		}
		else 
		{
			$allowance=.01*($gbasic+array_sum($allowance_amount))*$row['percentage'];	
		}
		 
		  
		   if(strtolower($rq2['name'])=='pf' && $allowance!=0)
		   {
		 
		   		$html.= round($gbasic*.0833);
				$html.= "<br>";
				$html.= round($gbasic*.0367);
				$html.= "<br>";
				$html.= $allowance=(round($gbasic*.0833)+round($gbasic*.0367));
				  
		   }else{
		 
		  $html.= (round($allowance)!=0?round($allowance):'-');
		 
		  } $deduction_amount[]=round($allowance);
		
		
		
		/* if($row['all_ded_prefix']=='A') 
		$allowance_amount[]=round($allowance);
		else*/
			 
	 		$html.=' </td>';
       	   }
		}else{$html.= "<td>-</td>";}
	  }
	  $dept_ded[]=$deduction_amount;	
	  $acg_total_deduction[]=$deduction_amount;	
 
  		 $html.='<td>';
		 $AdvLoan=advance_loan($emp_id,$month,$years);
		 $html.= ($AdvLoan[0]>0?$AdvLoan[0]:'-');
		 $arr_advloan[]=($AdvLoan[0]>0?$AdvLoan[0]:0);
		 $dept_adv_loan[]=($AdvLoan[0]>0?$AdvLoan[0]:0);
		 
		 $html.='</td>';
		 $html.='<td>';
		  $x=EmpBalanceAmount($emp_id,$AdvLoan[1],$month);
		  
		 $t=$x-$AdvLoan[0];
		   $html.= ($t>0?$t:'-');
		   $arr_advbalance[]=($t>0?$t:'-');
		   $dept_advbalance[]=($t>0?$t:'-');
		   
		  $html.='</td>'; 
	      $html.='<td>&nbsp;';
		   $html.=round(array_sum($deduction_amount),0)+$AdvLoan[0];
		    $html.='</td>';
         $arr_total_deducation[]=round(array_sum($deduction_amount),0)+$AdvLoan[0];
		 $dept_total_ded[]=round(array_sum($deduction_amount),0)+$AdvLoan[0];
		 		 $netpayable=$paid_gross+round(array_sum($allowance_amount)-array_sum($deduction_amount),0);   
				 if($AdvLoan!=0)
				 $netpayable=$netpayable-$AdvLoan[0];
      	 $html.='<td>';
		 $html.=$netpayable!=0?round($netpayable):0;
		$arr_netpay[]=($netpayable!=0?round($netpayable):0);
		$dept_netpay[]=($netpayable!=0?round($netpayable):0);
		 $html.='</td>';
		    	
				if($over_timestatus=='Yes')
			 	$OT=GetOverTime_Calculation($emp_id,$month,$years, $_SESSION['emp_salprocess_site']);
				 else
			  	 $OT='-';
          	  // $OT=round(GetOverTime($emp_id,$month,$years),0);
           
        if($_SESSION['emptype']=='Temporary'){
				$startdate=firstOfMonth($month,$years);
				$end_date=lastOfMonth($month,$years);
				$week_off_day=GetDay($emp_weekly_off);
				$finalWorkHours='';
				$total_work_hrs_in_month='00:00';
	   			for($i=$startdate;$i<=$end_date;$i++)
				{
					if(DayOfDate($i)==$week_off_day)
					{
						$array_of_week_off[]=$i;
						$check_week_off_present="Select work_hrs,pres_abs from daily_attendance where attendance_date='".$i."' and employee='".$emp_id."'";
						//echo $check_week_off_present."<br>";
						$check_result=DB_query($check_week_off_present,$db);
						//echo DB_num_rows($check_result);
						if(DB_num_rows($check_result)>0)
						{
							$check_row=DB_fetch_array($check_result);
							if($check_row['pres_abs']=='P')
							{
								$work_hours=$check_row['work_hrs'];
								$total_work_hrs_in_month_BRK=explode(':',$total_work_hrs_in_month);
								$work_hours_BRK=explode(':',$work_hours);
								$total_hours=$total_work_hrs_in_month_BRK[0]+$work_hours_BRK[0];
								$total_min=$total_work_hrs_in_month_BRK[1]+$work_hours_BRK[1];
								$total_work_hrs_in_month=$total_hours.":".$total_min;
								$quotient=$total_min/60;
								$q=explode(".",$quotient);
								if($q[0]!=0)
								{$r=$total_min%60;}
								else
								{$r=$total_min;}
								$finalWorkHours=($total_hours+$q[0]).":".$r;
							}	
							
						}
					}
					
				}
				$OTHOUR=getOTHours($emp_id,$month,$years);
	  			$OTHOUR_brk=explode(':',$OTHOUR);
				$finalWorkHours_brk=explode(':',$finalWorkHours);
				$h=$OTHOUR_brk[0]+$finalWorkHours_brk[0];
				$m=$OTHOUR_brk[1]+$finalWorkHours_brk[1];
				$quot=$m/60;
				$qt=explode(".",$quot);
				if($qt[0]!=0)
				{$r=$m%60;}
				else
				{$r=$m;}
	    
		$html.='<td>';
		$html.= $h.":".$r.'&nbsp;</td>
		<td>';
	   
	   if($over_timestatus=='Yes')
       {
			$OT=GetOverTime_Calculation($emp_id,$month,$years,$_REQUEST['site']);
			$DefineEmptype= $s->getField('shift_master','id',$RowData['employee_type'],'shift_for');
			if($DefineEmptype=='Worker')
			{
				if($gross_sal<5000){$rate=$gross_sal;}else{$rate="5000";}
				$one_day_salary=$rate/$workingdays;
				$one_hour_salary=$one_day_salary/8;
				$one_min_salary=$one_hour_salary/60;
						
				$tot1=round($finalWorkHours_brk[0]*$one_hour_salary);
				$tot2=round($finalWorkHours_brk[1]*$one_min_salary);
				$total=$tot1+$tot2;
			}
					//else if($DefineEmptype=='Staff')
		}
		else
		{$OT='-';}
	   
	    if($DefineEmptype=='Worker')
		{$t=$OT+$total;}else{$t=$OT;}
		
		$html.=$t;
		$arr_OT_amount[]=$t;
		$dept_OT_amt[]=$t;
		$html.='&nbsp;</td>';
		 }
		 
		 
		 
		 
		 
		 if($_SESSION['emptype']=='Temporary'){$t1=$OT+$netpayable;
		 $html.=' <td>';
          	 $html.= round($t1);
		 $arr_OTnetpay[]=$t1;
		 $dept_net_pay[]=$t1;
			 $html.=' </td>';
			  }  
          $html.='<td width="20%">&nbsp;</td>';
 $condition="payslip_month='".$month."' and payslip_year='".$years."' and emp_id='".$emp_id."'";
 $Lockedid= $s->GetFieldValue('master_process_salary',$condition ,'id');
 $html.='&nbsp;</tr>';
 }

$i++;

       }} 
	   
	   $html.='<tr bgcolor="#676767">
        <td>&nbsp;</td>
        <td >&nbsp;</td>
        <td >&nbsp;</td>
        <td><strong><font color="FFFFFF"><b>Total</b></font></strong></td>
        <td >&nbsp;</td>
        <td >&nbsp;</td>
        <td >&nbsp;</td>
        <td >&nbsp;</td>
		<td><font color="FFFFFF"><b>'.array_sum($dept_basic).'</b></font></td>'; 
		$klp=0;
	   	$grandtotal=array();
 	   	$q1=DB_query("Select * from allowmaster",$db); 
	  	while($rq1=DB_fetch_array($q1))
	  	{
	   		$p=array();
	    	for($kl=0;$kl<count($dept_hra);$kl++)
	   		{
	    		$p[]=$dept_hra[$kl][$klp];
 	   		} 
 	   		$grandtotal[]=array_sum($p);
 	     	$html.='<td><font color="FFFFFF"><b>';
		 	$html.=array_sum($p);
		  	$html.='&nbsp;</b></td>';
		   	$klp++; 
		}
		
		
		$dept_gross=array_sum($grandtotal)+array_sum($dept_basic);
		//$html.='<td>&nbsp;</td>';
		$html.='<td><font color="FFFFFF"><b>'.$dept_gross.'</b></font></td>';	
 		$klp1=0;
	  	$q2 =DB_query("Select * from deduction_master",$db); 
	  	while($rq2=DB_fetch_array($q2))
	  	{ 
	    	$p=array();
	    	for($kl=0;$kl<count($dept_ded);$kl++)
	   		{
	     		$p[]=$dept_ded[$kl][$klp1];;
 	   		} 
	    	$grand_deduction_total[]=array_sum($p);
 		    $html.=' <td><font color="FFFFFF"><b>'; // echo ""; print_r($p); 
			$html.=   array_sum($p);  
			$html.='&nbsp;</b></font></td>';
		   	$klp1++;
		    }
		$html.='<td><font color="FFFFFF"><b>'.array_sum($dept_adv_loan).'</b></font></td>';
		$html.='<td><font color="FFFFFF"><b>'.array_sum($dept_advbalance).'</b></font></td>';
		$html.='<td><font color="FFFFFF"><b>'.array_sum($dept_total_ded).'</b></font></td>';
		$html.='<td><font color="FFFFFF"><b>'.array_sum($dept_netpay).'</b></font></td>';
		$html.='<td>&nbsp;</td>';
		if($_SESSION['emptype']=='Temporary'){
		$html.='<td><font color="FFFFFF"><b>'.array_sum($dept_OT_amt).'</b></font></td>';
		$html.='<td><font color="FFFFFF"><b>'.round(array_sum($dept_net_pay)).'</b></font></td>';
		$html.='<td>&nbsp;</td>';}
		
	}

 $html.='<tr bgcolor="#676767">
        <td>&nbsp;</td>
        <td >&nbsp;</td>
        <td >&nbsp;</td>
        <td><strong>Grand Total</strong></td>
        <td >&nbsp;</td>
        <td >&nbsp;</td>
        <td >&nbsp;</td>
        <td >&nbsp;';   // echo ""; print_r($acg_total_allownace); 
		 $html.='</td>
        <td ><b>'.array_sum($arr_basic) .'&nbsp;</b></td>';
        $klp=0;
	   $grandtotal=array();
 	   	$q1 =DB_query("Select * from allowmaster",$db); 
	  while($rq1=DB_fetch_array($q1))
	  {
	   $p=array();
	    for($kl=0;$kl<count($acg_total_allownace);$kl++)
	   {
	     $p[]=$acg_total_allownace[$kl][$klp];;
 	   } 
 	   $grandtotal[]=array_sum($p);
 	     $html.='<td ><b>';
		 $html.=  array_sum($p);
		  $html.=' &nbsp;</b></td>';
		   $klp++; }		
		
       $gross=array_sum($grandtotal)+array_sum($arr_basic);
	   
	   $html.='<td><b>'.$gross.'</b></td>';
	  // $html.='<td>'.array_sum($grandtotal)+array_sum($arr_basic).'</td>';
       $klp1=0;
	  $q2 =DB_query("Select * from deduction_master",$db); 
	  while($rq2=DB_fetch_array($q2))
	  { 
	    $p=array();
	    for($kl=0;$kl<count($acg_total_deduction);$kl++)
	   {
	     $p[]=$acg_total_deduction[$kl][$klp1];;
 	   } 
	    $grand_deduction_total[]=array_sum($p);

		 
 		    $html.=' <td><b>'; // echo ""; print_r($p); 
			
			
				$html.=   array_sum($p);  
				$html.='&nbsp;</b></td>';
		   $klp1++;
		    }  
		
       $html.=' <td><b>'. array_sum($arr_advloan).'&nbsp;</b></td>
		    <td><b>'. array_sum($arr_advbalance).'&nbsp;</b></td>
      <td><b>'. array_sum($arr_total_deducation).'&nbsp;</b></td>
	   <td><b>'. array_sum($arr_netpay).'</b></td>';
	    if($_SESSION['emptype']=='Temporary'){
		  $html.=' <td>&nbsp;</td>';
		   $html.='<td><b>'.array_sum($arr_OT_amount).'&nbsp;</b></td>';
		    
	   $html.='<td><b>'.array_sum($arr_OTnetpay).'</td> 
        <td>&nbsp;</td>';}
		$html.='<td>&nbsp;</td>
   </tr>
</table>';  
echo  $html;

/*
require_once("dompdf/dompdf_config.inc.php");
$content=$html;
$dompdf = new DOMPDF();
$dompdf->load_html($content);
$dompdf->render();
//$dompdf->stream("mmm.pdf");
header('Content-type: application/pdf; charset=utf-8');
$output = $dompdf->output();
echo $output;
*/
/*
include('tcpdf/config/lang/eng.php');
include('tcpdf/tcpdf.php');

ob_clean();
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 001');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');

// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
$pdf->setFooterData($tc=array(0,64,0), $lc=array(0,64,128));

// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

//set some language-dependent strings
$pdf->setLanguageArray($l);

// ---------------------------------------------------------

// set default font subsetting mode
$pdf->setFontSubsetting(true);

// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
$pdf->SetFont('dejavusans', '', 14, '', true);

// Add a page
// This method has several options, check the source code documentation for more information.
$pdf->AddPage();

// Set some content to print
$html = $html;

// Print text using writeHTMLCell()
$pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);

// ---------------------------------------------------------

// Close and output PDF document
// This method has several options, check the source code documentation for more information.
$pdf->Output('mmm.pdf', 'I');

//============================================================+
// END OF FILE
//============================================================+
*/

/*
require('html2pdf/html2fpdf.php');
$pdf=new HTML2FPDF();
$strContent=$html;
$pdf->AddPage();
$pdf->WriteHTML($strContent);
$pdf->Output("mmm.pdf");
*/

?>
<div id="foo"><p align="center">
  <a href="#" onclick="javascript:toggle_visibility('foo');" ><input type="button" value="Print" /></a></p>
</div>