load->model('payroll_model'); $this->load->model('monthlypay_model'); $this->load->library('form_validation'); $this->isLoggedIn(); $this->CompanyName = "RESICO"; } function phpAlert($msg) { echo ''; } /** * This function used to call stored procedure named with final_payroll_data() */ public function callsp(){ $payon = $this->input->post('payon'); $employee = $this->input->post('employee'); $result = $this->payroll_model->model_sp($payon,$employee); // $result = $this->db->last_query(); return $result; //$this->db->call_function('model_sp'); } function loadBankreportScreen() { $Data['Payon'] = $this->payroll_model->getPayOn(); $Data['Bank'] = $this->payroll_model->getBankInfo(); $this->global['pageTitle'] = $this->CompanyName.' : Bank Report Screen'; $this->loadViews("bankreport", $this->global,$Data,NULL); } function getBankReport() { $bank = $this->input->post('bank'); $payon = $this->input->post('month'); $chequeno = $this->input->post('chequeno'); $chequedate = date("Y-m-d", strtotime($this->input->post('chequedate'))); $createdby = $this->session->userdata ( 'userId' ); $monthsoptions = array("01" => "Jan", "02" => "Feb","03" => "Mar","04" => "Apr","05" => "May","06" => "June","07"=> "July","08"=> "Aug","09" => "Sep","10"=> "Oct","11" => "Nov","12"=>"Dec"); $m = substr($payon,0,2); $y = substr($payon,3); $month = $monthsoptions[$m]."-".$y; $excel = $this->input->post('excel'); $HTML = ''; //echo $excel; // if(empty($excel)) // { // echo "PDF"; // } // else // { // echo "EXCEL"; // } // die(); $filename = ''; if($this->input->post('Bank_Report')) { $data['result'] = $this->payroll_model->getReportforBank($bank,$payon); if($chequeno != '' && $chequedate != '') { $empcount=count($data['result']); $cheque = array('ChequeNO'=>$chequeno, 'ChequeDate'=>$chequedate, 'BankName'=>$bank, 'Monthyear'=>$payon, 'Empcount'=>$empcount, 'CreatedBy'=>$createdby); $data['insertcheque'] = $this->payroll_model->ChequeDetails($cheque); } //print_r($data['result']);die(); $totamtwords = ''; $totalamt=0.00; if(!empty($data['result'])){ foreach($data['result'] as $amt) { $totalamt += $amt->LessAdvance; } } $totamtwords = $this->convertNumber($totalamt); $data['bankdetails']=$this->payroll_model->getBankInfo($bank); $data['chequedetails']=$this->payroll_model->getChequeInfo($bank,$payon); $data['Totalamount']=$totalamt; $data['Totalamtwords']=$totamtwords; $data['PayMonth']=$month; $filename = 'Bank Report for'.$payon.'pdf' ; $HTML = $this->load->view("bankreportprint",$data,true); } if($this->input->post('PF_Report')) { $data['PFESI'] = $this->payroll_model->getReportforPFESI($payon); $data['PayMonth']=$month; $data['companyinfo']=$this->payroll_model->getCompanyInformation(); //print_r($data['companyinfo']);die(); $totamtwords = ''; $totalamt=0.00; $totemppf = 0.00; $totemprpf = 0.00; if(!empty($data['PFESI'])){ foreach($data['PFESI'] as $pf) { $totalamt += ($pf->PF + $pf->CompanyPF); $totemppf += ($pf->PF); $totemprpf += ($pf->CompanyPF); } } $data['Totalamount']=$totalamt; $data['TotalEmployeeContribution']=$totemppf; $data['TotalEmployerContribution']=$totemprpf; $totamtwords = $this->convertNumber($totalamt); $data['Totalamtwords']=$totamtwords; if(empty($excel)){ $filename = 'PF Report for'.$payon.'pdf' ; $HTML = $this->load->view("pfreportprint",$data,true); // echo "PDF PART 1"; } else{ $this->load->library('excel'); // $this->global['pageTitle'] = $this->CompanyName.' : PF Excel Report'; // $this->loadViews('pfexcel',$this->global,$data,NULL); $this->excel->setActiveSheetIndex(0); $this->excel->getActiveSheet()->setTitle('Employee PF Report ' . $data['PayMonth']); $this->excel->getActiveSheet()->setCellValue('A1', 'Employee PF Report ' . $data['PayMonth']); $this->excel->getActiveSheet()->setCellValue('A4', 'S.No.'); $this->excel->getActiveSheet()->setCellValue('B4', 'Employee Name'); $this->excel->getActiveSheet()->setCellValue('C4', 'PF Account No'); $this->excel->getActiveSheet()->setCellValue('D4', 'Employee Contribution'); $this->excel->getActiveSheet()->setCellValue('E4', 'Employeer Contribution'); $this->excel->getActiveSheet()->setCellValue('F4', 'No Of Days Worked'); $this->excel->getActiveSheet()->setCellValue('G4', 'OT Hrs Worked'); $this->excel->getActiveSheet()->setCellValue('H4', 'Total Amount'); $this->excel->getActiveSheet()->mergeCells('A1:F1'); $this->excel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); $this->excel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true); $this->excel->getActiveSheet()->getStyle('A1')->getFont()->setSize(16); $this->excel->getActiveSheet()->getStyle('A1')->getFill()->getStartColor()->setARGB('#333'); for($col = ord('A'); $col <= ord('H'); $col++){ $this->excel->getActiveSheet()->getColumnDimension(chr($col))->setAutoSize(true); $this->excel->getActiveSheet()->getStyle(chr($col))->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle(chr($col))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); } // print_r($data['PFESI']);die(); $i=6; $j=1; $total=0; $overall=0; $totemp = 0; $overallemp = 0; $totemr = 0; $overallemr = 0; foreach($data['PFESI'] as $row){ $this->excel->getActiveSheet()->setCellValue('A' . (string)($i),$j); $this->excel->getActiveSheet()->setCellValue('B' . (string)($i),$row->FName . $row->Lname); $this->excel->getActiveSheet()->setCellValue('C' . (string)($i),$row->PFNO); $this->excel->getActiveSheet()->setCellValue('D' . (string)($i),number_format($row->PF,2,'.','')); $this->excel->getActiveSheet()->getStyle('D'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->getStyle('D'.(string)($i))->getNumberFormat()->setFormatCode('0.00'); $this->excel->getActiveSheet()->setCellValue('E' . (string)($i),number_format($row->CompanyPF,2,'.','')); $this->excel->getActiveSheet()->getStyle('E'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->getStyle('E'.(string)($i))->getNumberFormat()->setFormatCode('0.00'); $this->excel->getActiveSheet()->setCellValue('C' . (string)($i+1),'Total'); $this->excel->getActiveSheet()->setCellValue('F' . (string)($i),number_format($row->NoofDaysWorked,2,'.','')); $this->excel->getActiveSheet()->getStyle('F'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->setCellValue('G' . (string)($i),number_format($row->OTperHours,2,'.','')); $this->excel->getActiveSheet()->getStyle('G'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $total = $row->PF + $row->CompanyPF; $totemp = $row->PF; $totemr = $row->CompanyPF; $overall=$overall + $total; $overallemp = $overallemp + $totemp; $overallemr = $overallemr + $totemr; $this->excel->getActiveSheet()->setCellValue('H' . (string)($i),($total)); //$this->excel->getActiveSheet()->setCellValue('D' . (string)($i),($totemp)); //$this->excel->getActiveSheet()->setCellValue('E' . (string)($i),($totemr)); $this->excel->getActiveSheet()->getStyle('H'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->getStyle('H'.(string)($i))->getNumberFormat()->setFormatCode('0.00'); $this->excel->getActiveSheet()->setCellValue('H' . (string)($i+1),($overall)); $this->excel->getActiveSheet()->setCellValue('D' . (string)($i+1),($overallemp)); $this->excel->getActiveSheet()->setCellValue('E' . (string)($i+1),($overallemr)); $this->excel->getActiveSheet()->getStyle('H'.(string)($i+1))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->getStyle('H'.(string)($i+1))->getNumberFormat()->setFormatCode('0.00'); //$this->excel->getActiveSheet()->setCellValue('A6','HI'); $i++; $j++; } $this->excel->getActiveSheet()->getProtection()->setSheet(true); $this->excel->getActiveSheet()->getProtection()->setSort(true); $this->excel->getActiveSheet()->getProtection()->setInsertRows(true); $this->excel->getActiveSheet()->getProtection()->setFormatCells(true); $filename='EmployeePFReport'.$payon.'xls'; header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="'.$filename.'"'); header('Cache-Control: max-age=0'); $objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5'); $objWriter->save('php://output'); } } if($this->input->post('ESI_Report')) { $data['PFESI'] = $this->payroll_model->getReportforPFESI($payon); //print_r($data['PFESI']);die(); $data['PayMonth']=$month; $data['companyinfo']=$this->payroll_model->getCompanyInformation(); $totamtwords = ''; $totalamt=0.00; $totemppf = 0.00; $totemprpf = 0.00; if(!empty($data['PFESI'])){ foreach($data['PFESI'] as $pf) { $totalamt += ($pf->EmployeeESI + $pf->CompanyESI); $totemppf += ($pf->EmployeeESI); $totemprpf += ($pf->CompanyESI); } } $data['Totalamount']=$totalamt; $totamtwords = $this->convertNumber($totalamt); $data['TotalEmployeeContribution']=$totemppf; $data['TotalEmployerContribution']=$totemprpf; $data['Totalamtwords']=$totamtwords; if(empty($excel)){ $filename = 'ESI Report for'.$payon.'pdf'; $HTML = $this->load->view("esireportprint",$data,true); // echo "PDF PART 1"; } else{ $this->load->library('excel'); $this->excel->setActiveSheetIndex(0); $this->excel->getActiveSheet()->setTitle('Employee ESI Report ' . $data['PayMonth']); $this->excel->getActiveSheet()->setCellValue('A1', 'Employee ESI Report ' . $data['PayMonth']); $this->excel->getActiveSheet()->setCellValue('A4', 'S.No.'); $this->excel->getActiveSheet()->setCellValue('B4', 'Employee Name'); $this->excel->getActiveSheet()->setCellValue('C4', 'ESI Account No'); $this->excel->getActiveSheet()->setCellValue('D4', 'Employee Contribution'); $this->excel->getActiveSheet()->setCellValue('E4', 'Employeer Contribution'); $this->excel->getActiveSheet()->setCellValue('F4', 'No Of Days Worked'); $this->excel->getActiveSheet()->setCellValue('G4', 'OT Hrs Worked'); $this->excel->getActiveSheet()->setCellValue('H4', 'Total Amount'); $this->excel->getActiveSheet()->mergeCells('A1:F1'); $this->excel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); $this->excel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true); $this->excel->getActiveSheet()->getStyle('A1')->getFont()->setSize(16); $this->excel->getActiveSheet()->getStyle('A1')->getFill()->getStartColor()->setARGB('#333'); for($col = ord('A'); $col <= ord('H'); $col++){ $this->excel->getActiveSheet()->getColumnDimension(chr($col))->setAutoSize(true); $this->excel->getActiveSheet()->getStyle(chr($col))->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle(chr($col))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); } // print_r($data['PFESI']);die(); $i=6; $j=1; $total=0; $overall=0; $totemp = 0; $overallemp = 0; $totemr = 0; $overallemr = 0; foreach($data['PFESI'] as $row){ $this->excel->getActiveSheet()->setCellValue('A' . (string)($i),$j); $this->excel->getActiveSheet()->setCellValue('B' . (string)($i),$row->FName . $row->Lname); $this->excel->getActiveSheet()->setCellValue('C' . (string)($i),$row->ESI); $this->excel->getActiveSheet()->setCellValue('D' . (string)($i),number_format($row->EmployeeESI,2,'.','')); $this->excel->getActiveSheet()->getStyle('D'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->getStyle('D'.(string)($i))->getNumberFormat()->setFormatCode('0.00'); $this->excel->getActiveSheet()->setCellValue('E' . (string)($i),number_format($row->CompanyESI,2,'.','')); $this->excel->getActiveSheet()->getStyle('E'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->getStyle('E'.(string)($i))->getNumberFormat()->setFormatCode('0.00'); $this->excel->getActiveSheet()->setCellValue('C' . (string)($i+1),'Total'); $this->excel->getActiveSheet()->setCellValue('F' . (string)($i),number_format($row->NoofDaysWorked,2,'.','')); $this->excel->getActiveSheet()->getStyle('F'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->setCellValue('G' . (string)($i),number_format($row->OTperHours,2,'.','')); $this->excel->getActiveSheet()->getStyle('G'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $total = $row->EmployeeESI + $row->CompanyESI; $overall=$overall + $total; $totemp = $row->EmployeeESI; $totemr = $row->CompanyESI; $overallemp = $overallemp + $totemp; $overallemr = $overallemr + $totemr; $this->excel->getActiveSheet()->setCellValue('H' . (string)($i),($total)); $this->excel->getActiveSheet()->getStyle('H'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->getStyle('H'.(string)($i))->getNumberFormat()->setFormatCode('0.00'); $this->excel->getActiveSheet()->setCellValue('D' . (string)($i+1),($overallemp)); $this->excel->getActiveSheet()->setCellValue('E' . (string)($i+1),($overallemr)); $this->excel->getActiveSheet()->setCellValue('H' . (string)($i+1),($overall)); $this->excel->getActiveSheet()->getStyle('H'.(string)($i+1))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->getStyle('H'.(string)($i+1))->getNumberFormat()->setFormatCode('0.00'); //$this->excel->getActiveSheet()->setCellValue('A6','HI'); $i++; $j++; } $this->excel->getActiveSheet()->getProtection()->setSheet(true); $this->excel->getActiveSheet()->getProtection()->setSort(true); $this->excel->getActiveSheet()->getProtection()->setInsertRows(true); $this->excel->getActiveSheet()->getProtection()->setFormatCells(true); $filename='EmployeeESIReport'.$payon.'xls'; header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="'.$filename.'"'); header('Cache-Control: max-age=0'); $objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5'); $objWriter->save('php://output'); } } if(empty($excel)){ // $php = $this->output->get_output(); // Load library // $this->load->library('dompdf_gen'); // require_once(APPPATH .'third_party/dompdf/dompdf_config.inc.php'); // $dompdf = new DOMPDF(); // $dompdf->set_paper('A4', 'portrait'); // $dompdf->load_html($php); // $dompdf->render(); // // add the header // $canvas = $dompdf->get_canvas(); // $font = Font_Metrics::get_font("helvetica", "bold"); // // the same call as in my previous example // $canvas->page_text(72, 18,"", // $font, 6, array(0,0,0)); // $dompdf->stream($filename); //echo "PDF PART 2"; $mpdf=new mPDF('utf-8','A4-P',10, 12,12, 10, 10, 38, 4, 6); $HTMLFooter = $this->load->view('includes/bankreport_footer',$data, true); $mpdf->SetDisplayMode('fullpage'); $mpdf->SetHTMLHeader($HtmlHeading); //$html = $this->load->view("bankreportprint",$data,true); $mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}"); $mpdf->setTitle('Sidharthindustries:PayrollReport'); // $mpdf->setFooter("Page {PAGENO} of {nb}"); $mpdf->list_indent_first_level = 1; $mpdf->setAutoTopMargin = 'stretch'; $mpdf->setAutoBottomMargin = 'stretch'; $mpdf->WriteHTML($HTML); $mpdf->Output("".$filename.'.pdf','I',$php); } } function loadLoanReport() { $currentyear = ''; $nxtyear = ''; $eid = $this->uri->segment(3); $fyr = $this->uri->segment(4); if(!empty($eid) and !empty($fyr) and !is_numeric($eid) and !($fyr =='Overall')) { //echo "EMPLOYEE WITH FINYEAR"; $currentyear = substr($fyr,0,4); $nxtyear = substr($fyr,5,4); $data['fyear'] = $currentyear.'-'.$nxtyear; $data['loanrecords'] = $this->payroll_model->getLoanReportforEmp($eid,$currentyear,$nxtyear,'emp'); $data['selsource'] = $eid; } else if(!empty($eid) and !empty($fyr) and $fyr=='Overall') { // echo "EMPLOYEE WITH OVERALL"; $data['fyear'] = "Overall"; $currentyear =''; $nxtyear = ''; $data['loanrecords'] = $this->payroll_model->getLoanReportforEmp($eid,$currentyear,$nxtyear,'emp'); $data['selsource'] = $eid; } else if(is_numeric($eid)) { //echo "LOAN HISTORY"; $currentyear =''; $nxtyear = ''; $data['selsource'] = $eid; $data['fyear'] = $currentyear.'-'.$nxtyear; $data['childdata'] = $this->payroll_model->getLoanReportforEmp($eid,$currentyear="",$nxtyear="",'history'); } else { if(empty($this->input->post('finyear'))) { //echo "DEFAULT LOAD"; $year = date("Y"); $month = date("m"); $currentyear = ''; $nxtyear = ''; $source = $this->input->post('source'); $data['selsource'] = 'Company'; } else { if(!empty($this->input->post('finyear'))) { //echo "FIN YEAR WITH SOURCE"; $source = $this->input->post('source'); $data['selsource'] =$source; $finyear = $this->input->post('finyear'); $currentyear = substr($finyear,0,4); $nxtyear = substr($finyear,5,4); $data['fyear'] = $currentyear.'-'.$nxtyear; } } // echo $currentyear.'-'.$nxtyear; // echo "Company"; $data['loanrecords'] = $this->payroll_model->getLoanReport($source,$currentyear,$nxtyear); // print_r($data['loanrecords']); } $data['loanemployees'] = $this->payroll_model->getEmpDetailsforLoan(); $this->global['pageTitle'] = $this->CompanyName.' : Loan Reports'; $this->loadViews("loanreports", $this->global,$data, NULL); } /** * This function used to load the first screen of the user */ public function viewUpload2() { $this->global['pageTitle'] = $this->CompanyName.' : Payroll Data Upload2'; $this->loadViews("payslipupload2", $this->global, NULL); } public function monthlyInputs() { $current = date("m-Y"); //echo $current; $data['month'] = $this->monthlypay_model->monthlyListing($current); // $data['fresh'] = $this-> monthlypay_model->getEmpPayDetails($current); $data['dropdownvalue'] = $current; $data['fresh'] = $this->monthlypay_model->getEmpPayDetailsforMonthInputs($current); $employeeSalary = []; foreach($data['fresh'] as $value){ $NoofDays=$value->NoofDays;//Month day 30,31,28 $HRA_Amount = $value->HRA_Amount; $Basic_Pay = $value->Basic_Pay; $TotalSalary = $value->TotalSalary; $Food_Allowances= $value->Food_Allowances; $Days_worked = $value->Days_worked; // working day $LOP_Days = $value->LOP_Days; // not working day $Paid_leave = $value->Paid_leave; // leave day $OT_Hrs_Worked = $value->OT_Hrs_Worked; //OT hours $Monthly_Due = $value->Monthly_Due;// AUTO LOAN DUE $Loan_Recovered = $value->Loan_Recovered; //MANUAL LOAN DUE $MasterIncentives=$value->MasterIncentives;//Master values get // echo 'master'.$MasterIncentives; $due_start_date = $value->DueDate; $paydate = $current;//From POST parm $pmonth = substr($paydate,0,2); $pyear = substr($paydate,-4); $pday=cal_days_in_month(CAL_GREGORIAN,$pmonth,$pyear); $paymonth = $pyear.'-'.$pmonth.'-'.$pday; $Loan_amount = $value->Loan_Amount; $Paid_Amount = $value->Paid_Amount; $Balance_Amount = $Loan_amount - $Paid_Amount; $loan=0; if($Loan_Recovered =='NA'){ $loan=0.00; } else if($Loan_Recovered == 0.00) { if(strtotime($due_start_date) <= strtotime($paymonth)) { $loan=$Monthly_Due; } } else if($Loan_Recovered >= 0.00) { if(strtotime($due_start_date) <= strtotime($paymonth)) { $loan = $Loan_Recovered; } } if($Monthly_Due > $Balance_Amount) { // current= Balance_Amount - autoLoan; //alert('hi'); $loan = $Balance_Amount; } $Allowances =$value->Allowances; $HRA_Rate=$value->HRA_Rate; $PF_Rate=$value->PF_Rate; $ESI_Rate=$value->ESI_Rate; $MonthIncentive = $value->MonthlyIncentives;//T_Monthly_Pay_Inputs,for change month $Incentive = 0; if(empty($MonthIncentive)) { $Incentive = $MasterIncentives; } else { $Incentive = $MonthIncentive; } // echo $Incentive; $daySalarys = $Days_worked + $Paid_leave; //echo "hra amount";print_r(array($HRA_Amount,$Basic_Pay,$totalsalary)); //$Allowances = $allowances * $values; $dayFood_Allowance = $Food_Allowances * $Days_worked; $daySalary = $Basic_Pay / $NoofDays; /**per day salary working hour**/ //echo $daySalary.'
'; $dayHra = $HRA_Amount / $NoofDays; /** per day hra amount **/ //echo $dayHra.'
'; $onehoursSalary = ($daySalary + $dayHra) / 8; /**one hour salay ot calculation**/ if ($OT_Hrs_Worked != 0) { $totSalayOT = $OT_Hrs_Worked * $onehoursSalary; } else { $totSalayOT = 0; } $currentDaySalary = $daySalary * $daySalarys; /** current day salary working days calculation**/ $currentDayHra = $dayHra * $daySalarys; /** total working days hra calculations**/ // echo $currentDayHra.'
'; $currentDatePF = $currentDaySalary + $currentDayHra + $totSalayOT; /** current date pf calculation**/ if ($TotalSalary <= 20000) { $esiAmount = $currentDatePF * $ESI_Rate/ 100; /** esiamount not elgiable for 20000 **/ } else { $esiAmount = 0; } $pfAmount = $currentDaySalary * $PF_Rate/ 100; /** pf amount per day**/ //echo $totalothour;die; $empSalaryAdd = $currentDaySalary + $totSalayOT + $currentDayHra + $dayFood_Allowance + $Allowances + $Incentive; $empSalarySub = $esiAmount + $pfAmount + $loan; $salaryInCurrentday= $empSalaryAdd - $empSalarySub; $employeeSalary []= round($salaryInCurrentday); } $data['empSalary'] = $employeeSalary; //echo sizeof($data['fresh'])."-".sizeof($data['empSalary']);die; $this->global['pageTitle'] = $this->CompanyName.' : Payroll Monthly Inputs'; $this->loadViews("monthlypayinputs", $this->global,$data,NULL); } function changeMonth() { $current = $this->input->post('monthyear'); $data['month'] = $this->monthlypay_model->monthlyListing($current); //print_r($data['month']); $data['dropdownvalue'] = $current; $data['fresh'] = $this->monthlypay_model->getEmpPayDetailsforMonthInputs($current); //print_r($data['fresh']); $employeeSalary = []; foreach($data['fresh'] as $value){ //print_r($value); //die(); $NoofDays=$value->NoofDays;//Month day 30,31,28 $HRA_Amount = $value->HRA_Amount; $Basic_Pay = $value->Basic_Pay; $TotalSalary = $value->TotalSalary; $Food_Allowances= $value->Food_Allowances; $Days_worked = $value->Days_worked; // working day $LOP_Days = $value->LOP_Days; // not working day $Paid_leave = $value->Paid_leave; // leave day $OT_Hrs_Worked = $value->OT_Hrs_Worked; //OT hours $Monthly_Due = $value->Monthly_Due;// AUTO LOAN DUE $due_start_date = $value->DueDate; $paydate = $current;//From POST parm if(strlen($paydate) == 6) { $paydate = '0'.$paydate; } $pmonth = substr($paydate,0,2); $pyear = substr($paydate,-4); $pday=cal_days_in_month(CAL_GREGORIAN,$pmonth,$pyear); $paymonth = $pyear.'-'.$pmonth.'-'.$pday; $Loan_Recovered = $value->Loan_Recovered; //MANUAL LOAN DUE $MasterIncentives=$value->MasterIncentives;//Master values get // echo 'master'.$MasterIncentives; $Loan_amount = $value->Loan_Amount; $Paid_Amount = $value->Paid_Amount; $Balance_Amount = $Loan_amount - $Paid_Amount; $loan=0; if($Loan_Recovered =='NA'){ $loan=0.00; } else if($Loan_Recovered == 0.00) { if(strtotime($due_start_date) <= strtotime($paymonth)) { $loan=$Monthly_Due; } } else if($Loan_Recovered >= 0.00) { if(strtotime($due_start_date) <= strtotime($paymonth)) { $loan = $Loan_Recovered; } } if($Monthly_Due > $Balance_Amount) { // current= Balance_Amount - autoLoan; //alert('hi'); $loan = $Balance_Amount; } $Allowances =$value->Allowances; $HRA_Rate=$value->HRA_Rate; $PF_Rate=$value->PF_Rate; $ESI_Rate=$value->ESI_Rate; $MonthIncentive = $value->MonthlyIncentives;//T_Monthly_Pay_Inputs,for change month $Incentive = 0; if(empty($MonthIncentive)) { $Incentive = $MasterIncentives; } else { $Incentive = $MonthIncentive; } // echo $Incentive; $daySalarys = $Days_worked + $Paid_leave; //echo "hra amount";print_r(array($HRA_Amount,$Basic_Pay,$totalsalary)); //$Allowances = $allowances * $values; $dayFood_Allowance = $Food_Allowances * $Days_worked; $daySalary = $Basic_Pay / $NoofDays; /**per day salary working hour**/ //echo $daySalary.'
'; $dayHra = $HRA_Amount / $NoofDays; /** per day hra amount **/ //echo $dayHra.'
'; $onehoursSalary = ($daySalary + $dayHra) / 8; /**one hour salay ot calculation**/ if ($OT_Hrs_Worked != 0) { $totSalayOT = $OT_Hrs_Worked * $onehoursSalary; } else { $totSalayOT = 0; } $currentDaySalary = $daySalary * $daySalarys; /** current day salary working days calculation**/ $currentDayHra = $dayHra * $daySalarys; /** total working days hra calculations**/ // echo $currentDayHra.'
'; $currentDatePF = $currentDaySalary + $currentDayHra + $totSalayOT; /** current date pf calculation**/ if ($TotalSalary <= 20000) { $esiAmount = $currentDatePF * $ESI_Rate/ 100; /** esiamount not elgiable for 20000 **/ } else { $esiAmount = 0; } $pfAmount = $currentDaySalary * $PF_Rate/ 100; /** pf amount per day**/ //echo $totalothour;die; $empSalaryAdd = $currentDaySalary + $totSalayOT + $currentDayHra + $dayFood_Allowance + $Allowances + $Incentive; $empSalarySub = $esiAmount + $pfAmount + $loan; $salaryInCurrentday= $empSalaryAdd - $empSalarySub; $employeeSalary []= round($salaryInCurrentday); } $data['empSalary'] = $employeeSalary; //echo sizeof($data['fresh'])."-".sizeof($data['empSalary']);die; $this->global['pageTitle'] = $this->CompanyName.' : Payroll Monthly Inputs'; $this->loadViews("monthlypayinputs", $this->global,$data,NULL); } function saveMonthlyData() { $month = $this->input->post('param2'); $jsondata =$this->input->post('param1'); $json = json_decode($jsondata,true); $mon=''; $year=''; if(strlen($month) == 7) { //echo "SEVEN"; $mon = substr($month,0,2); $year = substr($month,3); } else { //echo "NOT SEVEN"; $mon = substr($month,0,1); $year = substr($month,2); if((int)$mon < 10) { $mon = '0'.$mon; } } $month = $mon ."-". $year; //echo $month;die(); $total = 0; $ErrorEmpId = ''; $TotalErrorFlag = 0; $i = sizeof($json); $len = $i-2; foreach($json as $index=>$j) { if($index<=$len){ $ErrorFlag = 0; $Emp = $j['Employee']; $EmpID = substr($Emp,0,4); //$Name = $j['Employee Name']; //echo $EmpID; die; $DaysWorked = $j['Days Worked']; $LOP_Days = $j['LOP Days']; $Paid_leave = $j['Paid Leave']; $OT_Hrs_Worked = $j['OT Hrs']; $Loan_Recovered = $j['Manual Loan Due ₹']; $Incentives = $j['Incentives in ₹']; $Festival_Bonus = $j['Festival Bonus in ₹']; $Other_Deductions = $j['Other Deductions in ₹']; $Estimate =$j['Estimate in ₹']; $Created_By = $this->session->userdata ( 'userId' ); if(!is_numeric($DaysWorked) || ($DaysWorked > 31) || (strlen((string)$DaysWorked)) > 5 ) { //echo $EmpID . "-LOP_Days Invalid Data!"; $ErrorFlag++; } if(!is_numeric($LOP_Days) || ($LOP_Days > 31) || (strlen((string)$LOP_Days)) > 5 ) { //echo $EmpID . "-LOP_Days Invalid Data!"; $ErrorFlag++; } if(!is_numeric($Paid_leave) || ($Paid_leave > 31) || (strlen((string)$Paid_leave)) > 5) { //echo $EmpID . "-Paid Leave Invalid Data!"; $ErrorFlag++; } $OT_Hrs_Worked_first = explode(".",$OT_Hrs_Worked); if(!is_numeric($OT_Hrs_Worked) || (strlen((string)$OT_Hrs_Worked))>6 || (strlen((string)$OT_Hrs_Worked_first[0])) >= 4)// || (strlen((string)$OT_Hrs_Worked_first[1]))> 3 ) { //echo $EmpID . "-OT Hrs Invalid Data!"; $ErrorFlag++; } if(is_numeric($Loan_Recovered)){ $Loan_Recovered_first = explode(".",$Loan_Recovered); if((strlen((string)$Loan_Recovered))>8 || (strlen((string)$Loan_Recovered_first[0]))> 5) { //echo $EmpID . "-Loan Recoverd Invalid Data!"; $ErrorFlag++; } } else if(is_string($Loan_Recovered)) { //echo "STRING"; if(strcasecmp($Loan_Recovered,'NA')) { //echo "NOT NA"; $ErrorFlag++; } } $Incentives_first = explode(".",$Incentives); if(!is_numeric($Incentives) || (strlen((string)$Incentives))>8 || (strlen((string)$Incentives_first[0]))> 5) { //echo $EmpID . "-Loan Recoverd Invalid Data!"; $ErrorFlag++; } $Festivalbonus_first = explode(".",$Festival_Bonus); if(!is_numeric($Festival_Bonus) || (strlen((string)$Festival_Bonus))>8 || (strlen((string)$Festivalbonus_first[0]))> 5) { $ErrorFlag++; } $Other_Deductions_first = explode(".",$Other_Deductions); if(!is_numeric($Other_Deductions) || (strlen((string)$Other_Deductions))>8 || (strlen((string)$Other_Deductions_first[0]))> 5) { //echo $EmpID . "-Loan Recoverd Invalid Data!"; $ErrorFlag++; } $Estimate_first = explode(".",$Estimate); if(!is_numeric($Estimate) || (strlen((string)$Estimate))>8 || (strlen((string)$Estimate_first[0]))> 5) { //echo $EmpID . "-Loan Recoverd Invalid Data!"; $ErrorFlag++; } if($ErrorFlag != 0) { //echo $EmpID ."- has Invalid Data!"; $ErrorEmpId = $ErrorEmpId ."|". $EmpID; $TotalErrorFlag++; } else//if($ErrorFlag == 0) { //nothing } } } if($TotalErrorFlag == 0) { foreach($json as $index=>$j) { $Emp = $j['Employee']; $EmpID = substr($Emp,0,4); //$Name = $j['Employee']; $DaysWorked = $j['Days Worked']; $LOP_Days = $j['LOP Days']; $Paid_leave = $j['Paid Leave']; $OT_Hrs_Worked = $j['OT Hrs']; $Loan_Recovered = $j['Manual Loan Due ₹']; if(is_string($Loan_Recovered)) { $Loan_Recovered = strtoupper($Loan_Recovered); } $Incentives = $j['Incentives in ₹']; $Festival_Bonus = $j['Festival Bonus in ₹']; $Other_Deductions = $j['Other Deductions in ₹']; $Estimate =$j['Estimate in ₹']; $Created_By = $this->session->userdata ( 'userId' ); $monthlypaydata = array('Month_Year'=>$month,'EmpID'=>$EmpID,'Days_worked'=>$DaysWorked,'LOP_Days'=>$LOP_Days,'Paid_leave'=>$Paid_leave,'OT_Hrs_Worked'=>$OT_Hrs_Worked,'Loan_Recovered'=>$Loan_Recovered,'Incentives'=>$Incentives,'Festival_Bonus'=>$Festival_Bonus,'Other_Deductions'=>$Other_Deductions,'Estimate'=>$Estimate,'Created_By'=>$Created_By); //print_r($monthlypaydata); $result = $this->monthlypay_model->saveMonthlyData_model($monthlypaydata); $total = $total + $result; } } $total = $total -1; //echo ""; if(!empty($ErrorEmpId)) { echo $ErrorEmpId . "- are have Invalid Data!"; } echo $total . "- Employees Updated Successfully "; } function payslipLisiting() { $curr_year = date('Y'); $curr_month =date('m'); $curr_monthyear = $curr_month.'-'.$curr_year; $this->global['pageTitle'] = $this->CompanyName.' : Payslip Listing'; $data['PayInfo'] = $this->payroll_model->GetPayslipdata(); $data['dropdownvalue'] = $curr_monthyear; $this->loadViews("paysliplist", $this->global, $data , NULL); } function reload_paysliplist() { $pre_monthyear = $this->input->post('month'); $this->global['pageTitle'] = $this->CompanyName.' : Payslip Listing'; $data['PayInfo'] = $this->payroll_model->GetPayslipdata($pre_monthyear); $data['dropdownvalue'] = $pre_monthyear; $this->loadViews("paysliplist", $this->global, $data , NULL); } function editPayslip($EmpID,$PayOn) { $this->global['pageTitle'] = $this->CompanyName.' : Edit Employee Payslip'; $data['PayInfo'] = $this->payroll_model->GetPayslipdata($PayOn,$EmpID); $this->loadViews("editPayslip", $this->global, $data , NULL); } public function viewGenerator() { $Data['Payon'] = $this->payroll_model->getPayOn(); $this->global['pageTitle'] = $this->CompanyName.' : Payroll Generater'; $this->loadViews("payslipgenerate", $this->global, $Data , NULL); } /* Validation for Employee Dropdown */ function Employee_validate($selectValue) { //echo 'select_validate method called'; // 'none' is the first option and the text says something like "-Choose one-" if($selectValue == '-1') { $this->form_validation->set_message('Employee_validate', 'Please Select Employee.'); return false; } else // user picked something { return true; } } function getEmployee() { $id = $this->input->post('id1'); $result = $this->payroll_model->getEmployeelist2($id ); $HTML=""; if($result->num_rows() > 0){ foreach($result->result() as $list){ $HTML.=""; } } echo $HTML; } /* Validation for PayOn Dropdown */ function PayOn_validate($selectValue) { //echo 'select_validate method called'; // 'none' is the first option and the text says something like "-Choose one-" if($selectValue == '-1') { $this->form_validation->set_message('PayOn_validate', 'Please Select PayOn.'); return false; } else // user picked something { return true; } } /** * This function used to load the first screen of the user */ public function PrintPdf() { $filename=" "; $html=""; $All = $this->input->post('All'); if($All == '') { $this->form_validation->set_rules('Employee','Employee','trim|callback_Employee_validate'); } $this->form_validation->set_rules('PayOn','PayOn','trim|callback_PayOn_validate'); if($this->form_validation->run() == FALSE) { $this->viewGenerator(); } else { $Payon = $this->input->post('PayOn'); $m =date("M", mktime(0, 0, 0, $Payon, 10)); //$y =date("Y",mktime(0, 0, 0, $Payon, 10)); //$m=date("M-Y",mktime(0,0,0,$month,1,$year)); $y=substr($Payon,3); //echo "Payon" . $Payon; if($All != '') { $filename='PayslipFor-'.$m.'-'.$y; $result = $this->payroll_model->getEmpAll($Payon); // print_r($result); // die(); if($result > 0 ) { for($i=0; $ipayroll_model->GetPayslipdata($Payon,$EmpID); // $totalsalary =$Data['PayDetails'][0]->LessAdvance; $totalsalaryinwords = $this->convertNumber(round($totalsalary)); $Data['amtinwords']=$totalsalaryinwords; // print_r ($Data); // exit(); //$Data['Count'] = $i; $html.=$this->load->view("payslipgenerateprint", $Data,true ); // print_r ($Data); // exit(); } } } else { $EmpID = $this->input->post('Employee'); //echo "EmpID" . $EmpID; $Data['PayDetails'] = $this->payroll_model->GetPayslipdata($Payon,$EmpID); $fname=$Data['PayDetails'][0]->FName; $filename='PayslipFor-'.$EmpID.' '.$fname.' '.$m.' '.$y; $totalsalary =$Data['PayDetails'][0]->LessAdvance; $totalsalaryinwords = $this->convertNumber(round($totalsalary)); $Data['amtinwords']=$totalsalaryinwords; //print_r ($Data); //exit(); $html=$this->load->view("payslipgenerateprint", $Data,true ); } // $php = $this->output->get_output(); // // Load library // $this->load->library('dompdf_gen'); // if($All != '') // { // $filename = 'Payslip-'.$Payon.'.pdf' ; // } // else // { // $filename = 'Payslip-'.$EmpID . '-' .$Payon.'.pdf' ; // } // require_once(APPPATH .'third_party/dompdf/dompdf_config.inc.php'); // $dompdf = new DOMPDF(); // $dompdf->set_paper('A4', 'portrait'); // $dompdf->load_html($php); // $dompdf->render(); // // add the header // $canvas = $dompdf->get_canvas(); // $font = Font_Metrics::get_font("helvetica", "bold"); // // the same call as in my previous example // $canvas->page_text(72, 18, "Page: {PAGE_NUM} of {PAGE_COUNT}", // $font, 6, array(0,0,0)); // $dompdf->stream($filename); // } $mpdf=new mPDF('utf-8','A4-P',10, 10,10, 10, 10, 24, 4, 6); $mpdf->SetDisplayMode('fullpage'); $mpdf->SetHTMLHeader($HtmlHeading); $mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}"); $mpdf->setFooter("Page {PAGENO} of {nb}"); $mpdf->list_indent_first_level = 1; $mpdf->setAutoTopMargin = 'stretch'; $mpdf->setAutoBottomMargin = 'stretch'; $mpdf->WriteHTML($html); $mpdf->SetTitle('Sidharthindustries:Payslip'); $mpdf->Output("".$filename.'.pdf','I',$php); } } function updatePayslip() { $paykey = $this->input->post("Key"); $EmpID = $this->input->post("EmpID"); $PayOn = $this->input->post("PayOn"); $otherallowence = $this->input->post("otherallowence"); $otherdeductions = $this->input->post("otherdeductions"); $incentive = $this->input->post("incentive"); $netpay = $this->input->post("netpay"); $esi = $this->input->post("txtesi"); $pf = $this->input->post("txtpf"); $basic = $this->input->post("txtbasicda"); $hra = $this->input->post("txthra"); $otsalary = $this->input->post("otsalary"); $Totaldeduction = $esi + $pf + $otherdeductions; $SalaryAsPerPF = ($basic + $hra + $otsalary) - $Totaldeduction; $userid = $this->session->userdata ( 'userId' ); $remarks = 'Manual Edit By' . $userid ." On " . date('Y-m-d'); $paydetails = array('Key'=>$paykey,'EmpID'=>$EmpID,'PayOn'=>$PayOn,'Other_allowances'=>$otherallowence,'OtherDeductions'=>$otherdeductions,'Incentive'=>$incentive,'LessAdvance'=>$netpay,'TotalSalary'=>$netpay,'SalaryAsPerPF'=>$SalaryAsPerPF,'Totaldeduction'=>$Totaldeduction,'remarks'=>$remarks); $monthdetails = array('Month_Year'=>$PayOn,'Other_Deductions'=>$otherdeductions,'Incentives'=>$incentive); $result = $this->payroll_model->updateEmpPayslip($paydetails); $res = $this->monthlypay_model->editmonth($monthdetails,$EmpID); echo $result; } /** * This function used to upload the Excel file Details */ /** * This function used to upload the Excel file Details2 */ function uploadExcel2(){ $PayrollFileName = ''; //Check whether user upload picture if(!empty($_FILES['userfile']['name'])) { $pathinfo = pathinfo($_FILES['userfile']['name']); $config['upload_path'] = 'uploads/files/'; $config['allowed_types'] = 'xls|xlsx|csv'; $config['file_name'] = $_FILES['userfile']['name']; $config['overwrite'] = true; //Load upload library and initialize configuration $this->load->library('upload',$config); $this->upload->initialize($config); if (($pathinfo['extension'] == 'xlsx' || $pathinfo['extension'] == 'xls') && $_FILES['userfile']['size'] > 0 ) { if($this->upload->do_upload('userfile')) { $uploadData = $this->upload->data(); $PayrollFileName = $uploadData['file_name']; } else { $error = array('error' => $this->upload->display_errors()); $PayrollFileName = ''; } $inputFileName = $_FILES['userfile']['tmp_name']; require_once APPPATH .'third_party/PHPExcel/IOFactory.php'; $objTpl = PHPExcel_IOFactory::load($inputFileName); $sheet = $objTpl->getActiveSheet(0) ;//->toArray(null, NULL, True, True); $highestRow = $sheet->getHighestRow(); $highestColumn = $sheet->getHighestColumn(); $x = 8; $month=$this->input->post('mon'); $year=$this->input->post('yr'); $PayOn= $month . "-" . $year; $createdby = $this->session->userdata ( 'userId' ); if($month=='01' || $month=='03' || $month=='05' || $month=='07' || $month=='08' || $month=='10' || $month=='12') { $Totaldays = 31; } else if($month=='04' || $month=='06' || $month=='09' || $month=='11'){ $Totaldays = 30; } else{ $Totaldays = 28; } // $Totaldays = 0; //echo $highestRow; $FileDetails = array('PayOn'=>$PayOn,'TotalNoofDays'=>$Totaldays,'FileName'=> $config['file_name'],'CreatedBy'=>$createdby); $result = $this->payroll_model->UploadFileName($FileDetails); $emplid=$this->payroll_model->getEmpID($q=''); $payEmpID=$this->payroll_model->getEmpIDfromPayData(); //print_r($payEmpID);die(); $nopaydata=0; $nopayid=''; $nopayrowid=''; $Unknowncount=0; $Unknown=""; $row=""; $d=array("-1"=>""); $fail=0; $success=0; for($x=8;$x<=$highestRow;$x++){ $EmpId = $sheet->getCell('A'.$x)->getValue(); /**** For Check Uploading EmpID existing in Employee Details(Valid or Not) *****/ $flag=0; foreach($emplid as $e){ if(strtoupper($EmpId) == $e->EmpID){ $flag++; } } if($flag==0){ $Unknowncount++; $Unknown.='-'.$EmpId; $row.='-'.$x; } /***** For Check Uploading EmpID existing in Emp Pay Data Details(Whether master pay data available or not) *****/ if($flag != 0) { $flag2=0; foreach($payEmpID as $p) { if(strtoupper($EmpId) == $p->EmpID) { $flag2++; } } if($flag2==0) { $nopaydata++; $nopayid.='-'.$EmpId; $nopayrowid.='-'.$x; } } $FileDataExists = $this->payroll_model->checkFileDetailsExists2($PayOn,$EmpId); if ($FileDataExists=='' || $FileDataExists==0) { $EmpId = $sheet->getCell('A'.$x)->getValue(); $EmpId=strtoupper($EmpId); $Days_worked = $sheet->getCell('C'.$x)->getValue(); $LOPDays = $sheet->getCell('D'.$x)->getValue(); $Paid_leave =$sheet->getCell('E'.$x)->getValue(); $OTHoursWorked =$sheet->getCell('F'.$x)->getValue(); $LoanRecovered=$sheet->getCell('G'.$x)->getValue(); if(is_string($loanRecovered)) { $loanRecovered = strtoupper($loanRecovered); } $Incentive =$sheet->getCell('G'.$x)->getValue(); $Other_Deductions =$sheet->getCell('H'.$x)->getValue(); if( $EmpId != '') { if($flag!=0 && $flag2!=0){ $FileData = array('Month_Year'=>$PayOn,'EmpID'=>$EmpId,'Days_worked'=>$Days_worked,'LOP_Days'=>$LOPDays,'Paid_leave'=>$Paid_leave,'OT_Hrs_Worked'=>$OTHoursWorked,'Loan_Recovered'=>$loanRecovered,'Incentives'=>$Incentive,'Other_Deductions'=>$Other_Deductions,'Created_By'=>$createdby,'Created_Time'=>date("Y-m-d h:i:sa")); $result = $this->payroll_model->UploadFileData2($FileData); $success++; } //} } } else{ $fail++;} } //End of For Loop echo ""; echo ""; echo ""; echo ""; echo "";//redirect('payslip/viewUpload2'); } else { echo ""; } } else { echo ""; } } function checkExistPay() { $empid = $this->input->post('employee'); $payon = $this->input->post('payon'); $result = $this->payroll_model->checkExistPayData($empid,$payon); echo json_encode(count($result)); } function pageNotFound() { $this->global['pageTitle'] = 'CodeInsect : 404 - Page Not Found'; $this->loadViews("404", $this->global, NULL, NULL); } function convertNumber($amt){ $ShowPaise='0'; $totalAmt=explode(".",$amt); $number = $totalAmt[0]; $no = $number; if(!empty($totalAmt[1]) && $totalAmt[1]!=0){ $point = $totalAmt[1]; $ShowPaise='1'; } else{ $point=0; $ShowPaise='0'; } $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' => 'Fourty', '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 > 1) ? '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] : ''; if($ShowPaise=='0'){ $amountInWords = "Rupees " . $result." Only"; } else{ $amountInWords = "Rupees " . $result ." Paise ". $points." Only"; } return $amountInWords; } function Bonusreport() { //echo"function in controller"; $this->global['pageTitle'] = $this->CompanyName.' : Incentive and Bonus Reports'; $fin_year = $this->input->post('finyear'); //echo "values are,".$year.$fin_year; $data['finyear'] = $fin_year; $data['Reportvalue'] = $this->monthlypay_model->reportvalue($fin_year); $this->loadViews("Bonusreport", $this->global,$data,NULL); } function MonthwiseBonusreport() { //echo"in controller"; $EmployeeID = $_GET['EID']; $Fin_year = $_GET['Finyear']; $data['finyear'] = $Fin_year; //echo $EmployeeID; //echo $Fin_year; $this->global['pageTitle'] = $this->CompanyName.' : Monthwise Incentive and Bonus Reports'; $data['MonthwiseReport'] = $this->monthlypay_model->Monthwisereportvalue($Fin_year,$EmployeeID); //print_r($data['MonthwiseReport']); $this->loadViews("Bonusreportmonthwise", $this->global,$data,NULL); } function ValidationCheque(){ $bank = $this->input->post("id1"); $payon = $this->input->post("id2"); $result = $this->payroll_model->getChequeInfo($bank,$payon); $count = count($result); echo $count; } } ?>