cost center edit
This commit is contained in:
parent
dd82e3dab1
commit
5386b47083
@ -234,7 +234,7 @@ class CostCenter extends BaseController
|
|||||||
*/
|
*/
|
||||||
function editcost()
|
function editcost()
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->form_validation->set_rules('CostCode','CostCode','trim|required');
|
$this->form_validation->set_rules('CostCode','CostCode','trim|required');
|
||||||
$this->form_validation->set_rules('CostName','CostName','trim|required');
|
$this->form_validation->set_rules('CostName','CostName','trim|required');
|
||||||
|
|
||||||
@ -249,16 +249,18 @@ class CostCenter extends BaseController
|
|||||||
$updatedBy = $this->session->userdata ( 'userId' );
|
$updatedBy = $this->session->userdata ( 'userId' );
|
||||||
$SelectedDepartment = $this->input->post('txtSelectedDepartment');
|
$SelectedDepartment = $this->input->post('txtSelectedDepartment');
|
||||||
//echo $SelectedDepartment;
|
//echo $SelectedDepartment;
|
||||||
|
//die();
|
||||||
|
|
||||||
$ApproverName = $this->input->post('ApprovedBy');
|
$ApproverName = $this->input->post('ApprovedBy');
|
||||||
$comma_separated = "";
|
$comma_separated = "";
|
||||||
//print_r(strlen($SelectedDepartment));
|
//print_r(strlen($SelectedDepartment));
|
||||||
if(strlen($SelectedDepartment)>0)
|
if(strlen($SelectedDepartment)>0)
|
||||||
{
|
{
|
||||||
|
|
||||||
$comma_separated = explode(':', $SelectedDepartment);
|
$comma_separated = explode(':', $SelectedDepartment);
|
||||||
}
|
}
|
||||||
|
|
||||||
//print_r($comma_separated);
|
//die();
|
||||||
//echo count($comma_separated);
|
//echo count($comma_separated);
|
||||||
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||||
|
|
||||||
@ -271,13 +273,11 @@ class CostCenter extends BaseController
|
|||||||
$Cost = array( 'CostCenterName'=>$CostName,'ApprovedBy'=>$ApproverName,'UpdatedBy'=>$updatedBy,'UpdatedDate'=>$updateddt);
|
$Cost = array( 'CostCenterName'=>$CostName,'ApprovedBy'=>$ApproverName,'UpdatedBy'=>$updatedBy,'UpdatedDate'=>$updateddt);
|
||||||
$this->costcenter_model->EditCost($Cost,$CostCode);
|
$this->costcenter_model->EditCost($Cost,$CostCode);
|
||||||
}
|
}
|
||||||
//echo count($comma_separated);
|
|
||||||
|
if(count($comma_separated)>= 1)
|
||||||
if(count($comma_separated)> 0)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
//echo "scs";
|
|
||||||
//die();
|
|
||||||
for ($j = 0; $j < count($comma_separated); $j++)
|
for ($j = 0; $j < count($comma_separated); $j++)
|
||||||
{
|
{
|
||||||
$DeptCode = $comma_separated[$j];
|
$DeptCode = $comma_separated[$j];
|
||||||
@ -313,6 +313,72 @@ class CostCenter extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function DeleteCostDepartment()
|
||||||
|
{
|
||||||
|
// echo "dasf";
|
||||||
|
// die();
|
||||||
|
$CostCode = strtoupper(trim($this->input->post('CostCode')));
|
||||||
|
$CostName = strtoupper(trim($this->input->post('CostName')));
|
||||||
|
$updatedBy = $this->session->userdata ( 'userId' );
|
||||||
|
$SelectedDepartment = $this->input->post('txtSelectedDepartment');
|
||||||
|
$this->costcenter_model->DeleteDepartment($SelectedDepartment,$CostCode);
|
||||||
|
echo ("Department Removed Successfully");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// function AddCostDepartment()
|
||||||
|
// {
|
||||||
|
// // echo "343";
|
||||||
|
// // die();
|
||||||
|
// $CostCode = strtoupper(trim($this->input->post('CostCode')));
|
||||||
|
// $CostName = strtoupper(trim($this->input->post('CostName')));
|
||||||
|
// $updatedBy = $this->session->userdata ( 'userId' );
|
||||||
|
// $SelectedDepartment = $this->input->post('txtSelectedDepartment');
|
||||||
|
// //echo $SelectedDepartment;
|
||||||
|
// //die();
|
||||||
|
|
||||||
|
// $ApproverName = $this->input->post('ApprovedBy');
|
||||||
|
// $comma_separated = "";
|
||||||
|
// //print_r(strlen($SelectedDepartment));
|
||||||
|
// if(strlen($SelectedDepartment)>0)
|
||||||
|
// {
|
||||||
|
|
||||||
|
// $comma_separated = explode(':', $SelectedDepartment);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //die();
|
||||||
|
// //echo count($comma_separated);
|
||||||
|
// $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||||
|
|
||||||
|
// $updateddt = $dt->format('Y-m-d H:i:s');
|
||||||
|
|
||||||
|
|
||||||
|
// if(count($comma_separated)>= 1)
|
||||||
|
// {
|
||||||
|
|
||||||
|
|
||||||
|
// for ($j = 0; $j < count($comma_separated); $j++)
|
||||||
|
// {
|
||||||
|
// $DeptCode = $comma_separated[$j];
|
||||||
|
|
||||||
|
// $this->costcenter_model->DeleteDepartment( $DeptCode,$CostCode);
|
||||||
|
|
||||||
|
// $Dept = array('CostCenterCode'=>$CostCode, 'DEPCode'=>$DeptCode,'CreatedBy'=>$updatedBy,'createdDate'=>$updateddt,'UpdatedBy'=>$updatedBy,'UpdatedDate'=>$updateddt);
|
||||||
|
|
||||||
|
// //print_r($Dept);
|
||||||
|
// $this->costcenter_model->addCostCenterDepartment($Dept);
|
||||||
|
|
||||||
|
// }
|
||||||
|
// echo "Updated";
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
function viewcost($CostCenterID = NULL)
|
function viewcost($CostCenterID = NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@ -270,6 +270,9 @@ function addNewcost($Cost)
|
|||||||
|
|
||||||
function DeleteDepartment($DepCode='',$CostCode='')
|
function DeleteDepartment($DepCode='',$CostCode='')
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// echo "fsds";
|
||||||
|
// die();
|
||||||
$this->db->where("DEPCode", $DepCode);
|
$this->db->where("DEPCode", $DepCode);
|
||||||
$this->db->where("CostCenterCode", $CostCode);
|
$this->db->where("CostCenterCode", $CostCode);
|
||||||
$this->db->delete('T_CostCenter_Departments');
|
$this->db->delete('T_CostCenter_Departments');
|
||||||
|
|||||||
@ -761,6 +761,7 @@ $('.tempClickEdit').click(function(){
|
|||||||
var o = new Option(tempText,tempSelect);
|
var o = new Option(tempText,tempSelect);
|
||||||
var hidval = tempSelect;
|
var hidval = tempSelect;
|
||||||
var orgVal = $('#txtSelectedDepartment').val();
|
var orgVal = $('#txtSelectedDepartment').val();
|
||||||
|
alert(orgVal);
|
||||||
var Selectedval = ''
|
var Selectedval = ''
|
||||||
|
|
||||||
if(orgVal != '')
|
if(orgVal != '')
|
||||||
@ -784,7 +785,14 @@ $('.tempClickEdit').click(function(){
|
|||||||
tempSelect = '';
|
tempSelect = '';
|
||||||
tempText = '';
|
tempText = '';
|
||||||
Selectedval = '';
|
Selectedval = '';
|
||||||
} else {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
alert("Before add please select any position.");
|
alert("Before add please select any position.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -797,8 +805,42 @@ $('.tempClickEdit').click(function(){
|
|||||||
$("#distriList").attr('selectedIndex', '-1').find("option:selected").removeAttr("selected");
|
$("#distriList").attr('selectedIndex', '-1').find("option:selected").removeAttr("selected");
|
||||||
|
|
||||||
$("#distriList").val(tempSelect);
|
$("#distriList").val(tempSelect);
|
||||||
|
$('#txtSelectedDepartment').val(tempSelect);
|
||||||
tempSelect = '';
|
tempSelect = '';
|
||||||
} else {
|
|
||||||
|
|
||||||
|
|
||||||
|
if(validate())
|
||||||
|
{
|
||||||
|
$('#content').loader('show');
|
||||||
|
$.ajax({
|
||||||
|
data:$('.EditCost').serialize(),
|
||||||
|
type:"POST",
|
||||||
|
url:"<?php echo base_url() ?>CostCenter/DeleteCostDepartment",
|
||||||
|
success:function(data) {
|
||||||
|
if(data)
|
||||||
|
{
|
||||||
|
$('#content').loader('hide');
|
||||||
|
alert(data);
|
||||||
|
$('#txtSelectedDepartment').val('');
|
||||||
|
$('#txtRowCount').val('');
|
||||||
|
|
||||||
|
//window.location = baseurl + 'CostCenter/CostListing';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//$('#content').loader('hide');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
alert("Before remove please select any position.");
|
alert("Before remove please select any position.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user