Raised trackers issues

This commit is contained in:
VE10-Sanjeev 2025-04-15 06:02:32 +00:00
parent 8a76fbcf52
commit 75110ae438
7 changed files with 171 additions and 85 deletions

View File

@ -251,6 +251,7 @@ $routes->post('EditRequisition', 'Requisitionform::EditRequisition');
$routes->post('addNewRequisition', 'Requisitionform::addNewRequisition'); $routes->post('addNewRequisition', 'Requisitionform::addNewRequisition');
$routes->post('getMaterialCode', 'Requisitionform::getMaterialCode'); $routes->post('getMaterialCode', 'Requisitionform::getMaterialCode');
$routes->post('getMaterialDetails', 'Requisitionform::getMaterialDetails'); $routes->post('getMaterialDetails', 'Requisitionform::getMaterialDetails');
$routes->post('getCategoryDetails', 'Requisitionform::getCategoryDetails');
$routes->post('DeleteRequistionForm', 'Requisitionform::DeleteRequistionForm'); // recheck it used or not. $routes->post('DeleteRequistionForm', 'Requisitionform::DeleteRequistionForm'); // recheck it used or not.
$routes->post('requisitionform/ApproveRequest', 'Requisitionform::ApproveRequest'); $routes->post('requisitionform/ApproveRequest', 'Requisitionform::ApproveRequest');
$routes->post('requisitionform/DeleteReqNo', 'Requisitionform::DeleteReqNo'); $routes->post('requisitionform/DeleteReqNo', 'Requisitionform::DeleteReqNo');

View File

