0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
USER
/
[
Home
]
File: leavesummary_report_ctrl.php
<?php require_once "../lib/config.php"; require_once BASE_DIR."/lib/db/connection.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['show'])) {//20 //---------Null--------// $year=@$_POST['txtyear']; 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) { /*echo "<script>window.location='http://localhost/CPFMS/USER/leavesummary_report.php</script>";*/ $url=$server_ip."/USER/leavesummary_report.php"; echo "<script>window.location='$url'</script>"; } if($error_flag==0) {//68 $p_id=@$_SESSION['project_id']; $u_id=@$_SESSION['user_id']; if($emp_name=="") // All { $sql_emp="select * from employe where user_id='$u_id' and status=1"; } else { $sql_emp="select * from employe where user_id='$u_id' and`emp_name`='$emp_name'"; } $sql3=mysql_query($sql_emp); LeaveSummary::printleaveSummaryDetailsheader($year); while($row_emp=mysql_fetch_array($sql3)) { //98 $emp_id_var=$row_emp['emp_id']; $emp_name_var=$row_emp['emp_name']; $proj_id_var=$row_emp['project_id']; // emp id , emp name from cmb, year from txt box LeaveSummary::printLeaveSummaryDetails($emp_id_var,$empname,$year); } //98 }//68 }//20 class LeaveSummary { //43 public function printleaveSummaryDetailsheader($year) {//45 ?> <style type="text/css"> <!-- .style3 {font-size: 36px} --> </style> <p> </p> <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> <div align="center"> <p><b>Leave Summary Report</b> <strong>for the Year : <?php echo $year;?></strong></p> </div> <table width="738" height="48" border="1" align="center"> <tr> <th width="46" height="42"> S No </th> <th width="200">Employee</th> <th width="130">Project Code </th> <th width="50">Credit</th> <th width="50">CL</th> <th width="50">LWOS</th> <th width="84">Last Leave Entry Date</th> <th width="76">Remaining CL</th> </tr> </table> <?php }//45 public function printLeaveSummaryDetails($emp_id_var,$empname,$year) {//64 ?> <table width="739" height="45" border="1" align="center"> <tr> <td width="46" height="39"><div align="center"> <?php @$_SESSION['sl_no']=@$_SESSION['sl_no']+1; echo @$_SESSION['sl_no']; ?> </div></td> <td width="201" ><div align="center"> <?php //$emp_db=$row['emp_id']; $sql_emp="select * from employe where emp_id='$emp_id_var'"; $sql3=mysql_query($sql_emp); while($row_emp_fn=mysql_fetch_array($sql3)) { $project_id=$row_emp_fn['project_id']; echo $row_emp_fn['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="50"><div align="center"> <?php $sql_credit="select * from leave_credit where emp_id='$emp_id_var' and year='$year'"; $sql_credit=mysql_query($sql_credit); $credit=0; while($row_credit=mysql_fetch_array($sql_credit)) { $credit_db=$row_credit['credit_count']; $credit=$credit+$credit_db; } echo $credit; ?> </div></td> <td width="50"><div align="center"> <?php $sql_count="select * from leave_entry where leave_type='CL' and emp_id='$emp_id_var'"; $sql_count=mysql_query($sql_count); $count_cl=0; while($row_count=mysql_fetch_array($sql_count)) { $date=$row_count['start_date']; list($date_yy, $date_mm, $date_dd) = split('[/.-]', $date); if($year==$date_yy) { $count_db=$row_count['leave_count']; $count_cl=$count_cl+$count_db; } } echo $count_cl; ?> </div></td> <td width="50"><div align="center"> <?php $sql_count1="select * from leave_entry where leave_type='LWOS' and emp_id='$emp_id_var'"; $sql_count1=mysql_query($sql_count1); $count=0; while($row_count1=mysql_fetch_array($sql_count1)) { $date=$row_count1['start_date']; list($date_yy, $date_mm, $date_dd) = split('[/.-]', $date); if($year==$date_yy) { $count_db1=$row_count1['leave_count']; $count=$count+$count_db1; } } echo $count; ?> </div></td> <td width="84" ><div align="center"> <?php $sql_count1="select max(end_date) from leave_entry where emp_id='$emp_id_var'"; $sql_count1=mysql_query($sql_count1); while($row_count1=mysql_fetch_array($sql_count1)) { $last_date = $row_count1[0]; } echo $last_date; ?> </div></td> <td width="76" ><div align="center"> <?php $remaining=$credit-$count_cl; echo $remaining; ?> </div></td> </tr> </table> <?php }//64 }//43 if(isset($_POST['show'])) { ?> </p> <p><a href="#" class="projectboldtxt " onclick="window.print()">Print</a> <a href="leavemanagement.php">Back</a></p> </blockquote> <?php } ?>