cost center defect

This commit is contained in:
venbatechnologies@gmail.com 2017-08-02 12:10:28 +05:30
parent f57b3c8b0f
commit 29c3d98e7d
2 changed files with 135 additions and 18 deletions

View File

@ -280,14 +280,14 @@ class CostCenter extends BaseController
for ($j = 0; $j < count($comma_separated); $j++)
{
$DeptCode = $comma_separated[$j];
// $DeptCode = $comma_separated[$j];
$this->costcenter_model->DeleteDepartment( $DeptCode,$CostCode);
// $this->costcenter_model->DeleteDepartment( $DeptCode,$CostCode);
$Dept = array('CostCenterCode'=>$CostCode, 'DEPCode'=>$DeptCode,'CreatedBy'=>$updatedBy,'createdDate'=>$updateddt,'UpdatedBy'=>$updatedBy,'UpdatedDate'=>$updateddt);
//$Dept = array('CostCenterCode'=>$CostCode, 'DEPCode'=>$DeptCode,'CreatedBy'=>$updatedBy,'createdDate'=>$updateddt,'UpdatedBy'=>$updatedBy,'UpdatedDate'=>$updateddt);
//print_r($Dept);
$this->costcenter_model->addCostCenterDepartment($Dept);
//$this->costcenter_model->addCostCenterDepartment($Dept);
}
}
@ -304,6 +304,7 @@ class CostCenter extends BaseController
$this->costcenter_model->DeleteBudget( $BudgetType,$BudgetYear,$CostCode);
$Budget = array('CostCenterCode'=>$CostCode, 'BudgetType'=>$BudgetType,'BudgetYear'=>$BudgetYear,'BudgetAmount'=>$BudgetAmount,'Remarks'=>$Remarks,'CreatedBy'=>$updatedBy,'createdDate'=>$updateddt,'UpdatedBy'=>$updatedBy,'UpdatedDate'=>$updateddt);
//print_r($Budget);
$this->costcenter_model->addBudget($Budget);
//print_r( $BudgetType );
}
@ -328,6 +329,22 @@ class CostCenter extends BaseController
}
function AddCostDepartment()
{
$CostCode = strtoupper(trim($this->input->post('CostCode')));
$CostName = strtoupper(trim($this->input->post('CostName')));
$updatedBy = $this->session->userdata ( 'userId' );
$SelectedDepartment = $this->input->post('txtSelectedDepartment');
// $updatedBy = $this->session->userdata ( 'userId' );
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$updateddt = $dt->format('Y-m-d H:i:s');
$Dept = array('CostCenterCode'=>$CostCode, 'DEPCode'=>$SelectedDepartment,'CreatedBy'=>$updatedBy,'createdDate'=>$updateddt,'UpdatedBy'=>$updatedBy,'UpdatedDate'=>$updateddt);
$this->costcenter_model->addCostCenterDepartment($Dept);
echo ("Department Added Successfully");
}
// function AddCostDepartment()
// {
// // echo "343";

View File

