From b4c0330d8a5f61b96e245b9944a72a4ae0272aed Mon Sep 17 00:00:00 2001 From: velz2020 Date: Sat, 11 Nov 2017 18:08:08 +0530 Subject: [PATCH] ATTENDANCE LOAN REPORT MODULES --- application/config/routes.php | 3 + application/controllers/emppaydate.php | 78 +- application/controllers/monthlypay.php | 157 +++- application/controllers/payslip.php | 143 +++- application/models/emppaydate_model.php | 32 +- application/models/monthlypay_model.php | 142 +++- application/models/payroll_model.php | 91 +++ application/views/attendance.php | 721 ++++++++++++++++++ application/views/editOldemppay.php | 81 +- application/views/editPayslip.php | 2 +- application/views/includes/header.php | 21 +- application/views/loanreports.php | 386 ++++++++++ application/views/monthlypayinputs.php | 29 +- application/views/publicholidays.php | 242 ++++++ assets/js/jquery.CongelarFilaColumna.js | 633 +++++++++++++++ assets/tabletoexport/jquery.tableexport.v2.js | 85 +++ 16 files changed, 2738 insertions(+), 108 deletions(-) create mode 100644 application/views/attendance.php create mode 100644 application/views/loanreports.php create mode 100644 application/views/publicholidays.php create mode 100644 assets/js/jquery.CongelarFilaColumna.js create mode 100644 assets/tabletoexport/jquery.tableexport.v2.js diff --git a/application/config/routes.php b/application/config/routes.php index 5fec2710..a93eabe7 100755 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -75,6 +75,9 @@ $route['monthlyListings/(:num)'] = "monthlypay/monthlyListing/$1"; $route['emppayListings'] = 'emppaydate/emppayListing'; $route['emppayListings/(:num)'] = 'emppaydate/emppayListing/$1'; +$route['attendance'] = 'monthlypay/attendanceLoad'; +$route['publicholidays'] = 'monthlypay/loadPublicholidays'; +$route['loanreports'] = 'payslip/loadLoanReport'; diff --git a/application/controllers/emppaydate.php b/application/controllers/emppaydate.php index c195a1ae..3f30cdd0 100755 --- a/application/controllers/emppaydate.php +++ b/application/controllers/emppaydate.php @@ -109,12 +109,12 @@ class emppaydate extends BaseController $Loan_Amount=$this->input->post('Loan_Amount'); $Load_Issued_date=$this->input->post('loan_issued_date'); if(!empty($Load_Issued_date)){ - $Load_Issued_date=$this->getDateformat2($Load_Issued_date); + $Load_Issued_date=$Load_Issued_date=date('Y-m-d',strtotime($Load_Issued_date)); }else{$Load_Issued_date=null;} $Due_Amount=$this->input->post('monthly_due'); $Due_Started=$this->input->post('due_started'); if(!empty($Due_Started)){ - $Due_Started=$this->getDateformat2($Due_Started); + $Due_Started=$Due_Started=date('Y-m-d',strtotime($Due_Started)); }else{$Due_Started=null;} @@ -129,22 +129,35 @@ class emppaydate extends BaseController $chked = $this->input->post('is_Active'); $IsActive = '1'; - $emppay = array('EmpID'=>$EmpID,'TotalSalary'=>$Total_Salary,'Basic_Pay'=>$Basic_Pay,'HRA_Rate'=>$HRA_Rate,'HRA_Amount'=>$HRA_Amount,'Allowances'=>$Allowances, 'PF_Rate'=>$PF_Rate, 'ESI_Rate'=>$ESI_Rate ,'Food_Allowances'=>$Food_Allowances,'Loan_Amount'=>$Loan_Amount,'Loan_Issued_Date'=>$Load_Issued_date,'Monthly_Due'=>$Due_Amount,'Due_Start_Date'=>$Due_Started,'No_of_Dues'=>$No_Of_Dues,'Paid_Due'=>$Paid_due,'Remaining_Due'=>$Remaining_Due,'Paid_Amount'=>$Paid_Amount,'Created_By'=>$CreateBy); + $emppay = array('EmpID'=>$EmpID,'TotalSalary'=>$Total_Salary,'Basic_Pay'=>$Basic_Pay,'HRA_Rate'=>$HRA_Rate,'HRA_Amount'=>$HRA_Amount,'Allowances'=>$Allowances, 'PF_Rate'=>$PF_Rate, 'ESI_Rate'=>$ESI_Rate ,'Food_Allowances'=>$Food_Allowances,'Created_By'=>$CreateBy); + $loandetails = array('EmpID'=>$EmpID,'Loan_Amount'=>$Loan_Amount,'Loan_Issued_Date'=>$Load_Issued_date,'Monthly_Due'=>$Due_Amount,'Due_Start_Date'=>$Due_Started,'No_of_Dues'=>$No_Of_Dues,'Paid_Due'=>$Paid_due,'Remaining_Due'=>$Remaining_Due,'Paid_Amount'=>$Paid_Amount,'is_Active'=>1,'Created_By'=>$CreateBy); $result = $this->emppaydate_model->addNewemppay($emppay); - + if($Loan_Amount != 0) + { + $result2 = $this->emppaydate_model->addLoanInfo($loandetails,'add'); + if($result2 > 0) + { + echo ""; + } + else + { + echo ""; + } + } if($result > 0) { - - redirect('emppaydate/emppayListing','refresh'); echo ""; + redirect('emppaydate/emppayListing','refresh'); + } else { - redirect('emppaydate/emppayListing','refresh'); echo ""; + redirect('emppaydate/emppayListing','refresh'); + } //} @@ -214,16 +227,19 @@ class emppaydate extends BaseController $Allowances=$this->input->post('Allowances'); $PF_Rate=$this->input->post('PF_Rate'); $ESI_Rate=$this->input->post('ESI_Rate'); + $loan_ID =$this->input->post('loanid'); $Loan_Amount=$this->input->post('Loan_Amount'); $Load_Issued_date=$this->input->post('loan_issued_date'); - if(!empty($Load_Issued_date)){$Load_Issued_date=$this->getDateformat2($Load_Issued_date);} + if(!empty($Load_Issued_date)){$Load_Issued_date=date('Y-m-d',strtotime($Load_Issued_date));} else{$Load_Issued_date=null;} - + + $Due_Amount=$this->input->post('monthly_due'); $Due_Started=$this->input->post('due_started'); - if(!empty($Due_Started)){$Due_Started=$this->getDateformat2($Due_Started);} + if(!empty($Due_Started)){$Due_Started=date('Y-m-d',strtotime($Due_Started));} else{$Due_Started=null;} + //echo $Load_Issued_date. "-" . $Due_Started;die(); $No_Of_Dues=$this->input->post('no_of_due'); $Paid_due=$this->input->post('paid_due'); @@ -237,10 +253,38 @@ class emppaydate extends BaseController - $emppaydatas = array('Pay_Data_ID'=>$Pay_Data_ID,'EmpID'=>$EmpID,'TotalSalary'=>$TotalSalary,'Basic_Pay'=>$Basic_Pay,'HRA_Rate'=>$HRA_Rate,'HRA_Amount'=>$HRA_Amount,'Allowances'=>$Allowances, 'PF_Rate'=>$PF_Rate, 'ESI_Rate'=>$ESI_Rate ,'Food_Allowances'=>$Food_Allowances,'Loan_Amount'=>$Loan_Amount,'Loan_Issued_Date'=>$Load_Issued_date,'Monthly_Due'=>$Due_Amount,'Due_Start_Date'=>$Due_Started,'No_of_Dues'=>$No_Of_Dues,'Paid_Due'=>$Paid_due,'Remaining_Due'=>$Remaining_Due,'Paid_Amount'=>$Paid_Amount,'Last_Mod_By'=>$Last_Mod_By,'Last_Mod_Time'=>$Last_Mod_Time); + $emppay = array('Pay_Data_ID'=>$Pay_Data_ID,'EmpID'=>$EmpID,'TotalSalary'=>$TotalSalary,'Basic_Pay'=>$Basic_Pay,'HRA_Rate'=>$HRA_Rate,'HRA_Amount'=>$HRA_Amount,'Allowances'=>$Allowances, 'PF_Rate'=>$PF_Rate, 'ESI_Rate'=>$ESI_Rate ,'Food_Allowances'=>$Food_Allowances,'Last_Mod_By'=>$Last_Mod_By); + $loandetails = array('Loan_ID'=>$loan_ID,'EmpID'=>$EmpID,'Loan_Amount'=>$Loan_Amount,'Loan_Issued_Date'=>$Load_Issued_date,'Monthly_Due'=>$Due_Amount,'Due_Start_Date'=>$Due_Started,'No_of_Dues'=>$No_Of_Dues,'Paid_Due'=>$Paid_due,'Remaining_Due'=>$Remaining_Due,'Paid_Amount'=>$Paid_Amount,'is_Active'=>1,'Last_Mod_By'=>$Last_Mod_By); - $result = $this->emppaydate_model->editemppay($emppaydatas); + if($Loan_Amount != 0 and $loan_ID !='') + { + $result2 = $this->emppaydate_model->addLoanInfo($loandetails,'update'); + if($result2 > 0) + { + echo ""; + } + else + { + echo ""; + } + } + else if($Loan_Amount != 0 and $loan_ID == '') + { + $loandetails = array('EmpID'=>$EmpID,'Loan_Amount'=>$Loan_Amount,'Loan_Issued_Date'=>$Load_Issued_date,'Monthly_Due'=>$Due_Amount,'Due_Start_Date'=>$Due_Started,'No_of_Dues'=>$No_Of_Dues,'Paid_Due'=>$Paid_due,'Remaining_Due'=>$Remaining_Due,'Paid_Amount'=>$Paid_Amount,'is_Active'=>1,'Created_By'=>$Last_Mod_By); + $result2 = $this->emppaydate_model->addLoanInfo($loandetails,'add'); + if($result2 > 0) + { + echo ""; + } + else + { + echo ""; + } + } + + + $result = $this->emppaydate_model->editemppay($emppay); if($result == true) @@ -260,6 +304,7 @@ class emppaydate extends BaseController } } + function deleteEmpPay() @@ -287,14 +332,7 @@ class emppaydate extends BaseController $this->loadViews("404", $this->global, NULL, NULL); } - function getDateformat2($Val) - { - $date = new DateTime($Val,new DateTimeZone('Asia/Kolkata')); - - $retDate = $date->format('d-m-Y'); - - return $retDate; - } + function getDateformat($Val) { diff --git a/application/controllers/monthlypay.php b/application/controllers/monthlypay.php index 088ae2a4..87722165 100755 --- a/application/controllers/monthlypay.php +++ b/application/controllers/monthlypay.php @@ -34,10 +34,161 @@ class monthlypay extends BaseController $this->loadviews('monthlyListing',$this->global); } - /** - * This function is used to load the monthly list - */ + function loadPublicholidays() + { + + + $data['days'] = $this-> monthlypay_model->getPublicHoldays(); + $this->global['pageTitle'] = 'Siddharth : Public Holidays'; + + $this->loadviews('publicholidays',$this->global,$data,NULL); + + } + function deletePublicHoliday() + { + $d = $this->input->post('param1'); + $res = $this->monthlypay_model->deleteHoliday($d); + if($res == 1){ + echo "Deleted Successfully..!"; + }else{echo "Something Wrong, Try Later...!";} + } + + function savePublicHolidays() + { + $jsondata = $this->input->post('param1'); + $phpdata = json_decode($jsondata); + $total =0; + + foreach($phpdata as $d) + { + + + $hname = $d->Holiday_Name; + $hdate = $d->Date; + + $tostore = array('H_Name'=>$hname,'H_Date'=>$hdate); + $isExist = $this->monthlypay_model->checkHoliday($hdate); + + if($isExist[0]['count'] == 0) + { + $count = $this->monthlypay_model->saveHolidays($tostore,'i'); + $total = $total + $count; + } + else + { + $count = $this->monthlypay_model->saveHolidays($tostore,'u'); + $total = $total + $count; + } + + } + + echo $total . "-Holiday(s) Saved Successfully..!"; + } + + + function attendanceLoad() + { + $montharray = array(01=>"Jan",02=>"Feb",03=>"Mar",04=>"Apr",05=>"May",06=>"Jun",07=>"Jul",08=>"Aug",09=>"Sep",10=>"Oct",11=>"Nov",12=>"Dec"); + + if($this->input->post('month')) + { + //echo "post"; + $current = $this->input->post('month'); + $month = substr($current,0,3); + $year = substr($current,4); + $month=array_search($month,$montharray); + $current = $year."-".$month.'-01'; + //echo $current; + } + if(empty($current)) + { + // echo "fresh"; + $current = date("Y-m"); + $year = date("Y"); + $month = date("m"); + $current = $current."-01"; + } + + $monthdays =cal_days_in_month(CAL_GREGORIAN,$month,$year); + $begin = new DateTime($year.'-'.$month.'-01'); + $end = new DateTime($year.'-'.$month.'-'.$monthdays); + $sundayarray =array(); + while ($begin <= $end) + { + if($begin->format("D") == "Sun") + { + array_push($sundayarray,$begin->format("d")); + } + $begin->modify('+1 day'); + } + $noofsundays = count($sundayarray); + + $publicholidaysarray = $this-> monthlypay_model->getPublicHoldays($current); + $string ="attendance"; + $data['noofsundays']=$noofsundays; + $data['noofpublicholidays']=count($publicholidaysarray); + $data['publicholidaysarray']=$publicholidaysarray; + $data['sundayarray']=$sundayarray; + $data['monthdays']=$monthdays; + $data['datefordropdown'] = $current; + $data['attendance'] = $this-> monthlypay_model->monthlyAttendance($current); + $data['emppay'] = $this-> monthlypay_model->getEmpPayDetails($current,$string); + $this->global['pageTitle'] = 'Siddharth : Monthly Attendance'; + $this->loadViews("attendance", $this->global, $data, NULL); + } + function saveAttendance() + { + + $total = 0; + $jsondata = $this->input->post('param1'); + $phpdata = json_decode($jsondata,true); + $date = $this->input->post('param2'); + $NoofDays = $this->input->post('param3'); + $Month_Year = date('Y-m-d',strtotime($date)); + $CreateBy = $this->session->userdata ( 'userId' ); + // echo 'from COn' . $date; + // print_r($phpdata);die();[Paid Leave + // echo count($phpdata); + //echo $NoofDays.'sdjksjh'; + $EmpID ='temp'; + foreach($phpdata as $data) + { + + + $EmpID = $data['Employee ID']; + $W1H = $data['1W'];$W1OT = $data['1OT']; $W2H = $data['2W'];$W2OT = $data['2OT'];$W3H = $data['3W'];$W3OT = $data['3OT'];$W4H = $data['4W'];$W4OT = $data['4OT']; + $W5H = $data['5W'];$W5OT = $data['5OT']; $W6H = $data['6W'];$W6OT = $data['6OT']; $W7H = $data['7W'];$W7OT = $data['7OT']; $W8H = $data['8W'];$W8OT = $data['8OT']; + $W9H = $data['9W'];$W9OT = $data['9OT']; $W10H = $data['10W'];$W10OT = $data['10OT']; $W11H = $data['11W'];$W11OT = $data['11OT']; $W12H = $data['12W'];$W12OT = $data['12OT']; + $W13H = $data['13W'];$W13OT = $data['13OT']; $W14H = $data['14W'];$W14OT = $data['14OT']; $W15H = $data['15W'];$W15OT = $data['15OT']; $W16H = $data['16W'];$W16OT = $data['16OT']; + $W17H = $data['17W'];$W17OT = $data['17OT']; $W18H = $data['18W'];$W18OT = $data['18OT']; $W19H = $data['19W'];$W19OT = $data['19OT']; $W20H = $data['20W'];$W20OT = $data['20OT']; + $W21H = $data['21W'];$W21OT = $data['21OT']; $W22H = $data['22W'];$W22OT = $data['22OT']; $W23H = $data['23W'];$W23OT = $data['23OT']; $W24H = $data['24W'];$W24OT = $data['24OT']; + $W25H = $data['25W'];$W25OT = $data['25OT']; $W26H = $data['26W'];$W26OT = $data['26OT']; $W27H = $data['27W'];$W27OT = $data['27OT']; $W28H = $data['28W'];$W28OT = $data['28OT']; + if(!empty($data['29W'])){$W29H = $data['29W'];}else{$W29H=null;} if(!empty($data['29OT'])){$W29OT = $data['29OT'];}else{$W29OT=null;} if(!empty($data['30W'])){$W30H = $data['30W'];}else{$W30H=null;} + if(!empty($data['30OT'])){$W30OT = $data['30OT'];}else{$W30OT=null;} if(!empty($data['31W'])){$W31H = $data['31W'];}else{$W31H=null;}if(!empty($data['31OT'])){$W31OT = $data['31OT'];}else{$W31OT=null;} + $totalworkinghrs = $data['Total Hrs'];$totalothrs = $data['OT Hrs'];$paidleave = $data['Paid Leave'];$daysworked = $data['Days Worked'];$absent = $data['Absent']; + + $monthattendance = array('Month_Year'=>$Month_Year,'NoofDays'=>$NoofDays,'EmpID'=>$EmpID,'WH1'=>$W1H,'OT1'=>$W1OT,'WH2'=>$W2H,'OT2'=>$W2OT,'WH3'=>$W3H,'OT3'=>$W3OT, + 'WH4'=>$W4H,'OT4'=>$W4OT,'WH5'=>$W5H,'OT5'=>$W5OT,'WH6'=>$W6H,'OT6'=>$W6OT,'WH7'=>$W7H,'OT7'=>$W7OT,'WH8'=>$W8H,'OT8'=>$W8OT,'WH9'=>$W9H,'OT9'=>$W9OT,'WH10'=>$W10H,'OT10'=>$W10OT, + 'WH11'=>$W11H,'OT11'=>$W11OT,'WH12'=>$W12H,'OT12'=>$W12OT,'WH13'=>$W13H,'OT13'=>$W13OT,'WH14'=>$W14H,'OT14'=>$W14OT,'WH15'=>$W15H,'OT15'=>$W15OT,'WH16'=>$W16H,'OT16'=>$W16OT, + 'WH17'=>$W17H,'OT17'=>$W17OT,'WH18'=>$W18H,'OT18'=>$W18OT,'WH19'=>$W19H,'OT19'=>$W19OT,'WH20'=>$W20H,'OT20'=>$W20OT,'WH21'=>$W21H,'OT21'=>$W21OT,'WH22'=>$W22H,'OT22'=>$W22OT, + 'WH23'=>$W23H,'OT23'=>$W23OT,'WH24'=>$W24H,'OT24'=>$W24OT,'WH25'=>$W25H,'OT25'=>$W25OT,'WH26'=>$W26H,'OT26'=>$W26OT,'WH27'=>$W27H,'OT27'=>$W27OT,'WH28'=>$W28H,'OT28'=>$W28OT, + 'WH29'=>$W29H,'OT29'=>$W29OT,'WH30'=>$W30H,'OT30'=>$W30OT,'WH31'=>$W31H,'OT31'=>$W31OT,'Total_WHrs'=>$totalworkinghrs,'Total_OTHrs'=>$totalothrs,'Paid_Leave'=>$paidleave, + 'Days_Worked'=>$daysworked,'Absent'=>$absent,'Created_by'=>$CreateBy); + + + $res = $this->monthlypay_model->saveAttendance($monthattendance,$Month_Year,$EmpID); + echo $res; + $total = $total + $res; + // die(); + } + echo $total . "-Employee(s) Attendance saved Successfully..!"; + + + + + + } function monthlyListing() { diff --git a/application/controllers/payslip.php b/application/controllers/payslip.php index b4f548b3..f450a630 100755 --- a/application/controllers/payslip.php +++ b/application/controllers/payslip.php @@ -228,18 +228,7 @@ function phpAlert($msg) { } - - - - - - - - - - - - if($this->input->post('ESI_Report')) + if($this->input->post('ESI_Report')) { $data['PFESI'] = $this->payroll_model->getReportforPFESI($payon); //print_r($data['PFESI']);die(); @@ -388,8 +377,100 @@ function phpAlert($msg) { } + + 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'; + + // if($month >= 4) + // { + // $currentyear = $year; + // $nxtyear = ($year+1); + // } + // else + // { + // $currentyear =($year-1); + // $nxtyear = $year; + // } + + } + 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'] = 'Siddharth : Loan Reports'; + $this->loadViews("loanreports", $this->global,$data, NULL); - + } /** * This function used to load the first screen of the user @@ -407,8 +488,9 @@ function phpAlert($msg) { { $current = date("m-Y"); $data['month'] = $this-> monthlypay_model->monthlyListing($current); - $data['fresh'] = $this-> monthlypay_model->getEmpPayDetails($current); - + // $data['fresh'] = $this-> monthlypay_model->getEmpPayDetails($current); + + $data['fresh'] = $this-> monthlypay_model->getEmpPayDetailsforMonthInputs($current); $this->global['pageTitle'] = 'Siddharth : Payroll Monthly Inputs'; $this->loadViews("monthlypayinputs", $this->global,$data,NULL); @@ -419,8 +501,9 @@ function phpAlert($msg) { { $current = $this->input->post('param1'); + // echo $current;die(); $month = $this-> monthlypay_model->monthlyListing($current); - $fresh = $this-> monthlypay_model->getEmpPayDetails($current); + $fresh = $this-> monthlypay_model->getEmpPayDetailsforMonthInputs($current); $data = json_encode(array_merge($month,$fresh)); echo $data; } @@ -467,6 +550,7 @@ function phpAlert($msg) { $EmpID = $j['Employee Id']; $Name = $j['Employee Name']; + $DaysWorked = $j['Days Worked']; $LOP_Days = $j['LOP Days']; $Paid_leave = $j['Paid Leave']; $OT_Hrs_Worked = $j['OT Hours Worked in Hrs']; @@ -474,7 +558,14 @@ function phpAlert($msg) { $Incentives = $j['Incentives in ₹']; $Other_Deductions = $j['Other Deductions in ₹']; $Created_By = $this->session->userdata ( 'userId' ); - if(!is_numeric($LOP_Days) || ($LOP_Days > 31) || (strlen((string)$LOP_Days)) > 5 ) + + 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++; @@ -555,6 +646,7 @@ function phpAlert($msg) { { $EmpID = $j['Employee Id']; $Name = $j['Employee Name']; + $DaysWorked = $j['Days Worked']; $LOP_Days = $j['LOP Days']; $Paid_leave = $j['Paid Leave']; $OT_Hrs_Worked = $j['OT Hours Worked in Hrs']; @@ -567,7 +659,7 @@ function phpAlert($msg) { $Other_Deductions = $j['Other Deductions in ₹']; $Created_By = $this->session->userdata ( 'userId' ); - $monthlypaydata = array('Month_Year'=>$month,'EmpID'=>$EmpID,'LOP_Days'=>$LOP_Days,'Paid_leave'=>$Paid_leave,'OT_Hrs_Worked'=>$OT_Hrs_Worked,'Loan_Recovered'=>$Loan_Recovered,'Incentives'=>$Incentives,'Other_Deductions'=>$Other_Deductions,'Created_By'=>$Created_By); + $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,'Other_Deductions'=>$Other_Deductions,'Created_By'=>$Created_By); $result = $this->monthlypay_model->saveMonthlyData_model($monthlypaydata); $total = $total + $result; } @@ -781,7 +873,9 @@ function getEmployee() $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; } @@ -931,11 +1025,12 @@ function getEmployee() $EmpId = $sheet->getCell('A'.$x)->getValue(); - $EmpId=strtoupper($EmpId); - $LOPDays = $sheet->getCell('C'.$x)->getValue(); - $Paid_leave =$sheet->getCell('D'.$x)->getValue(); - $OTHoursWorked =$sheet->getCell('E'.$x)->getValue(); - $loanRecovered=$sheet->getCell('F'.$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); @@ -951,7 +1046,7 @@ function getEmployee() if($flag!=0 && $flag2!=0){ - $FileData = array('Month_Year'=>$PayOn,'EmpID'=>$EmpId,'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")); + $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++; } diff --git a/application/models/emppaydate_model.php b/application/models/emppaydate_model.php index 1fa28163..e78a0781 100755 --- a/application/models/emppaydate_model.php +++ b/application/models/emppaydate_model.php @@ -47,17 +47,31 @@ class emppaydate_model extends CI_Model return $emppay; } + + function addLoanInfo($dataarray,$string) + { + if($string == 'add'){ + $this->db->insert('T_Loan_Master', $dataarray); + $loanid = $this->db->affected_rows(); + return $loanid; + } + else if($string == 'update') + { + $loanid = $dataarray['Loan_ID']; + $this->db->where('Loan_ID',$loanid); + $this->db->update('T_Loan_Master', $dataarray); + $loanid = $this->db->affected_rows(); + return $loanid; + } + } function getUserInfo($paydataid) { - $this->db->select('T_Emp_Pay_Data.*,T_Employee_Details.FirstName,T_Employee_Details.LastName'); - $this->db->from('T_Emp_Pay_Data'); - $this->db->join('T_Employee_Details','T_Emp_Pay_Data.EmpID=T_Employee_Details.EmpID'); - //$this->db->where('isDeleted', 0); - //$this->db->where('roleId !=', 1); - $this->db->where('T_Emp_Pay_Data.Pay_Data_ID', $paydataid); - $query = $this->db->get(); -//print_r($query->result()); -//die(); + $sql = 'select T_Emp_Pay_Data.Pay_Data_ID,T_Emp_Pay_Data.EmpID as PAYEMPID,T_Emp_Pay_Data.Basic_Pay,T_Emp_Pay_Data.HRA_Rate,T_Emp_Pay_Data.Allowances,T_Emp_Pay_Data.Food_Allowances,T_Emp_Pay_Data.PF_Rate,T_Emp_Pay_Data.ESI_Rate,T_Emp_Pay_Data.HRA_Amount,T_Emp_Pay_Data.TotalSalary,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Loan_Master.*from T_Emp_Pay_Data + join T_Employee_Details on T_Emp_Pay_Data.EmpID=T_Employee_Details.EmpID + left join T_Loan_Master on T_Emp_Pay_Data.EmpID=T_Loan_Master.EmpID and T_Loan_Master.is_Active = 1 + where T_Emp_Pay_Data.Pay_Data_ID = ?;'; + $query = $this->db->query($sql,array($paydataid)); + return $query->result(); } diff --git a/application/models/monthlypay_model.php b/application/models/monthlypay_model.php index d0207103..18bc6307 100755 --- a/application/models/monthlypay_model.php +++ b/application/models/monthlypay_model.php @@ -12,26 +12,29 @@ class monthlypay_model extends CI_Model */ function monthlyListing($current="") { - - $this->db->select('T_Monthly_Pay_Inputs.*,T_Employee_Details.FirstName,T_Employee_Details.LastName'); + //echo $current; + $this->db->select('T_Monthly_Pay_Inputs.*,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Payroll.Key'); $this->db->from('T_Monthly_Pay_Inputs'); $this->db->join('T_Employee_Details','T_Monthly_Pay_Inputs.EmpID=T_Employee_Details.EmpID'); + $this->db->join('T_Payroll','T_Monthly_Pay_Inputs.EmpID=T_Payroll.EmpID','left'); $this->db->where('Month_Year',$current); - - $query = $this->db->get(); + $query = $this->db->get(); + // print_r($query->result()); $result = $query->result(); return $result; } - function getEmpPayDetails($current="") + function getEmpPayDetails($current="",$s="") { + //echo $s;die(); + if($s == ''){ + $current = '01-'.$current; - //echo $current; $current = date_create($current); $current = date_format($current,"Y-m-d"); - //echo $current; + } $this->db->select('T_Emp_Pay_Data.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.DateofJoining'); $this->db->from('T_Emp_Pay_Data'); $this->db->join('T_Employee_Details ','T_Emp_Pay_Data.EmpID=T_Employee_Details.EmpID'); @@ -42,6 +45,93 @@ class monthlypay_model extends CI_Model return $result; } + function getEmpPayDetailsforMonthInputs($current="") + { + + $current = '01-'.$current; + //echo $current; + $current = date_create($current); + $current = date_format($current,'Y-m-d'); + $sql = "select T_Emp_Pay_Data.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.DateofJoining,T_Attendance.Days_Worked as Days_worked,T_Attendance.Absent as LOP_Days,T_Attendance.Paid_Leave as Paid_leave,T_Attendance.Total_OTHrs as OT_Hrs_Worked,T_Attendance.NoofDays from T_Emp_Pay_Data + left join T_Employee_Details on T_Employee_Details.EmpID = T_Emp_Pay_Data.EmpID + left join T_Attendance on T_Emp_Pay_Data.EmpID = T_Attendance.EmpID + where T_Employee_Details.DateofJoining <= CURRENT_DATE + and month(T_Attendance.Month_Year) = month(?)"; + + $query = $this->db->query($sql,array($current)); + return $query->result(); + } + + function getPublicHoldays($current="") + { + if(!empty($current)) + { + $sql = "select * from T_Public_Holidays where month(H_Date) = month(?) and year(H_Date) = year(?)"; + $query = $this->db->query($sql,array($current,$current)); + return $query->result(); + } + else + { + $sql = "select * from T_Public_Holidays where year(H_Date)=year(CURRENT_DATE) order by H_Date"; + $query = $this->db->query($sql); + return $query->result(); + + } + + + + } + + function checkHoliday($Date) + { + $Date = date('Y-m-d',strtotime($Date)); + //echo $Date;die();[ + + $sql="select count(*) as count from T_Public_Holidays where H_Date = ?"; + $query = $this->db->query($sql,array($Date)); + return $query->result_array(); + } + + function saveHolidays($data,$string) + { + //print_r($data); + if($string == 'i') + { + $this->db->insert('T_Public_Holidays',$data); + $i= $this->db->affected_rows(); + return $i; + } + else if($string == 'u') + { + $this->db->where('H_date',$data['H_Date']); + $this->db->update('T_Public_Holidays',$data); + $i = $this->db->affected_rows(); + return $i; + } + } + + + function deleteHoliday($d) + { + //echo "from Model" . $d; + $this->db->where('H_date',$d); + $this->db->delete('T_Public_Holidays'); + return $this->db->affected_rows(); + } + function monthlyAttendance($current="") + { + + $this->db->select('T_Attendance.*,T_Employee_Details.FirstName,T_Employee_Details.LastName'); + $this->db->from('T_Attendance'); + $this->db->join('T_Employee_Details','T_Attendance.EmpID=T_Employee_Details.EmpID'); + $this->db->where('Month_Year',$current); + + $query = $this->db->get(); + + $result = $query->result(); + + return $result; + } function saveMonthlyData_model($data) { @@ -80,6 +170,44 @@ class monthlypay_model extends CI_Model } + function saveAttendance($monthattendance,$Month_Year,$EmpID) + { + $this->db->select('count(*) as c'); + $this->db->from('T_Attendance'); + $this->db->where('Month_Year',$Month_Year); + $this->db->where('EmpID',$EmpID); + $isExist = $this->db->get(); + $isExist = $isExist->result_array(); + $ans = $isExist[0]['c']; + + if($ans == 0) + { + + //array_pop(); + $this->db->insert('T_Attendance',$monthattendance); + return $this->db->affected_rows(); + //echo "INS"; + // if($this->db->affected_rows() > 0) + // { + + // return true; + // } + // else + // { + // return false; + // } + } + else + { + $this->db->where('Month_Year',$Month_Year); + $this->db->where('EmpID',$EmpID); + $this->db->update('T_Attendance',$monthattendance); + //echo "UPDATE"; + return $this->db->affected_rows(); + + } + } + function addNewmonthlisting($m_list) { diff --git a/application/models/payroll_model.php b/application/models/payroll_model.php index 060f618b..7fed0613 100755 --- a/application/models/payroll_model.php +++ b/application/models/payroll_model.php @@ -207,6 +207,7 @@ class Payroll_model extends CI_Model return $query->result(); } + function getReportforPFESI($payon) { $this->db->select('Pay.EmployeeESI,Pay.PF,Pay.CompanyESI,Pay.CompanyPF,Pay.NoofDaysWorked,Pay.OTperHours,Emp.FirstName as FName ,Emp.LastName as Lname,Emp.PFNO,Emp.ESI'); @@ -218,6 +219,96 @@ class Payroll_model extends CI_Model } + function getLoanReport($source='',$year1="",$year2="") + { + // echo "
---------------------------"; + // echo "
From Model-"; + // echo $source.'-'.$year1.'-'.$year2; + + $this->db->distinct(); + $this->db->select('Pay.EmpID,Emp.FirstName as FName ,Emp.LastName as Lname,sum(Loan_Amount) as Loan_Amount,sum(Paid_Amount) as Paid_Amount'); + $this->db->from('T_Emp_Pay_Data Pay'); + $this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID'); + $this->db->join('T_Loan_Master loan', 'Pay.EmpID = loan.EmpID'); + + if($source != 'company'){ + $this->db->where('Pay.EmpID',$source); + } + + if($year1 != "" and $year2 != ""){ + $this->db->where('month(loan.Loan_Issued_Date)>=',4); + $this->db->where('year(loan.Loan_Issued_Date)=',$year1); + $this->db->or_where('month(loan.Loan_Issued_Date)<=',3); + $this->db->where('year(loan.Loan_Issued_Date)=',$year2); + } + $this->db->group_by('Pay.EmpID'); + $this->db->order_by('Pay.EmpID','asc'); + + $query = $this->db->get(); + return $query->result(); + //print_r($query->result());die(); + + } + + function getEmpDetailsforLoan() + { + + $this->db->select('Pay.EmpID,Pay.FirstName as FName ,Pay.LastName as Lname'); + $this->db->from('T_Employee_Details Pay'); + $this->db->join('T_Loan_Master loan', 'Pay.EmpID = loan.EmpID'); + $this->db->order_by('Pay.EmpID','asc'); + $query = $this->db->get(); + return $query->result(); + + } + + function getLoanReportforEmp($eid='',$year1="",$year2="",$string="") + { + + + //$this->db->distinct(); + if($string == 'emp'){ + $this->db->select('Pay.EmpID,Emp.FirstName as FName ,Emp.LastName as Lname,loan.*'); + $this->db->from('T_Emp_Pay_Data Pay'); + $this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID'); + $this->db->join('T_Loan_Master loan', 'Pay.EmpID = loan.EmpID','left'); + // if($source != 'company'){ + $this->db->where('Pay.EmpID',$eid); + //} + if($year1 != "" and $year2 != ""){ + $this->db->where('month(loan.Loan_Issued_Date)>=',4); + $this->db->where('year(loan.Loan_Issued_Date)=',$year1); + $this->db->or_where('month(loan.Loan_Issued_Date)<=',3); + $this->db->where('year(loan.Loan_Issued_Date)=',$year2); + //$this->db->group_by('Pay.EmpID'); + } + $this->db->order_by('loan.Loan_Issued_Date','asc'); + + $query = $this->db->get(); + return $query->result(); + } + elseif($string == 'history') + { + + $this->db->select('T_Loan_Master.EmpID,Emp.FirstName,Emp.LastName,T_Loan_Master.Loan_Amount,T_Loan_Master.Loan_Issued_Date,T_Loan_History.*'); + $this->db->from('T_Loan_History'); + $this->db->join('T_Loan_Master','T_Loan_Master.Loan_ID=T_Loan_History.Loan_ID'); + $this->db->join('T_Employee_Details Emp', 'T_Loan_Master.EmpID = Emp.EmpID'); + $this->db->where('T_Loan_History.Loan_ID',$eid); + $q = $this->db->get(); + // $this->db->order_by('Entry_Date','asc'); + // $this->db->where('Loan_ID',$eid); + // $q = $this->db->get('T_Loan_History'); + //print_r($q->result()); + return $q->result(); + // print_r($q->result()); + // die(); + + + } + //print_r($query->result());die(); + + } /* *//** * This function is used to get the PayOn details from T_Payroll_FileOTperHours * @return array $result : This is result of the query diff --git a/application/views/attendance.php b/application/views/attendance.php new file mode 100644 index 00000000..0af86b06 --- /dev/null +++ b/application/views/attendance.php @@ -0,0 +1,721 @@ + + + + + + +"; +// echo count($attendance); +// echo "
"; +// print_r($emppay); +// echo "
"; +// echo count($emppay); +//print_r($datefordropdown); +//print_r($noofpublicholidays);print_r($publicholidaysarray); +$datefordropdown = date_create($datefordropdown); +$datefordropdown = date_format($datefordropdown,'M-Y'); +//echo $datefordropdown; +$attendance = array_merge($attendance,$emppay); +// echo count($attendance) ."
"; +// print_r($attendance); +// echo "
------------------------------
"; + +?> + +
+ +
+

