Salary details and editable in requisition

This commit is contained in:
saravanakumar_kandasami 2017-05-08 18:27:00 +05:30
parent 89aa1d2846
commit 75c10ad252
9 changed files with 957 additions and 7 deletions

View File

@ -0,0 +1,267 @@
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
require APPPATH . '/libraries/BaseController.php';
/**
* Class : Cost Center (Cost Center Controller)
* User Class to control all user related operations.
* @author : VenbaMail Mali
* @version : 1.1
* @since : 15 Feb 2016
*/
class emppaydate extends BaseController
{
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
//$this->load->model('');
$this->load->library('session');
$this->load->library('form_validation');
//$this->load->library('pagination');
$this->isLoggedIn();
}
/**
* This function used to load the first screen of the user
*/
public function index()
{
$this->global['pageTitle'] = 'Siddharth : Cost';
$this->loadViews("emppaydate", $this->global);
}
/**
* This function is used to load the Cost list
*/
/*function monthlypayListing()
{
$searchText = $this->input->post('searchText');
$data['searchText'] = $searchText;
$count = $this->emppaydate_model->CostListingCount($searchText);
$returns = $this->paginationCompress ( "monthlypayListing/", $count, 5 );
$data['userRecords'] = $this->emppaydate_model->monthlypayListing($searchText, $returns["page"], $returns["segment"]);
//print_r( $data) ;
$this->global['pageTitle'] = 'Siddharth : montlypay List';
$this->loadViews("emppaydateListing", $this->global, $data, NULL);
}
/**
* This function is used to load the add new cost Center */
function addemppaydate()
{
//$data['emp_id'] = $this->monthlypay_model->getmonthlypay();
$this->global['pageTitle'] = 'siddharth : Add Monthly Pay';
$this->loadViews("addemppaydate", $this->global);
}
/*
function addNewmonthly()
{
$this->form_validation->set_rules('pay_data_id','Pay_Data_ID','trim|required');
$this->form_validation->set_rules('emp_id','emp_id','trim|required');
$this->form_validation->set_rules('basic_Pay','basic_Pay','trim|required');
$this->form_validation->set_rules('hra_rate','hra_rate','trim|required');
$this->form_validation->set_rules('OT_Rate','OT_Rate','trim|required');
$this->form_validation->set_rules('allowances','allowances','trim|required');
$this->form_validation->set_rules('PF_Rate','PF_Rate','trim|required');
$this->form_validation->set_rules('ESI_Rate','ESI_Rate','trim|required');
$this->form_validation->set_rules('All','All','trim|required');
if($this->form_validation->run() == FALSE)
{
$this->addmonthly();
}
else
{
$pay_data_id = $this->input->post('pay_data_id');
$emp_id = $this->input->post('emp_id');
$LOP_days = $this->input->post('basic_Pay');
$basic_Pay = $this->input->post('hra_rate');
$OT_Rate = $this->input->post('OT_Rate');
$allowances = $this->input->post('allowances');
$PF_Rate = $this->input->post('PF_Rate');
$ESI_Rate = $this->input->post('ESI_Rate');
$All = $this->input->post('All');
$CreateBy = $this->session->userdata ( 'userId' );
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$createddt = $dt->format('Y-m-d H:i:s');
$emppayExists = $this->emppaydate_model->checkemppayExists( $emppay);
if(count($emppay) == 0)
{
$emppay = array('pay_data_id'=>$pay_data_id, 'emp_id'=>$emp_id,'basic_Pay'=>$basic_Pay,'hra_rate'=>$hra_rate,'OT_Rate'=>$OT_Rate,'allowances'=>$allowances,'PF_Rate'=>$PF_Rate,'ESI_Rate'=>$ESI_Rate,'All'=>$All,'CreatedBy'=>$CreateBy,'createdDate'=>$createddt);
$this->monthlypay_model->addNewcost($Cost);
}
Print_r('Successfully Created Monthly pay details');
}
}
/**
* This function is used load user edit information
* @param number $userId : Optional : This is user id
*/
/*function editOldcost($CostCode = NULL)
{
if($CostCode == '')
{
$CostCenterID = $_GET['CostCode'];
}
else
{
$CostCenterID = $CostCode; }
$data['CostMaster'] = $this->costcenter_model->GetCostCenterMaster($CostCenterID);
$data['CostDepts'] = $this->costcenter_model->GetCostCenterDepartment($CostCenterID);
$data['CostBudget'] = $this->costcenter_model->GetCostCenterBudget($CostCenterID);
// $data['DeptList'] = $this->costcenter_model->GetDepartmentNotinCostCenter($CostCenterID);
$this->global['pageTitle'] = 'Siddharth : Edit Cost';
$this->loadViews("editOldcost", $this->global, $data,NULL);
}
function ech()
{
echo $this->input->post('CostCentreID');
echo $this->input->post('CostName');
echo $this->input->post('Description');
}
/**
* This function is used to edit the user information
function editcost()
{
$this->load->library('form_validation');
$CostCenterID = $this->input->post('CostCentreID');
$this->form_validation->set_rules('CostName','Cost Name','trim|required|');
$this->form_validation->set_rules('Description','Description','trim|required|');
if($this->form_validation->run() == FALSE)
{
$this->editcost($CostCenterID);
}
else
{
$CostCenterID = $this->input->post('CostCentreID');
$CostName = ucwords(strtolower($this->input->post('CostName')));
$Description = $this->input->post('Description');
//$this->costcenter_model->editcost($Cost);
$cost = array();
$Cost = array('CostCentreID'=>$CostCenterID,'CostName'=>$CostName, 'Description'=>$Description,'createdDate'=>date('Y-m-d H:i:sa'));
$result = $this->costcenter_model->editcost($Cost, $CostCenterID);
if($result == true)
{
$this->session->set_flashdata('success', 'Cost updated successfully');
}
else
{
$this->session->set_flashdata('error', 'Cost updation failed');
}
redirect('costListing');
}
}
function viewcost($CostCenterID = NULL)
{
if($CostCenterID == null)
{
redirect('costListing');
}
$data['Cost'] = $this->costcenter_model->getuserinfo($CostCenterID);
//$data['users'] = $this->purchaseorder_model->getusers();
$this->global['pageTitle'] = 'Siddharth : View Cost';
$this->loadViews("viewcost", $this->global, $data,NULL);
}
/**
* This function is used to delete the user using userId
* @return boolean $result : TRUE / FALSE
function deletecost()
{
if($this->isAdmin() == TRUE)
{
echo(json_encode(array('status'=>'access')));
}
else
{
$CostCenterID = $this->input->Costst('CostCentreID');
$cost = array('CreateDate'=>date('Y-m-d H:i:sa'));
$result = $this->costcenter_model->deletecost($Cost, $CostCenterID);
if ($result > 0) { echo(json_encode(array('status'=>TRUE))); }
else { echo(json_encode(array('status'=>FALSE))); }
}
}
*/
function pageNotFound()
{
$this->global['pageTitle'] = 'CodeInsect : 404 - Page Not Found';
$this->loadViews("404", $this->global, NULL, NULL);
}
}
?>