@ -204,49 +204,6 @@ class Requisitionform extends BaseController
$this->loadViews("requisitionlistapproval", $this->global, $data, NULL); $this->loadViews("requisitionlistapproval", $this->global, $data, NULL);
} }
/**
* This function used to load the Employee details based on the EmpID selection
*/
function GetSelectedEmpDetails()
{
$ReqType = $_GET['ReqType'];
$EmpID = $this->request->getPost('id');
$empDetails = $this->requistion_model->GetEmployeeDetails($EmpID);
$DeptCode = $empDetails[0]['DEPCode'];
$CostList = $this->requistion_model->GetCostCenterByDept($DeptCode);
$HTML = "<option value='-1'>Select Cost center</option>";
$BudAmount = "";
if (count($CostList) > 0) {
for ($j = 0; $j < count($CostList); $j++) {
$Code = $CostList[$j]['CostCenterCode'];
$Name = $CostList[$j]['CostCenterName'];
$HTML .= "<option value='" . $Code . "'>" . $Code . "-" . $Name . "</option>";
}
}
if (count($CostList) == 1) {
$FYStart = '';
$FYEnd = '';
$FiscalYear = $this->costcenter_model->getFiscalYear();
if (!empty($FiscalYear)) {
foreach ($FiscalYear as $Fy) {
$FYStart = $Fy->StartYear;
$FYEnd = $Fy->EndYear;
}
}
$FYdt = $FYStart . " - " . $FYEnd;
$result = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode, $FYdt, $ReqType);
//print_r($result);
$AvilBudAmt = '0';
if (count($result) > 0) {
$BudAmount = $result[0]['BudgetAmount'] - $result[0]['Totalvalue'];
}
}
die(json_encode(array('emp' => $empDetails, 'Cost' => $HTML, 'AvlAmount' => $BudAmount)));
}
function getAvailableBudAmount() function getAvailableBudAmount()
{ {
@ -277,8 +234,9 @@ class Requisitionform extends BaseController
{ {
$ReqType = $this->request->getPost('id'); $ReqType = $this->request->getPost('id');
$CatType = $this->request->getPost('cid');
$MaterialCode = $this->requistion_model->GetMaterialCode($ReqType); $MaterialCode = $this->requistion_model->GetMaterialCode($ReqType,$CatType);
$MaterialName = ""; $MaterialName = "";
$UOM = ""; $UOM = "";
$HTML = "<option value='-1'>Select Material Type</option>"; $HTML = "<option value='-1'>Select Material Type</option>";
@ -310,6 +268,28 @@ class Requisitionform extends BaseController
return $this->response->setJSON(['MatDetail' => $MaterialDetails]); return $this->response->setJSON(['MatDetail' => $MaterialDetails]);
} }
function getCategoryDetails()
{
$CategoryDetails = $this->requistion_model->getmaterialCategory();
$HTML = "<option value='-1'>Select Category</option>";
if (count($CategoryDetails) > 0) {
for ($j = 0; $j < count($CategoryDetails); $j++) {
$Code = $CategoryDetails[$j]['Key'];
$Name = $CategoryDetails[$j]['ConfigValue'];
$HTML .= "<option value='" . $Code . "'>" . $Name . "</option>";
}
}
$response = ['Category' => $HTML];
return $this->response->setJSON($response);
}
/** /**
* To Insert the Requistion Details to Database * To Insert the Requistion Details to Database
*/ */
@ -390,9 +370,13 @@ class Requisitionform extends BaseController
} }
if ($Status == REQ_DRAFT) { if ($Status == REQ_DRAFT) {
$display_message = 'Successfully Saved the Requistion details.Requistion No is ' . $ReqNumber; $display_message = "Successfully Saved the Requisition details in Draft!\nRequistion Number Is: ". $ReqNumber;
} else { // $display_message = "Requistion Saved as Draft!\nRequistion Number Is: ". $ReqNumber;
$display_message = 'Successfully Created the Requistion details.Requistion No is ' . $ReqNumber; } else if($Status == REQ_APPROVED) {
$display_message = "Successfully Updated the Requistion details as Approved!\nRequistion Number Is: ". $ReqNumber;
// $display_message = "Requistion Created Successfully!\nRequistion Number Is: ". $ReqNumber;
}else{
$display_message = "Successfully Created the Requistion details!\nRequistion Number Is: ". $ReqNumber;
} }
return $this->response->setJSON([$display_message]); return $this->response->setJSON([$display_message]);
@ -459,7 +443,8 @@ class Requisitionform extends BaseController
} }
} }
} }
$display_message = 'Successfully Updated the Requistion details.Requistion No is ' . $ReqNumber;
$display_message = "Successfully Updated the Requistion details as Created!\nRequistion Number Is: ". $ReqNumber;
return $this->response->setJSON([$display_message]); return $this->response->setJSON([$display_message]);
} }
@ -592,7 +577,8 @@ class Requisitionform extends BaseController
$Request = array('Status' => $Status, 'Comments' => $Remarks, 'ApprovedOn' => $ApprovedDate, 'Approvedby' => $ApprovedBy); $Request = array('Status' => $Status, 'Comments' => $Remarks, 'ApprovedOn' => $ApprovedDate, 'Approvedby' => $ApprovedBy);
$this->requistion_model->UpdateRequistion($Request, $ReqNo); $this->requistion_model->UpdateRequistion($Request, $ReqNo);
return $this->response->setJSON(['message' => "Successfully Updated the Requisition No: " . $ReqNo]);
return $this->response->setJSON(['message' => "Requistion Updated Successfully!\nRequistion Number Is: ".$ReqNo]);
} }
} }

View File

