diff --git a/application/controllers/payslip.php b/application/controllers/payslip.php index a69e9f9a..bf1ab4f7 100755 --- a/application/controllers/payslip.php +++ b/application/controllers/payslip.php @@ -688,10 +688,27 @@ function phpAlert($msg) { function payslipLisiting() { + $curr_year = date('Y'); + $curr_month =date('m'); + $curr_monthyear = $curr_month.'-'.$curr_year; $this->global['pageTitle'] = 'Siddharth : 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'] = 'Siddharth : 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) { diff --git a/application/controllers/supplier.php b/application/controllers/supplier.php index b9f0d22a..6b11eaab 100755 --- a/application/controllers/supplier.php +++ b/application/controllers/supplier.php @@ -199,12 +199,13 @@ class supplier extends BaseController { $pan = $this->input->post('panno'); + $gst = $this->input->post('GSTNo'); $this->form_validation->set_rules('SupplierName','Supplier Name','trim|required'); $this->form_validation->set_rules('Address','Address','trim|required|'); $this->form_validation->set_rules('ContactNumber','Contact Number','trim|required|max_length[13]'); $this->form_validation->set_rules('AlternateContactNumber','Alternate Contact Number','trim|max_length[13]'); $this->form_validation->set_rules('emailid','emailid', 'valid_email|max_length[128]|required'); - $this->form_validation->set_rules('TIN','TIN','trim|required|max_length[11]'); + $this->form_validation->set_rules('TIN','TIN','trim|max_length[11]'); if($pan=='') { $this->form_validation->set_rules('panno', 'panno', 'trim|max_length[10]'); @@ -213,7 +214,14 @@ class supplier extends BaseController { $this->form_validation->set_rules('panno', 'panno', 'trim|max_length[10]|callback_checkPanValidate'); } - $this->form_validation->set_rules('GSTNo','GSTNo','trim|requried|max_length[15]|callback_checkGstValidate'); + if($gst=='') + { + $this->form_validation->set_rules('GSTNo','GSTNo','trim|max_length[15]'); + } + else + { + $this->form_validation->set_rules('GSTNo','GSTNo','trim|max_length[15]|callback_checkGstValidate'); + } if($this->form_validation->run() == FALSE) { @@ -318,7 +326,8 @@ class supplier extends BaseController * This function is used to edit the Supplier information */ function editsupplier() - { $pan = $this->input->post('panno'); + { $pan = $this->input->post('panno'); + $gst = $this->input->post('GSTNo'); $this->form_validation->set_rules('SupplierName','Supplier Name','trim|required'); $this->form_validation->set_rules('Address','Address','trim|required|'); $supplierID = $this->input->post('SupplierID'); @@ -326,7 +335,7 @@ class supplier extends BaseController $this->form_validation->set_rules('ContactNumber','Contact Number','trim|required|max_length[13]'); $this->form_validation->set_rules('AlternateContactNumber','Alternate Contact Number','trim|max_length[13]'); $this->form_validation->set_rules('emailid','emailid','valid_email|max_length[128]|required'); - $this->form_validation->set_rules('TIN','TIN','trim|required|max_length[11]'); + $this->form_validation->set_rules('TIN','TIN','trim|max_length[11]'); if($pan=='') { $this->form_validation->set_rules('panno', 'panno', 'trim|max_length[10]'); @@ -336,7 +345,14 @@ class supplier extends BaseController $this->form_validation->set_rules('panno', 'panno', 'trim|max_length[10]|callback_checkPanValidateSupplier'); } - $this->form_validation->set_rules('GSTNo','GSTNo','trim|requried|max_length[15]|callback_checkGstValidateSupplier'); + if($gst=='') + { + $this->form_validation->set_rules('GSTNo','GSTNo','trim|max_length[15]'); + } + else + { + $this->form_validation->set_rules('GSTNo','GSTNo','trim|max_length[15]|callback_checkGstValidateSupplier'); + } diff --git a/application/models/monthlypay_model.php b/application/models/monthlypay_model.php index 476b7a15..832d5c04 100755 --- a/application/models/monthlypay_model.php +++ b/application/models/monthlypay_model.php @@ -31,15 +31,34 @@ class monthlypay_model extends CI_Model function getEmpPayDetails($current="",$s="") { - $this->db->select('T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.DateofJoining'); - $this->db->from('T_Employee_Details'); - //$this->db->join('T_Emp_Pay_Data','T_Emp_Pay_Data.EmpID=T_Employee_Details.EmpID','Left'); - $this->db->where('T_Employee_Details.IsActive',1); - $this->db->order_by('EmpID','asc'); - $query = $this->db->get(); + // $this->db->select('T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.DateofJoining'); + // $this->db->from('T_Employee_Details'); + // //$this->db->join('T_Emp_Pay_Data','T_Emp_Pay_Data.EmpID=T_Employee_Details.EmpID','Left'); + // $this->db->where('T_Employee_Details.IsActive',1); + // $this->db->order_by('EmpID','asc'); + // $query = $this->db->get(); + // $result = $query->result(); + + // return $result; + $month_val = date('m',strtotime($current)); + $year_val = date('Y',strtotime($current)); + $date_val =cal_days_in_month(CAL_GREGORIAN,$month_val,$year_val); + //$monthyear_val = date('Y-m',strtotime($current)); + $lastdate = $year_val.'-'.$month_val.'-'.$date_val; + + $sql = "select Emp.EmpID, Emp.FirstName,Emp.LastName,Emp.DateofJoining,Emp.IsActive + from T_Employee_Details as Emp + where Emp.DateofJoining <= ? + and Emp.IsActive = 1 + order by Emp.EmpID + asc "; + $query = $this->db->query($sql,array($lastdate)); + $result = $query->result(); return $result; + + } function getEmpPayDetailsforMonthInputs($current="") @@ -54,11 +73,11 @@ class monthlypay_model extends CI_Model left join T_Payroll on T_Employee_Details.EmpID = T_Payroll.EmpID left join T_Attendance on T_Emp_Pay_Data.EmpID = T_Attendance.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_Employee_Details.DateofJoining <= CURRENT_DATE + where month(T_Employee_Details.DateofJoining) <= month(?) and year(T_Employee_Details.DateofJoining) <= year(?) and month(T_Attendance.Month_Year) = month(?) order by T_Employee_Details.EmpID"; - $query = $this->db->query($sql,array($current)); + $query = $this->db->query($sql,array($current,$current,$current)); return $query->result(); } @@ -121,18 +140,37 @@ class monthlypay_model extends CI_Model 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->order_by('T_Attendance.EmpID', 'asc'); - $this->db->where('Month_Year',$current); - $this->db->where('T_Employee_Details.IsActive',1); + // $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->order_by('T_Attendance.EmpID', 'asc'); + // $this->db->where('Month_Year',$current); + // $this->db->where('T_Employee_Details.IsActive',1); - $query = $this->db->get(); + // $query = $this->db->get(); - $result = $query->result(); + // $result = $query->result(); - return $result; + // return $result; + $month_val = date('m',strtotime($current)); + $year_val = date('Y',strtotime($current)); + + $sql = "select Emp.DateofJoining, Emp.FirstName,Emp.LastName,Att.* + from T_Attendance as Att + join T_Employee_Details as Emp + on Emp.EmpID = Att.EmpID + where year(Emp.DateofJoining) <= year(?) + and month(Emp.DateofJoining) <= month(?) + and Emp.IsActive = 1 + and Att.Month_Year = ? + order by Att.EmpID + asc "; + + $query = $this->db->query($sql,array($current,$current,$current)); + + $result = $query->result(); + return $result; + } function saveMonthlyData_model($data) { diff --git a/application/views/addsupplier.php b/application/views/addsupplier.php index 35f8e810..8d81e09e 100755 --- a/application/views/addsupplier.php +++ b/application/views/addsupplier.php @@ -405,8 +405,8 @@ $(function() { PAN