payroll new field changes and material & supplier duplication name alert

This commit is contained in:
venbatechnologies@gmail.com 2018-01-17 16:21:09 +05:30
parent 742ebc8932
commit dfa3bdff73
11 changed files with 167 additions and 19 deletions

View File

@ -569,6 +569,7 @@ function phpAlert($msg) {
$OT_Hrs_Worked = $j['OT Hours Worked in Hrs'];
$Loan_Recovered = $j['Loan Recovered in ₹'];
$Incentives = $j['Incentives in ₹'];
$Festival_Bonus = $j['Festival Bonus in ₹'];
$Other_Deductions = $j['Other Deductions in ₹'];
$Created_By = $this->session->userdata ( 'userId' );
@ -627,6 +628,11 @@ function phpAlert($msg) {
$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)
@ -669,10 +675,11 @@ function phpAlert($msg) {
$Loan_Recovered = strtoupper($Loan_Recovered);
}
$Incentives = $j['Incentives in ₹'];
$Festival_Bonus = $j['Festival Bonus in ₹'];
$Other_Deductions = $j['Other Deductions 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,'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,'Festival_Bonus'=>$Festival_Bonus,'Other_Deductions'=>$Other_Deductions,'Created_By'=>$Created_By);
$result = $this->monthlypay_model->saveMonthlyData_model($monthlypaydata);
$total = $total + $result;
}

View File

@ -450,6 +450,18 @@ class rawmaterialdetails extends BaseController
$this->loadViews("404", $this->global, NULL, NULL);
}
function checkmaterial()
{
$material = $this->input->post('id');
$this->load->model('rawmaterialdetails_model');
$query = $this->rawmaterialdetails_model->checkMaterialExists($material);
//if(!empty($material)){
echo json_encode($query);
//}
}
}
?>

View File

@ -628,6 +628,17 @@ class supplier extends BaseController
$this->loadViews("404", $this->global, NULL, NULL);
}
function checksupplier()
{
$supp_name = $this->input->post('id');
$this->load->model('supplier_model');
$query = $this->supplier_model->checkSupplierExists($supp_name);
//if(!empty($supp_name)){
echo json_encode($query);
//}
}
}
?>

View File

@ -13,21 +13,30 @@ class monthlypay_model extends CI_Model
function monthlyListing($current="")
{
//echo $current;
$month_val = date('m',strtotime($current));
$year_val = date('Y',strtotime($current));
$curr_split = explode('-',$current);
$month_val = $curr_split[0];
$year_val = $curr_split[1];
$date_val =cal_days_in_month(CAL_GREGORIAN,$month_val,$year_val);
$lastdate = $year_val.'-'.$month_val.'-'.$date_val;
$this->db->select('T_Monthly_Pay_Inputs.*,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Payroll.Key,T_Loan_Master.Loan_ID');
$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->join('T_Loan_Master','T_Monthly_Pay_Inputs.EmpID=T_Loan_Master.EmpID','left');
$this->db->order_by('T_Employee_Details.EmpID','asc');
$this->db->where('T_Employee_Details.DateofJoining <=',$lastdate);
$this->db->where('Month_Year',$current);
// $this->db->select('T_Monthly_Pay_Inputs.*,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Payroll.Key,T_Loan_Master.Loan_ID');
// $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->join('T_Loan_Master','T_Monthly_Pay_Inputs.EmpID=T_Loan_Master.EmpID','left');
// $this->db->order_by('T_Employee_Details.EmpID','asc');
// $this->db->where('T_Employee_Details.DateofJoining <=',$lastdate);
// $this->db->where('Month_Year',$current);
$sql="select T_Monthly_Pay_Inputs.*,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Loan_Master.Loan_ID,T_Payroll.Key
from T_Monthly_Pay_Inputs
left join T_Employee_Details on T_Monthly_Pay_Inputs.EmpID=T_Employee_Details.EmpID and T_Employee_Details.DateofJoining <= ?
left join T_Payroll on T_Monthly_Pay_Inputs.EmpID=T_Payroll.EmpID
left join T_Loan_Master on T_Monthly_Pay_Inputs.EmpID=T_Loan_Master.EmpID and T_Loan_Master.is_Active = 1
where Month_Year = ?
order by T_Employee_Details.EmpID asc";
$query = $this->db->get();
$query = $this->db->query($sql,array($lastdate,$current));
// print_r($query->result());
$result = $query->result();
@ -69,7 +78,7 @@ class monthlypay_model extends CI_Model
$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;
echo $lastdate;
//echo $lastdate;
$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,T_Loan_Master.Loan_ID,T_Payroll.Key from T_Emp_Pay_Data
left join T_Employee_Details on T_Employee_Details.EmpID = T_Emp_Pay_Data.EmpID
left join T_Payroll on T_Employee_Details.EmpID = T_Payroll.EmpID and month(T_Payroll.PayOn) = month(?) and year(T_Payroll.PayOn) = year(?)

View File

@ -174,5 +174,17 @@ class rawmaterialdetails_model extends CI_Model
// $this->db->update('T_PurchaseOrderDetails', $POInfo);
// return $this->db->affected_rows();
// }
function checkMaterialExists($material)
{
$this->db->select('MaterialCode,MaterialName,MaterialType,Category');
$this->db->from('T_MaterialMaster');
$this->db->like('MaterialName', $material);
$query = $this->db->get();
//print_r($query->result());
return $query->result();
}
}
?>

View File

