0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
USER
/
[
Home
]
File: salaryvoucher_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"); $error_flag=0; $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]; $year=@$_POST['txtyear']; $month_var=@$_POST['cmbmonth']; $num_workday=@$_POST['txtworkday']; if(isset($_POST['showbtn'])) { if (!is_numeric(@$_POST['txtyear'])) { $error['year_numeric']="Please enter valid year"; $error_flag=1; } if (!is_numeric(@$_POST['txtworkday'])) { $error['wd_numeric']="Please enter only number"; $error_flag=1; } if ($num_workday >31 or $num_workday <1) { $error['wd_invalid']="Please enter valid working days"; $error_flag=1; } if($year=="") { $error['year']="Please Enter year"; $error_flag=1; } if($num_workday=="") { $error['num_workday']="Please Enter Number of workingday"; $error_flag=1; } if($error_flag==1) { include("salaryvoucher_datewise_report.php"); exit(); } 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'"; } @$_SESSION['total_salary']=0; LeaveSalaryVoucherReport::printleaveSalaryVoucherheader($month[$month_var],$year); $sql3=mysql_query($sql_emp); while($row_emp=mysql_fetch_array($sql3)) { //98 $emp_id_var=$row_emp['emp_id']; $emp_name_var=$row_emp['emp_name']; LeaveSalaryVoucherReport::printLeaveSalaryVoucherReport($emp_id_var,$empname,$month_var,$year,$num_workday); } } } class LeaveSalaryVoucherReport { //57 public function printleaveSalaryVoucherheader($month_var,$year_var) {//59 ?> <div align="center"> <p><b>Salary Voucher of <b><?php $u_name=@$_SESSION['username'];$u_name=strtoupper($u_name);echo $u_name; ?></b> for the month : <?php echo $month_var;?>, Year : <?php echo $year_var;?></p> </div> <table width="799" height="48" border="1" align="center"> <tr> <th width="40" height="42"> S No </th> <th width="172">Employee Name</th> <th width="140">Project Code</th> <th width="110">Gross Salary </th> <th width="50">CL</th> <th width="50">LWOS</th> <th width="90"><p>LWOS Amt</p></th> <th width="95">Salary*</th> </tr> </table> <?php }//59 public function printLeaveSalaryVoucherReport($emp_id_var,$empname,$month_var,$year,$num_workday) {//77 ?> <table width="799" height="48" border="1" align="center"> <tr> <td width="40" height="39"><div align="center"> <?php @$_SESSION['sl_no']=@$_SESSION['sl_no']+1; echo @$_SESSION['sl_no']; ?> </div></td> <td width="172" ><div align="center"> <?php $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']; $gross_salary=$row_emp_fn['salary']; echo $row_emp_fn['emp_name']; } ?> </div></td> <td width="140"><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="110"><div align="center"> <?php echo $gross_salary; ?> </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) && ($month_var==date_mm)) { $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_lwos=0; while($row_count1=mysql_fetch_array($sql_count1)) { $date=$row_count1['start_date']; list($date_yy, $date_mm, $date_dd) = split('[/.-]', $date); //$date_mm=$date_mm+0; if(($year==$date_yy) && ($month_var==$date_mm)) { $count_db1=$row_count1['leave_count']; $count_lwos=$count_lwos+$count_db1; } } echo $count_lwos; ?> </div></td> <td width="90"><div align="center"> <?php $Lwos_amt=($gross_salary/$num_workday)*$count_lwos; echo round($Lwos_amt,0); ?> </div></td> <th width="95" ><div align="center"> <?php $salary=$gross_salary-$Lwos_amt; $salary=round($salary,0); echo $salary; @$_SESSION['total_salary']=@$_SESSION['total_salary']+$salary; ?> </div></tr> </table> <?php }//77 }//57 if(isset($_POST['showbtn'])) { ?> <br /> <table width="864"> <tr> <td width="752"> <div align="right">Total Salary :</div></td> <td width="100"> <div align="center"><b><?php echo @$_SESSION['total_salary'];?></b></div></td> </tr> </table> </p> <br /> Total Working Days : <?php echo $_POST['txtworkday'];?><br /><br /> * Not including HRA, Water Bill etc. <p><a href="#" class="projectboldtxt style2" onclick="window.print()">Print</a> <a href="leavemanagement.php">Back</a></p> </blockquote> <?php } ?>