Raised trackers issues 3

This commit is contained in:
VE10-Sanjeev 2025-04-15 11:23:26 +00:00
parent ea1aa1923c
commit 2040199888
5 changed files with 105 additions and 129 deletions

View File

@ -236,7 +236,7 @@ class Requisitionform extends BaseController
$ReqType = $this->request->getPost('id');
$CatType = $this->request->getPost('cid');
$MaterialCode = $this->requistion_model->GetMaterialCode($ReqType,$CatType);
$MaterialCode = $this->requistion_model->GetMaterialCode($ReqType);
$MaterialName = "";
$UOM = "";
$HTML = "<option value='-1'>Select Material Type</option>";

View File

@ -172,13 +172,14 @@ class Requistion_model extends Model
* This function is used to get the Material details for the Request type
* @return array $result : This is result of the query
*/
function GetMaterialCode($ReqType,$CatType,$NotArray='')
function GetMaterialCode($ReqType,$NotArray='')
{
$builder = $this->db->table('t_materialmaster')
->select('MaterialCode, MaterialName,UOM,material_rate,HSNCODE')
->where('IsActive',1)
->where('Category',$CatType);
->where('IsActive',1);
//->where('MaterialType',$ReqType );
$query = $builder->get();
if($NotArray == '')
{
@ -189,6 +190,7 @@ class Requistion_model extends Model
return $query->getResult();
}
}
/**
* This function is used to get the Raw Material information
* @return array $result : This is result of the query

View File

@ -2083,8 +2083,11 @@ if (!empty($INRSYMBOL)) {
}
$(document).ready(function () {
$('#ServiceMaterialCode').change(function () {
var selectedMaterialCode = '';
selectedMaterialCode = $("#ServiceMaterialCode").val();
selectedMaterialCode = $("#ServiceMaterialCode").val(); // First I have get the data from materialcode dropdown
clearServiceModalFields(); // then Clear All Fields
$("#ServiceMaterialCode").val(selectedMaterialCode); // again i fetched the materialcode in that dropdown // konjam loose thaan
$.each(JSON.parse(materialData), function (index, value) {
if (selectedMaterialCode == value.MaterialCode) {
$("#ServiceDescription").val(value.MaterialName);
@ -2292,17 +2295,17 @@ if (!empty($INRSYMBOL)) {
*/
$('#MaterialCode').on('change', function () {
console.log("111111111111");
// $('#MaterialCode').change(function() {
var selectedRevenueMaterialCode = '';
selectedRevenueMaterialCode = $("#MaterialCode").val();
console.log(materialData);
console.log("materialData - 1111111");
selectedRevenueMaterialCode = $("#MaterialCode").val();// First I have get the data from materialcode dropdown
clearRevenueModalFields();// then Clear All Fields
// $('#MaterialCode').change(function() {
$("#MaterialCode").val(selectedRevenueMaterialCode); // again i fetched the materialcode in that dropdown // konjam loose thaan
$.each(JSON.parse(materialData), function (index, value) {
if (selectedRevenueMaterialCode == value.MaterialCode) {
$("#ItemName").val(value.MaterialName);
$("#UOM").val(value.UOM);
$("#Rate").val(value.material_rate);
$("#Quantity").val(0);
}
});
@ -3599,7 +3602,7 @@ if (!empty($INRSYMBOL)) {
<br>
<div class="col-12 text-right">
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" style="margin:10px;">Cancel</a>&nbsp;&nbsp;
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" style="margin:10px;" onclick="clearRevenueModalFields()">Cancel</a>&nbsp;&nbsp;
<a class="btn btn-success font AddRevenue" ID="AddRevenue">&nbsp;&nbsp;<span class="bold">Add Revenue</span></a>&nbsp;&nbsp;
</div>
@ -3893,7 +3896,7 @@ if (!empty($INRSYMBOL)) {
</div>
<div class="modal-footer">
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel">Cancel</a>
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" onclick="clearServiceModalFields()">Cancel</a>
&nbsp;&nbsp;&nbsp;&nbsp;
<a class="btn btn-success font AddService" ID="AddService"> &nbsp;&nbsp;<span class="bold">Add Service</span></a>
</div>
@ -6248,7 +6251,7 @@ if (!empty($INRSYMBOL)) {
$('#deptName').val('');
$('#CostCenter').val("0");
$('#AvlBudAmt').val(0);
$('#MaterialCode').val('');
$('#MaterialCode').val("").select2();
$("#ItemName").val('');
$('#UOM').val('');
$("#Rate").val('');

View File

@ -322,17 +322,6 @@ td {
aria-hidden="true">×</button>
</div>
<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="col-md-12">
<div class="form-group">
@ -353,14 +342,14 @@ td {
</div>
</div>
<!-- <div class="row">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="AddCategory" class="control-label">Category</label>
<label for="AddCategory" class="control-label">Material Category</label>
<input type ="text" id="AddCategory" readonly class="form-control">
</div>
</div>
</div> -->
</div>
<div class="row" id="otherDescription" style="display:none;">
<div class="col-md-12">
@ -508,17 +497,35 @@ td {
<script>
$(document).ready(function() {
$(".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);
}
});
// $('#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;
// }
// });
});
function isNumberKey(evt) {
@ -532,36 +539,6 @@ td {
$(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 ReqLineItem = <?php echo json_encode($LineItem, JSON_PRETTY_PRINT) ?>;
$.each(ReqLineItem, function(idx, obj) {
@ -619,7 +596,7 @@ td {
//alert(converttext)
$("#Description").val('');
$("#AddCategory").val('');
$("#UOM").val('');
if (id != '-1') {
@ -636,7 +613,7 @@ td {
$('#loader').hide();
//alert(json.MatDetail);
$("#Description").val(json.MatDetail[0]['MaterialName']);
$("#AddCategory").val(json.MatDetail[0]['CategoryName']);
$("#UOM").val(json.MatDetail[0]['UOM']);
}
@ -878,7 +855,7 @@ td {
var uom = $("#UOM").val();
var quantity = $("#Quantity").val();
var materialdescription = $('#otherD').val();
var categoryName = $('#AddCategory option:selected').text();
var categoryName = $('#AddCategory').val();
var selectedText = $('#drpMaterial option:selected').text();
var parts = selectedText.split('-');
var HSN = selectedText.includes('-') && /^\d+$/.test(parts[0].trim())

View File

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