@ -11,15 +11,18 @@ $FYEnd ='';
$FYear = '';
//print_r($opt);
$Budget='';
$a=0;
foreach ($CostBudget as $BUD)
{
$Budget=$BUD->BudgetType;
$BudgetTypeAdd=[];
foreach ($CostBudget as $record)
{
$a=+1;
$BudgetTypeAdd[$a]=$record->BudgetType;
//print_r($BudgetTypeAdd);
}
//echo $Budget;
//print_r($BudgetTypeAdd);
if(!empty($CostMaster))
{
@ -297,8 +300,13 @@ $(function() {
<div col="row">
<div class="col-md-12">
<div style="text-align:right">
<a data-toggle="modal" href="#addbudgetmodel" class="btn btn-primary"><i class="fa fa-plus"></i>&nbsp;&nbsp;Add Budget</a>
<a data-toggle="modal" href="#addbudgetmodel" ID="ButtonAdd" class="btn btn-primary"><i class="fa fa-plus"></i>&nbsp;&nbsp;Add Budget</a>
<!-- <a class="btn btn-primary" ID="EditImport" ><i class="fa fa-plus" ></i>&nbsp;&nbsp;<span class="bold">Edit Import</span></a> -->
</div>
</div>
<!-- Modal -->
@ -333,19 +341,27 @@ $(function() {
$Budget = array("-1"=>'Select Budget Type');
//print_r( $options);
$i=0;
if(!empty($BudType))
{
//print_r($BudgetTypeAdd);
//print_r($BudType);
foreach ($BudType as $SID):
//print_r($Budget);
if($SID->ConfigValue!=$Budget)
foreach ($BudgetTypeAdd as $BUD)
{
if($SID->ConfigValue!=$BUD)
{
//print_r($BUD);
$Budget[$SID->ConfigValue] = $SID->ConfigValue;
}
}
endforeach;
$i=+1;
}
@ -426,6 +442,9 @@ $(function() {
foreach($CostBudget as $record)
{
$index =$index + 1;
// $BudgetTypeAdd=[];
// $BudgetTypeAdd[$index]=$record->BudgetType;
// print_r($BudgetTypeAdd);
?>
<tr id="<?php echo $index ?>">
@ -688,7 +707,12 @@ $("#Edit").on("shown.bs.modal", function(e) {
// addHidden(theForm,"BudgetAmount"+temp,BudAmount);
//addHidden(theForm,"Remarks"+temp,BudRemarks);
$('#txtRowCount').val(temp);
$('#txtRowCount').val(temp);
CountRows();
// var a= CountRowsbutton();
// alert(a);
}
@ -777,7 +801,7 @@ $('.tempClickEdit').click(function(){
var o = new Option(tempText,tempSelect);
var hidval = tempSelect;
var orgVal = $('#txtSelectedDepartment').val();
alert(orgVal);
//alert(orgVal);
var Selectedval = ''
if(orgVal != '')
@ -797,6 +821,31 @@ $('.tempClickEdit').click(function(){
$('#distriList option:selected').remove();
$("#distriList").attr('selectedIndex', '-1').find("option:selected").removeAttr("selected");
$("#selectDistriList").attr('selectedIndex', '-1').find("option:selected").removeAttr("selected");
if(validate())
{
$('#content').loader('show');
$.ajax({
data:$('.EditCost').serialize(),
type:"POST",
url:"<?php echo base_url() ?>CostCenter/AddCostDepartment",
success:function(data) {
if(data)
{
$('#content').loader('hide');
alert(data);
$('#txtSelectedDepartment').val('');
$('#txtRowCount').val('');
//window.location = baseurl + 'CostCenter/CostListing';
}
}
});
//$('#content').loader('hide');
}
tempSelect = '';
tempText = '';
@ -892,6 +941,57 @@ $('.tempClickEdit').click(function(){
});
var totalRowCount = 0;
var rowCount = 0;
var table = document.getElementById("BudgetTable");
var rows = table.getElementsByTagName("tr");
//console.log(rows.length);
if(rows.length>=5)
{
$('#ButtonAdd').hide();
}
else
{
$('#ButtonAdd').show();
}
function CountRows()
{
totalRowCount = 0;
rowCount = 0;
table = document.getElementById("BudgetTable");
rows = table.getElementsByTagName("tr")
for (var i = 0; i < rows.length; i++) {
totalRowCount++;
if (rows[i].getElementsByTagName("td").length > 0) {
rowCount++;
}
}
var message = "Total Row Count: " + totalRowCount;
message += "\nRow Count: " + rowCount;
//alert(message);
if(totalRowCount>"4")
{
$("#addbudgetmodel").modal('hide');
}
else
{
return false;
}
}
function validate()
{
/* if($("#txtSelectedDepartment").val().length < 1)