+
Employee Monthly Attendance View/Edit
+

+
+
+ + +
+
+
+
+
+
+ 'atten'); + echo form_open('attendance', $attributes); + $today = date('M-Y'); + $data = array('type' => 'text','name' => 'month','id' => 'month','value' => $datefordropdown,'class' => 'form-control select2'); + echo form_input($data);?> +
+
+ +
+ + +
+ +
+ + +
+ format("D") == "Sun") //Check that the day is Sunday here + // { + + // array_push($ind,$begin->format("d")); + // } + + // $begin->modify('+1 day'); + // } + // $noofsundays = count($ind); + + $testarray=array(); + $finalarray = array(); + if(!empty($attendance)) + { + + foreach($attendance as $record) + { + + //$index++; + + if(in_array($record->EmpID,$testarray)) + { + //$index--; + + + } + else{ + + + array_push($testarray,$record->EmpID); + array_push($finalarray,$record); + } + } + } +//print_r($testarray);echo count($testarray); +//echo "
...........................
"; +//print_r($finalarray);echo count($finalarray); +// $index = 0; +// foreach($finalarray as $gg ) +// { + // echo "
...........................
"; + // $index = $index +1; + // echo "S.NO" . $index . "
"; + // echo "EmpID" . $gg->EmpID ."
"; + // //echo $key ."-".$value; + + // for ($col =1; $col <= $monthdays;$col++){ + // $flag =0; + // foreach($ind as $in) + // { + // if($in == $col) + // { + // $flag = 1; + // } + // } + // $WH='WH'.$col; + // $OT = 'OT'.$col; + + + // if(!empty($gg->$WH)){echo "WORK" . $gg->$WH."--";}else{echo "WORK" . "0--";} + + // if(!empty($gg->$OT)){echo "OT" . $gg->$OT. "--";}else{echo "OT" . "0--";} + // } +// // /// echo "$WH"; + // //print_r($gg); + + // //break; + +// } +//die(); +?> + + + +
+
+ + + + + + + + + + + + H_Date; + $temp = substr($temp,8); + $title = ''; + if($temp == $col) + { + $flag2 = 1; + //$title ="Public Holiday-" . str_replace(" ","_",$h->H_Name); + $title = str_replace(" ","_",$h->H_Name); + //echo $title; + } + } + + ?> + + + + + + + + + + + + + + + + + + + + + + + H_Date; + $temp = substr($temp,8); + $title = ''; + $flag2 = 0; + if($temp == $col) + { + $flag2 = 1; + //$title ="Public_Holiday-" . str_replace(" ","_",$h->H_Name); + $title = str_replace(" ","_",$h->H_Name); + //echo $title; + } + } + $WH='WH'.$col; + $OT = 'OT'.$col; + + ?> + + + + + + + + + + + + + + +
S.NOEmployee IDEmployee Name title = "Sunday" title = class="celda_encabezado_general" >".$col . "W";}else{echo $col."W";}?> title = "Sunday" title = class="celda_encabezado_general" >".$col . "OT";}else{echo $col."OT";}?>Total HrsOT HrsPaid LeaveDays WorkedAbsent
EmpID;?>FirstName.'-'.$a->LastName;?> title = "Sunday" title = class="celda_normal" onkeyup="myFunction(this.parentNode.id,this.id,this.textContent);" id ="" contenteditable = "true">$WH)){echo $a->$WH;}else{echo "0";}?> title = "Sunday" title = class="celda_normal" onkeyup="myFunction(this.parentNode.id,this.id,this.textContent);" id ="" contenteditable = "true">$OT)){echo $a->$OT;}else{echo "0";}?>Total_WHrs)){echo $a->Total_WHrs;}else{echo "0.00";}?>Total_OTHrs)){echo $a->Total_OTHrs;}else{echo "0.00";}?>Paid_Leave)){echo $a->Paid_Leave;}else{echo "0.00";}?>Days_Worked)){echo $a->Days_Worked;}else{echo "0.00";}?>Absent)){echo $a->Absent;}else{echo "0.00";}?>
+
+
+ +
+
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/application/views/editOldemppay.php b/application/views/editOldemppay.php index 8af075ed..81e9c165 100755 --- a/application/views/editOldemppay.php +++ b/application/views/editOldemppay.php @@ -17,32 +17,32 @@ $("#due_started").datepicker({ -window.onload = function(){ - loanReset(); -function loanReset(){ - //alert("hi"); -var loan=$("#Loan_Amount").val();//document.getElementById('Loan_Amount').value; -var paid=$("#Paid_Amount").val();//document.getElementById('Paid_Amount').value; -if(loan !=0){ -if (loan == paid) -{ - //alert("loan reset"); - $("#Loan_Amount").val(0.00); - $("#Paid_Amount").val(0.00); - $("#monthly_due").val(0.00); - $("#no_of_due").val(0); - $("#remaining_due").val(0); - $("#paid_due").val(0); - $("#loan_issued_date").val(""); - $("#due_started").val(""); +// window.onload = function(){ + // loanReset(); +// function loanReset(){ + // //alert("hi"); +// var loan=$("#Loan_Amount").val();//document.getElementById('Loan_Amount').value; +// var paid=$("#Paid_Amount").val();//document.getElementById('Paid_Amount').value; +// if(loan !=0){ +// if (loan == paid) +// { + // //alert("loan reset"); + // $("#Loan_Amount").val(0.00); + // $("#Paid_Amount").val(0.00); + // $("#monthly_due").val(0.00); + // $("#no_of_due").val(0); + // $("#remaining_due").val(0); + // $("#paid_due").val(0); + // $("#loan_issued_date").val(""); + // $("#due_started").val(""); -}else -{ - //alert("loan pending"); -} -} -} -}; +// }else +// { + // //alert("loan pending"); +// } +// } +// } +// }; Pay_Data_ID; - $EmpID=$ep->EmpID; + $EmpID=$ep->PAYEMPID; $Empname=$ep->FirstName ." ". $ep->LastName ; $TotalSalary=$ep->TotalSalary; $Basic_Pay=$ep->Basic_Pay; @@ -97,24 +98,31 @@ if(!empty($emppay)) $is_Active=$ep->is_Active; $Food_Allowances=$ep->Food_Allowances; $Loan_Amount=$ep->Loan_Amount; + if(empty($Loan_Amount)){$Loan_Amount = 0.00;} if( !empty($ep->Loan_Issued_Date) ){ $Loan_issued_date=new DateTime( $ep->Loan_Issued_Date, new DateTimeZone('Asia/Kolkata')); $Loan_issued_date=$Loan_issued_date->format('d-m-Y');} else{$Loan_issued_date=null;} $Monthly_due=$ep->Monthly_Due; + if(empty($Monthly_due)){$Monthly_due = 0.00;} if(!empty($ep->Due_Start_Date)){ $Due_start_date=new DateTime( $ep->Due_Start_Date, new DateTimeZone('Asia/Kolkata')); $Due_start_date=$Due_start_date->format('d-m-Y');} else{$Due_start_date=null;} $No_of_dues=$ep->No_of_Dues; + if(empty($No_of_dues)){$No_of_dues = 0.00;} $Paid_Due=$ep->Paid_Due; + if(empty($Paid_Due)){$Paid_Due = 0.00;} $Remaining_Due=$ep->Remaining_Due; + if(empty($Remaining_Due)){$Remaining_Due = 0.00;} $Paid_Amount=$ep->Paid_Amount; + if(empty($Paid_Amount)){$Paid_Amount = 0.00;} $Created_By=$ep->Created_By; $Created_Time=$ep->Created_Time; $Last_Mod_By=$ep->Last_Mod_By; $Last_Mod_Time=$ep->Last_Mod_Time; + $loanid = $ep->Loan_ID; } @@ -175,8 +183,8 @@ if(!empty($emppay))
- Employee Name - + Employee Name +
@@ -276,8 +284,8 @@ if(!empty($emppay))
- - + + Loan Amount
@@ -533,6 +541,9 @@ function dateCalulation() function finalCheck() { //alert("final check"); + + + var loanamount=document.getElementById('Loan_Amount').value; if(loanamount != "" && loanamount != 0.00) { @@ -541,8 +552,16 @@ function finalCheck() var dsdate=document.getElementById('due_started').value; if(idate == "" || due == "" || due == 0.00 || dsdate == ""){ alert("Enter All Loan Information Correctly...!"); + return false; } } + + if($('#Total_Salary').val() == '' || $('#HRA_Rate').val() == '' || $('#Allowances').val() == '' ||$('#PF_Rate').val() == '' ||$('#ESI_Rate').val() == '' || $('#Food_Allowances').val() == '') + { + + alert("Please Enter All Information Correctly..!"); + return false; + } } $("#deleteemp").click(function(){ diff --git a/application/views/editPayslip.php b/application/views/editPayslip.php index 20e35225..633e6cb8 100755 --- a/application/views/editPayslip.php +++ b/application/views/editPayslip.php @@ -492,7 +492,7 @@ if(!empty($PayInfo))
- +
diff --git a/application/views/includes/header.php b/application/views/includes/header.php index 221a7332..2c5e4ccf 100755 --- a/application/views/includes/header.php +++ b/application/views/includes/header.php @@ -456,14 +456,20 @@ $(function() { PaySlip assets/tabletoexport/jquery.tableexport.v2.js"> + + + +'Company'); + $historytableflag = 0; + if(!empty($childdata) ) + { + if(count($childdata) > 0 ){ + $historytableflag = 1; } + //echo "child"; + } + if(!empty($loanrecords)) + { + + foreach($loanrecords as $r) + { + + if(!empty($r->Loan_Issued_Date)) + { + $dateflag=1; + $statusflag=1; + } + + + + } + } + if(!empty($loanemployees)) + { + foreach($loanemployees as $l) + { + $source[$l->EmpID] = $l->EmpID.'-'.$l->FName.'-'.$l->Lname; + } + + } + $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"); + + ?> + + + + + + + + +
+ +
+

+
Company/Employee Loan Reports
+

+
+
+ + +
+
+
+
+ +
+ +
+ + +
+ +
+ +
+
+ +
+
+ + + +
+ +
+ + +
+ +
+
+
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
S.NoEmployee NameLoan GivenLoan Issue DateLoan RecoveredLoan StatusLoan Balance
EmpID.'/'.$fyear.'">'.$rec->EmpID.'-'.$rec->FName.'-'.$rec->Lname.'';?>Loan_ID.'">'.$rec->EmpID.'-'.$rec->FName.'-'.$rec->Lname.'';?>Loan_Amount)){$totalloangiven+=$rec->Loan_Amount; echo $rec->Loan_Amount;}else{echo "0.00";}?>Loan_Issued_Date)){echo $rec->Loan_Issued_Date;}else{echo "-";}?>Paid_Amount)){$totalrecovered+=$rec->Paid_Amount ;echo $rec->Paid_Amount;}else{echo "0.00";} ?>is_Active == 1){$final = "Pending"; }else{$final = "Completed";} if($rec->Remaining_Due < 0 and $rec->is_Active == 1){$final.=",Over Due";} echo $final;?>Loan_Amount) and ($rec->Paid_Amount))){ $totalbalance+= ($rec->Loan_Amount - $rec->Paid_Amount);echo number_format(($rec->Loan_Amount - $rec->Paid_Amount),2,'.','');}else {echo "0.00";}?>
Total
+
+

 