@ -74,16 +74,16 @@ class Rawmaterialdetails_model extends Model
} }
//This function used to get the material category using configdetails table //This function used to get the material category using configdetails table
function getmaterialCategory($MaterialCategory = '') function getmaterialCategory()
{ {
$Config_ID = 'C023'; $Config_ID = 'C023';
$builder = $this->db->table('t_configdetails') $builder = $this->db->table('t_configdetails')
->select('Key,Config_ID,ConfigValue') ->select('Key,Config_ID,ConfigValue')
->where('isActive', 1) ->where('isActive', 1)
->where('Config_id', $Config_ID); ->where('Config_id', $Config_ID);
if ($MaterialCategory != '') { // if ($MaterialCategory != '') {
$builder->where('ConfigValue !=', $MaterialCategory); // $builder->where('ConfigValue !=', $MaterialCategory);
} // }
$query = $builder->get(); $query = $builder->get();
return $query->getResult(); return $query->getResult();
@ -143,6 +143,7 @@ class Rawmaterialdetails_model extends Model
return $query->getResult(); return $query->getResult();
} }
function getAllSilicaRawMaterialCode(){ function getAllSilicaRawMaterialCode(){
$builder = $this->db->table('t_materialmaster') $builder = $this->db->table('t_materialmaster')

View File

@ -172,14 +172,13 @@ class Requistion_model extends Model
* This function is used to get the Material details for the Request type * This function is used to get the Material details for the Request type
* @return array $result : This is result of the query * @return array $result : This is result of the query
*/ */
function GetMaterialCode($ReqType,$NotArray='') function GetMaterialCode($ReqType,$CatType,$NotArray='')
{ {
$builder = $this->db->table('t_materialmaster') $builder = $this->db->table('t_materialmaster')
->select('MaterialCode, MaterialName,UOM,material_rate,HSNCODE') ->select('MaterialCode, MaterialName,UOM,material_rate,HSNCODE')
->where('IsActive',1)
->where('IsActive',1); ->where('Category',$CatType);
//->where('MaterialType',$ReqType ); //->where('MaterialType',$ReqType );
$query = $builder->get(); $query = $builder->get();
if($NotArray == '') if($NotArray == '')
{ {
@ -594,6 +593,17 @@ class Requistion_model extends Model
return $categoryName; return $categoryName;
} }
function getmaterialCategory()
{
$Config_ID = 'C023';
$builder = $this->db->table('t_configdetails')
->select('Key,Config_ID,ConfigValue')
->where('isActive', 1)
->where('Config_id', $Config_ID);
$query = $builder->get();
return $query->getResultArray();
}
} }

View File

@ -322,6 +322,17 @@ td {
aria-hidden="true">×</button> aria-hidden="true">×</button>
</div> </div>
<div class="modal-body p-4"> <div class="modal-body p-4">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="AddCategory" class="control-label">Material Category</label>
<?php
$options = array("0" => 'Category');
echo form_dropdown('AddCategory', $options, set_value('AddCategory'), 'id="AddCategory" class="form-control searchabledropdown" ');
?>
</div>
</div>
</div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group"> <div class="form-group">
@ -342,14 +353,14 @@ td {
</div> </div>
</div> </div>
<div class="row"> <!-- <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group"> <div class="form-group">
<label for="AddCategory" class="control-label">Category</label> <label for="AddCategory" class="control-label">Category</label>
<input type ="text" id="AddCategory" readonly class="form-control"> <input type ="text" id="AddCategory" readonly class="form-control">
</div> </div>
</div> </div>
</div> </div> -->
<div class="row" id="otherDescription" style="display:none;"> <div class="row" id="otherDescription" style="display:none;">
<div class="col-md-12"> <div class="col-md-12">
@ -497,6 +508,17 @@ td {
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$(".searchabledropdown").select2(); $(".searchabledropdown").select2();
$.ajax({
dataType: 'json',
type: "POST",
url: "<?php echo base_url(); ?>getCategoryDetails",
success: function(json) {
console.log(json);
$("#AddCategory").empty();
$("#drpMaterial").empty();
$("#AddCategory").append(json.Category);
}
});
}); });
function isNumberKey(evt) { function isNumberKey(evt) {
@ -510,6 +532,36 @@ td {
$(function() { $(function() {
$('#AddCategory').change(function() {
var id = $('#RequestType').val();
var cid = $('#AddCategory').val();
if(id){
$.ajax({
data: {
id: id,
cid : cid
},
dataType: 'json',
type: "POST",
url: "<?php echo base_url(); ?>getMaterialCode",
success: function(json) {
console.log(json);
// $('#content').loader('hide');
$("#drpMaterial").empty();
$("#drpMaterial").append(json.Material);
// $("#Description").val(json.MaterialName);
// $("#UOM").val(json.UOM);
}
});
}else{
alert('Please select the Material Category');
return false;
}
});
var j = 0; var j = 0;
var ReqLineItem = <?php echo json_encode($LineItem, JSON_PRETTY_PRINT) ?>; var ReqLineItem = <?php echo json_encode($LineItem, JSON_PRETTY_PRINT) ?>;
$.each(ReqLineItem, function(idx, obj) { $.each(ReqLineItem, function(idx, obj) {
@ -567,7 +619,7 @@ td {
//alert(converttext) //alert(converttext)
$("#Description").val(''); $("#Description").val('');
$("#AddCategory").val('');
$("#UOM").val(''); $("#UOM").val('');
if (id != '-1') { if (id != '-1') {
@ -584,7 +636,7 @@ td {
$('#loader').hide(); $('#loader').hide();
//alert(json.MatDetail); //alert(json.MatDetail);
$("#Description").val(json.MatDetail[0]['MaterialName']); $("#Description").val(json.MatDetail[0]['MaterialName']);
$("#AddCategory").val(json.MatDetail[0]['CategoryName']);
$("#UOM").val(json.MatDetail[0]['UOM']); $("#UOM").val(json.MatDetail[0]['UOM']);
} }
@ -826,7 +878,7 @@ td {
var uom = $("#UOM").val(); var uom = $("#UOM").val();
var quantity = $("#Quantity").val(); var quantity = $("#Quantity").val();
var materialdescription = $('#otherD').val(); var materialdescription = $('#otherD').val();
var categoryName = $('#AddCategory').val(); var categoryName = $('#AddCategory option:selected').text();
var selectedText = $('#drpMaterial option:selected').text(); var selectedText = $('#drpMaterial option:selected').text();
var parts = selectedText.split('-'); var parts = selectedText.split('-');
var HSN = selectedText.includes('-') && /^\d+$/.test(parts[0].trim()) var HSN = selectedText.includes('-') && /^\d+$/.test(parts[0].trim())

View File

@ -310,10 +310,10 @@
e.preventDefault(); e.preventDefault();
const $btn = $(this); const $btn = $(this);
const strMsg = $btn.is('#IGRLink') const strMsg = $btn.is('#IGRLink')
? 'Generate IGR?' ? 'generate the IGR?'
: 'Save as draft IGR?'; : 'Save as draft IGR?';
if (confirm('Are you sure? ' + strMsg)) { if (confirm('Are you sure you want to ' + strMsg)) {
$btn.prop("disabled", true) $btn.prop("disabled", true)
.html('<i class="fa fa-spinner fa-spin"></i> Processing...'); .html('<i class="fa fa-spinner fa-spin"></i> Processing...');
filecheck($btn.is('#IGRLink') ? 1 : 0); filecheck($btn.is('#IGRLink') ? 1 : 0);

View File

@ -208,6 +208,18 @@ if (!empty($Emp)) {
</div> </div>
<div class="modal-body p-4"> <div class="modal-body p-4">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="AddCategory" class="control-label">Material Category</label>
<?php
$options = array("0" => 'Category');
echo form_dropdown('AddCategory', $options, set_value('AddCategory'), 'id="AddCategory" class="form-control searchabledropdown" ');
?>
</div>
</div>
</div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group"> <div class="form-group">
@ -227,14 +239,14 @@ if (!empty($Emp)) {
</div> </div>
</div> </div>
<div class="row"> <!-- <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group"> <div class="form-group">
<label for="AddCategory" class="control-label">Category</label> <label for="AddCategory" class="control-label">Category</label>
<input type ="text" id="AddCategory" readonly class="form-control"> <input type ="text" id="AddCategory" readonly class="form-control">
</div> </div>
</div> </div>
</div> </div> -->
<div class="row" id="otherDescription" style="display:none;" > <div class="row" id="otherDescription" style="display:none;" >
<div class="col-md-12"> <div class="col-md-12">
@ -301,10 +313,9 @@ if (!empty($Emp)) {
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group"> <div class="form-group">
<input type="hidden" name="EditMaterialCode" id="EditMaterialCode" /> <label for="EditCategory" class="control-label">Material Category</label>
<label for="EditMaterialCode" class="control-label">Material Code</label>
<?php <?php
$data = array('value' => set_value('EditMaterialType'), 'id' => 'EditMaterialType', 'class' => 'form-control', 'readonly' => 'true'); $data = array('value' => set_value('EditCategory'), 'id' => 'EditCategory', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data); echo form_input($data);
?> ?>
@ -314,9 +325,10 @@ if (!empty($Emp)) {
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group"> <div class="form-group">
<label for="EditCategory" class="control-label">Material Category</label> <input type="hidden" name="EditMaterialCode" id="EditMaterialCode" />
<label for="EditMaterialCode" class="control-label">Material Code</label>
<?php <?php
$data = array('value' => set_value('EditCategory'), 'id' => 'EditCategory', 'class' => 'form-control', 'readonly' => 'true'); $data = array('value' => set_value('EditMaterialType'), 'id' => 'EditMaterialType', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data); echo form_input($data);
?> ?>
@ -438,20 +450,13 @@ if (!empty($Emp)) {
if (id != '-1') { if (id != '-1') {
// $('#content').loader('show'); // $('#content').loader('show');
$.ajax({ $.ajax({
data: {
id: id
},
dataType: 'json', dataType: 'json',
type: "POST", type: "POST",
url: "<?php echo base_url(); ?>getMaterialCode", url: "<?php echo base_url(); ?>getCategoryDetails",
success: function(json) { success: function(json) {
console.log(json); console.log(json);
// $('#content').loader('hide'); $("#AddCategory").empty();
$("#AddCategory").append(json.Category);
$("#MaterialCode").empty();
$("#MaterialCode").append(json.Material);
// $("#Description").val(json.MaterialName);
// $("#UOM").val(json.UOM);
if (id != 'SERVICE') { if (id != 'SERVICE') {
$('#DisplayScheduleDiv').hide(); $('#DisplayScheduleDiv').hide();
} else { } else {
@ -467,6 +472,36 @@ if (!empty($Emp)) {
} }
}); });
$('#AddCategory').change(function() {
var id = $('#RequestType').val();
var cid = $('#AddCategory').val();
if(id){
$.ajax({
data: {
id: id,
cid : cid
},
dataType: 'json',
type: "POST",
url: "<?php echo base_url(); ?>getMaterialCode",
success: function(json) {
console.log(json);
// $('#content').loader('hide');
$("#MaterialCode").empty();
$("#MaterialCode").append(json.Material);
// $("#Description").val(json.MaterialName);
// $("#UOM").val(json.UOM);
}
});
}else{
alert('Please select the Material Category');
return false;
}
});
$('#MaterialCode').change(function() { $('#MaterialCode').change(function() {
var id = $('#MaterialCode').val(); var id = $('#MaterialCode').val();
@ -478,7 +513,7 @@ if (!empty($Emp)) {
// alert(checkanswer) // alert(checkanswer)
$("#Description").val(''); $("#Description").val('');
$("#AddCategory").val(''); // $("#AddCategory").val('');
$("#UOM").val(''); $("#UOM").val('');
if (id != '-1') { if (id != '-1') {
@ -496,7 +531,7 @@ if (!empty($Emp)) {
// $('#content').loader('hide'); // $('#content').loader('hide');
//alert(json.MatDetail); //alert(json.MatDetail);
$("#Description").val(json.MatDetail[0]['MaterialName']); $("#Description").val(json.MatDetail[0]['MaterialName']);
$("#AddCategory").val(json.MatDetail[0]['CategoryName']); // $("#AddCategory").val(json.MatDetail[0]['CategoryName']);
$("#UOM").val(json.MatDetail[0]['UOM']); $("#UOM").val(json.MatDetail[0]['UOM']);
} }
@ -660,6 +695,7 @@ if (!empty($Emp)) {
<script> <script>
$('.addClick').click(function() { $('.addClick').click(function() {
console.log($("#AddCategory option:selected").text());
if ($("#MaterialCode option:selected").val() == '-1') { if ($("#MaterialCode option:selected").val() == '-1') {
alert('Please Select The MaterialCode '); alert('Please Select The MaterialCode ');
return false; return false;
@ -676,7 +712,7 @@ if (!empty($Emp)) {
var temp = index; var temp = index;
var materialCode = $("#MaterialCode option:selected").val(); var materialCode = $("#MaterialCode option:selected").val();
var materialName = $("#Description").val(); var materialName = $("#Description").val();
var categoryName = $('#AddCategory').val(); var categoryName = $("#AddCategory option:selected").text();
var uom = $("#UOM").val(); var uom = $("#UOM").val();
var quantity = $("#Quantity").val(); var quantity = $("#Quantity").val();
var materialdescription = $('#otherD').val(); var materialdescription = $('#otherD').val();
@ -798,7 +834,7 @@ if (!empty($Emp)) {
var editMaterialType = $('#EditMaterialType').val(); var editMaterialType = $('#EditMaterialType').val();
var editparts = editMaterialType.split('-'); var editparts = editMaterialType.split('-');
var editHSN = editselectedText.includes('-') && /^\d+$/.test(editparts[0].trim()) var editHSN = editMaterialType.includes('-') && /^\d+$/.test(editparts[0].trim())
? editparts[0].trim() ? editparts[0].trim()
: ''; : '';