View File

@ -0,0 +1,265 @@
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
require APPPATH . '/libraries/BaseController.php';
/**
* Class : Cost Center (Cost Center Controller)
* User Class to control all user related operations.
* @author : VenbaMail Mali
* @version : 1.1
* @since : 15 Feb 2016
*/
class monthlypay extends BaseController
{
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
//$this->load->model('monthlypay_model');
$this->load->library('session');
$this->load->library('form_validation');
// $this->load->library('pagination');
$this->isLoggedIn();
}
/**
* This function used to load the first screen of the user
*/
public function index()
{
$this->global['pageTitle'] = 'Siddharth : monthlypay';
$this->loadviews('addmonthly',$this->global);
}
/**
* This function is used to load the Cost list
*/
/*function monthlypayListing()
{
$searchText = $this->input->post('searchText');
$data['searchText'] = $searchText;
$count = $this->monthlpay_model->CostListingCount($searchText);
$returns = $this->paginationCompress ( "monthlypayListing/", $count, 5 );
$data['userRecords'] = $this->monthlypay_model->monthlypayListing($searchText, $returns["page"], $returns["segment"]);
//print_r( $data) ;
$this->global['pageTitle'] = 'Siddharth : montlypay List';
$this->loadViews("monthlypayListing", $this->global, $data, NULL);
}*/
/**
* This function is used to load the add new cost Center */
function addmonthly()
{
//$data['emp_id'] = $this->monthlypay_model->getmonthlypay();
$this->global['pageTitle'] = 'siddharth : Add Monthly Pay';
$this->loadviews('addmontly',$this->global, NULL);
}
/*
function addNewmonthly()
{
$this->form_validation->set_rules('month_year','month_year','trim|required');
$this->form_validation->set_rules('emp_id','emp_id','trim|required');
$this->form_validation->set_rules('LOP_days','LOP_days','trim|required');
$this->form_validation->set_rules('OT_Hrs_Worked','OT_Hrs_Worked','trim|required');
$this->form_validation->set_rules('Loan_Recovered','Loan_Recovered','trim|required');
$this->form_validation->set_rules('Loan_Balance','Loan_Balance','trim|required');
$this->form_validation->set_rules('Incentives','Incentives','trim|required');
$this->form_validation->set_rules('Other_Deductions','Other_Deductions','trim|required');
if($this->form_validation->run() == FALSE)
{
$this->addmonthly();
}
else
{
$month_year = $this->input->post('month_year');
$emp_id = $this->input->post('emp_id');
$LOP_days = $this->input->post('LOP_days');
$OT_Hrs_Worked = $this->input->post('OT_Hrs_Worked');
$Loan_Recovered = $this->input->post('Loan_Recovered');
$Loan_Balance = $this->input->post('Loan_Balance');
$Incentives = $this->input->post('Incentives');
$Other_Deductions = $this->input->post('Other_Deductions');
$CreateBy = $this->session->userdata ( 'userId' );
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$createddt = $dt->format('Y-m-d H:i:s');
$monthlypayExists = $this->monthlypay_model->checkmonthlypayExists( $monthlypay);
if(count($CodeExists) == 0)
{
$montlypay = array('month_year'=>$month_year, 'emp_id'=>$emp_id,'LOP_days'=>$LOP_days,'OT_Hrs_Worked'=>$Loan_Recovered,'Loan_Balance'=>$Loan_Balance,'Incentives'=>$Incentives,'Other_Deductions'=>$Other_Deductions,'CreatedBy'=>$CreateBy,'createdDate'=>$createddt);
$this->monthlypay_model->addNewmonthly($monthlypay);
}
Print_r('Successfully Created Monthly pay details');
}
}
/**
* This function is used load user edit information
* @param number $userId : Optional : This is user id
*/
/*function editOldcost($CostCode = NULL)
{
if($CostCode == '')
{
$CostCenterID = $_GET['CostCode'];
}
else
{
$CostCenterID = $CostCode; }
$data['CostMaster'] = $this->costcenter_model->GetCostCenterMaster($CostCenterID);
$data['CostDepts'] = $this->costcenter_model->GetCostCenterDepartment($CostCenterID);
$data['CostBudget'] = $this->costcenter_model->GetCostCenterBudget($CostCenterID);
// $data['DeptList'] = $this->costcenter_model->GetDepartmentNotinCostCenter($CostCenterID);
$this->global['pageTitle'] = 'Siddharth : Edit Cost';
$this->loadViews("editOldcost", $this->global, $data,NULL);
}
function ech()
{
echo $this->input->post('CostCentreID');
echo $this->input->post('CostName');
echo $this->input->post('Description');
}
/**
* This function is used to edit the user information
function editcost()
{
$this->load->library('form_validation');
$CostCenterID = $this->input->post('CostCentreID');
$this->form_validation->set_rules('CostName','Cost Name','trim|required|');
$this->form_validation->set_rules('Description','Description','trim|required|');
if($this->form_validation->run() == FALSE)
{
$this->editcost($CostCenterID);
}
else
{
$CostCenterID = $this->input->post('CostCentreID');
$CostName = ucwords(strtolower($this->input->post('CostName')));
$Description = $this->input->post('Description');
//$this->costcenter_model->editcost($Cost);
$cost = array();
$Cost = array('CostCentreID'=>$CostCenterID,'CostName'=>$CostName, 'Description'=>$Description,'createdDate'=>date('Y-m-d H:i:sa'));
$result = $this->costcenter_model->editcost($Cost, $CostCenterID);
if($result == true)
{
$this->session->set_flashdata('success', 'Cost updated successfully');
}
else
{
$this->session->set_flashdata('error', 'Cost updation failed');
}
redirect('costListing');
}
}
function viewcost($CostCenterID = NULL)
{
if($CostCenterID == null)
{
redirect('costListing');
}
$data['Cost'] = $this->costcenter_model->getuserinfo($CostCenterID);
//$data['users'] = $this->purchaseorder_model->getusers();
$this->global['pageTitle'] = 'Siddharth : View Cost';
$this->loadViews("viewcost", $this->global, $data,NULL);
}
/**
* This function is used to delete the user using userId
* @return boolean $result : TRUE / FALSE
function deletecost()
{
if($this->isAdmin() == TRUE)
{
echo(json_encode(array('status'=>'access')));
}
else
{
$CostCenterID = $this->input->Costst('CostCentreID');
$cost = array('CreateDate'=>date('Y-m-d H:i:sa'));
$result = $this->costcenter_model->deletecost($Cost, $CostCenterID);
if ($result > 0) { echo(json_encode(array('status'=>TRUE))); }
else { echo(json_encode(array('status'=>FALSE))); }
}
}
*/
function pageNotFound()
{
$this->global['pageTitle'] = 'CodeInsect : 404 - Page Not Found';
$this->loadViews("404", $this->global, NULL, NULL);
}
}
?>