+ + +
+
+ Loan_ID; + $Name = $c->EmpID.'-'.$c->FirstName.'-'.$c->LastName; + $Loan = $c->Loan_Amount; + $Issue_date = $c->Loan_Issued_Date; + $dis = 'Loan ID:-'.$Loan_ID.'-Name:-'.$Name.'- Amount:-'. $Loan; + break; + } + } + + + ?> + +

+
+ + + + + + + Due_Date,0,2); + $yr = substr($child->Due_Date,3,4); + $final = $monthsoptions[$monthno].'-'.$yr; + + ?> + + + +
Date Due_Month Due Amount Balance Amount
Entry_Date),'Y-m-d');?> Due_Amount ;?> Balance_Amount;?>
+
+ +
+ +
+
+ +
+
+
+
+
+ + + \ No newline at end of file diff --git a/application/views/monthlypayinputs.php b/application/views/monthlypayinputs.php index c80ac1c8..28635c4c 100755 --- a/application/views/monthlypayinputs.php +++ b/application/views/monthlypayinputs.php @@ -1,5 +1,7 @@ @@ -71,7 +73,7 @@ $('html').bind('keypress', function(e) $aftersix = array(); for ($i = 0; $i <3;$i++){ - $month++;; + $month++; if($month > 12) { $month = 1; @@ -134,6 +136,7 @@ $('html').bind('keypress', function(e) S.No Employee Id Employee Name + Days Worked LOP Days Paid Leave OT Hours Worked in Hrs @@ -178,15 +181,16 @@ $('html').bind('keypress', function(e) ?> - + EmpID ?> FirstName ." ". $record->LastName ?> - LOP_Days)){echo $record->LOP_Days;}else{echo "0.00";}?> - Paid_leave)){echo $record->Paid_leave;}else { echo number_format(0.00,2,'.','');} ?> - OT_Hrs_Worked)){echo $record->OT_Hrs_Worked;}else { echo number_format(0.00,2,'.','');} ?> - Loan_Recovered)){if(is_numeric($record->Loan_Recovered)){echo number_format($record->Loan_Recovered,2,'.','');}else {echo $record->Loan_Recovered;}}else{echo number_format(0.00,2,'.','');} ?> - Incentives)){echo $record->Incentives;}else{ echo number_format(0.00,2,'.','');;} ?> - Other_Deductions)){echo $record->Other_Deductions; }else{ echo number_format(0.00,2,'.','');;} ?> + Key)){echo "contenteditable='true';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" >Days_worked)){echo $record->Days_worked;}else{echo "0.00";}?> + Key)){echo "contenteditable='true';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" >LOP_Days)){echo $record->LOP_Days;}else{echo "0.00";}?> + Key)){echo "contenteditable='true';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" >Paid_leave)){echo number_format($record->Paid_leave,2,'.','');}else { echo number_format(0.00,2,'.','');} ?> + Key)){echo "contenteditable='true';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" >OT_Hrs_Worked)){echo $record->OT_Hrs_Worked;}else { echo number_format(0.00,2,'.','');} ?> + Key)){echo "contenteditable='true';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" >Loan_Recovered)){if(is_numeric($record->Loan_Recovered)){echo number_format($record->Loan_Recovered,2,'.','');}else {echo $record->Loan_Recovered;}}else{echo number_format(0.00,2,'.','');} ?> + Key)){echo "contenteditable='true';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" >Incentives)){echo $record->Incentives;}else{ echo number_format(0.00,2,'.','');;} ?> + Key)){echo "contenteditable='true';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" >Other_Deductions)){echo $record->Other_Deductions; }else{ echo number_format(0.00,2,'.','');;} ?> @@ -241,7 +245,7 @@ $('html').bind('keypress', function(e) { var alldata = $("#monthlylistings").tableToJSON(); - // alert(JSON.stringify(alldata)); + //alert(JSON.stringify(alldata)); alldata=JSON.stringify(alldata) var month = $('#monthyear').val(); $('#content').loader('hide'); @@ -325,7 +329,7 @@ $('html').bind('keypress', function(e) if(data) { $('#content').loader('hide'); - //alert(data); + alert(data); var trHTML=""; var obj =JSON.parse(data); var temparray = []; @@ -347,6 +351,8 @@ $('html').bind('keypress', function(e) ++i i=i-j; + var Days_Worked = val.Days_worked; + if(Days_Worked == null){ Days_Worked="0.00";} var LOP_Days = val.LOP_Days; if(LOP_Days == null){ LOP_Days="0.00";} var Paid_leave = val.Paid_leave; @@ -365,6 +371,7 @@ $('html').bind('keypress', function(e) '' + (i) + '' + '' + val.EmpID + '' + '' + val.FirstName+" "+ val.LastName + '' + + '' + Days_Worked + '' + '' + LOP_Days + '' + '' + Paid_leave + '' + '' + OT_Hrs_Worked + '' + diff --git a/application/views/publicholidays.php b/application/views/publicholidays.php new file mode 100644 index 00000000..270810d1 --- /dev/null +++ b/application/views/publicholidays.php @@ -0,0 +1,242 @@ + + + + + + + + + + + + +
+ +
+

+
Public Holiday Information -
+

+
+
+ + +
+
+
+
+ +
+ + +
+ +
+
+
+ Holiday Name : + +
+
+ Date : + +
+
+ +
+
+

 

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Holiday_NameDateAction
H_Name)){echo $day->H_Name;}else{echo "NO DATA";}?>H_Date)){echo $day->H_Date;}else{echo "NO DATA";}?>
+

 

