master detail module changes-2 vadivel J 10-12-2024
This commit is contained in:
parent
a0b01f07a0
commit
fb66a2468f
@ -119,12 +119,9 @@ class Configurationctrl extends BaseController
|
||||
$child_result = $this->configmodel->addconfigdetails($child_arr);
|
||||
}
|
||||
}
|
||||
|
||||
if ($result || $child_result) {
|
||||
|
||||
$this->session->setFlashdata('success', 'Configuration Updated successfully!');
|
||||
} else {
|
||||
$this->session->setFlashdata('error', 'Configuration Record Not Updated!');
|
||||
}
|
||||
|
||||
return redirect()->route('configlisting');
|
||||
}
|
||||
|
||||
|
||||
@ -177,7 +177,7 @@ class StockController extends BaseController
|
||||
throw new \Exception('Failed to update gas stock consumption.');
|
||||
}
|
||||
$message2 = 'And updated gas stock consumption.';
|
||||
$message3 =" Warning..!! Kindly Update the next subsequent month Gas Stock If older month Gas Stock Updated..!!";
|
||||
$message3 = " Warning..!! Kindly Update the next subsequent month Gas Stock If older month Gas Stock Updated..!!";
|
||||
} else {
|
||||
throw new \Exception('Failed to insert Coating machine details.');
|
||||
}
|
||||
@ -189,11 +189,11 @@ class StockController extends BaseController
|
||||
}
|
||||
$this->db->transCommit();
|
||||
|
||||
|
||||
|
||||
|
||||
// Set flashdata for success message
|
||||
return redirect()->to("/coatingMachineDetails?month=$month")
|
||||
->with('success', $message1 . " " . $message2 ." ".$message3);
|
||||
->with('success', $message1 . " " . $message2 . " " . $message3);
|
||||
|
||||
} catch (\Exception $error) {
|
||||
$this->db->transRollback();
|
||||
@ -238,7 +238,7 @@ class StockController extends BaseController
|
||||
}
|
||||
$message2 = 'And updated gas stock consumption.';
|
||||
|
||||
$message3 ="Warning..!! Kindly Update the next subsequent month Gas Stock If older month Gas Stock Updated..!!";
|
||||
$message3 = "Warning..!! Kindly Update the next subsequent month Gas Stock If older month Gas Stock Updated..!!";
|
||||
|
||||
}
|
||||
// Commit the transaction if all queries succeed
|
||||
@ -254,7 +254,7 @@ class StockController extends BaseController
|
||||
|
||||
// Set flashdata for success message
|
||||
return redirect()->to("/coatingMachineDetails?month=$month")
|
||||
->with('success', $message1 . " " . $message2 ." " . $message3);
|
||||
->with('success', $message1 . " " . $message2 . " " . $message3);
|
||||
|
||||
} else {
|
||||
throw new \Exception('Failed to update Coating machine details.');
|
||||
@ -470,30 +470,27 @@ class StockController extends BaseController
|
||||
$data['groupedBagStockDetails'] = array_values($groupedByDate);
|
||||
|
||||
|
||||
/**
|
||||
* need to change the below condition to allow active bag materials for new entries
|
||||
* not for older entries
|
||||
**/
|
||||
|
||||
if(!empty($data['groupedBagStockDetails'])){
|
||||
|
||||
if (!empty($data['groupedBagStockDetails'])) {
|
||||
|
||||
$result = $this->bagStockDetails_model
|
||||
->select('materialCode') // Specify the column you want to select
|
||||
->distinct() // Use distinct without arguments
|
||||
->orderBy('materialCode', 'asc')
|
||||
->findAll();
|
||||
$distinctMaterialCodes=[];
|
||||
foreach($result as $index => $eachResult){
|
||||
$distinctMaterialCodes[] = $result[$index]['materialCode'];
|
||||
}
|
||||
->select('materialCode') // Specify the column you want to select
|
||||
->distinct() // Use distinct
|
||||
->orderBy('materialCode', 'asc')
|
||||
->findAll();
|
||||
$distinctMaterialCodes = [];
|
||||
foreach ($result as $index => $eachResult) {
|
||||
$distinctMaterialCodes[] = $result[$index]['materialCode'];
|
||||
}
|
||||
$bagMaterials = $this->rawmaterialdetails_model->getSelectedBagMaterialCode($distinctMaterialCodes);
|
||||
|
||||
}else{
|
||||
|
||||
} else {
|
||||
$bagMaterials = $this->rawmaterialdetails_model->getAllBagMaterialCode();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
foreach ($bagMaterials as $key => $bagMaterial) {
|
||||
@ -755,7 +752,25 @@ class StockController extends BaseController
|
||||
|
||||
|
||||
|
||||
$resinMaterials = $this->rawmaterialdetails_model->getAllResinMaterialCode();
|
||||
if (!empty($data['groupedBagStockDetails'])) {
|
||||
|
||||
$result = $this->resinStockDetails_model
|
||||
->select('materialCode') // Specify the column you want to select
|
||||
->distinct() // Use distinct
|
||||
->orderBy('materialCode', 'asc')
|
||||
->findAll();
|
||||
$distinctMaterialCodes = [];
|
||||
foreach ($result as $index => $eachResult) {
|
||||
$distinctMaterialCodes[] = $result[$index]['materialCode'];
|
||||
}
|
||||
$resinMaterials = $this->rawmaterialdetails_model->getSelectedResinMaterialCode($distinctMaterialCodes);
|
||||
|
||||
} else {
|
||||
$resinMaterials = $this->rawmaterialdetails_model->getAllResinMaterialCode();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
foreach ($resinMaterials as $key => $resinMaterial) {
|
||||
$materialCode = $resinMaterial['MaterialCode'];
|
||||
@ -1270,19 +1285,19 @@ class StockController extends BaseController
|
||||
if (!empty($inserts)) {
|
||||
$this->drierMachineDetails_model->insertBatch($inserts);
|
||||
|
||||
$message1 ="Warning..!! Kindly Update the next subsequent month Gas Stock If older month Gas Stock Updated..!!";
|
||||
$message1 = "Warning..!! Kindly Update the next subsequent month Gas Stock If older month Gas Stock Updated..!!";
|
||||
}
|
||||
|
||||
if (!empty($updates)) {
|
||||
$this->drierMachineDetails_model->updateBatch($updates, 'id');
|
||||
|
||||
$message1 ="Warning..!! Kindly Update the next subsequent month Gas Stock If older month Gas Stock Updated..!!";
|
||||
$message1 = "Warning..!! Kindly Update the next subsequent month Gas Stock If older month Gas Stock Updated..!!";
|
||||
}
|
||||
|
||||
if ($this->db->transStatus() === false) {
|
||||
throw new \Exception('Transaction failed due to database error.');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$this->db->transCommit();
|
||||
@ -1481,7 +1496,7 @@ class StockController extends BaseController
|
||||
$data['powerConsumptionDetails'] = $this->getElectricConsumptionPivot($data['machineDetails'], $data['startDate'], $data['endDate']);
|
||||
if (!count($data['powerConsumptionDetails'])) {
|
||||
//insert empty data
|
||||
$tempInsert = [];
|
||||
$tempInsert = [];
|
||||
foreach ($monthData as $key => $value) {
|
||||
array_push($tempInsert, ['date' => $value['database'], 'machine_id' => $data['machineDetails'][0]['id']]);
|
||||
}
|
||||
|
||||
@ -195,6 +195,20 @@ class Rawmaterialdetails_model extends Model
|
||||
|
||||
}
|
||||
|
||||
function getSelectedResinMaterialCode($distinctMaterialCodes)
|
||||
{
|
||||
$builder = $this->db->table('t_materialmaster')
|
||||
->select('MaterialCode, MaterialName')
|
||||
->whereIn('MaterialCode', $distinctMaterialCodes) // Matches MaterialCode with the array
|
||||
->orderBy('MaterialCode', 'asc');
|
||||
|
||||
$query = $builder->get();
|
||||
$materialResults = $query->getResultArray();
|
||||
|
||||
return $materialResults;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getMaterialstock($MaterialCode, $currentdate)
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@
|
||||
</div>
|
||||
<div class="col-md-12 text-right">
|
||||
<input type="hidden" name="txtRowCount" id="txtRowCount" />
|
||||
<input type="reset" id="reset" class="btn btn-reset" style="background-color: red;color: white; margin-right: 15px;width: 80px;" value="Reset" />
|
||||
<a class="btn btn-secondary" href="<?php echo base_url() ?>configlisting" class="btn btn-secondary">Cancel</a>
|
||||
<input type="submit" onclick="return Validate();" value="Submit" class="btn btn-success">
|
||||
</div>
|
||||
</form>
|
||||
@ -168,13 +168,16 @@
|
||||
<div class="modal-content">
|
||||
<!-- Modal Header -->
|
||||
<div class="modal-header">
|
||||
|
||||
<h4 class="modal-title" id="myModalLabel">
|
||||
<center> Edit Configuration</center>
|
||||
</h4>
|
||||
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
<span class="sr-only">Close</span>
|
||||
</button>
|
||||
<h4 class="modal-title" id="myModalLabel">
|
||||
<center> Edit Configuration</center>
|
||||
</h4>
|
||||
|
||||
</div>
|
||||
<!-- Modal Body -->
|
||||
<div class="modal-body">
|
||||
@ -195,7 +198,7 @@
|
||||
<!-- Modal Footer -->
|
||||
<div class="modal-footer">
|
||||
<a class="btn btn-success" style="background-color: grey;border: none;margin-right:10px" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
|
||||
<a class="btn btn-success font tempClickEdit" ID="tempClickEdit" style="margin-top: -24px;"><i class="fa fa-plus"></i> <span class="bold">Edit</span></a>
|
||||
<a class="btn btn-success tempClickEdit" style="background-color: light-blue;border: none;margin-right:10px"#addconfigID="tempClickEdit" ><span class="bold">Edit</span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -257,8 +260,9 @@
|
||||
<td>${ConfigValue}</td>
|
||||
<td>
|
||||
<a class="editConfig" data-target='#Edit' data-id="${temp}" data-index="${index}" data-userid="${temp}" data-toggle="modal" href="#Edit">
|
||||
<i class="ri-pencil-fill"></i>
|
||||
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
|
||||
</a>
|
||||
</td>
|
||||
</tr>`;
|
||||
@ -310,7 +314,7 @@
|
||||
|
||||
|
||||
|
||||
$("#AddConfiguration").modal('hide');
|
||||
$("#Edit").modal('hide');
|
||||
|
||||
} else {
|
||||
alert('Please enter all the values');
|
||||
@ -420,36 +424,17 @@
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$('#ConfigValue').change(function(){
|
||||
$('#loader').show();
|
||||
$.ajax({
|
||||
data: {ConfigValue: $('#ConfigValue').val()},
|
||||
type: 'POST',
|
||||
url: "<?php echo base_url(); ?>configurationctrl/configValueCheck",
|
||||
$('#ConfigValue , #EditConfigValue').change(function(){
|
||||
let configValue = $(this).val();
|
||||
let configTable = $('#configtable').tableToJSON();
|
||||
let configValueExisting = configTable.map(element => element['Configuration Value']);
|
||||
let result = configValueExisting.includes(configValue);
|
||||
|
||||
success: function (data) {
|
||||
if(data && data.length > 0){
|
||||
|
||||
if(data[0].isActive == 1){
|
||||
alert("This Configuration Value is already present. kindly change it..!!");
|
||||
$('#ConfigValue').val('');
|
||||
return;
|
||||
}else{
|
||||
alert("This Configuration Value is already present in deleted section. kindly reactivate it If needed..!!");
|
||||
$('#ConfigValue').val('');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
error:function(error){
|
||||
console.log("error occured..!!" ,error);
|
||||
},
|
||||
complete:function(){
|
||||
$('#loader').hide();
|
||||
console.log('ajax call completed..!!');
|
||||
}
|
||||
});
|
||||
if(result){
|
||||
alert('configuration value is already present..!!');
|
||||
$(this).val('');
|
||||
return false;
|
||||
}
|
||||
|
||||
})
|
||||
</script>
|
||||
@ -125,7 +125,7 @@ if (!empty($master)) {
|
||||
<thead>
|
||||
<tr>
|
||||
<th>S.NO</th>
|
||||
<th>Config Value</th>
|
||||
<th>Configuration Value</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -165,15 +165,16 @@ if (!empty($master)) {
|
||||
<a data-target='#Edit' data-id="<?php echo $index; ?>"
|
||||
data-userid="<?php echo $index; ?>" data-toggle="modal"
|
||||
href="#Edit"><i class="fas fa-edit" data-toggle="tooltip"
|
||||
title="Click here to Edit Config Value"></i>
|
||||
title="Click here to Edit Config Value"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a onclick="confirmDeleteConfig(event)" href="<?php echo base_url() . 'configurationctrl/deleteConfigValue
|
||||
?ConfigValue=' . $con->ConfigValue . '
|
||||
&ConfigID=' . $con->Config_ID; ?>">
|
||||
<i class="fas fa-trash" data-toggle="tooltip"
|
||||
title="Click here to Delete the Config Value"></i>
|
||||
title="Click here to Delete the Config Value"></i>
|
||||
</a>
|
||||
|
||||
|
||||
@ -247,7 +248,7 @@ if (!empty($master)) {
|
||||
<div class="modal-content">
|
||||
<!-- Modal Header -->
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myModalLabel">Edit Config</h4>
|
||||
<h4 class="modal-title" id="myModalLabel">Edit Configuration</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
|
||||
@ -285,7 +286,7 @@ if (!empty($master)) {
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
<div class="col-md-3 col-md-offset-2">
|
||||
Config Value :
|
||||
Configuration Value :
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<?php
|
||||
@ -303,7 +304,7 @@ if (!empty($master)) {
|
||||
<a class="btn btn-success" style="background-color: grey;border: none;margin-right:10px"
|
||||
data-dismiss="modal">Cancel</a>
|
||||
<a class="btn btn-success font tempClickUpdate" id="tempClickUpdate"><i
|
||||
class="fa fa-pencil"></i> Update</a>
|
||||
class="fas fa-edit"></i> Update</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -325,7 +326,7 @@ if (!empty($master)) {
|
||||
|
||||
|
||||
<td>
|
||||
<a data-target='#Edit' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#Edit"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the <%=ConfigValue%> Budget details"></i> </a>
|
||||
<a data-target='#Edit' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#Edit"><i class="fas fa-edit" data-toggle="tooltip" title="Click here to view/Edit the <%=ConfigValue%> Budget details"></i> </a>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
@ -367,9 +368,10 @@ if (!empty($master)) {
|
||||
<td>${ConfigValue}</td>
|
||||
<td>
|
||||
<a class="editConfig" data-target='#Edit' data-id="${temp}" data-index="${index}" data-userid="${temp}" data-toggle="modal" href="#Edit">
|
||||
<i class="ri-pencil-fill"></i>
|
||||
|
||||
</a>
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>`;
|
||||
$('#tempAppend').append(html);
|
||||
@ -527,45 +529,49 @@ if (!empty($master)) {
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$('#AddConfigValue').change(function () {
|
||||
$('#loader').show();
|
||||
$.ajax({
|
||||
data: {
|
||||
configId: $('#ConfigId').val(),
|
||||
ConfigValue: $('#AddConfigValue').val()
|
||||
},
|
||||
type: 'POST',
|
||||
url: "<?php echo base_url(); ?>configurationctrl/configValueCheck",
|
||||
|
||||
$('#AddConfigValue, #configValue').change(function () {
|
||||
|
||||
success: function (data) {
|
||||
if (data && data.length > 0) {
|
||||
let configValue = $(this).val();
|
||||
let configTable = customTableToJson();
|
||||
let configValueExisting = configTable.filter(element => element['Configuration Value'] == configValue);
|
||||
|
||||
if (data[0].isActive == 1) {
|
||||
alert("This Configuration Value is already present. kindly change it..!!");
|
||||
$('#AddConfigValue').val('');
|
||||
return;
|
||||
} else {
|
||||
alert("This Configuration Value is already present in deleted section. kindly reactivate it If needed..!!");
|
||||
$('#AddConfigValue').val('');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$('.tempClickAdd').click();
|
||||
}
|
||||
if(configValueExisting && configValueExisting.length > 0){
|
||||
alert('configuration value is already present , Kindly check in Table and archive too..!!');
|
||||
$(this).val('');
|
||||
return false;
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
},
|
||||
error: function (error) {
|
||||
console.log("error occured..!!", error);
|
||||
},
|
||||
complete: function () {
|
||||
$('#loader').hide();
|
||||
console.log('ajax call completed..!!');
|
||||
<script>
|
||||
function customTableToJson() {
|
||||
let rows = [];
|
||||
let headers = [];
|
||||
|
||||
// Get table headers
|
||||
$(`#configtable thead tr th`).each(function () {
|
||||
headers.push($(this).text().trim());
|
||||
});
|
||||
|
||||
// Get table rows including hidden ones
|
||||
$(`#configtable tbody tr`).each(function () {
|
||||
let row = {};
|
||||
$(this).find('td').each(function (index) {
|
||||
// Use the headers as keys for JSON
|
||||
let header = headers[index];
|
||||
row[header] = $(this).text().trim();
|
||||
});
|
||||
if (Object.keys(row).length > 0) {
|
||||
rows.push(row);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
return rows;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
@ -605,4 +611,4 @@ if (!empty($master)) {
|
||||
if (result) { return; } else { event.preventDefault(); }
|
||||
}
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@ -223,19 +223,20 @@
|
||||
<thead class="celda_encabezado_general" style="padding: 10px;">
|
||||
|
||||
<tr>
|
||||
<th class="celda_encabezado_general" rowspan="2" colspan="2">RIPL </th>
|
||||
<th class="celda_encabezado_general" colspan="12">SEP- GAS CONSUMPTION-422 & 425 kg </th>
|
||||
|
||||
<th class="celda_encabezado_general" colspan="14">SEP- GAS CONSUMPTION-422 & 425 kg </th>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<th class="celda_encabezado_general" colspan="5">Gas Stock </th>
|
||||
<th class="celda_encabezado_general" rowspan="1" colspan="1">RIPL </th>
|
||||
<th class="celda_encabezado_general" colspan="6">Gas Stock </th>
|
||||
<th class="celda_encabezado_general">10 Ton</th>
|
||||
<th class="celda_encabezado_general">Sand Dried</th>
|
||||
<th class="celda_encabezado_general">Coating Machine</th>
|
||||
<th class="celda_encabezado_general">Sand Coated</th>
|
||||
<th class="celda_encabezado_general">Trp Machine </th>
|
||||
<th class="celda_encabezado_general">Trp Machine </th>
|
||||
<th class="celda_encabezado_general">Sand TRP</th>
|
||||
<th class="celda_encabezado_general">Rotary Drier </th>
|
||||
</tr>
|
||||
|
||||
@ -364,7 +364,19 @@ foreach ($period as $day) {
|
||||
|
||||
<tbody >
|
||||
<?php foreach ($powerConsumptionDetails as $key => $row): ?>
|
||||
<tr id="<?php echo $key + 1; ?>">
|
||||
|
||||
|
||||
<?php
|
||||
$styleValue='';
|
||||
$currentDate = date('Y-m-d');
|
||||
$dateInMonthYMDFormat=date("Y-m-d", strtotime($powerConsumptionDetails[$key]['date']));
|
||||
if ($dateInMonthYMDFormat === $currentDate) { $styleValue="background: #cef0ad;"; }
|
||||
|
||||
?>
|
||||
|
||||
<tr id="<?php echo $key + 1; ?>"
|
||||
style="<?=$styleValue?>"
|
||||
>
|
||||
<?php foreach ($columns as $index => $column): ?>
|
||||
|
||||
<?php if($index == 0) : ?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user