View File

@ -0,0 +1,7 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?>
ERROR - 2017-05-08 13:15:24 --> Query error: Table 'kasiram9_SiddharthIndustries.T_CostCentre' doesn't exist
ERROR - 2017-05-08 13:15:31 --> Query error: Table 'kasiram9_SiddharthIndustries.T_CostCentre' doesn't exist
ERROR - 2017-05-08 13:15:38 --> Query error: Table 'kasiram9_SiddharthIndustries.T_CostCentre' doesn't exist
ERROR - 2017-05-08 13:30:54 --> Query error: Table 'kasiram9_SiddharthIndustries.T_CostCentre' doesn't exist
ERROR - 2017-05-08 13:35:54 --> Query error: Table 'kasiram9_SiddharthIndustries.T_CostCentre' doesn't exist

View File

@ -0,0 +1,178 @@
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Employee Monthly payment</center>
</h1>
</section>
<section class="content">
<div style="text-align:right;">
<a href="<?php echo base_url() ?>" class="btn btn-info" value="Back">Back</a>
</div>
<br>
<div class="row">
<!-- left column -->
<div class="col-md-12">
<div class="box box-primary">
<!-- form start -->
<form role="form" id="addemployee" action="<?php echo base_url() ?>monthlypay/AddNewmonthly" method="post" enctype="multipart/form-data">
<div class="box-body">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="month_year">Month Year:</label><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'month_year','value' => set_value('month_year'), 'class' => 'form-control' ,'required' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="emp_id">Employee ID</label><font color="Red">*</font>
<div class="form-group">
<?php
$options = array("-1"=>'Select Employee');
//print_r( $options);
if(!empty($emp_id))
{
foreach ($Approver as $SID):
$options[$SID->EmpID] = $SID->EmpID . " - " . $SID->FirstName . " - " . $SID->Designation;
endforeach;
}
echo form_dropdown('emp_id',$options,set_value('emp_id'),'id="emp_id"', 'class = "form-control "'); ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="LOP_days">LOP Days</label><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'LOP_days','value' => set_value('LOP_days'), 'class' => 'form-control' ,'required' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="OT_Hrs_Worked">OT Hrs Worked:</label><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'OT_Hrs_Worked','value' => set_value('OT_Hrs_Worked'), 'class' => 'form-control' ,'required' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="Loan_Recovered">Loan Recovered:</label>
<div class="form-group">
<?php
$data = array('name' => 'Loan_Recovered','value' => set_value('Loan_Recovered'), 'class' => 'form-control' );
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="Loan_Balance">Loan Balance:</label>
<div class="form-group">
<?php
$data = array('name' => 'Loan_Balance','value' => set_value('Loan_Balance'), 'class' => 'form-control');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="Incentives">Incentives:</label><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'Incentives','value' => set_value('Incentives'), 'class' => 'form-control' ,'required' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="Other_Deductions">Other Deductions:</label><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'Other_Deductions','value' => set_value('Other_Deductions'), 'class' => 'form-control' ,'required' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
<div id="content">
<div class="box-footer" style="text-align:right">
<input type="submit" class="btn btn-info" value="Submit" />
<input type="reset" class="btn btn-info" value="Cancel" />
</div>
</div>
</section>
</div>