@ -177,7 +177,18 @@ function addNewsupplier($supplier)
return $this->db->get('T_SupplierDetailsN as det')->result_array();
}
function checkSupplierExists($supp_name)
{
$this->db->select('SupplierID,SupplierName,Address');
$this->db->from('T_SupplierDetailsN');
$this->db->like('SupplierName', $supp_name);
$query = $this->db->get();
return $query->result();
}
/*SUPPLIER */
/*SUPPLIER TYPE */

View File

@ -60,7 +60,7 @@ function BlockSpecial(evt) {
</section>
<section class="content">
<section class="content" id="content">
<div style="text-align:right;">
<a href="<?php echo base_url() ?>rawmaterialdetails/rawmaterialListing" class="btn btn-primary" value="Back"/>Back</a>
</div>
@ -278,6 +278,40 @@ function BlockSpecial(evt) {
</div>
<script src="<?php echo base_url(); ?>assets/js/addUser.js" type="text/javascript"></script>
<script>
$('#MaterialName').change(function() {
var material = $('#MaterialName').val();
$('#content').loader('show');
$.ajax({
data:{id:material},
type:"POST",
url:"<?php echo base_url();?>rawmaterialdetails/checkmaterial",
success:function(data) {
var count = data.length;
//alert(count);
if(count >2 ){
$('#content').loader('hide');
alert('Material name already existed ! ');
dat = JSON.parse(data);
var related_name = "";
$.each(dat,function(i,obj){
related_name += obj.MaterialCode +" - "+ obj.MaterialName+" - "+obj.MaterialType+" - "+obj.Category+"\n";
});
alert("'" + material + "' - related materials are , " + " \n \n" + related_name);
}
else{
$('#content').loader('hide');
// alert("empty data");
}
}
});
});
function Validate()
{
if($("#MaterialName").val().length < 1)

View File

@ -328,7 +328,7 @@ $(function() {
</section>
<section class="content">
<section class="content" id="content">
<div style="text-align:right;">
<a href="<?php echo base_url() ?>supplierListing" class="btn btn-primary" value="Back"/>Back</a>
</div>
@ -703,5 +703,39 @@ if(!validateEmail())
}
});
</script>
$('#supplierName').change(function() {
var supplier = $('#supplierName').val();
$('#content').loader('show');
$.ajax({
data:{id:supplier},
type:"POST",
url:"<?php echo base_url();?>supplier/checksupplier",
success:function(data) {
var count = data.length;
//alert(count);
if(count >2 ){
$('#content').loader('hide');
alert('supplier already existed ! ');
dat = JSON.parse(data);
var related_supplier = "";
$.each(dat,function(i,obj){
related_supplier += obj.SupplierID +" - "+ obj.SupplierName +" - "+obj.Address+"\n";
});
alert("'" + supplier + "' - related supplier are , " + " \n \n" + related_supplier);
}
else{
$('#content').loader('hide');
// alert("empty data");
}
}
});
});
</script>

View File

@ -515,12 +515,12 @@ $(function() {
<span>Monthly Pay Information</span>
</a>
</li>
<li class="treeview">
<!-- <li class="treeview">
<a href="<?php echo base_url(); ?>ExcelUpload2">
<i class="fa fa-upload"></i>
<span>Monthly Pay Upload</span>
</a>
</li>
</li>-->
<li class="treeview">
<a href="<?php echo base_url(); ?>ViewPay">
<i class="fa fa-money"></i>

View File

@ -155,6 +155,7 @@ $('html').bind('keypress', function(e)
<th>Incentives in </th>
<th>Other Deductions in </th>
<th>Festival Bonus in </th>
</tr>
</thead>
@ -202,6 +203,7 @@ $('html').bind('keypress', function(e)
<td <?php if(empty($record->Key) && !empty($record->Loan_ID)){ echo "contenteditable='true'; style='background-color:#ffcccc;text-align:right' title='Loan Pending'"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->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,'.','');} ?></td>
<td <?php if(empty($record->Key)){echo "contenteditable='true';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->Incentives)){echo $record->Incentives;}else{ echo number_format(0.00,2,'.','');;} ?></td>
<td <?php if(empty($record->Key)){echo "contenteditable='true';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->Other_Deductions)){echo $record->Other_Deductions; }else{ echo number_format(0.00,2,'.','');;} ?></td>
<td <?php if(empty($record->Key)){echo "contenteditable='true';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->Festival_Bonus)){echo $record->Festival_Bonus; }else{ echo number_format(0.00,2,'.','');;} ?></td>
</tr>

View File

@ -35,6 +35,7 @@
$SalaryAsPerPF = '';
$FoodAllowance ='';
$Incentive = '';
$Festival_bonus = '';
$TotalSalary = '';
$Advance = '';
$BalanceAdvance = '';
@ -140,6 +141,15 @@ if(!empty($PayDetails))
{
$Incentive = $IncenAmt;
}
$festbonus = $Pay->Festival_Bonus;
if($festbonus == '')
{
$Festival_bonus = '0.00';
}
else
{
$Festival_bonus = $festbonus;
}
$TotalSalary = $WorkedSalary+$HRA+$Food+$IncenAmt+$OTSal+$Otherallowances;
$Adv = $Pay->Advance;
if($Adv == '')
@ -295,6 +305,12 @@ if($RecCount > 0)
<td></td>
<td style="text-align: right;"></td>
</tr>
<tr>
<td>&nbsp;Festival Bonus</td>
<td style="text-align: right;"><?php echo $Festival_bonus ?>&nbsp;</td>
<td></td>
<td style="text-align: right;"></td>
</tr>
<tr><th nowrap>&nbsp;Total Earning (Rounded) (TE)</th>
<td style="text-align: right;"> <?php echo number_format(round($TotalSalary),2,'.','')?>&nbsp;</td>
<th nowrap>&nbsp;Total Deduction (Rounded)(TD)</th>