material adjustment
This commit is contained in:
parent
88006a3e4d
commit
8e59ee2a1f
@ -175,6 +175,8 @@ define('NILTYPE', 'NIL');
|
||||
define('PERUOM', 'PER UOM');
|
||||
define('PERTRIP', 'PER TRIP');
|
||||
|
||||
//
|
||||
|
||||
|
||||
/* Formula for Tax calculation */
|
||||
/* Discount*/
|
||||
@ -329,6 +331,9 @@ define('Capital_RMCIncludingCustomers_Charge1',
|
||||
|
||||
|
||||
|
||||
//stock final product
|
||||
|
||||
define('Consumables', 'Consumables');
|
||||
define('RawMaterial', 'Raw Material');
|
||||
/* End of file constants.php */
|
||||
/* Location: ./application/config/constants.php */
|
||||
|
||||
@ -332,3 +332,10 @@ $route['DeliveryPerformance']="user/deliver_perform";
|
||||
//this function ues to ponoreset values
|
||||
|
||||
$route['poresetview']="purchaseorder/poresetview";
|
||||
|
||||
|
||||
//stock
|
||||
|
||||
$route['FinalProduct'] = "batchcard/FinalProductCalculation";
|
||||
|
||||
$route['MaterailAdjustment'] = "batchcard/MaterailAdjustment";
|
||||
|
||||
@ -1256,5 +1256,96 @@ class batchcard extends BaseController
|
||||
}
|
||||
|
||||
|
||||
|
||||
function FinalProductCalculation()
|
||||
{
|
||||
|
||||
$data['inv_final_product'] = $this->batchcard_model->getinvoice_products();
|
||||
$data['consumable_material']= $this->batchcard_model->get_consumablematerials();
|
||||
$data['Raw_material'] = $this->batchcard_model->get_rawmaterials();
|
||||
$data['supplier'] = $this->batchcard_model->getSupplierlist();
|
||||
//print_r($data['allhourdata']);die();
|
||||
$this->global['pageTitle'] = 'Siddharth : Final Product';
|
||||
$this->loadViews("FinalProduct", $this->global,$data,NULL);
|
||||
}
|
||||
|
||||
|
||||
function MaterailAdjustment()
|
||||
{
|
||||
$data['MaterialCode'] = $this->batchcard_model->getMaterial();
|
||||
$data['Supplier'] = $this->batchcard_model->getSupplierlist();
|
||||
|
||||
$this->global['pageTitle'] = 'Siddharth : Material Adjustment';
|
||||
$this->loadViews("materialadjustment", $this->global,$data,NULL);
|
||||
}
|
||||
|
||||
function getQuantity()
|
||||
{
|
||||
$MaterialCode = $this->input->post('materialcode');
|
||||
$date = $this->input->post('date');
|
||||
$Supplier = $this->input->post('Supplier');
|
||||
|
||||
$netQtyarray = $this->batchcard_model->GetNetQty($MaterialCode,$date,$Supplier);
|
||||
|
||||
echo json_encode($netQtyarray);
|
||||
//print_r($netQtyarray);
|
||||
|
||||
// echo $MaterialCode;
|
||||
// echo $date;
|
||||
// echo $Supplier;
|
||||
}
|
||||
|
||||
function addNewMaterialHistory()
|
||||
{
|
||||
$supplier = $this->input->post('supplier');
|
||||
$materialcode = $this->input->post('materialcode');
|
||||
$date = $this->input->post('date');
|
||||
$ActualQty = $this->input->post('ActualQty');
|
||||
$Qty = $this->input->post('AdjustableQty');
|
||||
$reason = $this->input->post('reason');
|
||||
$Description = $this->input->post('Description');
|
||||
$status = $this->input->post('transtatus');
|
||||
$CreatedBy = $this->session->userdata('userId');
|
||||
$absaluteQty = abs($Qty);
|
||||
|
||||
// echo $Qty;
|
||||
// echo "abs";
|
||||
// echo abs($Qty);
|
||||
//die();
|
||||
|
||||
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||
$createddt = $dt->format('Y-m-d H:i:s');
|
||||
|
||||
$adjustmentaarray = array('MaterialCode'=>$materialcode,'ActualQuantity'=>$ActualQty,'Quantity'=>$absaluteQty,'SupplierID'=>$supplier,'Reason'=>$reason,'Description'=>$Description,'CreatedOn'=>$createddt,'CreatedBy'=>$CreatedBy);
|
||||
|
||||
$materialadjust = $this->batchcard_model->AddmaterialAdjustment($adjustmentaarray);
|
||||
|
||||
$adjustId ='';
|
||||
|
||||
if(!empty($materialadjust))
|
||||
{
|
||||
foreach($materialadjust as $ig)
|
||||
{
|
||||
$adjustId = $ig->AdjustmentId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$historytable = array('SupplierID'=>$supplier,'MaterialCode'=>$materialcode,'Transaction_type'=>$status,'Ref_Type'=>'Adjust','Quantity'=>$absaluteQty,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt,'Ref_No'=>$adjustId);
|
||||
|
||||
$historyadd = $this->batchcard_model->AddMaterialHistory($historytable);
|
||||
|
||||
|
||||
if((count($materialadjust)>0) &&(count($historyadd)))
|
||||
{
|
||||
echo "Material Details Added Successfully";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Something Went Wrong,Please Try Again";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
@ -345,6 +345,34 @@ class inwardgateregister extends BaseController
|
||||
$igrDetails = array('IGRNO'=>$IGRNO,'MaterialCode'=>$MaterialCode,'QuantityAsPerInvoice'=>$QuantityAsPerInvoice,'Remarks'=>$Remarks,'IGRItemStatus'=>$IGRItemStatus,'CreatedBy'=>$CreatedBy,'CreatedDate'=>$createddt);
|
||||
|
||||
$igrD = $this->inwardgateregister_model->addigrD($igrDetails);
|
||||
|
||||
$igrlineno ='';
|
||||
|
||||
if(!empty($igrD))
|
||||
{
|
||||
foreach($igrD as $ig)
|
||||
{
|
||||
$igrlineno = $ig->IGRItemNo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$itemvalue='';
|
||||
$SupplierId='';
|
||||
$polineitemvalue = $this->inwardgateregister_model->getitemvalue($PONO,$MaterialCode);
|
||||
|
||||
foreach($polineitemvalue as $it)
|
||||
{
|
||||
$itemvalue =$it->Rate;
|
||||
$SupplierId =$it->SupplierID;
|
||||
}
|
||||
|
||||
$historydetails = array('MaterialCode'=>$MaterialCode,'Transaction_type'=>"Add",'Ref_Type'=>"IGR",'Ref_No'=>$igrlineno,'Quantity'=>$QuantityAsPerInvoice,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt,'SupplierID'=>$SupplierId,'ItemValue'=>$itemvalue);
|
||||
|
||||
|
||||
$this->inwardgateregister_model->addmaterialhistory($historydetails);
|
||||
|
||||
|
||||
|
||||
$Recqty = $this->inwardgateregister_model->getPOLineItemReceivedQty($PONO,$MaterialCode);
|
||||
$ReceivedQuantity = 0.00;
|
||||
@ -513,6 +541,44 @@ class inwardgateregister extends BaseController
|
||||
$Ogrline= array('OGRNO'=>$OGRNO,'MaterialCode'=>$MaterialCode,'OutwardQty'=>$Outwardtotal,'Status'=>$Status,'balance_Qty'=>$balance_Qty);
|
||||
$addOgrline = $this->inwardgateregister_model->AddOgrLine($Ogrline);
|
||||
|
||||
//print_r($addOgrline);
|
||||
|
||||
$ogrlineno='';
|
||||
$itemvalue='';
|
||||
$SupplierId='';
|
||||
|
||||
$CreatedBy = $this->session->userdata('userId');
|
||||
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||
$createddt = $dt->format('Y-m-d H:i:s');
|
||||
|
||||
if(count($addogrmaster)>0)
|
||||
{
|
||||
$ogrlinearray= $this->inwardgateregister_model->getlastogrline();
|
||||
|
||||
foreach($ogrlinearray as $og)
|
||||
{
|
||||
$ogrlineno = $og->OGRItemNO;
|
||||
}
|
||||
|
||||
$polineitemvalue = $this->inwardgateregister_model->getitemvalue($pono,$MaterialCode);
|
||||
|
||||
foreach($polineitemvalue as $it)
|
||||
{
|
||||
$itemvalue =$it->Rate;
|
||||
$SupplierId =$it->SupplierID;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$historydetails = array('MaterialCode'=>$MaterialCode,'Transaction_type'=>"Reduce",'Ref_Type'=>"OGR",'Ref_No'=>$ogrlineno,'Quantity'=>$Outwardtotal,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt,'ItemValue'=>$itemvalue,'SupplierID'=>$SupplierId);
|
||||
|
||||
|
||||
$this->inwardgateregister_model->addmaterialhistory($historydetails);
|
||||
|
||||
|
||||
|
||||
$this->inwardgateregister_model->UpdateOGRMasterOGRStatus($OGRNO);
|
||||
|
||||
$this->inwardgateregister_model->UpdateMRIRMasterOGRStatus($MRIRNO,$OGRNO);
|
||||
|
||||
0
application/controllers/payslip.php
Executable file → Normal file
0
application/controllers/payslip.php
Executable file → Normal file
@ -553,6 +553,116 @@ class batchcard_model extends CI_Model
|
||||
// return $res->result();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function getinvoice_products()
|
||||
{
|
||||
|
||||
$this->db->select('product_id,product_name');
|
||||
$this->db->from('ip_products');
|
||||
$supp = $this->db->get();
|
||||
return $supp->result();
|
||||
|
||||
}
|
||||
|
||||
function get_consumablematerials()
|
||||
{
|
||||
|
||||
$this->db->select('MaterialCode,MaterialName,');
|
||||
$this->db->from('T_MaterialMaster');
|
||||
$this->db->where('T_MaterialMaster.Category',Consumables);
|
||||
$supp = $this->db->get();
|
||||
return $supp->result();
|
||||
|
||||
}
|
||||
|
||||
|
||||
function get_rawmaterials()
|
||||
{
|
||||
$this->db->select('MaterialCode,MaterialName,');
|
||||
$this->db->from('T_MaterialMaster');
|
||||
$this->db->where('T_MaterialMaster.Category',RawMaterial);
|
||||
$supp = $this->db->get();
|
||||
return $supp->result();
|
||||
}
|
||||
|
||||
|
||||
function getMaterial()
|
||||
{
|
||||
$this->db->select('MaterialCode,MaterialName,');
|
||||
$this->db->from('T_MaterialMaster');
|
||||
//$this->db->where('T_MaterialMaster.Category',Consumables);
|
||||
$supp = $this->db->get();
|
||||
return $supp->result();
|
||||
}
|
||||
|
||||
|
||||
function GetNetQty($MaterialCode,$date,$Supplier)
|
||||
{
|
||||
//echo $date;
|
||||
$dt = date('d',strtotime($date));
|
||||
$year = date('Y', strtotime($date));
|
||||
$month = date('m', strtotime($date));
|
||||
|
||||
if($month<04)
|
||||
{
|
||||
//echo "b4finance";
|
||||
$newyr = $year - 1;
|
||||
$startdate = $newyr.'-'.'04'.'-'.'01';
|
||||
|
||||
//echo $startdate;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// echo "after Finance";
|
||||
$startdate = $year.'-'.'04'.'-'.'01';
|
||||
//echo $startdate;
|
||||
}
|
||||
|
||||
|
||||
$subQuery='select (select sum(Quantity) as AddQty from T_Material_stock_history where Transaction_type = "Add" and MaterialCode=?
|
||||
) as Addqty,(select sum(Quantity) as ReduceQty from T_Material_stock_history where Transaction_type = "Reduce" and MaterialCode=?
|
||||
) as ReduceQty from T_Material_stock_history where MaterialCode=? and CreatedOn >= ? and CreatedOn<=? and SupplierID=? group by Addqty';
|
||||
$query = $this->db->query($subQuery,array($MaterialCode,$MaterialCode,$MaterialCode,$startdate,$date,$Supplier));
|
||||
//print_r($this->db->last_query());
|
||||
return $query->result_array();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function AddmaterialAdjustment($adjustmentaarray)
|
||||
{
|
||||
$this->db->trans_start();
|
||||
$this->db->insert('T_Material_Adjustment',$adjustmentaarray);
|
||||
$insert_id = $this->db->affected_rows();
|
||||
$this->db->trans_complete();
|
||||
// print_r($this->db->last_query());
|
||||
//print_r($insert_id);
|
||||
if($insert_id>0)
|
||||
{
|
||||
$subQuery = 'select max(AdjustmentId) as AdjustmentId from T_Material_Adjustment';
|
||||
$query = $this->db->query($subQuery);
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function AddMaterialHistory($historytable)
|
||||
{
|
||||
$this->db->trans_start();
|
||||
$this->db->insert('T_Material_stock_history',$historytable);
|
||||
$insert_id = $this->db->affected_rows();
|
||||
$this->db->trans_complete();
|
||||
return $insert_id;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -18,8 +18,6 @@ class inwardgateregister_model extends CI_Model
|
||||
*/
|
||||
function igrListing()
|
||||
{
|
||||
|
||||
|
||||
$this->db->select('igr.*,PO.DeliveryDate,sup.SupplierName,igr.file');
|
||||
$this->db->from('T_IGR_Master igr');
|
||||
$this->db->join('T_PurchaseOrder_Master PO','igr.PONO = PO.PONO');
|
||||
@ -27,7 +25,6 @@ class inwardgateregister_model extends CI_Model
|
||||
$this->db->order_by('igr.CreatedDate','desc');
|
||||
$query = $this->db->get();
|
||||
$result = $query->result();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -117,10 +114,41 @@ class inwardgateregister_model extends CI_Model
|
||||
$subQuery = 'select max(IGRItemNo) as IGRItemNo from T_IGR_Details';
|
||||
|
||||
$query = $this->db->query($subQuery);
|
||||
|
||||
//print_r($query);
|
||||
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function addmaterialhistory($historydetails)
|
||||
{
|
||||
|
||||
$this->db->trans_start();
|
||||
$this->db->insert('T_Material_stock_history', $historydetails);
|
||||
$insert_id = $this->db->affected_rows();
|
||||
$this->db->trans_complete();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function getitemvalue($pono,$MaterialCode)
|
||||
{
|
||||
$this->db->select('Rate,SupplierID');
|
||||
$this->db->from('T_PurchaseOrder_LineItem');
|
||||
$this->db->join('T_PurchaseOrder_Master','T_PurchaseOrder_Master.PONO=T_PurchaseOrder_LineItem.PONO');
|
||||
$this->db->where('T_PurchaseOrder_LineItem.PONO',$pono);
|
||||
$this->db->where('MaterialCode',$MaterialCode);
|
||||
$query = $this->db->get();
|
||||
$result = $query->result();
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function viewigr($IGRNO)
|
||||
{
|
||||
$this->db->distinct();
|
||||
@ -558,6 +586,18 @@ function getPOmaterial($PONO)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function getlastogrline()
|
||||
{
|
||||
$subQuery = 'select max(OGRItemNO) as OGRItemNO from T_OGR_Details';
|
||||
|
||||
$query = $this->db->query($subQuery);
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
|
||||
function UpdateOGR($updateogrmaster,$OGRNO)
|
||||
{
|
||||
$this->db->where('OGRNO',$OGRNO);
|
||||
|
||||
0
application/models/monthlypay_model.php
Executable file → Normal file
0
application/models/monthlypay_model.php
Executable file → Normal file
@ -391,6 +391,44 @@ display: none;
|
||||
</li>
|
||||
<?php }?>
|
||||
<?php }?>
|
||||
|
||||
|
||||
|
||||
<!--STOCK -->
|
||||
<?php if(empty($DepAccesslist)){?>
|
||||
<?php if($DEPCode == PRODUCTION){?>
|
||||
|
||||
<!-- <li>
|
||||
<a href="<?php echo base_url(); ?>FinalProduct">
|
||||
<i class="fa fa-dashboard"></i> <span>Final Product</span>
|
||||
</a>
|
||||
</li> -->
|
||||
|
||||
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>MaterailAdjustment">
|
||||
<i class="fa fa-dashboard"></i> <span>Material Adjustment</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<?php } }
|
||||
|
||||
else{
|
||||
$check25=0;
|
||||
foreach($DepAccesslist as $dep){
|
||||
$assd=$dep->AssDep;
|
||||
if($assd == PRODUCTION || $DEPCode == PRODUCTION){
|
||||
$check25 =1
|
||||
?>
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>MaterailAdjustment">
|
||||
<i class="fa fa-dashboard"></i> <span>Material Adjustment</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<?php } if($check25 == 1){break;} } } ?>
|
||||
|
||||
|
||||
<!-- INPROCESS MODULE-->
|
||||
@ -508,7 +546,7 @@ display: none;
|
||||
</a>
|
||||
|
||||
|
||||
<?php// if(empty($DepAccesslist)){?>
|
||||
<?php // if(empty($DepAccesslist)){?>
|
||||
<?php //if($DEPCode == PRODUCTION){?>
|
||||
|
||||
<ul class="treeview-menu">
|
||||
@ -617,7 +655,7 @@ display: none;
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<?php// if(empty($DepAccesslist)){?>
|
||||
<?php // if(empty($DepAccesslist)){?>
|
||||
<?php //if($DEPCode == PRODUCTION){?>
|
||||
|
||||
<ul class="treeview-menu">
|
||||
|
||||
392
application/views/materialadjustment.php
Normal file
392
application/views/materialadjustment.php
Normal file
@ -0,0 +1,392 @@
|
||||
<script>
|
||||
$(function() {
|
||||
//Initialize Select2 Elements
|
||||
$("#materialcode").select2();
|
||||
$('#supplier').select2();
|
||||
$('#reason').select2();
|
||||
|
||||
$("#date").datepicker({
|
||||
|
||||
//maxDate : 'now',
|
||||
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
.content {
|
||||
Padding:0% ! important;
|
||||
}
|
||||
|
||||
.num{
|
||||
text-align:right;
|
||||
}
|
||||
</style>
|
||||
<div class="content-wrapper" style="min-height:537">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
|
||||
<h1>
|
||||
<center>Siddharth Industries - Material Adjustment</center>
|
||||
|
||||
</h1>
|
||||
</section>
|
||||
|
||||
</br>
|
||||
</br>
|
||||
<section class="content">
|
||||
<div id="content"></div>
|
||||
<?php
|
||||
$attributes = array('class' => 'form-label-left materialadjustment','name' => 'materialadjustment','id' => 'materialadjustment');
|
||||
|
||||
echo form_open($this->config->base_url().'batchcard/addmaterialadjustment',$attributes);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<div class="row" style="padding:0% 2%">
|
||||
<div class="col-md-12" >
|
||||
<div class="col-md-3">
|
||||
<label>Material Code</label>
|
||||
<?php
|
||||
|
||||
$options = array("0"=>'Select Material Code');
|
||||
|
||||
if(!empty($MaterialCode))
|
||||
{
|
||||
foreach ($MaterialCode as $mat):
|
||||
$options[$mat->MaterialCode] =$mat->MaterialCode.' '.' - '.' '.$mat->MaterialName;
|
||||
|
||||
|
||||
//$RL[$SID->ReqNo] = $SID->ReqNo.' '.' - '.' '.$SID->DepartmentName;
|
||||
endforeach;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
echo form_dropdown('materialcode', $options,set_value('MaterialCode'),'id="materialcode"' ,'class="form-control select2"' , 'required="true"' );
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<label>Date</label>
|
||||
<div class="form-group">
|
||||
|
||||
<?php
|
||||
$data = array('name' => 'date','value' => set_value('date',$CurrentDate),'id'=>'date', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;');
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-3">
|
||||
<label>Supplier</label>
|
||||
<?php
|
||||
|
||||
$options = array("0"=>'Select Supplier');
|
||||
|
||||
if(!empty($Supplier))
|
||||
{
|
||||
foreach ($Supplier as $PO):
|
||||
$options[$PO->SupplierID] =$PO->SupplierID.' '.' - '.' '.$PO->SupplierName;
|
||||
|
||||
|
||||
//$RL[$SID->ReqNo] = $SID->ReqNo.' '.' - '.' '.$SID->DepartmentName;
|
||||
endforeach;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
echo form_dropdown('supplier', $options,set_value('SupplierID'),'id="supplier"' ,'class="form-control select2"' , 'required="true"' );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-md-offset-8">
|
||||
|
||||
<a class="btn btn-primary font getdetails" ID="getdetails" > <span class="bold">Get Details</span></a>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</br>
|
||||
</br>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="col-md-8">
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-6">
|
||||
|
||||
<label><?php echo "Quantity As Per System";?></label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<?php
|
||||
$data = array('name' => 'Qty_aspersystem','value' => set_value('Qty_aspersystem',0),'id'=>'Qty_aspersystem', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'', 'readonly'=>'true');
|
||||
echo form_input($data);
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-6">
|
||||
|
||||
<label><?php echo "Actual Quantity";?></label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<?php
|
||||
$data = array('name' => 'ActualQty','value' => set_value('ActualQty',0),'id'=>'ActualQty', 'class' => 'form-control num' ,'onchange'=>'calculateamount()');
|
||||
echo form_input($data);
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-6">
|
||||
|
||||
<label><?php echo "Adjustable Quantity";?></label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<?php
|
||||
$data = array('name' => 'AdjustableQty','value' => set_value('AdjustableQty',0),'id'=>'AdjustableQty', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'', 'readonly'=>'true');
|
||||
echo form_input($data);
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</br>
|
||||
</br>
|
||||
</br>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-6">
|
||||
|
||||
<label><?php echo "Reason";?></label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<?php
|
||||
|
||||
$options = array("0"=>'Select');
|
||||
|
||||
// if(!empty($PONO))
|
||||
// {
|
||||
// foreach ($PONO as $PO):
|
||||
// $options[$PO->PONO] =$PO->PONO.' '.' - '.' '.$PO->POType;
|
||||
|
||||
|
||||
// //$RL[$SID->ReqNo] = $SID->ReqNo.' '.' - '.' '.$SID->DepartmentName;
|
||||
// endforeach;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
echo form_dropdown('reason', $options,set_value('reason'),'id="reason"' ,'class="form-control select2"' , 'required="true"' );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-6">
|
||||
|
||||
<label><?php echo "Description";?></label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<?php
|
||||
$data = array('name' => 'Description','value' => set_value('Description'),'id'=>'Description', 'class' => 'form-control' ,'rows' => '5', 'cols' => '100','maxlength' => '250');
|
||||
echo Form_textarea($data);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="transtatus" id="transtatus">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- <div class="col-md-9" align = "right"><br/>
|
||||
<input type="Submit" class="btn btn-primary" value="Save" style="margin-right:28px" onclick="validate();" />
|
||||
</div> -->
|
||||
|
||||
<div class="col-md-1 col-md-offset-8" id="save"><br><br><br>
|
||||
<a class="btn btn-primary Save" ID="Save" onclick="Save" > <span class="bold">Save</span></a>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
$('.getdetails').click(function()
|
||||
{
|
||||
var materialcode =$('#materialcode').val();
|
||||
var date = $('#date').val();
|
||||
var Supplier = $('#supplier').val();
|
||||
$('#content').loader('show');
|
||||
$.ajax({
|
||||
|
||||
data:{materialcode:materialcode,date:date,Supplier:Supplier},
|
||||
type:"POST",
|
||||
url:"<?php echo base_url();?>batchcard/getQuantity",
|
||||
success:function(data)
|
||||
{
|
||||
$('#content').loader('hide');
|
||||
//console.log(data);
|
||||
var addqty = '';
|
||||
var reduceqty = '';
|
||||
$.each(JSON.parse(data),function(i,obj)
|
||||
{
|
||||
addqty = obj.Addqty;
|
||||
reduceqty = obj.ReduceQty;
|
||||
});
|
||||
|
||||
var resultantqty = parseFloat(addqty)- parseFloat(reduceqty);
|
||||
|
||||
if(isNaN(resultantqty))
|
||||
{
|
||||
$('#Qty_aspersystem').val(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$('#Qty_aspersystem').val(resultantqty);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
function calculateamount()
|
||||
{
|
||||
var actualqty = $('#ActualQty').val();
|
||||
var resultant = $('#Qty_aspersystem').val();
|
||||
var adjustQty = parseFloat(actualqty) - parseFloat(resultant);
|
||||
if(adjustQty<0)
|
||||
{
|
||||
var status = "Reduce";
|
||||
}
|
||||
else
|
||||
{
|
||||
var status = "Add";
|
||||
}
|
||||
|
||||
var absalutevale = Math.abs(adjustQty);
|
||||
|
||||
$('#transtatus').val(status);
|
||||
|
||||
if(isNaN(adjustQty))
|
||||
{
|
||||
$('#AdjustableQty').val(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//$('#AdjustableQty').val(status+" "+absalutevale);
|
||||
|
||||
$('#AdjustableQty').val(adjustQty);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$('.Save').click(function()
|
||||
{
|
||||
|
||||
if($('#materialcode').val()==0)
|
||||
{
|
||||
alert("Please Select Material");
|
||||
}
|
||||
|
||||
else if($('#date').val()=="")
|
||||
{
|
||||
alert("Please Select Date");
|
||||
}
|
||||
|
||||
else if($('#supplier').val()==0)
|
||||
{
|
||||
alert("Please Select Supplier");
|
||||
}
|
||||
|
||||
else if($('#ActualQty').val()=="")
|
||||
{
|
||||
alert("Please Enter the Quantity to Adjust")
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
$('#content').loader('show');
|
||||
$.ajax({
|
||||
|
||||
data:$('.materialadjustment').serialize(),
|
||||
type:"POST",
|
||||
url:"<?php echo base_url() ?>batchcard/addNewMaterialHistory",
|
||||
|
||||
success:function(data)
|
||||
{
|
||||
$('#content').loader('hide');
|
||||
alert(data);
|
||||
location.reload();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
924
application/views/monthlypayinputs.php
Executable file → Normal file
924
application/views/monthlypayinputs.php
Executable file → Normal file
@ -1,922 +1,4 @@
|
||||
<?php
|
||||
$sample = array_merge($month,$fresh);
|
||||
$show_hide_column_value = true;
|
||||
|
||||
foreach($sample as $s)
|
||||
{
|
||||
if(!empty($s->Key))
|
||||
{
|
||||
$show_hide_column_value = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$show_hide_column_value = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$ex = explode('-',$dropdownvalue);
|
||||
|
||||
if(strlen($ex[0])== '2')
|
||||
{
|
||||
if($ex[0] < 10)
|
||||
{
|
||||
$ex1 = substr($ex[0],1);
|
||||
}
|
||||
else{
|
||||
$ex1 = $ex[0];
|
||||
}
|
||||
}
|
||||
else{
|
||||
$ex1 = $ex[0];
|
||||
}
|
||||
|
||||
$drop = $ex1.'-'.$ex[1];
|
||||
?>
|
||||
|
||||
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
|
||||
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
$('html').bind('keypress', function(e)
|
||||
{
|
||||
//alert('Key Pressed');
|
||||
if(e.keyCode == 13)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
.num {
|
||||
text-align:right;
|
||||
}
|
||||
</style>
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
<center>Employee Monthly Payment Listing</center>
|
||||
</h1>
|
||||
</section>
|
||||
<section class="content">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<!--<center><h3 class="box-title">-->
|
||||
<div class="box-tools">
|
||||
<!-- <form action="<?php echo base_url() ?>assetListing" method="POST" id="searchList">-->
|
||||
<p><b>The <span style="background-color:#ff4d4d;">Red</span> highlighted Employee have loan to pay. Put <span style="background-color:#66ff33;">'NA'</span> for Skip Current Month Loan Due.</b></p>
|
||||
<form action="<?php echo base_url() ?>monthlypay/monthlyListing" method="POST" id="searchList">
|
||||
|
||||
</form>
|
||||
</div><!--</h3></center>-->
|
||||
|
||||
</div><!-- /.box-header -->
|
||||
<?php
|
||||
//print_r($sample);
|
||||
$year = date("Y");
|
||||
$current = date("m-Y");
|
||||
|
||||
//echo $current;
|
||||
$month = date("m");
|
||||
if($month < 10)
|
||||
{
|
||||
$month = substr($month,1);
|
||||
}
|
||||
$currentselection = $month . "-" . $year;
|
||||
$options = array();
|
||||
$monthsoptions = array("1" => "Jan", "2" => "Feb","3" => "Mar","4" => "Apr","5" => "May","6" => "June","7"=> "July","8"=> "Aug","9" => "Sep","10"=> "Oct","11" => "Nov","12"=>"Dec");
|
||||
|
||||
$currentmontharray = array(array($month."-".$year => $monthsoptions[$month]."-".$year));
|
||||
// For find out Next and previous month and year from current year
|
||||
$aftersix = array();
|
||||
for ($i = 0; $i <3;$i++){
|
||||
|
||||
$month++;
|
||||
if($month > 12)
|
||||
{
|
||||
$month = 1;
|
||||
$year = $year +1;
|
||||
}
|
||||
|
||||
$aftersix[]=array($month."-".$year => $monthsoptions[$month]."-".$year);
|
||||
|
||||
}
|
||||
|
||||
$year = date("Y");
|
||||
$month = date("m");
|
||||
|
||||
$beforesix = array();
|
||||
for ($i = 3; $i >0;$i--){
|
||||
|
||||
$month--;
|
||||
if($month < 1 )
|
||||
{
|
||||
$month = 12;
|
||||
$year = $year - 1;
|
||||
}
|
||||
|
||||
$beforesix[]=array($month."-".$year => $monthsoptions[$month]."-".$year);
|
||||
|
||||
}
|
||||
|
||||
$beforesix = array_reverse($beforesix);
|
||||
|
||||
|
||||
$options = array_merge($options,$beforesix);
|
||||
//echo count($options);
|
||||
|
||||
$options = array_merge($options,$currentmontharray);
|
||||
$options = array_merge($options,$aftersix);
|
||||
|
||||
$ot = array();
|
||||
foreach($options as $o)
|
||||
{
|
||||
|
||||
foreach($o as $key => $value)
|
||||
{
|
||||
|
||||
$ot[$key] = $value;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<form id="formid">
|
||||
<?php echo form_dropdown('monthyear',$ot,set_value('monthyear',$currentselection),'id="monthyear"' ,'class="form-control select2');?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<table id="monthlylistings" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
|
||||
<thead style="background-color:#ddf">
|
||||
<tr>
|
||||
|
||||
<th>S.No</th>
|
||||
<th>Employee </th>
|
||||
<!-- <th>Employee Name</th> -->
|
||||
<th>Days Worked</th>
|
||||
<th>LOP Days</th>
|
||||
<th>Paid Leave</th>
|
||||
<th>OT Hrs</th>
|
||||
|
||||
<th>Auto Loan Due ₹</th>
|
||||
|
||||
<th>Manual Loan Due ₹</th>
|
||||
|
||||
<th>Incentives in ₹</th>
|
||||
<th>Other Deductions in ₹</th>
|
||||
<th>Festival Bonus in ₹</th>
|
||||
|
||||
<th>Estimate in ₹</th>
|
||||
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
$index=0;
|
||||
$testarray=array();
|
||||
|
||||
|
||||
|
||||
if(!empty($sample))
|
||||
|
||||
{
|
||||
|
||||
//print_r($sample); die;
|
||||
$index = 0;
|
||||
$i = 0;
|
||||
|
||||
foreach($sample as $i=> $record)
|
||||
{
|
||||
//echo 'PAY'.$record->Key;
|
||||
$index++;
|
||||
|
||||
if(in_array($record->EmpID,$testarray))
|
||||
{
|
||||
$index--;
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
|
||||
array_push($testarray,$record->EmpID);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<tr class="lastvalue">
|
||||
<td style="text-align:right;" style="background-color:blue;"><?php echo $index; ?></td>
|
||||
<!-- <td style="text-align:right;"><?php echo $record->EmpID ?></td> -->
|
||||
<td style="max-width:80px"><?php echo $record->EmpID ."-".$record->FirstName ."". $record->LastName ?></td>
|
||||
|
||||
|
||||
<td id="dayWork<?php echo $index?>"<?php if(empty($record->Key)){echo "contenteditable='false';"; } ?> <?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->Days_worked)){echo $record->Days_worked;}else{echo "0.00";}?></td>
|
||||
|
||||
<td id="lopDay<?php echo $index?>"<?php if(empty($record->Key)){echo "contenteditable='false';"; } ?> <?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->LOP_Days)){echo $record->LOP_Days;}else{echo "0.00";}?></td>
|
||||
|
||||
<td id="paidLeave<?php echo $index?>"<?php if(empty($record->Key)){echo "contenteditable='false';"; } ?> <?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->Paid_leave)){echo number_format($record->Paid_leave,2,'.','');}else { echo number_format(0.00,2,'.','');} ?></td>
|
||||
|
||||
<td id="otHrsWork<?php echo $index?>"<?php if(empty($record->Key)){echo "contenteditable='false';"; } ?> <?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->OT_Hrs_Worked)){echo $record->OT_Hrs_Worked;}else { echo number_format(0.00,2,'.','');} ?></td>
|
||||
|
||||
<td id="monthDue<?php echo $index?>" <?php if(empty($record->Key)){echo "contenteditable='false';"; } ?> <?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->Monthly_Due)){echo $record->Monthly_Due; $totalmonthloan []=$record->Monthly_Due;}else { echo number_format(0.00,2,'.','');} ?></td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td id="loanRecd<?php echo $index?>" onkeypress="return isCheckKeyCode(event);" onkeyup="changeInput(event);"<?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,'.',''); $totalmanualoan[] = $record->Loan_Recovered;}else {echo $record->Loan_Recovered; $totalmanualoan[] = $record->Loan_Recovered;}}else{echo number_format(0.00,2,'.','');} ?>
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td id="incentie<?php echo $index?>" onkeypress="return isNumber(event);" onkeyup="changeInput(event);"<?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->MasterIncentives)){echo $record->MasterIncentives;}else {echo $record->MonthlyIncentives;} ?> -->
|
||||
|
||||
<?php if(!empty($record->MonthlyIncentives)){echo $record->MonthlyIncentives; $totalinst [] = $record->MonthlyIncentives;}else {echo $record->MasterIncentives; $totalinst [] = $record->MasterIncentives;}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
<?php ?>
|
||||
<!-- else{ echo number_format(0.00,2,'.','');;} -->
|
||||
|
||||
<td id ="otherDet<?php echo $index?>" onkeypress="return isNumber(event);" onkeyup="changeInput(event);"<?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;$totalotherDet [] = $record->Other_Deductions;}else{ echo number_format(0.00,2,'.','');} ?></td>
|
||||
|
||||
<?php $totalotherDet [] = $Other_Deductions;?>
|
||||
<td id="Festival<?php echo $index?>"onkeypress="return isNumber(event);" onkeyup="changeInput(event);"<?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;$totalfestival [] = $record->Festival_Bonus;}else{ echo number_format(0.00,2,'.','');;} ?></td>
|
||||
|
||||
<?php $totalfestival [] = $Festival_Bonus;?>
|
||||
|
||||
<td id="empsal<?php echo $index?>"<?php if(empty($record->Key)){echo "contenteditable='false';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php }?>> <?php if(!empty($record->Estimate)){echo $record->Estimate; $estTotal [] = $record->Estimate; }else { echo $empSalary[$i]; $estTotal [] = $empSalary[$i];
|
||||
}?></td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <input type="hidden" id = "eid" value="<?php echo $record->EmpID?>">
|
||||
<input type="hidden" id = "inv" value="<?php echo $record->Incentives?>">
|
||||
<input type="hidden" id = "pdi" value="<?php echo $record->Pay_Data_ID?>"> -->
|
||||
<input type="hidden" id = "bPay<?php echo $index?>" value="<?php echo $record->Basic_Pay?>">
|
||||
<input type="hidden" id = "hraRate<?php echo $index?>" value="<?php echo $record->HRA_Rate?>">
|
||||
<input type="hidden" id = "allow<?php echo $index?>" value="<?php echo $record->Allowances?>">
|
||||
<input type="hidden" id = "fAllow<?php echo $index?>" value="<?php echo $record->Food_Allowances?>">
|
||||
<input type="hidden" id = "pfRate<?php echo $index?>" value="<?php echo $record->PF_Rate?>">
|
||||
<input type="hidden" id = "eslRate<?php echo $index?>" value="<?php echo $record->ESI_Rate?>">
|
||||
<input type="hidden" id = "hraAmt<?php echo $index?>" value="<?php echo $record->HRA_Amount?>">
|
||||
|
||||
<input type="hidden" id = "loanamt<?php echo $index?>" value="<?php echo $record->Loan_amount?>">
|
||||
<input type="hidden" id = "paidamt<?php echo $index?>" value="<?php echo $record->Paid_Amount?>">
|
||||
|
||||
<!-- <input type="hidden" id = "eid" value="<?php echo $record->TotalSalary?>">
|
||||
<input type="hidden" id = "eid" value="<?php echo $record->LOP_Days?>">
|
||||
<input type="hidden" id = "eid" value="<?php echo $record->Paid_leave?>">
|
||||
<input type="hidden" id = "eid" value="<?php echo $record->OT_Hrs_Worked?>">
|
||||
<input type="hidden" id = "eid" value="<?php echo $record->NoofDays?>">
|
||||
<input type="hidden" id = "eid" value="<?php echo $record->Monthly_Due?>"> -->
|
||||
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//print_r($totalinst);
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
<tfoot><tr>
|
||||
<th colspan="5"></th>
|
||||
|
||||
|
||||
<th>Total</th>
|
||||
<th id="manualoan"><?php echo array_sum($totalmonthloan);?></th>
|
||||
<th id="monthloan"><?php echo array_sum($totalmanualoan);?></th>
|
||||
<th id="inst"><?php echo array_sum($totalinst);?></th>
|
||||
<th id="other"><?php echo array_sum($totalotherDet);?></th>
|
||||
<th id="fest"><?php echo array_sum($totalfestival);?></th>
|
||||
<th id="estsal"><?php echo array_sum($estTotal);?></th>
|
||||
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<p> </p>
|
||||
<div class="row">
|
||||
<div class="col-md-3" id="savebutton">
|
||||
<input type="button" id="submit" value = "Save" class="btn btn-primary" onclick="getAllData();">
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.box-body -->
|
||||
<!-- <div class="box-footer clearfix">
|
||||
|
||||
</div> -->
|
||||
</div><!-- /.box -->
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/common.js" charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
var estTotal = [];
|
||||
var totalinst = [];
|
||||
var totalotherDet =[];
|
||||
var totalmonthloan =[];
|
||||
var totalmanualoan =[];
|
||||
|
||||
$(function () {
|
||||
var i = 0;
|
||||
$('tr.lastvalue').each(function(){
|
||||
i = i+1;
|
||||
estTotal [i]=$(this).find('td').eq(11).text();
|
||||
});
|
||||
|
||||
var i = 0;
|
||||
$('tr.lastvalue').each(function(){
|
||||
i = i+1;
|
||||
totalinst [i]=$(this).find('td').eq(8).text();
|
||||
});
|
||||
|
||||
|
||||
var i = 0;
|
||||
$('tr.lastvalue').each(function(){
|
||||
i = i+1;
|
||||
totalotherDet [i]=$(this).find('td').eq(9).text();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
var i = 0;
|
||||
$('tr.lastvalue').each(function(){
|
||||
i = i+1;
|
||||
totalmanualoan [i]=$(this).find('td').eq(6).text();
|
||||
});
|
||||
|
||||
//console.log(totalmanualoan);
|
||||
|
||||
var i = 0;
|
||||
$('tr.lastvalue').each(function(){
|
||||
i = i+1;
|
||||
totalmonthloan[i]=$(this).find('td').eq(7).text();
|
||||
});
|
||||
console.log(totalmonthloan);
|
||||
/* $('#monthlylisting').DataTable({
|
||||
"paging": true,
|
||||
"lengthChange": true,
|
||||
"searching": true,
|
||||
"ordering": true,
|
||||
"aaSorting": [[ 0, "asc" ]],
|
||||
"info": true,
|
||||
"autoWidth": true
|
||||
|
||||
}); */
|
||||
|
||||
//var key = <?php echo $show_hide_column_value; ?>;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// show_hide_column(11,key);
|
||||
var t = $('#monthlylistings').DataTable( {
|
||||
"columnDefs": [ {
|
||||
"searchable": false,
|
||||
"orderable": false,
|
||||
"targets": 0
|
||||
} ],
|
||||
"searching": true,
|
||||
"lengthChange": true,
|
||||
"info": true,
|
||||
"paging": false,
|
||||
"autoWidth": true,
|
||||
"order": [[ 1, 'asc' ]]
|
||||
} );
|
||||
|
||||
t.on( 'order.dt search.dt', function () {
|
||||
t.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
|
||||
cell.innerHTML = i+1;
|
||||
} );
|
||||
} ).draw();
|
||||
|
||||
var s = "<?php echo $drop; ?>";
|
||||
$('#monthyear').val(s);
|
||||
|
||||
savebuttonvalidation();
|
||||
|
||||
});
|
||||
|
||||
function isNumber(evt) {
|
||||
|
||||
//alert("hi");
|
||||
var iKeyCode = (evt.which) ? evt.which : evt.keyCode
|
||||
if (iKeyCode != 46 && iKeyCode > 31 && (iKeyCode < 48 || iKeyCode > 57))
|
||||
{ return false;}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function isCheckKeyCode(event){
|
||||
|
||||
var iKeyCode = (event.which) ? event.which : event.keyCode
|
||||
if (iKeyCode != 46 && iKeyCode > 31 && (iKeyCode < 48 || iKeyCode > 57 ) && (iKeyCode ==78 && iKeyCode == 65))
|
||||
{ return false;}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getAllData()
|
||||
{
|
||||
|
||||
var alldata = $("#monthlylistings").tableToJSON();
|
||||
//alert(JSON.stringify(alldata));
|
||||
alldata=JSON.stringify(alldata)
|
||||
var month = $('#monthyear').val();
|
||||
$('.content').loader('show');
|
||||
$.ajax({
|
||||
data:{param1:alldata,param2:month},
|
||||
//dataType:"json",
|
||||
type:"POST",
|
||||
url:"<?php echo base_url() ?>payslip/saveMonthlyData",
|
||||
success:function(data) {
|
||||
if(data)
|
||||
{
|
||||
$('.content').loader('hide');
|
||||
alert(data);
|
||||
//console.log(data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$("#monthyear").change(function(){
|
||||
|
||||
$s = $('#monthyear').val();
|
||||
//echo $dropdownvalue;
|
||||
//$('#monthyear').attr('selected',true);
|
||||
//alert($s);
|
||||
|
||||
$("#formid").attr("method", "post");
|
||||
//alert($s);
|
||||
$("#formid").attr("action", "<?php echo base_url() ?>payslip/changeMonth");
|
||||
|
||||
$('#formid').submit();
|
||||
|
||||
|
||||
});
|
||||
function savebuttonvalidation()
|
||||
{
|
||||
var curselection = $("#monthyear").val();
|
||||
//alert('current selection'+curselection);
|
||||
var currentdate = new Date();
|
||||
var currentmonth = currentdate.getMonth();
|
||||
var currentyear = currentdate.getFullYear();
|
||||
currentmonth++;
|
||||
//alert('currentmonth'+currentmonth);
|
||||
var res = curselection.split("-");
|
||||
var selmonth = res[0];
|
||||
var selyear = res[1];
|
||||
//alert('current selec month '+ selmonth + 'current selec year '+ selyear);
|
||||
var savebuttonstatus = currentmonth - selmonth;
|
||||
var year = currentyear - selyear ;
|
||||
//alert(selyear + currentyear);
|
||||
if(savebuttonstatus >= 2)
|
||||
{
|
||||
if(year == 1)
|
||||
{
|
||||
// $("#savebutton").hide();
|
||||
$("#savebutton").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
//$("#savebutton").hide();
|
||||
$("#savebutton").show();
|
||||
}
|
||||
}
|
||||
else if(savebuttonstatus < 0 )
|
||||
{
|
||||
|
||||
if(year == 1)
|
||||
{
|
||||
$("#savebutton").show();
|
||||
}
|
||||
else if(year == 0)
|
||||
{
|
||||
//$("#savebutton").hide();
|
||||
$("#savebutton").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
//$("#savebutton").hide();
|
||||
$("#savebutton").show();
|
||||
}
|
||||
}
|
||||
else if(savebuttonstatus == 0 && year == 0)
|
||||
{
|
||||
//$("#savebutton").hide();
|
||||
$("#savebutton").show();
|
||||
}
|
||||
else if(savebuttonstatus == 1)
|
||||
{
|
||||
if(year == 0 || year == 1)
|
||||
{
|
||||
$("#savebutton").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#savebutton").show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
var totalfestival =[];
|
||||
var totalempSal=[];
|
||||
var grandtotal = [];
|
||||
function changeInput(event,k)
|
||||
{
|
||||
|
||||
|
||||
var str=event.target.id;
|
||||
var sno = str.substr(8);
|
||||
|
||||
|
||||
var dayWorks=parseFloat(document.getElementById('dayWork'+sno).textContent);
|
||||
var lopDay=parseFloat(document.getElementById('lopDay'+sno).textContent);
|
||||
var paidLeave =parseFloat(document.getElementById('paidLeave'+sno).textContent);
|
||||
var otHrsWork =parseFloat(document.getElementById('otHrsWork'+sno).textContent);
|
||||
var monthDue =parseFloat(document.getElementById('monthDue'+sno).textContent);
|
||||
//totalmonthloan[sno]=monthDue;
|
||||
|
||||
var loanRecd=document.getElementById('loanRecd'+sno).textContent;
|
||||
|
||||
//totalmanualoan[sno]=loanRecd;
|
||||
var incentie=parseFloat(document.getElementById('incentie'+sno).textContent);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var otherDet =parseFloat(document.getElementById('otherDet'+sno).textContent);
|
||||
//totalotherDet[sno] = otherDet;
|
||||
|
||||
var Festival =parseFloat(document.getElementById('Festival'+sno).textContent);
|
||||
totalfestival[sno]= Festival ;
|
||||
var empsal =parseFloat(document.getElementById('empsal'+sno).textContent);
|
||||
|
||||
var bpay =parseFloat(document.getElementById('bPay'+sno).value);
|
||||
|
||||
var hraRate=parseFloat(document.getElementById('hraRate'+sno).value);
|
||||
var allow=parseFloat(document.getElementById('allow'+sno).value);
|
||||
var fAllow =parseFloat(document.getElementById('fAllow'+sno).value);
|
||||
var pfRate =parseFloat(document.getElementById('pfRate'+sno).value);
|
||||
var eslRate =parseFloat(document.getElementById('eslRate'+sno).value);
|
||||
var hraAmt =parseFloat(document.getElementById('hraAmt'+sno).value);
|
||||
// var Balance_Amount =parseFloat(document.getElementById('Balance'+sno).value);
|
||||
var loanamt =parseFloat(document.getElementById('loanamt'+sno).value);
|
||||
var paidamt =parseFloat(document.getElementById('paidamt'+sno).value);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var dayWorkPaid=dayWorks+paidLeave;
|
||||
// console.log("day"+dayWorkPaid);
|
||||
var NoofDays=dayWorks+paidLeave +lopDay;
|
||||
// console.log("monthday"+NoofDays);
|
||||
var Food_Allowances = fAllow * dayWorks;
|
||||
// console.log("workedFA"+Food_Allowances);
|
||||
|
||||
var daySalary = bpay / NoofDays;
|
||||
// console.log("1daysalary "+daySalary);
|
||||
var dayHra = hraAmt / NoofDays;
|
||||
// console.log("1dayHRA"+dayHra);
|
||||
var onehoursSalary = (daySalary + dayHra) / 8;
|
||||
//console.log("onehours "+onehoursSalary);
|
||||
var totSalayOT =0;
|
||||
|
||||
if (otHrsWork!= 0)
|
||||
{
|
||||
totSalayOT = otHrsWork * onehoursSalary;
|
||||
}
|
||||
else
|
||||
{
|
||||
totSalayOT = 0;
|
||||
}
|
||||
//console.log(totSalayOT);
|
||||
|
||||
var currentDaySalary = daySalary * dayWorkPaid;
|
||||
//console.log("11days salary"+currentDaySalary);
|
||||
|
||||
var currentDayHra = dayHra * dayWorkPaid;
|
||||
// console.log("11days hra"+currentDayHra);
|
||||
|
||||
|
||||
var current_loan_amt = 0;
|
||||
var autoLoan =parseFloat(monthDue);
|
||||
console.log(monthDue);
|
||||
var manualLoan =parseFloat(loanRecd);
|
||||
// var manualLoan = Math.min.apply(null, arrayOfNumbers.filter(function(loanRecd) { return !isNaN(loanRecd); }))
|
||||
//alert(manualLoan);
|
||||
|
||||
if(manualLoan == 0.00){
|
||||
current_loan_amt = autoLoan;
|
||||
//alert('0.00');
|
||||
}
|
||||
else if(isNaN(manualLoan))
|
||||
{
|
||||
//alert('N');
|
||||
current_loan_amt = 0.00;
|
||||
|
||||
}
|
||||
else if(manualLoan == 'NA')
|
||||
{
|
||||
//alert('NA');
|
||||
current_loan_amt = 0.00;
|
||||
|
||||
}
|
||||
else if(manualLoan >= 0.00)
|
||||
{
|
||||
current_loan_amt = manualLoan;
|
||||
//alert('manual');
|
||||
}
|
||||
|
||||
|
||||
var Balance_Amount = loanamt - paidamt;
|
||||
|
||||
if(autoLoan > Balance_Amount) {
|
||||
|
||||
// current= Balance_Amount - autoLoan;
|
||||
current_loan_amt = Balance_Amount;
|
||||
|
||||
|
||||
//alert('HI');
|
||||
|
||||
}
|
||||
|
||||
// console.log(current_loan_amt);
|
||||
|
||||
if(parseFloat(incentie) == parseFloat(incentie)){
|
||||
|
||||
var incent =parseFloat(incentie);
|
||||
//console.log("Incentives"+incent);
|
||||
|
||||
}
|
||||
if(parseFloat(Festival) == parseFloat(Festival)){
|
||||
|
||||
var Festivals =parseFloat(Festival);
|
||||
//console.log("Festivals"+Festivals);
|
||||
|
||||
}
|
||||
|
||||
if(parseFloat( otherDet) == parseFloat( otherDet)){
|
||||
|
||||
var otherDets =parseFloat( otherDet);
|
||||
//console.log("otherDets"+ otherDets);
|
||||
|
||||
}
|
||||
|
||||
var currentDatePF = currentDaySalary + currentDayHra + totSalayOT;
|
||||
// console.log("pf "+currentDatePF);
|
||||
|
||||
// var totalsalary= empsal + hraAmt;
|
||||
var totalsalary =currentDaySalary+currentDayHra;
|
||||
// console.log("total"+totalsalary);
|
||||
var esiAmount=0;
|
||||
|
||||
if (totalsalary <= 20000)
|
||||
{
|
||||
|
||||
esiAmount = currentDatePF * eslRate / 100;
|
||||
/** esiamount not elgiable for 20000 **/
|
||||
}
|
||||
else
|
||||
{
|
||||
esiAmount = 0;
|
||||
}
|
||||
|
||||
var pfAmount = currentDaySalary * pfRate / 100;
|
||||
// console.log("11daypf"+pfAmount);
|
||||
|
||||
var empSalaryAdd= currentDaySalary + totSalayOT + currentDayHra + Food_Allowances + allow +incent+Festivals ;
|
||||
|
||||
var empSalarySub = current_loan_amt + esiAmount + pfAmount + otherDets;
|
||||
|
||||
|
||||
|
||||
var empMonthSalary = empSalaryAdd - empSalarySub
|
||||
|
||||
var employeeSalary = Math.round(empMonthSalary);
|
||||
|
||||
//console.log( employeeSalary);
|
||||
|
||||
var cals =(employeeSalary).toFixed(0);
|
||||
|
||||
document.getElementById("empsal"+sno).innerHTML = cals;
|
||||
|
||||
|
||||
$.each(estTotal,function(i,value){
|
||||
if(sno==i){
|
||||
|
||||
estTotal[i] = cals;
|
||||
|
||||
}
|
||||
});
|
||||
//console.log(estTotal);
|
||||
|
||||
$.each(totalinst,function(i,value){
|
||||
if(sno==i){
|
||||
|
||||
totalinst[i] = incentie;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$.each(totalotherDet,function(i,value){
|
||||
if(sno==i){
|
||||
|
||||
totalotherDet[i] = otherDet;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$.each(totalmonthloan,function(i,value){
|
||||
if(sno==i){
|
||||
|
||||
totalmonthloan[i] = loanRecd;
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$.each(totalmanualoan,function(i,value){
|
||||
if(sno==i){
|
||||
|
||||
totalmanualoan[i] = monthDue;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
//console.log(totalinst);
|
||||
|
||||
calculategrandtotal();
|
||||
|
||||
|
||||
|
||||
}
|
||||
var tempTotal = [];
|
||||
function calculategrandtotal(){
|
||||
|
||||
$.each(totalinst, function( index, value )
|
||||
{
|
||||
//var res2 = value.split('-');
|
||||
tempTotal[index]=parseFloat(value);
|
||||
});
|
||||
|
||||
var sum = 0;
|
||||
|
||||
for (var i = 0; i < tempTotal.length; i++) {
|
||||
sum += tempTotal[i] << 0;
|
||||
}
|
||||
|
||||
$('#inst').text(parseFloat(sum).toFixed(2));
|
||||
|
||||
$.each(totalotherDet, function( index, value )
|
||||
{
|
||||
//var res2 = value.split('-');
|
||||
tempTotal[index]=parseFloat(value);
|
||||
});
|
||||
|
||||
var sum = 0;
|
||||
|
||||
for (var i = 0; i < tempTotal.length; i++) {
|
||||
sum += tempTotal[i] << 0;
|
||||
}
|
||||
$('#other').text(parseFloat(sum).toFixed(2));
|
||||
|
||||
$.each(totalfestival, function( index, value )
|
||||
{
|
||||
//var res2 = value.split('-');
|
||||
tempTotal[index]=parseFloat(value);
|
||||
});
|
||||
|
||||
var sum = 0;
|
||||
|
||||
for (var i = 0; i < tempTotal.length; i++) {
|
||||
sum += tempTotal[i] << 0;
|
||||
}
|
||||
$('#fest').text(parseFloat(sum).toFixed(2));
|
||||
|
||||
|
||||
|
||||
$.each(estTotal, function( index, value )
|
||||
{
|
||||
//var res2 = value.split('-');
|
||||
tempTotal[index]=parseFloat(value);
|
||||
});
|
||||
|
||||
var sum = 0;
|
||||
|
||||
for (var i = 0; i < tempTotal.length; i++) {
|
||||
sum += tempTotal[i] << 0;
|
||||
}
|
||||
$('#estsal').text(parseFloat(sum).toFixed(2));
|
||||
|
||||
|
||||
|
||||
|
||||
$.each(totalmonthloan, function( index, value )
|
||||
{
|
||||
//var res2 = value.split('-');
|
||||
tempTotal[index]=parseFloat(value);
|
||||
});
|
||||
|
||||
var sum = 0;
|
||||
|
||||
for (var i = 0; i < tempTotal.length; i++) {
|
||||
sum += tempTotal[i] << 0;
|
||||
}
|
||||
$('#monthloan').text(parseFloat(sum).toFixed(2));
|
||||
|
||||
console.log(totalmanualoan);
|
||||
$.each(totalmanualoan, function( index, value )
|
||||
{
|
||||
//var res2 = value.split('-');
|
||||
tempTotal[index]=parseFloat(value);
|
||||
});
|
||||
|
||||
var sum = 0;
|
||||
|
||||
for (var i = 0; i < tempTotal.length; i++) {
|
||||
sum += tempTotal[i] << 0;
|
||||
}
|
||||
$('#manualoan').text(parseFloat(sum).toFixed(2));
|
||||
}
|
||||
|
||||
|
||||
function show_hide_column(col_no, do_show) {
|
||||
var rows = document.getElementById('monthlylistings').rows;
|
||||
|
||||
for (var row = 0; row < rows.length; row++) {
|
||||
var cols = rows[row].cells;
|
||||
if (col_no >= 0 && col_no < cols.length) {
|
||||
cols[col_no].style.display = do_show ? '' : 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script> <?php
|
||||
$sample = array_merge($month,$fresh);
|
||||
$show_hide_column_value = true;
|
||||
//print_r($sample);die();
|
||||
@ -983,7 +65,7 @@ $('html').bind('keypress', function(e)
|
||||
</section>
|
||||
<section class="content">
|
||||
|
||||
<input type="text" id="paydate" value="<?php echo $drop;?>"/>
|
||||
<input type="hidden" id="paydate" value="<?php echo $drop;?>"/>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="box">
|
||||
@ -1215,7 +297,7 @@ $('html').bind('keypress', function(e)
|
||||
<input type="hidden" id = "loanamt<?php echo $index?>" value="<?php echo $record->Loan_amount?>">
|
||||
<input type="hidden" id = "paidamt<?php echo $index?>" value="<?php echo $record->Paid_Amount?>">
|
||||
|
||||
<input type="text" id = "duedate<?php echo $index?>" value="<?php echo $record->DueDate?>">
|
||||
<input type="hidden" id = "duedate<?php echo $index?>" value="<?php echo $record->DueDate?>">
|
||||
|
||||
<!-- <input type="hidden" id = "eid" value="<?php echo $record->TotalSalary?>">
|
||||
<input type="hidden" id = "eid" value="<?php echo $record->LOP_Days?>">
|
||||
@ -1313,7 +395,7 @@ $('html').bind('keypress', function(e)
|
||||
i = i+1;
|
||||
totalmonthloan[i]=$(this).find('td').eq(7).text();
|
||||
});
|
||||
console.log(totalmonthloan);
|
||||
//console.log(totalmonthloan);
|
||||
/* $('#monthlylisting').DataTable({
|
||||
"paging": true,
|
||||
"lengthChange": true,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user