View File

@ -0,0 +1,158 @@
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Employee Salary Details</center>
</h1>
</section>
<section class="content">
<div style="text-align:right;">
<a href="<?php echo base_url() ?>" class="btn btn-info" value="Back">Back</a>
</div>
<br>
<div class="row">
<!-- left column -->
<div class="col-md-12">
<div class="box box-primary">
<!-- form start -->
<div class="box-body">
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="Pay_Data_ID">Pay Data ID:</label><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'pay_data_id','value' => set_value('pay_data_id'), 'class' => 'form-control' ,'required' => 'true','style'=>'text-transform:uppercase;');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="EmpID">EmpID</label><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'empID','value' => set_value('empID'), 'class' => 'form-control' ,'required' => 'true','style'=>'text-transform:uppercase;');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="Basic_Pay">Basic Pay</label><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'basic_Pay','value' => set_value('basic_pay'), 'class' => 'form-control' ,'required' => 'true','style'=>'text-transform:uppercase;');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="HRA_Rate">HRA Rate:</label><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'hra_rate','value' => set_value('hra_rate'), 'class' => 'form-control' ,'required' => 'true','style'=>'text-transform:uppercase;');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="OT_Rate">OT Rate:</label><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'OT_Rate','value' => set_value('OT_Rate'), 'class' => 'form-control' ,'required' => 'true','style'=>'text-transform:uppercase;');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="Allowances">Allowances:</label><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'allowances','value' => set_value('allowances'), 'class' => 'form-control' ,'required' => 'true','style'=>'text-transform:uppercase;');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="PF_Rate">PF Rate:</label><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'PF_Rate','value' => set_value('PF_Rate'), 'class' => 'form-control' ,'required' => 'true','style'=>'text-transform:uppercase;');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="ESI_Rate">ESI Rate</label><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'ESI_Rate','value' => set_value('ESI_Rate'), 'class' => 'form-control' ,'required' => 'true','style'=>'text-transform:uppercase;');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<input type="checkbox" name="All"> Select All<br>
</div>
</div>
</div>
</div>
<div id="content">
<div class="box-footer" style="text-align:right">
<input type="submit" class="btn btn-info" value="Submit" />
<input type="reset" class="btn btn-info" value="Cancel" />
</div>
</div>
</div>
</div>
</div>
</div>
</section>

