0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
USER
/
[
Home
]
File: leavetaken_report_ctrl.php
<?php include("../model/financial_mdl.php"); include("../model/financial_report_mdl.php"); $u_id= @$_SESSION['user_id']; $p_id=@$_SESSION['project_id']; $sql="select * from employe where user_id='$u_id' and status=1"; $sql=mysql_query($sql); $i=0; while($row=mysql_fetch_array($sql)) { $emp_group=$row['emp_name']; $i=$i+1; $emp_name_array[$i]=$emp_group; } $empname=@$_POST['cmbempname']; $emp_name=$emp_name_array[$empname]; if(isset($_POST['showbtn'])) {//18 //---------Null--------// $year=@$_POST['txtyear']; $leave_type=@$_POST['cmbleavetype']; $emp_combo=@$_POST['cmbempname']; $day=@$_POST['cmbdd']; $month_var=@$_POST['cmbmm']; $date=$year."-".$month_var."-".$day; if($year=="") { $error['year_null']="Please Enter Year"; $error_flag=1; } if (!is_numeric(@$_POST['txtyear'])) { $error['year_numeric']="Only allow numbers"; $error_flag=1; } if($error_flag==1) { /*$url=$server_ip."/USER/leavetaken_report.php"; echo "<script>window.location='$url'</script>"; */ include "leavetaken_report.php"; exit(); } if($error_flag==0) {//77 if($emp_combo==0) { $emp_name="ALL"; } if($leave_type==0) { $leave_type_var="ALL"; } else if($leave_type==1) { $leave_type_var="CL"; } elseif($leave_type==2) { $leave_type_var="LWOS"; } $p_id=@$_SESSION['project_id']; $u_id=@$_SESSION['user_id']; $sql_emp="select * from employe where `emp_name`='$emp_name' and `user_id`='$u_id'"; $sql3=mysql_query($sql_emp); while($row_emp=mysql_fetch_array($sql3)) { $emp_id_var=$row_emp['emp_id']; } if($emp_name=="ALL") { $emp_id_var="ALL"; ///////// $sql1="select distinct(emp_id) from leave_entry where user_id='$u_id'"; $sql2=mysql_query($sql1); Leavetaken::printleavetakenDetailsheader($date); while($row_base=mysql_fetch_array($sql2)) { // 85 $emp_id_db=$row_base['emp_id']; $sql_emp="select * from employe where `emp_id`='$emp_id_db' and `user_id`='$u_id' and status=1" ; $sql3=mysql_query($sql_emp); if (mysql_affected_rows()>0) { while($row_emp=mysql_fetch_array($sql3)) { $emp_id_var=$row_emp['emp_id']; } Leavetaken::printLeavetakenDetails($emp_id_var,$leave_type_var,$date); } ///////// //$sql1="select distinct(emp_id) from leave_entry where user_id='$u_id'"; } } else { //$emp_id_var="ALL"; Leavetaken::printleavetakenDetailsheader($date); Leavetaken::printLeavetakenDetails($emp_id_var,$leave_type_var,$date); } }//77 }//18 class Leavetaken { //43 public function printleavetakenDetailsheader($date) {//45 ?> <style type="text/css"> <!-- .style3 {font-size: 36px} --> </style> <div align="center"> <div align="center"> <p><strong><span class="style3"> <?php $u_name=@$_SESSION['username'];$u_name=strtoupper($u_name);echo $u_name;?> </span></strong></p> </div> <p><b>Leave Taken Report</b><strong> up to the date : <?php echo $date;?></strong></p> </div> <table width="754" height="48" border="1" align="center"> <tr> <th width="31" height="42"> S No </th> <th width="144">Employee Name</th> <th width="130">Project Code </th> <th width="90">Start Date</th> <th width="90">End Date</th> <th width="50">Count</th> <th width="50">Leave Type</th> <th width="117">Description</th> </tr> </table> <?php }//45 public function printLeavetakenDetails($emp_id_var,$leave_type,$date) {//10 $u_id= @$_SESSION['user_id']; //$emp_id_var==0 ///////////////////////////change here 2 morroe //0 = ALL // 0 0 if($emp_id_var==ALL and $leave_type==ALL ) { $sql1="select * from leave_entry where `user_id`='$u_id' and start_date<='$date' ORDER BY start_date"; } // 0 1 if($emp_id_var==ALL and $leave_type!=ALL ) { $sql1="select * from leave_entry where `user_id`='$u_id' and start_date<='$date' and leave_type='$leave_type' ORDER BY start_date"; } // 1 0 if($emp_id_var!=ALL and $leave_type==ALL ) { $sql1="select * from leave_entry where `user_id`='$u_id' and `emp_id`='$emp_id_var' and start_date<='$date' ORDER BY start_date"; } // 1 1 if($emp_id_var!=ALL and $leave_type!=ALL ) { $sql1="select * from leave_entry where `user_id`='$u_id' and `emp_id`='$emp_id_var' and leave_type='$leave_type' and start_date<='$date' ORDER BY start_date"; } //echo $sql1;exit(); $sql=mysql_query($sql1); if(mysql_affected_rows()>0) {//14 $l_count=0; ?> <table width="752" height="67" border="1" align="center"> <?php while($row=mysql_fetch_array($sql)) {//32 ?> <tr> <td width="31"><div align="center"> <?php @$_SESSION['sl_no']=@$_SESSION['sl_no']+1; echo @$_SESSION['sl_no']; ?> </div></td> <td width="142" ><div align="center"> <?php $emp_db=$row['emp_id']; $sql_emp="select * from employe where emp_id='$emp_db'"; $sql3=mysql_query($sql_emp); while($row_emp=mysql_fetch_array($sql3)) { $project_id=$row_emp['project_id']; echo $row_emp['emp_name']; } ?> </div></td> <td width="130"><div align="center"> <?php $sql_code="select project_code from addproject where project_id='$project_id'"; $sql_code=mysql_query($sql_code); while($row_code=mysql_fetch_array($sql_code)) { echo $row_code['project_code']; } ?> </div></td> <td width="90"><div align="center"> <?php echo $row['start_date']; ?> </div></td> <td width="90"><div align="center"> <?php echo $row['end_date']; ?> </div></td> <td width="50"><div align="center"> <?php echo $row['leave_count']; $l_count=$l_count+$row['leave_count']; ?> </div></td> <td width="50"><div align="center"> <?php echo $row['leave_type']; ?> </div></td> <td width="117" ><div align="center"> <?php echo $row['description']; ?> </div></td> </tr> <?php }//32 ?> </table> <table width="416" height="67" border="0" align="center"> <tr> <td width="343"><strong>Total Leave</strong></td> <td width="63"><div align="center"><b><?php echo $l_count;?></b> </div></td> </tr> </table> <?php }//14 else {//14 ?><font color="#CC0000"><b><?php echo "Nothing to display"; ?></b></font><?php }//14 }//10 }//7 if(isset($_POST['showbtn'])) { ?> </p> <p><a href="#" class="projectboldtxt style2" onclick="window.print()">Print</a> <a href="leavemanagement.php">Back</a></p> </blockquote> <?php } ?>