From 4e0de35c2d0ac952da3470cc7ac282d241eb2fbc Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Tue, 25 Jun 2024 07:18:56 +0000 Subject: [PATCH] FIX_costCenter : ps --- app/Controllers/CostCenter.php | 10 +++- app/Views/addCostCenter.php | 101 ++++++++++++++++----------------- app/Views/editCostCenter.php | 67 +++++++++++----------- 3 files changed, 90 insertions(+), 88 deletions(-) diff --git a/app/Controllers/CostCenter.php b/app/Controllers/CostCenter.php index b307e4fb..42e5eb68 100644 --- a/app/Controllers/CostCenter.php +++ b/app/Controllers/CostCenter.php @@ -87,7 +87,6 @@ class CostCenter extends BaseController */ function saveCostCenter() { - // $this->validator->setRules([ // 'CostName' => 'trim|required', // 'CostCode' => 'trim|required', @@ -104,7 +103,8 @@ class CostCenter extends BaseController $CreateBy = $this->session->get('userId'); $SelectedDepartment = $this->request->getPost('txtSelectedDepartment'); - $ApproverName = $this->request->getPost('ApprovedBy'); + // $ApproverName = $this->request->getPost('ApprovedBy'); + $ApproverName = $this->session->get('EmpID'); $comma_separated = explode(':', (string)$SelectedDepartment); // $comma_separated = $this->costcenter_model->getDepartment(); // print_r($comma_separated);die; @@ -243,7 +243,11 @@ class CostCenter extends BaseController $SelectedDepartment = (string)$this->request->getPost('txtSelectedDepartment'); - $ApproverName = $this->request->getPost('ApprovedBy'); + // $ApproverName = $this->request->getPost('ApprovedBy'); + // $ApproverName = $this->session->get('EmpID'); + $ApproverName = NULL; + + $comma_separated = []; print_r(strlen($SelectedDepartment)); if(strlen($SelectedDepartment)>0) diff --git a/app/Views/addCostCenter.php b/app/Views/addCostCenter.php index b7415fe7..1def3ef7 100644 --- a/app/Views/addCostCenter.php +++ b/app/Views/addCostCenter.php @@ -162,9 +162,9 @@ $(function() {
- * + -
+ 'Select Approver'); @@ -180,10 +180,10 @@ $(function() { endforeach; } - echo form_dropdown('ApprovedBy',$options,set_value('ApprovedBy'),'id="ApprovedBy"', 'class = "form-control "'); ?> + // echo form_dropdown('ApprovedBy',$options,set_value('ApprovedBy'),'id="ApprovedBy"', 'class = "form-control "'); ?> -
+
@@ -257,18 +257,18 @@ $(function() { -
-
-
- Budget Amount : -
-
+ + + + + + - + -
-
-
+ + +
@@ -302,7 +302,7 @@ $(function() { Budget Type Budget Year - Budget Amount + Remarks Action @@ -361,21 +361,21 @@ $(function() {
-
-
-
+ + + + 'EditAmout', 'value' => set_value('EditAmout'),'id'=>'EditAmout', 'class' => 'form-control','onkeypress'=>'return isNumberKey(event);'); - echo form_input($data); + echo form_hidden($data); ?> -
-
-
+ + +
@@ -462,8 +462,7 @@ $(function() { <%=BudgetType%> <%=BudgetYear%> - - <%=BudgetAmount%> + <%=BudgetAmount%> <%=Remarks%> @@ -494,12 +493,12 @@ function OpenModal() $('#selectDistriList').focus(); return false; } - else if($('#ApprovedBy').val() == "-1") - { - alert('Please Select the Approver'); - $('#ApprovedBy').focus(); - return false; - } + // else if($('#ApprovedBy').val() == "-1") + // { + // alert('Please Select the Approver'); + // $('#ApprovedBy').focus(); + // return false; + // } else { $('#addbudgetmodel').modal('show'); @@ -514,7 +513,7 @@ $("#Edit").on("shown.bs.modal", function(e) { $('#Editbudget').val($('#BudgetTable tr:eq('+ userid +') td:eq(0)').text()); $('#EditYear').val($('#BudgetTable tr:eq('+ userid +') td:eq(1)').text()); - $('#EditAmout').val($('#BudgetTable tr:eq('+ userid +') td:eq(2)').text()); + $('#EditAmout').val($('#BudgetTable tr:eq('+ userid +') td:eq(2)').text()).hide(); $('#EditRemarks').val($('#BudgetTable tr:eq('+ userid +') td:eq(3)').text()); }); @@ -536,11 +535,11 @@ var iflag = 0; alert('Please Enter the Budget Year'); //return; } - if(document.getElementById('AddAmout').value == '' ) - { - alert('Please Enter the Budget Amount'); - // return; - } + // if(document.getElementById('AddAmout').value == '' ) + // { + // alert('Please Enter the Budget Amount'); + // // return; + // } if ($("#Addbudget option:selected").val() !='-1' && $('#AddYear').val() != '0' && $('#AddAmout').val() != '' ) @@ -550,7 +549,7 @@ var iflag = 0; var temp = index; var BudType = $("#Addbudget option:selected").val(); var BudYear = $("#AddYear").val(); - var BudAmount = $("#AddAmout").val(); + var BudAmount = $("#AddAmout").val() ? $("#AddAmout").val() : 0; //$('#Addbudget option[value='+BudType+']').remove(); var BudRemarks = $('#AddRemarks').val(); $('#AddYear').val(''); @@ -626,11 +625,11 @@ $('.tempClickEdit').click(function(){ alert('Please Enter the Budget Year'); //return; } - if(document.getElementById('EditAmout').value == '' ) - { - alert('Please Enter the Budget Amount'); - // return; - } + // if(document.getElementById('EditAmout').value == '' ) + // { + // alert('Please Enter the Budget Amount'); + // // return; + // } if ( $('#EditAmout').val() != '' && $('#EditYear').val() != '' ) @@ -644,11 +643,11 @@ $('.tempClickEdit').click(function(){ $('#BudgetTable tr:eq('+ temp +') td:eq(1)').text(BudYear); - $('#BudgetTable tr:eq('+ temp +') td:eq(2)').text(BudAmount); + $('#BudgetTable tr:eq('+ temp +') td:eq(2)').text(BudAmount).hide(); $('#BudgetTable tr:eq('+ temp +') td:eq(3)').text(BudRemarks); $('#BudgetYear'+temp).val(BudYear); - $('#BudgetAmount'+temp).val(BudAmount); + $('#BudgetAmount'+temp).val(BudAmount).hide(); $('#Remarks'+temp).val(BudRemarks); @@ -857,11 +856,11 @@ function validate() alert('Please Add Budget'); return false; } - else if($("option:selected", $("#ApprovedBy")).val() == '-1') - { - alert('Please Select Approver Names'); - return false; - } + // else if($("option:selected", $("#ApprovedBy")).val() == '-1') + // { + // alert('Please Select Approver Names'); + // return false; + // } else { return true; diff --git a/app/Views/editCostCenter.php b/app/Views/editCostCenter.php index 15d8cc0e..958679d9 100644 --- a/app/Views/editCostCenter.php +++ b/app/Views/editCostCenter.php @@ -237,7 +237,7 @@ for ($i = 1; $i < 5; $i++) {
-
+
@@ -402,18 +402,18 @@ for ($i = 1; $i < 5; $i++) {
-
-
-
+ + + + - + -
-
-
+ + +
@@ -447,7 +447,7 @@ for ($i = 1; $i < 5; $i++) { Budget Type Budget Year - Budget Amount + Remarks Action @@ -544,21 +544,21 @@ for ($i = 1; $i < 5; $i++) {
-
-
-
+ + + + 'EditAmout', 'value' => set_value('EditAmout'), 'id' => 'EditAmout', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);'); - echo form_input($data); + echo form_hidden($data); ?> -
-
-
+ + +
@@ -661,10 +661,10 @@ for ($i = 1; $i < 5; $i++) { alert('Please Enter the Budget Year'); //return; } - if (document.getElementById('AddAmout').value == '') { - alert('Please Enter the Budget Amount'); - // return; - } + // if (document.getElementById('AddAmout').value == '') { + // alert('Please Enter the Budget Amount'); + // // return; + // } if ($("#Addbudget option:selected").val() != '-1' && $('#AddYear').val() != '0' && $('#AddAmout').val() != '') { @@ -756,10 +756,10 @@ for ($i = 1; $i < 5; $i++) { alert('Please Enter the Budget Year'); //return; } - if (document.getElementById('EditAmout').value == '') { - alert('Please Enter the Budget Amount'); - // return; - } + // if (document.getElementById('EditAmout').value == '') { + // alert('Please Enter the Budget Amount'); + // // return; + // } if ($('#EditAmout').val() != '' && $('#EditYear').val() != '') { @@ -1006,13 +1006,12 @@ for ($i = 1; $i < 5; $i++) { alert('Please Add Budget'); return false; } - else */ - if ($("option:selected", $("#ApprovedBy")).val() == '-1') { + else if ($("option:selected", $("#ApprovedBy")).val() == '-1') { alert('Please Select Approver Names'); return false; } else { return true; - } - + }*/ + return true } \ No newline at end of file