File: /home/cafsindia/cpaqua.cafsinfotech.in/application/controllers/Pf_report.php
<?php if ( ! defined('BASEPATH')) exit('No direct script is allowed');
require_once("Action_controller.php");
class Pf_report extends Action_controller{
public function __construct(){
parent::__construct('pf_report');
if(!$this->Appconfig->isAppvalid()){
redirect('config');
}
}
// LOAD PAGE WITH TABLE DATA
public function index(){
$data['table_headers']= $this->xss_clean(get_dbtable_headers($this->table_info));
$role_info = $this->db->query("CALL sp_a_run ('SELECT','SELECT * FROM `cw_category` where trans_status = 1 and prime_category_id !=1')");
$role_result = $role_info->result();
$role_info->next_result();
$category_list[""] = "---- Select Category ----";
$category_list[1] = "All Category";
foreach($role_result as $for){
$role_id = $for->prime_category_id;
$category_name = $for->category_name;
$category_list[$role_id] = $category_name;
}
$data['category_list'] = $category_list;
$data['key'] = $this->generateKey();
$this->load->view("$this->control_name/manage",$data);
}
public function get_employees_list(){
$encString = file_get_contents('php://input');
$_POST = $this->cryptoDecrypt($encString);
if(!$_POST){
echo json_encode(array('success' => false,'message' => 'Url Expired.. Please refresh the page and try again....','table_data' => ""));
exit(0);
}
$category = $this->input->post('category');
$query = "";
if($category > 1){
$query = 'role in ('.$category.') and';
}
$emp_detail_query = 'SELECT * FROM cw_employees WHERE '.$query.' role != 1 and trans_status = 1';
$emp_detail_info = $this->db->query("CALL sp_a_run ('SELECT','$emp_detail_query')");
$emp_detail_result = $emp_detail_info->result();
$emp_detail_info->next_result();
$emp_detail_list = "<option value=''>---- Select Employee ----</option>";
foreach($emp_detail_result as $emp_detail){
$employee_code = $emp_detail->employee_code;
$emp_name = $emp_detail->emp_name;
$emp_detail_list .= "<option value='$employee_code'>$employee_code - $emp_name</option>";
}
echo $emp_detail_list;
}
public function generate_pf_report(){
$encString = file_get_contents('php://input');
$_POST = $this->cryptoDecrypt($encString);
if(!$_POST){
echo json_encode(array('success' => false,'message' => 'Url Expired.. Please refresh the page and try again....','table_data' => ""));
exit(0);
}
$pf_column_qry = 'SELECT count(*) as pf_column_count FROM cw_payroll_function_map WHERE loc_name in("father_name","paid_days","pf_gross","fpf","epf","vpf","pf","inspections_charge","admin_charge","edli_charge") and trans_status = 1';
$pf_column_info = $this->db->query("CALL sp_a_run ('SELECT','$pf_column_qry')");
$pf_column_rslt = $pf_column_info->result();
$pf_column_info->next_result();
$pf_column_count = $pf_column_rslt[0]->pf_column_count;
if((int)$pf_column_count !== 10){
echo json_encode(array('success' => false, 'message' => 'Please add payroll function mapping for Father Name,Paid days,Pf Gross,FPF,EPF,VPF,PF,Inspections Charge,Admin Charge and Edli Charge'));
exit(0);
}
// $loc_column_qry = 'select group_concat("cw_transactions.",db_column," as ",loc_name) as select_qry,group_concat("IFNULL(SUM(cw_transactions.",db_column,"),0) as ",loc_name) as sum_select_qry from cw_payroll_function_map where trans_status = 1';
$pf_common_qry ='SELECT GROUP_CONCAT(IF(cw_form_setting.transaction_type IN (1,2,3),CONCAT("cw_transactions.", db_column, " AS ", loc_name),CONCAT("cw_employees.", db_column, " AS ", loc_name))) AS select_qry,GROUP_CONCAT(IF(cw_form_setting.transaction_type IN (1,2,3),CONCAT("IFNULL(SUM(cw_transactions.", db_column, "), 0) AS ", loc_name),CONCAT("IFNULL(SUM(cw_employees.", db_column, "), 0) AS ", loc_name))) AS sum_select_qry FROM cw_payroll_function_map JOIN cw_form_setting ON cw_payroll_function_map.db_column = cw_form_setting.label_name WHERE cw_payroll_function_map.trans_status = 1';
$pf_common_info = $this->db->query("CALL sp_a_run ('SELECT','$pf_common_qry')");
$pf_common_rslt = $pf_common_info->result_array();
$pf_common_info->next_result();
$select_qry = $pf_common_rslt[0]['select_qry'];
$sum_select_qry = $pf_common_rslt[0]['sum_select_qry'];
if(!$select_qry){
echo json_encode(array('success'=>FALSE,'message'=>'Column Not Mapped....'));
exit(0);
}
$report_type = (int)$this->input->post('report_type');
$process_month = $this->input->post('date');
if($this->check_transactions_month($process_month) || (int)$report_type === 3){
$company_info = $this->db->query("CALL sp_a_run ('SELECT','SELECT * FROM `cw_company_information` where cw_company_information.trans_status = 1')");
$company_result = $company_info->result();
$company_info->next_result();
$company_name = $company_result[0]->company_name;
$company_address = $company_result[0]->address;
$company_city = $company_result[0]->city;
$company_state = $company_result[0]->state;
$company_country = $company_result[0]->country;
if($report_type === 1){
$process_month = $this->input->post('date');
$process_month_val = "01-".$process_month;
$process_month_name = date('F-Y',strtotime($process_month_val));
$view_qry = 'select cw_employees.emp_name,cw_employees.date_of_birth,cw_employees.date_of_joining,cw_gender.gender,cw_employees.pf_account_number,'.$select_qry.' from cw_employees inner join cw_transactions on cw_transactions.employee_code = cw_employees.employee_code join cw_gender on cw_gender.prime_gender_id = cw_employees.gender where cw_employees.trans_status = 1 and cw_transactions.transactions_month = "'.$process_month.'" and cw_employees.role != 1 and cw_transactions.trans_status = 1';
$view_data = $this->db->query("CALL sp_a_run ('SELECT','$view_qry')");
$view_result = $view_data->result();
$view_data->next_result();
$tr_line = "";
$i = 0;
foreach($view_result as $rlst){
$i++;
$emp_name = $rlst->emp_name;
$father_name = $rlst->father_name;
$date_of_birth = date('d-m-Y',strtotime($rlst->date_of_birth));
$date_of_joining = date('d-m-Y',strtotime($rlst->date_of_joining));
$pf_account_number = $rlst->pf_account_number;
$gender = $rlst->gender;
$tr_line .= "<tr>
<td style='text-align:center;'>$i</td>
<td style='text-align:center;'>$pf_account_number</td>
<td style='text-align:center;'>$emp_name</td>
<td style='text-align:center;'>$father_name</td>
<td style='text-align:center;'>$date_of_birth</td>
<td style='text-align:center;'>$gender</td>
<td style='text-align:center;'>$date_of_joining</td>
<td style='text-align:center;'></td>
<td style='text-align:center;'></td>
</tr>";
}
$report_type_list = array(1 => 'form_5',2 =>'pf_extract',3 =>'form_3a',4 => 'pf_challan',5 => 'form_10');
$report_type = $report_type_list[$report_type];
$header_info = "<table>
<tr>
<td style='border:0px !important; padding:3px'>
<table>
<tr><td style='border:0px !important;text-align:left;'><b>Name & Address of the Factory/Establishment</b></td></tr>
<tr><td style='border:0px !important;text-align:left;'>$company_name $company_city $company_state $company_country</td></tr>
</table>
</td>
<td style='border:0px !important;'>
<table>
<tr><td style='border:0px !important;text-align:center;'><b>FORM-5</b></td></tr>
<tr><td style='border:0px !important;text-align:center;font-size:11px!important;'>THE EMPLOYEES' PROVIDENT FUNDS SCHEME ,1952</td></tr>
<tr><td style='border:0px !important;text-align:center;font-size:11px!important;'>[ Paragraph 36 (2) (a) ]</td></tr>
<tr><td style='border:0px !important;text-align:center;font-size:11px!important;'>AND THE EMPLOYEES' PENSION SCHEME ,1995</td></tr>
<tr><td style='border:0px !important;text-align:center;font-size:11px!important;'>[ Paragraph 20 (4) ]</td></tr>
</table>
</td>
</tr>
<tr>
<td colspan='8' style='border:0px !important;'>
<table>
<tr><td style='border:0px !important;text-align:center;'><b>Return of Employee qualifying for membership of the employee provident Fund ,Employees' Pension Fund & Employees' Deposit Linked Insurance Fund for the first time during the month of $process_month_name</b></td></tr>
<tr><td style='border:0px !important;text-align:center;'>(To be sent to the Commissioner with Form 2 (EPF & EPS))</td></tr>
</table>
</td>
</tr>
</table>";
$final_result = "<table style='width:100%;'>
<thead>
<tr>
<th style='text-align:center;'>S.No</th>
<th style='text-align:center;'>PFA/Cno</th>
<th style='text-align:center;'>Employees Name</th>
<th style='text-align:center;'>Employee's Father Name</th>
<th style='text-align:center;'>Date Of Birth</th>
<th style='text-align:center;'>Gender</th>
<th style='text-align:center;'>Date Of Joining</th>
<th style='text-align:center;'>Total Period of Previous Service as the date of joining the fund</th>
<th style='text-align:center;'>Remarks</th>
</tr>
</thead>
<tbody>
$tr_line
</tbody>
</table>";
$final_result = preg_replace('/<\/tbody><\/table>(.*?)<tbody>/','',$final_result);//regex replace
$final_result = "<!DOCTYPE html><html>
<head>
<style>
table{
border: 0.5px !important;
border-collapse: collapse !important;
empty-cells: show !important;
max-width: 100% !important;
font-size: 13px !important;
}
tbody {
border: 1px !important;
border-collapse: collapse !important;
max-width: 100% !important;
font-size: 13px !important;
}
td, th {
border: 1px solid #000 !important;
font-size: 13px !important;
}
td.fr-thick,th.fr-thick {
border-width: 2px !important;
}
</style>
</head>
<body>
$header_info
$final_result
</body>
</html>";
//$pdf_path = $this->get_pdf_path($final_result,$process_month,$report_type);
$return_data = array();
$return_data[$process_month] = $final_result;
$count = count($return_data ?? []);
echo json_encode(array('success'=>TRUE,'final_result'=>$return_data,'count' => $count));
}else
if($report_type === 2){
$category = (int)$this->input->post('category');
$process_month = $this->input->post('date');
$process_month_val = "01-".$process_month;
$process_month_name = date('F-Y',strtotime($process_month_val));
if($category > 1){
$query = "and cw_employees.role = \"$category\"";
}
$view_qry = 'select cw_employees.employee_code,cw_employees.pf_account_number,cw_employees.emp_name,'.$select_qry.' from cw_employees inner join cw_transactions on cw_transactions.employee_code = cw_employees.employee_code where cw_employees.trans_status = 1 and cw_transactions.transactions_month = "'.$process_month.'" and cw_employees.role != 1 '.$query.' and cw_transactions.trans_status = 1';
$view_data = $this->db->query("CALL sp_a_run ('SELECT','$view_qry')");
$view_result = $view_data->result();
$view_data->next_result();
$today_date = date("m-d-Y H:i:s");
$tr_line = "";
$sr_no = 1;
$tot_gross = 0;
$total_pf_amount = 0;
$total_fpf = 0;
$total_emp_con = 0;
$total_vpf = 0;
$tot_ins = 0;
$tot_admin = 0;
$tot_edli = 0;
foreach($view_result as $rslt){
$employee_code = $rslt->employee_code;
$emp_name = $rslt->emp_name;
$pf_account_number = $rslt->pf_account_number;
$days_worked = $rslt->paid_days;
$salary = $rslt->pf_gross;
$pf_amount = $rslt->pf;
$fpf = $rslt->fpf;
$emp_con = $rslt->epf;
$vpf = $rslt->vpf;
$inspections_charge = $rslt->inspections_charge;
$admin_charge = $rslt->admin_charge;
$edli_charge = $rslt->edli_charge;
$tot_edli = $tot_edli + $edli_charge;
$tot_admin = $tot_admin + $admin_charge;
$tot_ins = $tot_ins + $inspections_charge;
$tot_gross = $tot_gross + $salary;
$total_pf_amount = $total_pf_amount + $pf_amount;
$total_fpf = $total_fpf + $fpf;
$total_emp_con = $total_emp_con + $emp_con;
$total_vpf = $total_vpf + $vpf;
$tr_line .= "<tr><td>$sr_no.</td><td>$employee_code</td><td>$pf_account_number</td><td>$emp_name</td><td>$days_worked</td><td>$salary</td><td>$pf_amount</td><td>$fpf</td><td>$emp_con</td><td>$vpf</td></tr>";
$sr_no++;
}
if($tr_line == ''){
$tr_line = "<tr style='text-align:center;font-weight:bold;'><td colspan='9'>No Data Found!!</td></tr>";
}else{
$tr_line .= "<tr style='font-weight: bold;'>
<td colspan='3'>Administration Charges On Total Salary (A/c No 2) : $tot_admin </td>
<td colspan='2'>Total</td>
<td>$tot_gross</td>
<td>$total_pf_amount</td>
<td>$total_fpf</td>
<td>$total_emp_con</td>
<td>$total_vpf</td>
</tr>
<tr style='font-weight: bold;'>
<td colspan='3' style='border:0px !important;border-bottom:1px !important;'>EDLI A/c No.21</td>
<td style='border:0px !important;border-bottom:1px !important;'>$tot_edli </td>
<td colspan='2' style='border:0px !important;border-bottom:1px !important;'>Ins. Charges A/c No.22</td>
<td style='border:0px !important;border-bottom:1px !important;'>$tot_ins</td>
<td colspan='2' style='border:0px !important;border-bottom:1px !important;'>A/c No.1</td>
<td style='border:0px !important;border-bottom:1px !important;'>$tot_ins</td>
</tr>";
}
$table_data = "
<style>
table{
border: 0.5px !important;
border-collapse: collapse !important;
empty-cells: show !important;
max-width: 100% !important;
font-size: 13px !important;
text-align:center;
}
tbody {
border: 1px !important;
border-collapse: collapse !important;
max-width: 100% !important;
font-size: 13px !important;
text-align:center;
}
td, th {
border: 1px solid #000 !important;
font-size: 13px !important;
text-align:center;
}
td.fr-thick,th.fr-thick {
border-width: 2px !important;
}
</style>
<table style='width:100%' >
<tr>
<td style='text-align:left;border:0px !important;' colspan='5'>Name and Address of the Company :
</td>
</tr>
<tr style='border:0px !important;'>
<td style='text-align:left;border:0px !important;' colspan='3'>
<h3 >$company_name</h3>
</td>
<td colspan='2' style='border:0px !important;text-align:right !important;border:0px !important;'>
<h3 style='margin:10px;font-size:16px;font-weight:bold;'>PROVIDENT FUND EXTRACT FOR THE MONTH OF $process_month_name</h3>
</td>
</tr>
<tr>
<td style='text-align:right;font-weight:bold;border:0px !important;' colspan='5'>$today_date</td>
</tr>
</table>
<table style='width:100%;border-collapse: collapse;border-spacing: 0;border: 0px;font-size: 14px;' cellspacing='0' cellpadding='4'>
<thead>
</thead>
<tbody>
<tr style='font-weight:bold;'>
<th>Sl.No.</th>
<th>Emp.No</th>
<th>PF A/C No </th>
<th>Employee Name</th>
<th>Days Worked</th>
<th>Salary</th>
<th>EPF</th>
<th>Pen.sch.</th>
<th>Empr.Con.tn</th>
<th>VPF</th>
</tr>
$tr_line
</tbody>
</table>";
$table_data = "<!DOCTYPE html><html> <body>".$table_data."</body></html>";
$return_data = array();
$return_data[$process_month] = $table_data;
$count = count($return_data ?? []);
echo json_encode(array('success'=>TRUE,'final_result'=>$return_data,'count' => $count));
}else
if($report_type === 3){
$category = (int)$this->input->post('category');
$process_mode = (int)$this->input->post('process_mode');
$employee_info = $this->input->post('employee_info');
$employee_info = implode('","',$employee_info ?? []);
$from_year = date('d-m-Y',strtotime("01-04-".$this->input->post('from_year')));
$to_year = date('d-m-Y',strtotime("01-03-".$this->input->post('to_year')));
$from_month = date('M Y',strtotime("01-04-".$this->input->post('from_year')));
$end_month = date('M Y',strtotime("01-03-".$this->input->post('to_year')));
if($category === 1){
if($process_mode === 2){
$query = 'select GROUP_CONCAT(cw_employees.employee_code order by prime_employees_id ASC) as employees from cw_employees where trans_status = 1 and cw_employees.role != 1 and cw_employees.termination_status = 0';
}else{
$query = 'select GROUP_CONCAT(cw_employees.employee_code) as employees from cw_employees where trans_status = 1 and cw_employees.role != 1 and cw_employees.employee_code IN ("'.$employee_info.'") and cw_employees.termination_status = 0';
}
}else
if($category > 1){
if($process_mode === 2){
$query = 'select GROUP_CONCAT(cw_employees.employee_code order by prime_employees_id ASC) as employees from cw_employees where trans_status = 1 and role = "'.$category.'" and cw_employees.role != 1 and cw_employees.termination_status = 0 ';
}else{
$query = 'select GROUP_CONCAT(cw_employees.employee_code) as employees from cw_employees where trans_status = 1 and role = "'.$category.'" and cw_employees.role != 1 and cw_employees.employee_code IN ("'.$employee_info.'") and cw_employees.termination_status = 0 ';
}
}
$view_data = $this->db->query("CALL sp_a_run ('SELECT','$query')");
$view_result = $view_data->result();
$view_data->next_result();
$employees = $view_result[0]->employees;
$employees = explode(",",$employees);
if(empty($employees[0])){
echo json_encode(array('success' => FALSE, 'message' => "Employees not found"));
}else{
$return_data = $this->get_table_info_for_emp($employees,$from_year,$to_year,$from_month,$end_month,$company_name,$company_city,$company_state,$company_country,$select_qry);
$count = count($return_data ?? []);
echo json_encode(array('success' => TRUE, 'final_result' => $return_data,'count' => $count));
}
}else
if($report_type === 4){
$process_month = $this->input->post('date');
$process_month_val = "01-".$process_month;
$process_month_name = date('F-Y',strtotime($process_month_val));
$cheque_date = $this->input->post('cheque_date');
$payment_date = $this->input->post('payment_date');
$cheque_no = $this->input->post('cheque_no');
$triplicate = (int)$this->input->post('triplicate');
$view_qry = 'select IFNULL(count(cw_employees.employee_code),0) as count,'.$sum_select_qry.' from cw_employees inner join cw_transactions on cw_transactions.employee_code = cw_employees.employee_code where cw_employees.trans_status = 1 and cw_transactions.transactions_month = "'.$process_month.'" and cw_employees.role != 1 '.$query.' and cw_transactions.trans_status = 1';
$view_data = $this->db->query("CALL sp_a_run ('SELECT','$view_qry')");
$view_result = $view_data->result();
$view_data->next_result();
foreach($view_result as $rslt){
$emp_count = $rslt->count;
$pf_gross = (int)$rslt->pf_gross;
$pf_amount = (int)$rslt->pf;
$fpf = (int)$rslt->fpf;
$emp_con = (int)$rslt->epf;
$vpf = (int)$rslt->vpf;
$inspections_charge = (int)$rslt->inspections_charge;
$admin_charge = (int)$rslt->admin_charge;
$edli_charge = (int)$rslt->edli_charge;
$emp_share = floor((int)$emp_con + (int)$fpf + (int)$edli_charge);
$total_1 = (int)$emp_con + (int)$pf_amount;
$total_2 = (int)$admin_charge;
$total_3 = (int)$fpf;
$total_4 = (int)$edli_charge;
$total_5 = (int)$inspections_charge;
$total_6 = (int)$emp_share + (int)$pf_amount +(int)$admin_charge +(int)$inspections_charge;
}
$head_list = array();
if($triplicate === 1){
$head_list = array('ORIGINAL','DUPLICATE','TRIPLICATE','QUADRUPLICATE');
}else{
$head_list = array('ORIGINAL');
}
$header_info = '';
$tr_line = '';
$footer_info = '';
foreach($head_list as $key_head => $value_head){
$header_info = "<div>
<p style='text-align:center; margin-bottom:0;font-weight:bold;'>COMBINED CHALLAN OF A/C. NO. 1, 2, 10, 21, & 22 </p><p style='text-align:right;margin-top:0;'>$value_head</p>
<p style='text-align:center;font-size:10px;'>(STATE BANK OF INDIA)</p>
<p style='text-align:center;font-weight:bold;'>EMPLOYEES' PROVIDENT FUND ORGANISATION</p>
<p style='text-align:center;font-size:10px;'>(USE SEPARATE CHALLAN FOR EACH MONTH)</p>
<table style='width:100%;border: 0px !important;'>
<tr>
<td style='border: 0px !important;font-weight: bold;'>ESTABLISHMENT CODE NO. :</td>
<td style='border: 0px !important;'>TN/60993/0014</td>
<td style='border: 0px !important;font-weight: bold;'>ACCOUNT GROUP NO.:</td>
<td style='border: 0px !important;'> </td>
<td style='border: 0px !important;' colspan='2'>PAID BY CHEQUE / CASH</td>
</tr>
<tr>
<td style='width:100%;border: 0px !important;' colspan='6'>
<table style='width:100%;border: 0px !important;'>
<tr>
<td style='font-weight: bold;border:0px !important;' rowspan='2'>DUES FOR THE MONTH OF $process_month_name</td>
<td style='text-align:left;border:0px !important;' rowspan='2'>Employees Share,Employeer Share {
</td>
<td style='font-weight: bold;text-align:left;border:0px !important;' rowspan='2'>
<table style='border:0px !important; border-spacing:5px !important;border-collapse:separate !important;'>
<tr>
<td style='text-align:center;' colspan='4'>MM-YY</td>
</tr>
<tr>
<td style='text-align:center;' colspan='4'>".date('m-y',strtotime($process_month_val))."</td>
</tr>
</table>
</td>
<td style='text-align:center;border:0px !important;' rowspan='2'>
DATE OF PAYMENT
</td>
<td style='text-align:left;border:0px !important;' rowspan='2'>
<table style='border:0px !important; border-spacing:5px !important;border-collapse:separate !important;'>
<tr>
<td cellpadding='4' style='padding:1px !important;text-align:center;' colspan='6'>DD-MM-YY</td>
</tr>
<tr>
<td style='padding:1px !important;text-align:center;' colspan='6'>".date('d-m-y',strtotime($payment_date))."</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style='width:100%;border: 0px !important;' colspan='6'>
<table style='width:100%;border: 0px !important;'>
<tr colspan='6'>
<td style='font-weight: bold;border:0px !important;' rowspan='2'>Total no. of Subscribers</br>Total Wages Due
</td>
<td style='text-align:right;border:0px !important;font-weight:bold;' rowspan='2'>
A/c 1{
</td>
<td style='font-weight: bold;text-align:left;border:0px !important;' rowspan='2'>
<table style='border:0px !important; border-spacing:5px !important;border-collapse:separate !important;'>
<tr>
<td style='text-align:right;width:50%;'>$emp_count</td>
</tr>
<tr>
<td style='text-align:right;width:50%;'>$pf_gross</td>
</tr>
</table>
</td>
<td style='text-align:right;border:0px !important;font-weight:bold;' rowspan='2'>
A/c 10{
</td>
<td style='font-weight: bold;text-align:left;border:0px !important;' rowspan='2'>
<table style='border:0px !important; border-spacing:5px !important;border-collapse:separate !important;' >
<tr>
<td style='text-align:right;width:50%;'>$emp_count</td>
</tr>
<tr>
<td style='text-align:right;width:50%;'>$pf_gross</td>
</tr>
</table>
</td>
<td style='text-align:right;border:0px !important;font-weight:bold;' rowspan='2'>
A/c 21{
</td>
<td style='font-weight: bold;text-align:left;border:0px !important;' rowspan='2'>
<table style='border:0px !important; border-spacing:5px !important;border-collapse:separate !important;'>
<tr>
<td style='text-align:right;width:50%;'>$emp_count</td>
</tr>
<tr>
<td style='text-align:right;width:50%;'>$pf_gross</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table></div>";
$tr_line = "<div><table style='width:100%'>
<thead>
<tr>
<td rowspan='2'>S.No.</td>
<td rowspan='2'>Particulars</td>
<td>A/C. No.1</td>
<td>A/C. No.2</td>
<td>A/C. No.10</td>
<td>A/C. No.21</td>
<td rowspan='2'>A/C. No.22</td>
<td rowspan='2'>Total</td>
</tr>
<tr>
<td colspan='4'>...........Amount (In Rupees) ................ </td>
</tr>
</thead>
<tbody>
<tr>
<td>1.</td>
<td> Employer's Share of Cont.</td>
<td >$emp_con</td>
<td ></td>
<td >$fpf</td>
<td >$edli_charge</td>
<td ></td>
<td >$emp_share</td>
</tr>
<tr>
<td>2.</td>
<td> Employees' Share of Cont.</td>
<td>$pf_amount</td>
<td></td>
<td>--</td>
<td></td>
<td></td>
<td>$pf_amount</td>
</tr>
<tr>
<td>3.</td>
<td>Administration Charges</td>
<td></td>
<td>$admin_charge</td>
<td></td>
<td></td>
<td></td>
<td>$admin_charge</td>
</tr>
<tr>
<td>4.</td>
<td>Inspection Charges</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>$inspections_charge</td>
<td>$inspections_charge</td>
</tr>
<tr>
<td>5.</td>
<td>Penal Damages</td>
<td></td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
</tr>
<tr>
<td>6.</td>
<td>Miscellaneous Payment</td>
<td>--</td>
<td>--</td>
<td></td>
<td></td>
<td>--</td>
<td>--</td>
</tr>
<tr>
<td colspan='2' style='text-align:right !important;'>Total</td>
<td>$total_1</td>
<td>$total_2</td>
<td>$total_3</td>
<td>$total_4</td>
<td>$total_5</td>
<td>$total_6</td>
</tr>
</tbody>
</table></div>";
$footer_info = "<div><table style='width:100%'>
<tr>
<td style='border:0px !important;text-align:center;' colspan='2'>(Amount in words.</td>
<td style='border:0px !important;text-align:center;' colspan='4' >".$this->numberTowords($total_6)."</td>
</tr>
<tr>
<td style='border:0px !important;text-align:center;' colspan='6'>(For Bank's use only)</td>
</tr>
<tr>
<td style='border:0px !important;' colspan='2' >Name of Establishment Address</td>
<td colspan='2' style='border:0px !important;'>$company_name $company_city $company_state $company_country</td>
<td style='text-align:right;border:0px !important;' colspan='2'>
<table>
<tr><td style='text-align:left;border:0px !important;'>Amount Received Rs.</td></tr>
<tr><td style='text-align:left;border:0px !important;'>For Cheques only :</td></tr>
<tr><td style='text-align:left;border:0px !important;'>Date of Presentation</td></tr>
<tr><td style='text-align:left;border:0px !important;'>Date of Realisation</td></tr>
</table>
</td>
</tr>
<tr>
<td style='border:0px !important;' colspan='2'>Name of the Depositor</td>
<td colspan='2' style='border:0px !important;'></td>
<td style='text-align:left;border:0px !important;' colspan='2'>Branch Name</td>
</tr>
<tr>
<td style='border:0px !important;' colspan='2'>Signature of the Depositor</td>
<td colspan='2' style='border:0px !important;'></td>
<td style='text-align:left;border:0px !important;' colspan='2'>Branch Code No.</td>
</tr>
<tr>
<td colspan='6' style='border:0px !important;'>( TO BE FILLED IN BY EMPLOYER )</td>
</tr>
<tr>
<td style='border:0px !important;' colspan='2'>Name of The Bank</td>
<td colspan='2' style='text-align:center;border:0px !important;'>Cheque No.".$cheque_no."</td>
<td style='text-align:right;border:0px !important;' colspan='2'>Date ".date('d-m-y',strtotime($cheque_date))."</td>
</tr>
</table></div>";
$pf_challan_data .= "$header_info
$tr_line
$footer_info ";
}
$final_result = "<!DOCTYPE html><html>
<head>
<style>
table{
border: 0.5px !important;
border-collapse: collapse !important;
empty-cells: show !important;
max-width: 100% !important;
font-size: 13px !important;
text-align:center;
}
tbody {
border: 1px !important;
border-collapse: collapse !important;
max-width: 100% !important;
font-size: 13px !important;
text-align:center;
}
td, th {
border: 1px solid #000 !important;
font-size: 13px !important;
text-align:center;
}
td.fr-thick,th.fr-thick {
border-width: 2px !important;
text-align:center;
}
</style>
</head>
<body>
$pf_challan_data
</body>
</html>";
$return_data = array();
$return_data[$process_month] = $final_result;
$count = count($return_data ?? []);
echo json_encode(array('success'=>TRUE,'final_result'=>$return_data,'count' => $count));
}else
if($report_type === 5){
$process_month = $this->input->post('date');
$process_month_val = "01-".$process_month;
$process_month_name = date('F-Y',strtotime($process_month_val));
// $view_data = $this->db->query("CALL sp_a_run ('SELECT','select cw_employees.prime_employees_id,cw_employees.role,cw_employees.emp_name,cw_employees.father_name,cw_employees.last_working_date,cw_employees.separation_reason,cw_employees.pf_account_number from cw_employees inner join cw_transactions on cw_transactions.employee_code = cw_employees.employee_code where cw_employees.trans_status = 1 and cw_transactions.transactions_month = \"$process_month\" and cw_employees.role != 1 and cw_employees.termination_status = 1 and cw_transactions.trans_status = 1')");
$view_qry = 'select cw_employees.emp_name,'.$select_qry.',cw_employees.last_working_date,cw_employees.separation_reason,cw_employees.pf_account_number from cw_employees inner join cw_transactions on cw_transactions.employee_code = cw_employees.employee_code where cw_employees.trans_status = 1 and cw_transactions.transactions_month = "'.$process_month.'" and cw_employees.role != 1 '.$query.' and cw_transactions.trans_status = 1';
$view_data = $this->db->query("CALL sp_a_run ('SELECT','$view_qry')");
$view_result = $view_data->result();
$view_data->next_result();
$tr_line = "";
$i = 0;
foreach($view_result as $rlst){
$i++;
$emp_name = $rlst->emp_name;
$father_name = $rlst->father_name;
$resignation_date = ($rlst->last_working_date == '0000-00-00' || empty($rlst->last_working_date)) ? '' : date('d-m-Y', strtotime($rlst->last_working_date));
$pf_account_number = $rlst->pf_account_number;
$separation_reason = $rlst->separation_reason;
$tr_line .= "<tr>
<td style='text-align:center;'>$i</td>
<td style='text-align:center;'>$pf_account_number</td>
<td style='text-align:center;'>$emp_name</td>
<td style='text-align:center;'>$father_name</td>
<td style='text-align:center;'>$resignation_date</td>
<td style='text-align:center;'>$separation_reason</td>
<td style='text-align:center;'></td>
</tr>";
}
$report_type_list = array(1 => 'form_5',2 =>'pf_extract',3 =>'form_3a',4 => 'pf_challan',5 => 'form_10');
$report_type = $report_type_list[$report_type];
$header_info = "<table>
<tr>
<td style='border:0px !important; padding:3px'>
<table>
<tr><td style='border:0px !important;text-align:left;'><b>Name & Address of the Factory/Establishment.......</b></td></tr>
<tr><td style='border:0px !important;text-align:left;'>$company_name $company_city $company_state $company_country</td></tr>
</table>
</td>
<td style='border:0px !important;'>
<table>
<tr><td style='border:0px !important;text-align:center;'><b>FORM-10</b></td></tr>
<tr><td style='border:0px !important;text-align:left;font-size:11px!important;'>PART 'B' Details of Employees leaving Service<br/></td></tr>
</table>
</td>
</tr>
<tr>
<td style='border:0px !important;'>
<table>
<tr><td style='border:0px !important;text-align:center;'><h5><b>Estt. Code No.</b></h5></td></tr>
</table>
</td>
</tr>
<tr>
<td style='border:0px !important;'>
<table>
<tr><td style='border:0px !important;text-align:center;'><b>Return of the members leaving service during the month of JULY 2019 $process_month_name</b></td></tr>
</table>
</td>
</tr>
</table>";
$footer_info = "<table>
<tr>
<td style='border:0px !important; padding:3px'>
<table>
<tr><td style='border:0px !important;text-align:left;'><b>* Please state whether the member is [a] retiring according to para 69 (1) (a) or (b) of the scheme [b] leaving india for permanent settlement aboard [c] retrenched [d] ordinarily dismissed for serious & wilful misconduct[e] discharge [f] resigning from or leaving service [g] taking up employment else where [the name & address of the employer's should be stated and [h] death.</b></td></tr>
</table>
</td>
</tr>
<tr>
<td style='border:0px !important; padding:3px'>
<table>
<tr><td style='border:0px !important;text-align:left;'>1. Incase of discharge from service the following certificate should be completed.</br>Certified that the member mentioned at sl. no...........shri..............is paid/not paid retrenchment compensation of Rs..........................under the industrial Disputes Act. 1947,</td></tr>
<tr><td style='border:0px !important;text-align:left;'>2. Certified that the member mentioned at sl. no ......................shri................................was dismissed for serious and wilful misconduct</br>I recommed that the employers contribution for .......................................................should be forfeited from his account in the Fund A copy of order of dismissal is enclosed.</td></tr>
</table>
</td>
</tr>
<tr>
<td style='border:0px !important; padding:3px'>
<table>
<tr>
<td style='border:0px !important;text-align:left;'></br>Place :</td>
</tr>
<tr>
<td style='border:0px !important;text-align:left;'>Date :</td>
</tr>
</table>
</td>
</tr>
</table>
<table style='width:100%;'>
<tr>
<td style='border:0px !important;text-align:center;'>stamp of Factory/Establishment.</td>
</tr>
<tr>
<td style='border:0px !important;text-align:right;'><b>Signature of employer or other authorised officer. </b></td>
</tr>
</table>";
$final_result = "<table style='width:100%;'>
<thead>
<tr>
<th style='text-align:center;'>S.No</th>
<th style='text-align:center;'>Account No.</th>
<th style='text-align:center;'>Name Of Employee</th>
<th style='text-align:center;'>Father's Name</th>
<th style='text-align:center;'>Date of leaving service</th>
<th style='text-align:center;'>Reasons for leaving Service</th>
<th style='text-align:center;'>Remarks</th>
</tr>
</thead>
<tbody>
$tr_line
</tbody>
</table>";
$final_result = preg_replace('/<\/tbody><\/table>(.*?)<tbody>/','',$final_result);//regex replace
$final_result = "<!DOCTYPE html><html>
<head>
<style>
table{
border: 0.5px !important;
border-collapse: collapse !important;
empty-cells: show !important;
max-width: 100% !important;
font-size: 13px !important;
}
tbody {
border: 1px !important;
border-collapse: collapse !important;
max-width: 100% !important;
font-size: 13px !important;
}
td, th {
border: 1px solid #000 !important;
font-size: 13px !important;
}
td.fr-thick,th.fr-thick {
border-width: 2px !important;
}
</style>
</head>
<body>
$header_info
$final_result
$footer_info
</body>
</html>";
//$pdf_path = $this->get_pdf_path($final_result,$process_month,$report_type);
$return_data = array();
$return_data[$process_month] = $final_result;
$count = count($return_data ?? []);
echo json_encode(array('success'=>TRUE,'final_result'=>$return_data,'count' => $count));
}
}else{
echo json_encode(array('success'=>FALSE,'message'=>'Trancation Month Not Found'));
}
}
public function get_pdf_path($final_result,$process_month,$category_name){
// Load pdf library
// $this->load->library('pdf');
// Load HTML content
$this->dompdf->loadHtml($final_result);
// (Optional) Setup the paper size and orientation
$this->dompdf->setPaper('A4', 'landscape');
// Render the HTML as PDF
$this->dompdf->render();
$output = $this->dompdf->output();
$folder = "pf_reports";
$folder1 = $category_name;
$pdf_name = $process_month;
$final_html = $output;
$oldmask = umask(0);
if(!file_exists($folder)){
mkdir($folder, 0777, true);
}
if(!file_exists($folder."/".$folder1)){
mkdir($folder."/".$folder1, 0777, true);
}
//Check File Exist
if(file_exists($folder."/".$folder1."/".$pdf_name.".pdf")){
chmod($folder."/".$folder1."/".$pdf_name.".pdf", 0777);
unlink($folder."/".$folder1."/".$pdf_name.".pdf");
}
file_put_contents($folder."/".$folder1."/".$pdf_name.".pdf", $final_html);
chmod($folder."/".$folder1."/".$pdf_name.".pdf", 0777);
umask($oldmask);
$path = $folder."/".$folder1."/".$pdf_name.".pdf";
chmod($path, 0777, true);
return $path;
}
public function get_table_info_for_emp($employees,$from_year,$to_year,$from_month,$end_month,$company_name,$company_city,$company_state,$company_country,$select_qry){
$months = $this->get_months($to_year,$from_year);
if(!empty($employees)){
$header_info = '';
$final_result = '';
$month = '';
$get_month = '';
$emp_codes = '';
foreach($months as $dt){
$month_list = $dt->format('M');
$month = $dt->format('m-Y');
$get_month .= "\"$month\",";
}
foreach($employees as $emp_code){
$emp_codes .= "\"$emp_code\",";
}
$get_month = '('.rtrim($get_month,',').')';
$emp_codes = '('.rtrim($emp_codes,',').')';
$trans_query = 'WITH ranked_data AS (select cw_employees.employee_code,cw_employees.emp_name,'.$select_qry.',cw_employees.last_working_date,cw_employees.separation_reason,cw_employees.pf_account_number,cw_transactions.transactions_month, ROW_NUMBER() OVER (PARTITION BY cw_employees.employee_code, cw_transactions.transactions_month) AS rn from cw_employees inner join cw_transactions on cw_transactions.employee_code = cw_employees.employee_code inner join cw_monthly_input on cw_monthly_input.employee_code = cw_employees.employee_code where cw_employees.trans_status = 1 and cw_employees.role != 1 and cw_transactions.trans_status = 1 and cw_monthly_input.trans_status = 1 and cw_employees.employee_code IN '.$emp_codes.' and cw_transactions.transactions_month IN '.$get_month.') SELECT * FROM ranked_data WHERE rn = 1 ORDER BY employee_code, transactions_month;';
$trans_data = $this->db->query("CALL sp_a_run ('SELECT','$trans_query')");
$trans_result = $trans_data->result();
$trans_data->next_result();
$trans_result = array_map(function($rslt){
$return_data['employee_code'] = $rslt->employee_code;
$return_data['employee_data'] = $rslt;
return $return_data;
}, $trans_result);
$data_result = [];
// EMPLOYEE CODE WAYS DATA ARRANGED _ARN
foreach($trans_result as $item){
$data_result[$item['employee_code']][] = $item['employee_data'];
}
foreach($employees as $employee_code){
$data = $data_result[$employee_code];
$separation_reason = $data[0]->separation_reason;
$emp_name = $data[0]->emp_name;
$father_name = $data[0]->father_name;
$pf_account_number = $data[0]->pf_account_number;
$last_working_date = ($data[0]->last_working_date == '0000-00-00' || empty($data[0]->last_working_date)) ? '' : date('d-m-Y', strtotime($data[0]->last_working_date));
$i = 1;
$tr_line = '';
$total_gross = 0;
$total_pf = 0;
$total_pension_fund = 0;
$total_epf_per = 0;
$today_date = date("m-d-Y");
// SET THE DATA BY _ARN
$employee_monthly_data = [];
$employee_data_array = is_array($data_result[$employee_code]) ? $data_result[$employee_code] : [$data_result[$employee_code]];
foreach($employee_data_array as $rslt){
$month = $rslt->transactions_month;
$employee_monthly_data[$month] = $rslt;
}
foreach($months as $dt){
$month_list = $dt->format('M');
$month = $dt->format('m-Y');
$cur_month_result = $employee_monthly_data[$month];
if($cur_month_result->pf_gross){
$pf_gross = $cur_month_result->pf_gross;
}else{
$pf_gross = 0;
}
if($cur_month_result->pf){
$pf = $cur_month_result->pf;
}else{
$pf = 0;
}
$pension_fund = round($pf_gross * 8.33 / 100);
$epf_per = $pf - $pension_fund;
$total_gross = $total_gross + $pf_gross;
$total_pf = $total_pf + $pf;
$total_epf_per = $total_epf_per + $epf_per;
$total_pension_fund = $total_pension_fund + $pension_fund;
if((int)$i === 1){
$tr_line = "<tr style='text-align:center'>
<td>$month_list</td>
<td>$pf_gross</td>
<td>$pf</td>
<td>$epf_per</td>
<td>$pension_fund</td>
<td></td>
<td></td>
<td rowspan='12'>
<table style='border:0px !important;'>
<tr>
<td style='border:0px !important;'>(a) Date of leaving service, if any</td>
<td style='border:0px !important;'>$last_working_date</td>
</tr>
<tr>
<td style='border:0px !important;'>(b) Reasons for leaving service,if any</td>
<td style='border:0px !important;'>$separation_reason</td>
</tr>
</table>
</td>
</tr>";
}else{
$tr_line .= "<tr style='text-align:center'>
<td>$month_list</td>
<td>$pf_gross</td>
<td>$pf</td>
<td>$epf_per</td>
<td>$pension_fund</td>
<td></td>
<td></td>
</tr>";
}
$header_info = "<h6 style='text-align:center;'>THE EMPLOYEE'S PROVIDENT FUND SCHEME, 1952. ( Paras 35 & 42 ) and The Employees' Family Pension Scheme, 1995 (Para 19)</h6>
<h6 style='text-align:center;'>FORM NO. 3A (Revised)</h6>
<h6>Contribution Card for the Currency Period from $from_month To $end_month</h6>
<table class='table table-bordered' style='width:100%;'>
<tr>
<td style='border:0px !important;' colspan='3'><b>1.Account No.</b> $pf_account_number</td>
<td style='border:0px !important;' colspan='3'><b>2.Name/Surname:</b>$emp_name </td>
<td style='border:0px !important;' colspan='3'><b>3.Father's/Husband's Name:</b> $father_name</td>
</tr>
<tr style='border:0px !important;'>
<td style='border:0px !important;' colspan='2'>4.Name & Address of the Establishment : $company_name,$company_city,$company_state,$company_country</td>
<td style='border:0px !important;' colspan='2'>5.Statutory rate of contribution </td>
<td style='border:0px !important;' colspan='2'>6.Voluntary higher rate of employees contribution if any</td>
</tr>
<tr style='border:0px !important;'>
<td style='border:0px !important;' colspan='2'>7.ER Cont. on Hr wages to EPF (ER) Y / N </td>
<td style='border:0px !important;'>#########</td>
<td style='border:0px !important;' colspan='2'>8.Vol. Cont. to pension Y / N </td>
<td style='border:0px !important;'>###########################</td>
</tr>
</table>";
$i++;
}
$full_epf = floor($total_pf + $total_epf_per);
$total_pension_fund = floor($total_pension_fund);
$footer_info = "<p>Certified that the total amount of contributions (both shares) indicated in this card i.e. $full_epf has already been remitted in
full in E.P.F A/c No.1 and Pension Fund A/c No.10___ $total_pension_fund (Vide note below)</p>
<p>Certified that the difference between the total of the contributions shown under the columns 3 & 4a & 4b of the above
table and that arrived at on the total wages shown in column (2) at the prescribed rate is solely due to the rounding
off the contributions to the nearest rupee under the rules.</p>
<p>Date : $today_date</p>
<p>Note:</p>
<p>1.In respect of the Form(3A) sent to the Regional Office during the course of the currency period
for the purpose of final settlement of the accounts of the members who had left service details of
date and reasons for leaving service should be furnished under Col.7(a) & (b)</p>
<p>2. In respect of those who are not members of the Pension Fund the employers share of contribution Signature of the Employer
to the EPF will be 8-1/3 or 10% as the case may be and is to be shown under column 4(a) with office Seal</p>";
$final_result = "<table style='width:100%;'>
<thead>
<tr>
<th style='text-align:center;' rowspan='2'>Month</th>
<th colspan='2' style='padding: 2px; text-align: center;'>Worker's Share</th>
<th style='text-align:center;text-align:center;' colspan='2'>Employer's Share</th>
<th style='text-align:center;' rowspan='2'>Refund of advances</th>
<th style='text-align:center;' rowspan='2'>No. of days/period of non-contributing Service (If Any)</th>
<th style='text-align:center;' rowspan='2'>Remarks</th>
</tr>
<tr>
<th style='text-align:center;'>Amount of wages</th>
<th style='text-align:center;'>EPF</th>
<th style='text-align:center;'>EPF (3.67%)</th>
<th style='text-align:center;'>Pension Fund (EPS 8.33%)</th>
</tr>
</thead>
<tbody>
$tr_line
<tr style='text-align:center;'>
<td style='border:0px !important;'>TOTAL</td>
<td style='border:0px !important;'>$total_gross</td>
<td style='border:0px !important;'>$total_pf</td>
<td style='border:0px !important;'>$total_epf_per</td>
<td style='border:0px !important;'>$total_pension_fund</td>
<td style='border:0px !important;'></td>
<td style='border:0px !important;'></td>
<td style='border:0px !important;'></td>
</tr>
</tbody>
</table>";
$final_result = preg_replace('/<\/tbody><\/table>(.*?)<tbody>/','',$final_result);//regex replace
$final_result = "<!DOCTYPE html><html>
<head>
<style>
table{
border: 0.5px !important;
border-collapse: collapse !important;
empty-cells: show !important;
max-width: 100% !important;
font-size: 13px !important;
}
tbody {
border: 1px !important;
border-collapse: collapse !important;
max-width: 100% !important;
font-size: 13px !important;
}
td, th {
border: 1px solid #000 !important;
font-size: 13px !important;
}
td.fr-thick,th.fr-thick {
border-width: 2px !important;
}
</style>
</head>
<body style='font-size:small!important;'>
$header_info
$final_result
$footer_info
</body>
</html>";
$return_data[$employee_code] = $final_result;
}
}
return $return_data;
}
public function pf_generate_pdf(){
$encString = file_get_contents('php://input');
$_POST = $this->cryptoDecrypt($encString);
if(!$_POST){
echo json_encode(array('success' => false,'message' => 'Url Expired.. Please refresh the page and try again....','table_data' => ""));
exit(0);
}
$employee_code = $this->input->post('code');
$content = $this->input->post('html');
$report_type = (int)$this->input->post('report_type');
$from_year = $this->input->post('from_year');
$to_year = $this->input->post('to_year');
$process_year = $from_year."-".$to_year;
$report_type_list = array(1 => 'form_5',2 =>'pf_extract',3 =>'form_3a',4 => 'pf_challan',5 => 'form_10');
$report_name = $report_type_list[$report_type];
if($report_type === 3){
$set_paper = 'portrait';
$folder = "pf_reports/".$report_name."/".$process_year;
}else{
$set_paper = 'landscape';
$folder = "pf_reports/".$report_name;
}
$path = $this->common_generate_pdf($content,$folder,$employee_code,$set_paper,'A4','','');
echo $path;
}
//Get all the months from the effective date.
public function get_months($to,$from){
$start = new DateTime($from);
//$start->modify('first day of this month');
$end = new DateTime($to);
$end->modify('last day of this month');
$interval = DateInterval::createFromDateString('1 month');
$period = new DatePeriod($start, $interval, $end);
return $period;
}
public function numberTowords($number){
$no = round($number);
$point = round($number - $no, 2) * 100;
$hundred = null;
$digits_1 = strlen($no);
$i = 0;
$str = array();
$words = array('0' => '', '1' => 'One', '2' => 'Two',
'3' => 'Three', '4' => 'Four', '5' => 'Five', '6' => 'Six',
'7' => 'Seven', '8' => 'Eight', '9' => 'Nine',
'10' => 'Ten', '11' => 'Eleven', '12' => 'Twelve',
'13' => 'Thirteen', '14' => 'Fourteen',
'15' => 'Fifteen', '16' => 'Sixteen', '17' => 'Seventeen',
'18' => 'Eighteen', '19' =>'Nineteen', '20' => 'Twenty',
'30' => 'Thirty', '40' => 'Forty', '50' => 'Fifty',
'60' => 'Sixty', '70' => 'Seventy',
'80' => 'Eighty', '90' => 'Ninety');
$digits = array('', 'Hundred', 'Thousand', 'Lakh', 'Crore');
while ($i < $digits_1) {
$divider = ($i == 2) ? 10 : 100;
$number = floor($no % $divider);
$no = floor($no / $divider);
$i += ($divider == 10) ? 1 : 2;
if ($number) {
$plural = (($counter = count($str ?? [])) && $number > 9) ? 's' : null;
$hundred = ($counter == 1 && $str[0]) ? ' and ' : null;
$str [] = ($number < 21) ? $words[$number] .
" " . $digits[$counter] . $plural . " " . $hundred
:
$words[floor($number / 10) * 10]
. " " . $words[$number % 10] . " "
. $digits[$counter] . $plural . " " . $hundred;
} else $str[] = null;
}
$str = array_reverse($str);
$result = implode('', $str ?? []);
$points = ($point) ?
"." . $words[$point / 10] . " " .
$words[$point = $point % 10] : '';
//echo $result . "Rupees " . $points . " Paise";
if($result === ""){
$result = "Zero ";
}
return $result . "INR Only ";
}
public function check_transactions_month($process_month){
$view_data = $this->db->query("CALL sp_a_run ('SELECT','select count(*) as count from cw_employees inner join cw_transactions on cw_transactions.employee_code = cw_employees.employee_code where cw_employees.trans_status = 1 and cw_transactions.transactions_month = \"$process_month\" and cw_employees.role != 1 and cw_transactions.trans_status = 1 ')");
$view_result = $view_data->row();
$view_data->next_result();
$count = $view_result->count;
if((int)$count > 0){
return TRUE;
}else{
return FALSE;
}
}
}
?>