View File

@ -283,6 +283,17 @@
<i class="fa fa-dashboard"></i> <span>Payslip</span>
</a>
</li>
<li class="treeview">
<a href="<?php echo base_url(); ?>emppaydate/addemppaydate" >
<i class="fa fa-dashboard"></i> <span>Emploee Salary Details</span>
</a>
</li>
<li class="treeview">
<a href="<?php echo base_url(); ?>monthlypay/addmonthly" >
<i class="fa fa-dashboard"></i> <span>Employee Monthly Payment</span>
</a>
</li>
</ul>
</li>
<?php

View File

@ -1,4 +1,25 @@
<script>
<!-- Editable table-->
$(function () {
$("td").dblclick(function () {
var OriginalContent = $(this).text();
$(this).addClass("cellEditing");
$(this).html("<input type='text' value='" + OriginalContent + "' />");
$(this).children().first().focus();
$(this).children().first().keypress(function (e) {
if (e.which == 13) {
var newContent = $(this).val();
$(this).parent().text(newContent);
$(this).parent().removeClass("cellEditing");
} });
$(this).children().first().blur(function(){
$(this).parent().text(OriginalContent);
$(this).parent().removeClass("cellEditing");
});
});
});
</script>
<style>
.table-bordered>thead>tr>th, .table-bordered>tbody>tr>th, .table-bordered>tfoot>tr>th, .table-bordered>thead>tr>td, .table-bordered>tbody>tr>td, .table-bordered>tfoot>tr>td {border: 1px solid #333;}
</style>
@ -119,7 +140,7 @@
</div>
<div class="container-fluid">
<table class="table table-bordered" style="border:1px solid #333">
<table class="table table-bordered editableTable" style="border:1px solid #333">
<div align="right" style="padding-right:10px">
<div align="right">
<a data-toggle="modal" data-target="#myModal1"><button type="button" class="btn btn-primary" data-dismiss="modal" >Add Line Item</button> </a>
@ -196,7 +217,7 @@
</div>
</div>
</div>
</div>
</div><br/>

View File

@ -1,3 +1,24 @@
<script>
<!-- Editable table-->
$(function () {
$("td").dblclick(function () {
var OriginalContent = $(this).text();
$(this).addClass("cellEditing");
$(this).html("<input type='text' value='" + OriginalContent + "' />");
$(this).children().first().focus();
$(this).children().first().keypress(function (e) {
if (e.which == 13) {
var newContent = $(this).val();
$(this).parent().text(newContent);
$(this).parent().removeClass("cellEditing");
} });
$(this).children().first().blur(function(){
$(this).parent().text(OriginalContent);
$(this).parent().removeClass("cellEditing");
});
});
});
</script>
<style>
.table-bordered>thead>tr>th, .table-bordered>tbody>tr>th, .table-bordered>tfoot>tr>th, .table-bordered>thead>tr>td, .table-bordered>tbody>tr>td, .table-bordered>tfoot>tr>td {border: 1px solid #333;}
@ -243,7 +264,7 @@
</div>
<table class="table table-bordered" style="border:1px solid #333">
<table class="table table-bordered editableTable" style="border:1px solid #333">
<div align="right" style="padding-right:10px">
<div class="modal fade" role="dialog">

View File

@ -1,3 +1,25 @@
<script>
<!-- Editable table-->
$(function () {
$("td").dblclick(function () {
var OriginalContent = $(this).text();
$(this).addClass("cellEditing");
$(this).html("<input type='text' value='" + OriginalContent + "' />");
$(this).children().first().focus();
$(this).children().first().keypress(function (e) {
if (e.which == 13) {
var newContent = $(this).val();
$(this).parent().text(newContent);
$(this).parent().removeClass("cellEditing");
} });
$(this).children().first().blur(function(){
$(this).parent().text(OriginalContent);
$(this).parent().removeClass("cellEditing");
});
});
});
</script>
<style>
.table-bordered>thead>tr>th, .table-bordered>tbody>tr>th, .table-bordered>tfoot>tr>th, .table-bordered>thead>tr>td, .table-bordered>tbody>tr>td, .table-bordered>tfoot>tr>td {border: 1px solid #333;}
@ -12,7 +34,7 @@
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="col-md-2">
<div class="col-md-3">
<label>Requisition Status</label>
<div>
<?php
@ -144,7 +166,7 @@
</div>
<div class="col-md-12">
<table class="table table-bordered" style="border:1px solid #333">
<table class="table table-bordered editableTable" style="border:1px solid #333">
<div align="right" style="padding-right:10px">
<div class="modal fade" role="dialog">
@ -164,7 +186,7 @@
<tr>
<td> 1 </td>
<td>R001</td>
<td contenteditable = "true">R001</td>
<td>Wasted Sand</td>
<td>Ton</td>
<td>100</td>
@ -207,7 +229,7 @@
</div>
<table class="table table-bordered" style="border:1px solid #333">
<table class="table table-bordered editableTable" style="border:1px solid #333">
<div align="right" style="padding-right:10px">
<div class="modal fade" role="dialog">