+
+
+ + +
+ +
+
+ +
+
+
+
+
+ + + + + + + + + + \ No newline at end of file diff --git a/assets/js/jquery.CongelarFilaColumna.js b/assets/js/jquery.CongelarFilaColumna.js new file mode 100644 index 00000000..6c92e60e --- /dev/null +++ b/assets/js/jquery.CongelarFilaColumna.js @@ -0,0 +1,633 @@ +/* +* CongelarFilaColumna is a jQuery plugin that allows freezing of rows and columns. +* Scrolling can be enabled. Both rows and columns can be frozen. Rows to be frozen +* should be placed in 'thead' (whole frozen header). You can freeze rows and columns combined with colspan or rowspan. +* +* +* Copyright (c) 2017 +* Author: Agustin Rios Reyes. +* Email: nitsugario@gmail.com +* Github: https://github.com/nitsugario/jQuery-Freeze-Table-Column-and-Rows +* Versión: 2.2 +* +* Licensed under MIT +* http://www.opensource.org/licenses/mit-license.php +* +*/ + +(function($) +{ + $.fn.CongelarFilaColumna = function (method) + { + + var defaults = + { + width: '100%', + height: '100%', + Columnas: 3, //Number of columns fixed + soloThead : false, //only the fixed header + coloreacelda: false, + colorcelda: '#F4FA58', + lboHoverTr: false, + tfoot: false + }; + var settings = {}; + var methods = + { + init: function (options) + { + settings = $.extend({}, defaults, options); + + return this.each(function () + { + var $tabla = $(this); + + if (helpers._EsUnaTabla($tabla)) + { + methods.setup.apply(this, Array.prototype.slice.call(arguments, 1)); + } + else + { + $.error('La Tabla No es válida. :( '); + }; + }); + }, + setup: function () + { + if ( settings.soloThead ) + { + var $wrapper, + $lobTable = $(this), + lobTable = this, + lstClassTable = $lobTable.attr("class"); + + helpers._ObtenerAsignarAnchoAltoThead( $lobTable ); + + var lobThead = $lobTable.find("thead").clone(), + lnuWidthTable = $lobTable.width(), + lobTableThead = $("").attr("class",lstClassTable).append(lobThead); + + + settings.scrollbarOffset = helpers._OptenerWidthBarraScroll(); + $lobTable.css({'width':lnuWidthTable}); + + if (!$lobTable.closest('.fht-table-wrapper').length) + { + $lobTable.addClass('fht-table'); + $lobTable.wrap('
'); + } + + $wrapper = $lobTable.closest('.fht-table-wrapper'); + + if ( $wrapper.find('.fht-fixed-body').length == 0) + $lobTable.wrap('
'); + + $fixedBody = $wrapper.find('.fht-fixed-body'); + + $wrapper.css({ + width: settings.width, + height: settings.height + }); + + /*Agregamos la tabla completa a fht-tbody-conten*/ + $lobTable.wrap('
'); + $lobTable.closest('.fht-tbody-conten').css({'width':lnuWidthTable}); + $lobDivBody = $wrapper.find('div.fht-tbody'); + + /*Agregamos el encabesado clonado al div fht-thead*/ + $lobDivTHead = $('
').prependTo($fixedBody).css({'width':lnuWidthTable}); + lobTableThead.css({'width':lnuWidthTable}); + $lobDivTHead.append(lobTableThead).css({'width':lnuWidthTable}); + + $lobTable.css({ + 'margin-top': -$lobDivTHead.outerHeight(true) + }); + + var lnuTbodyHeight = $wrapper.height() - $lobDivTHead.outerHeight(true); + + $lobDivBody.css({ + 'height': lnuTbodyHeight, + 'width':lnuWidthTable+settings.scrollbarOffset+2 + }); + + helpers._OnScroll( $lobDivBody ); + + return lobTable; + } + else + { + var $wrapper, + $tabla = $(this), + tabla = this, + contenedor = $(this).parent(), + classT = $tabla.attr("class"); + + helpers._ObtenerAsignarAnchoAlto($tabla); + + var thead = $tabla.find("thead").clone(), + anchotabla = $tabla.width(), + tablaTH = $("
").attr("class",classT).append(thead), + $tablaTHCol = $("
").attr("class",classT).append($("")), + $tablaTBCol = $("
").attr("class",classT).append($("")); + + settings.scrollbarOffset = helpers._OptenerWidthBarraScroll(); + $tabla.css({'width':anchotabla}); + + tablaTH.addClass('fht-table'); + $tablaTHCol.addClass('fht-table'); + $tablaTBCol.addClass('fht-table'); + + helpers._ClonarHeaderColumnasACongelar($tabla,$tablaTHCol,'thead',settings.Columnas); + helpers._ClonarHeaderColumnasACongelar($tabla,$tablaTBCol,'tbody',settings.Columnas); + + if( settings.tfoot) + { + $tablaTBCol.append($("")); + helpers._ClonarHeaderColumnasACongelar($tabla,$tablaTBCol,'tfoot',settings.Columnas); + } + + if (!$tabla.closest('.fht-table-wrapper').length) + { + $tabla.addClass('fht-table'); + $tabla.wrap('
'); + } + + $wrapper = $tabla.closest('.fht-table-wrapper'); + + if ( $wrapper.find('.fht-fixed-column').length == 0) + { + $tabla.wrap('
'); + $('
').prependTo($wrapper); + $fixedBody = $wrapper.find('.fht-fixed-body'); + } + + $wrapper.css({ + width: settings.width, + height: settings.height + }); + + if (!$tabla.hasClass('fht-table-init')) + { + $tabla.wrap('
'); + } + + $tabla.closest('.fht-tbody-conten').css({'width':anchotabla}); + $divBody = $wrapper.find('div.fht-tbody'); + + if (!$tabla.hasClass('fht-table-init')) + { + + $divHead = $('
').prependTo($fixedBody).css({'width':anchotabla}); + + tablaTH.css({'width':anchotabla}); + + $divHead.append(tablaTH).css({'width':anchotabla}); + } + else + { + $divHead = $wrapper.find('div.fht-thead'); + } + + $tabla.css({ + 'margin-top': -$tabla.find('thead').outerHeight(true) + }); + + var tbodyHeight = $wrapper.height() - $divHead.outerHeight(true); + + $divBody.css({ + 'height': tbodyHeight + }); + + $tabla.addClass('fht-table-init'); + + var $fixedColumn = $wrapper.find('.fht-fixed-column'); + + var $thead = $('
').append($tablaTHCol), + $tbody = $('
').append($tablaTBCol), + $fixedBody = $wrapper.find('.fht-fixed-body'), + fixedBodyWidth = $wrapper.width(), + fixedBodyHeight = $fixedBody.find('.fht-tbody').outerHeight() - settings.scrollbarOffset; + + $thead.appendTo($fixedColumn); + + var AnchoCol = $thead.find('table').width()+1; + + $thead.find('table').css({'width': AnchoCol,'height':$divHead.outerHeight(true)}); + $tbody.find('table').css({'width': AnchoCol}); + + $tbody.appendTo($fixedColumn).css({ + 'height': fixedBodyHeight+2, + 'background-color': '#ffffff' + }); + + $fixedColumn.css({ + 'width': AnchoCol + }); + + $fixedBody.css({ + 'width': fixedBodyWidth + }); + + helpers._OnScroll($divBody); + + return tabla; + }; + } + }; + var helpers = + { + /* + * return boolean + * valida si el elemento tien un thead y un tbody. + */ + _EsUnaTabla: function($obj) + { + var $tabla = $obj, + TieneTable = $tabla.is('table'), + TieneThead = $tabla.find('thead').length > 0, + TieneTbody = $tabla.find('tbody').length > 0; + + if (TieneTable && TieneThead && TieneTbody) + { + return true; + } + + return false; + }, + _ObtenerAsignarAnchoAltoThead: function($obj) + { + var $lobTable = $obj; + + $lobTable.find("thead tr").each(function() + { + $(this).find("th").each(function() + { + if( settings.coloreacelda ) + $(this).css({'background-color': settings.colorcelda}); + + $(this).css({'width':$(this).width(),'height':$(this).height(),'overflow': 'hidden'}); + }); + }); + }, + _ObtenerAsignarAnchoAlto: function($obj) + { + var $tabla = $obj, + lstTipoThTd = "", + lnuCuentaColumnasFila = 1, + lnuColumnasFijas = settings.Columnas, + lboRowspan = false, + lboColspan = false, + lboMasColumnas = true, + lboFaltaColumnaFila = false, + lnuCuantosColspan = 0, + lnuCuentaColspan = 0, + lnuCuantosRowspan = 0, + lnuCuentaRowspan = 0, + lnuCuentaRowspanFaltan = 0; + + $tabla.find("tr").each(function(lnuFila) + { + lstTipoThTd = ( $(this).parent().is('thead') ) ? 'th' : ( $(this).parent().is('tbody') ) ? 'td' : ( $(this).parent().is('tfoot') ) ? 'td' : 'undefined'; + + //-- Asignar un identificador a las filas, si no lo tienen. + if( $(this).parent().is('tbody') || $(this).parent().is('tfoot') ) + { + lstSigla = ( $(this).parent().is('thead') ) ? 'th' : ( $(this).parent().is('tbody') ) ? 'tb' : ( $(this).parent().is('tfoot') ) ? 'tf' : 'undefined'; + lstIdTr = lstSigla+lnuFila; + + if( settings.lboHoverTr ) + if( !$(this).attr("id") ) + $(this).attr("id",lstIdTr); + } + + if ( !lboRowspan ) + { + $(this).find( lstTipoThTd ).each(function(lnuCell) + { + if ( lnuCuentaColumnasFila <= lnuColumnasFijas ) + { + if ( $(this).attr("rowspan") ) + { + if ( $(this).attr( "colspan" ) ) + lnuCuentaRowspan = lnuCuentaRowspan-parseInt($(this).attr( "colspan" ))-1; + else + lnuCuentaRowspan++; + + if( lnuCuantosRowspan < $(this).attr("rowspan") ) + { + lnuCuantosRowspan = $(this).attr("rowspan")-1; + lboFaltaColumnaFila = true; + } + else + lboFaltaColumnaFila = true; + + lnuCuentaRowspanFaltan = $(this).attr("rowspan")-1; + lboRowspan = true; + } + + if ( $(this).attr( "colspan" ) ) + lnuCuentaColumnasFila += parseInt($(this).attr( "colspan" )); + else + lnuCuentaColumnasFila++; + + if( settings.coloreacelda ) + $(this).css({'background-color': settings.colorcelda}); + + $(this).css({'width':$(this).width(),'height':$(this).height(),'overflow': 'hidden'}); + } + }); + + lnuCuentaColumnasFila = 1; + + if( lboRowspan ) + lnuCuantosRowspan--; + } + else + { + var lnuFaltan = lnuColumnasFijas - lnuCuentaRowspan; + lnuCuentaRowspanFaltan--; + + if ( lnuCuantosRowspan-- <= 0 ) + { + lboRowspan = false; + lnuCuentaRowspan = 0; + + if( lnuFaltan > 0 ) + { + lnuCuentaColumnasFila3 = 1; + lnuColumnasFijas3 = lnuFaltan; + + $(this).find( lstTipoThTd ).each(function(lnuCell) + { + if ( lnuCuentaColumnasFila3 <= lnuColumnasFijas3 ) + { + if ( $(this).attr( "colspan" ) ) + lnuCuentaColumnasFila3 += parseInt($(this).attr( "colspan" )); + else + lnuCuentaColumnasFila3++; + + if( settings.coloreacelda ) + $(this).css({'background-color': settings.colorcelda}); + + $(this).css({'width':$(this).width(),'height':$(this).height(),'overflow': 'hidden'}); + } + }); + + lnuCuentaColumnasFila3 = 1; + } + } + else + { + lnuCuentaColumnasFila2 = 1; + lnuColumnasFijas2 = lnuFaltan; + + $(this).find( lstTipoThTd ).each(function(lnuCell) + { + if ( lnuCuentaColumnasFila2 <= lnuColumnasFijas2 ) + { + if ( $(this).attr( "colspan" ) ) + lnuCuentaColumnasFila2 += parseInt($(this).attr( "colspan" )); + else + lnuCuentaColumnasFila2++; + + if( settings.coloreacelda ) + $(this).css({'background-color': settings.colorcelda}); + + $(this).css({'width':$(this).width(),'height':$(this).height(),'overflow': 'hidden'}); + } + }); + + lnuCuentaColumnasFila2 = 1; + } + + }; + }); + }, + _ClonarHeaderColumnasACongelar: function($pobTabla,$ponDonde,pstTipoThTbTf,pnuCuantasCols) + { + var lnuCuentaColumnasFila = 1, + lnuColumnasFijas = pnuCuantasCols, + lboRowspan = false, + lboColspan = false, + lboMasColumnas = true, + lboFaltaColumnaFila = false, + lnuCuantosColspan = 0, + lnuCuentaColspan = 0, + lnuCuantosRowspan = 0, + lnuCuentaRowspan = 0, + lnuCuentaRowspanFaltan = 0, + $lobTrThTd = $pobTabla.find(pstTipoThTbTf), + lstTipoThTd = (pstTipoThTbTf == "thead") ? "th" : (pstTipoThTbTf == "tbody" || pstTipoThTbTf =='tfoot') ? "td" : "td", + $lobClonarTrThTd; + + $lobTrThTd.find("tr").each(function(lnuFila) + { + if( settings.lboHoverTr )// Asignar el evento hover a las filas para marcarlas. + if( pstTipoThTbTf =='tbody' || pstTipoThTbTf =='tfoot' ) + { + $(this).hover( + function() + { + lstIdTr = "#"+$(this).attr("id"); + $(this).css( "background", "rgba(182,227,250,0.6)" ); + $(lstIdTr).css( "background", "rgba(182,227,250,0.6)" ); + }, + function() { + lstIdTr = "#"+$(this).attr("id"); + $(this).css( "background", "" ); + $(lstIdTr).css( "background", "" ); + } + ); + } + + if ( !lboRowspan ) + { + var tr = $(this).clone(true).html(""); + + $(this).find( lstTipoThTd ).each(function(lnuCell) + { + if ( lnuCuentaColumnasFila <= lnuColumnasFijas ) + { + if ( $(this).attr("rowspan") ) + { + if ( $(this).attr( "colspan" ) ) + lnuCuentaRowspan = lnuCuentaRowspan-parseInt($(this).attr( "colspan" ))-1; + else + lnuCuentaRowspan++; + + if( lnuCuantosRowspan < $(this).attr("rowspan") ) + { + lnuCuantosRowspan = $(this).attr("rowspan")-1; + lboFaltaColumnaFila = true; + } + else + lboFaltaColumnaFila = true; + + lnuCuentaRowspanFaltan = $(this).attr("rowspan")-1; + lboRowspan = true; + } + + if ( $(this).attr( "colspan" ) ) + lnuCuentaColumnasFila += parseInt($(this).attr( "colspan" )); + else + lnuCuentaColumnasFila++; + + if (lnuCell == 0) + { + $lobClonarTrThTd = tr.appendTo($ponDonde.find(pstTipoThTbTf)); + $lobClonarTrThTd.append($(this).clone()); + } + else + $lobClonarTrThTd.append($(this).clone()); + } + }); + + lnuCuentaColumnasFila = 1; + + if( lboRowspan ) + lnuCuantosRowspan--; + } + else + { + var lnuFaltan = lnuColumnasFijas - lnuCuentaRowspan; + lnuCuentaRowspanFaltan--; + + if ( lnuCuantosRowspan-- <= 0 ) + { + lboRowspan = false; + lnuCuentaRowspan = 0; + + if( lnuFaltan > 0 ) + { + lnuCuentaColumnasFila3 = 1; + lnuColumnasFijas3 = lnuFaltan; + var tr = $(this).clone(true).html(""); + + $(this).find( lstTipoThTd ).each(function(lnuCell) + { + if ( lnuCuentaColumnasFila3 <= lnuColumnasFijas3 ) + { + if ( $(this).attr( "colspan" ) ) + lnuCuentaColumnasFila3 += parseInt($(this).attr( "colspan" )); + else + lnuCuentaColumnasFila3++; + + if (lnuCell == 0) + { + $lobClonarTrThTd = tr.appendTo($ponDonde.find(pstTipoThTbTf)); + $lobClonarTrThTd.append($(this).clone()); + } + else + $lobClonarTrThTd.append($(this).clone()); + } + }); + + lnuCuentaColumnasFila3 = 1; + } + else + { + var tr = $(this).clone(true).html(""); + tr.appendTo($ponDonde.find(pstTipoThTbTf)); + } + } + else + { + if( lnuFaltan > 0 ) + { + lnuCuentaColumnasFila2 = 1; + lnuColumnasFijas2 = lnuFaltan; + var tr = $(this).clone(true).html(""); + + $(this).find( lstTipoThTd ).each(function(lnuCell) + { + if ( lnuCuentaColumnasFila2 <= lnuColumnasFijas2 ) + { + if ( $(this).attr( "colspan" ) ) + lnuCuentaColumnasFila2 += parseInt($(this).attr( "colspan" )); + else + lnuCuentaColumnasFila2++; + + if (lnuCell == 0) + { + $lobClonarTrThTd = tr.appendTo($ponDonde.find(pstTipoThTbTf)); + $lobClonarTrThTd.append($(this).clone()); + } + else + $lobClonarTrThTd.append($(this).clone()); + } + }); + + lnuCuentaColumnasFila2 = 1; + } + else + { + var tr = $(this).clone(true).html(""); + tr.appendTo($ponDonde.find(pstTipoThTbTf)); + } + } + }; + }); + }, + _OnScroll: function($obj) + { + var $tabla = $obj, + $wrapper = $tabla.closest('.fht-table-wrapper'), + $thead = $tabla.siblings('.fht-thead'); + + $tabla.on('scroll', function() + { + if( !settings.soloThead ) + { + var $fixedColumns = $wrapper.find('.fht-fixed-column'); + + $fixedColumns.find('.fht-tbody table').css({ + 'margin-top': -$tabla.scrollTop() + }); + } + + $thead.find('table').css({ + 'margin-left': -this.scrollLeft + }); + + }); + }, + _OptenerWidthBarraScroll: function() + { + var scrollbarWidth = 0; + + if (!scrollbarWidth) + { + if (/msie/.test(navigator.userAgent.toLowerCase())) + { + var $textarea1 = $('').css({ position: 'absolute', top: -1000, left: -1000 }).appendTo('body'), + $textarea2 = $('').css({ position: 'absolute', top: -1000, left: -1000 }).appendTo('body'); + + scrollbarWidth = $textarea1.width() - $textarea2.width() + 2; + $textarea1.add($textarea2).remove(); + + } + else + { + var $div = $('
').css({ width: 100, height: 100, overflow: 'auto', position: 'absolute', top: -1000, left: -1000 }) + .prependTo('body').append('
').find('div') + .css({ width: '100%', height: 200 }); + + scrollbarWidth = 100 - $div.width(); + $div.parent().remove(); + + } + } + + return scrollbarWidth; + } + }; + + if (methods[method]) + return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); + else if (typeof method === 'object' || !method) + return methods.init.apply(this, arguments); + else + $.error('El Método "' + method + '" No existe en el plugin CongelarFilaColumna! :( '); + + } +})(jQuery); \ No newline at end of file diff --git a/assets/tabletoexport/jquery.tableexport.v2.js b/assets/tabletoexport/jquery.tableexport.v2.js new file mode 100644 index 00000000..743ec873 --- /dev/null +++ b/assets/tabletoexport/jquery.tableexport.v2.js @@ -0,0 +1,85 @@ +(function ($) { + + $.fn.tableExport = function (options) { + + var settings = $.extend({}, $.fn.tableExport.defaults, options), + rowD = $.fn.tableExport.rowDel, bootstrapClass, bootstrapTheme, bootstrapSpacing; + + if (settings.bootstrap) { + bootstrapClass = $.fn.tableExport.bootstrap[0] + " "; + bootstrapTheme = $.fn.tableExport.bootstrap[1] + " "; + + } else { + bootstrapClass = bootstrapTheme = bootstrapSpacing = ""; + } + + + return this.each(function () { + var $el = $(this), + $rows = settings.headings ? $el.find('tr') : $el.find('tr:has(td)'), + fileName = settings.fileName === "id" ? $el.attr('id') : settings.fileName, + exporters = { + csv: function (rdel, name) { + rdel = '"' + rdel + '"'; + var colD = '"' + $.fn.tableExport.csv.separator + '"', + dataURL = 'data:text/csv;charset=utf-8,' + + encodeURIComponent('"' + $rows.map(function (i, val) { + var $cols = $(val).find('th, td'); + return $cols.map(function (i, val) { + return $(val).text().replace(/"/g, '""') + }).get().join(colD); + }).get().join(rdel) + '"'), + myFile = name + ".csv", + myContent = $.fn.tableExport.csv.buttonContent, + myClass = $.fn.tableExport.csv.defaultClass; + createButton(dataURL, myFile, myContent, myClass); + } + }; + + settings.formats.forEach( + function (key) { + exporters[key](rowD, fileName); + } + ); + + function checkCaption(exportButton) { + var $caption = $el.find('caption:not(.head)'); + $caption.length ? $caption.append(exportButton) : $el.prepend('
'); + } + + function createButton(dataURL, myFile, myContent, myClass) { + var exportButton = "" + myContent + ""; + checkCaption(exportButton); + } + }); + }; + + // Define the plugin default properties. + $.fn.tableExport.defaults = { + headings: true, // [Boolean], display table headings (th elements) in the first row, [default: true] + formats: ["csv"], + fileName: "id", // [id, name, String], filename for the downloaded file, [default: "export"] + bootstrap: true, // [String], additional button classes to add, [default: ""] + position: "bottom" // [top, bottom], position of the caption element relative to table, [default: "bottom"] + }; + + + + $.fn.tableExport.csv = { + defaultClass: "csv", + buttonContent: "Excel", + separator: "," + }; + + + + $.fn.tableExport.bootstrap = ["btn", "btn-default", "btn-toolbar"]; + + $.fn.tableExport.rowDel = "\r\n"; + + +}(jQuery)); + + + +
' + exportButton + '