stock changes 07-04-2025

This commit is contained in:
vadivelJ96 2025-04-07 18:46:15 +05:30
parent ba328c5fe7
commit 8c6f13975f
7 changed files with 91 additions and 76 deletions

View File

@ -107,6 +107,7 @@ class Configurationctrl extends BaseController
$data['master'] = $this->configmodel->GetConfigCenterMaster($ConfigID);
$data['child'] = $this->configmodel->GetConfigCenterDetails($ConfigID,$isActiveFilter);
$data['ConfigID'] = $ConfigID;
$this->global['pageTitle'] = 'Edit Config';
@ -252,8 +253,10 @@ class Configurationctrl extends BaseController
$configId = $data['ConfigID'];
$configValue = $data['ConfigValue'];
$key = $data['key']??'';
$userId = $data['userId'];
$result = $this->configmodel->saveConfigValue($key,$configId, $configValue);
$result = $this->configmodel->saveConfigValue($key,$configId, $configValue,$userId);
if($result){
return $this->response->setJSON(['status'=>true]);

View File

@ -289,7 +289,7 @@ class Rawmaterialdetails extends BaseController
$data['assetcode'] = $this->rawmaterialdetails_model->getAssetcode();
$data['avg_price'] = $this->rawmaterialdetails_model->getMaterialAvg($RawMaterialID);
$data['materialRateHistory'] = $this->rawmaterialdetails_model->getMaterialRateHistory($RawMaterialID);
$data['materialListPage'] = $_GET['page'];
$data['materialListPage'] = $_GET['page']??1;
//print_r($data['avg_price']);die();
$this->global['pageTitle'] = 'Edit Material Master';
@ -318,7 +318,7 @@ class Rawmaterialdetails extends BaseController
$stock = $this->request->getPost('openstock');
$reorder = $this->request->getPost('reorder');
$stockdate = $this->request->getPost('Date');
$materialListPage = $this->request->getPost('materialListPage');
$materialListPage = $this->request->getPost('materialListPage') ?? 1;
$stockdate = (empty($stockdate)) ? NULL : get_date_time_dynamical_format('d-m-Y','Y-m-d',"$stockdate");
$chked = $this->request->getPost('isactive');

View File

@ -96,10 +96,24 @@ class Config_model extends Model
{
//echo $ConfigID ;die();
$builder = $this->db->table('t_configmaster COM')
->select('*')
->join('t_configdetails con', 'con.Config_ID = COM.Config_ID', 'left')
->where('COM.Config_ID', $ConfigID)
->where('con.isActive', $isActiveFilter);
->select('COM.*,
con.*,
creator_emp.FirstName AS created_by,
updater_emp.FirstName AS updated_by
')
->join('t_configdetails con', 'con.Config_ID = COM.Config_ID', 'left')
// Join for Created By
->join('tbl_users creator', 'creator.userId = con.created_by', 'left')
->join('t_employee_details creator_emp', 'creator_emp.EmpID = creator.EmpID', 'left')
// Join for Updated By
->join('tbl_users updater', 'updater.userId = con.updated_by', 'left')
->join('t_employee_details updater_emp', 'updater_emp.EmpID = updater.EmpID', 'left')
->where('COM.Config_ID', $ConfigID)
->where('con.isActive', $isActiveFilter);
$query = $builder->get();
return $query->getResult();
@ -288,7 +302,7 @@ return $result;
}
public function saveConfigValue($key,$configId, $configValue){
public function saveConfigValue($key,$configId, $configValue,$userId){
@ -297,7 +311,8 @@ return $result;
->where('Config_ID', $configId)
->where('key',$key)
->update([
'ConfigValue'=> $configValue
'ConfigValue'=> $configValue,
'updated_by' => $userId
]);
$res = $this->db->affectedRows();
return $res;
@ -308,6 +323,7 @@ return $result;
[
'ConfigValue'=>$configValue,
'Config_ID'=>$configId,
'created_by'=> $userId,
'isActive'=> 1]);
$res = $this->db->affectedRows();
return $res;

View File

@ -256,16 +256,19 @@ $currentday = date('d');
<div class="col-9 text-right d-flex" style="justify-content: end;" id="savebutton">
<input type="text" id="searchInput" placeholder="Search..." style="padding: 8px;margin-bottom: 10px;width: 250px;border: 1px solid #ccc;border-radius: 5px;margin-right:15px;">
<input type="text" id="searchInput" placeholder="Search..."
style="padding: 8px;margin-bottom: 10px;width: 250px;border: 1px solid #ccc;
cursor:pointer;
border-radius: 5px;margin-right:15px;">
<i id="exportButton" class="fas fa-download download-icon" style="margin-right: 15px;margin-top: 8px;font-size:25px;" title="Export Excel"></i>
<i id="exportButton" class="fas fa-download download-icon" style="margin-right: 15px;margin-top: 8px;font-size:25px; cursor:pointer;" title="Export Excel"></i>
<i class="fe-maximize noti-icon" onclick="toggleDivFullscreen()" style="margin-right: 15px;margin-top: 5px;font-size: 28px;" title="Full screen view"></i>
<i class="fe-maximize noti-icon" onclick="toggleDivFullscreen()" style="margin-right: 15px;margin-top: 5px;font-size: 28px; cursor:pointer;" title="Full screen view"></i>
<i class="fas fa-save" id="c" style="margin-right: 15px;margin-top: 5px;font-size:28px;" title="Save"></i>
<i class="fas fa-save" id="c" style="margin-right: 15px;margin-top: 5px;font-size:28px; cursor:pointer;" title="Save"></i>
</div>
@ -633,7 +636,6 @@ $currentday = date('d');
});
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
@ -670,25 +672,12 @@ $(document).ready(function () {
function exportTableToExcel(tableId, filename = 'attendance.xlsx') {
var table = document.getElementById(tableId);
var rows = table.rows;
var data = [];
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
var cols = row.querySelectorAll('td, th');
var rowData = [];
for (var j = 0; j < cols.length; j++) {
rowData.push(cols[j].innerText);
}
data.push(rowData);
}
var wb = XLSX.utils.book_new();
var ws = XLSX.utils.aoa_to_sheet(data);
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
XLSX.writeFile(wb, filename);
let ws = XLSX.utils.table_to_sheet(table); // Convert modified table to sheet
let wb = XLSX.utils.book_new(); // Create a new workbook
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
}
// Add click event listener to the export button

View File

@ -146,9 +146,9 @@
</thead>
<tbody>
<?php
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
?>
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
?>
<tr
class="<?php if ($record->isActive == 0) {
echo "deactivatedRow";

View File

@ -24,6 +24,8 @@ if (!empty($master)) {
}
</style>
<div class="content-page">
<div class="content">
<!-- Start Content-->
@ -119,6 +121,8 @@ if (!empty($master)) {
<div>
</div>
<div class="form-row" style="margin-top:10px">
<div class="col-md-12">
@ -129,6 +133,8 @@ if (!empty($master)) {
<tr>
<th>S.NO</th>
<th>Configuration Value</th>
<th>Created By</th>
<th>Updated By</th>
<th>Action</th>
</tr>
</thead>
@ -148,21 +154,31 @@ if (!empty($master)) {
<tr>
<td>
<?php echo $index; ?></td>
<?php if($con->Config_ID === 'C023'){ ?>
<td>
<a
class="config-category"
data-value="<?php echo $con->ConfigValue;?>"
data-key="<?php echo $con->Key; ?>"
style="cursor: pointer;">
<?php echo $index; ?>
</td>
<?php if($con->Config_ID === 'C023'){ ?>
<td>
<a
class="config-category"
data-value="<?php echo $con->ConfigValue;?>"
data-key="<?php echo $con->Key; ?>"
style="cursor: pointer;">
<?php echo $con->ConfigValue ?>
</a>
</td>
<?php }else{ ?>
<td><?php echo $con->ConfigValue; ?></td>
<?php } ?>
<td>
<?php echo $con->created_by ?>
</td>
<td>
<?php echo $con->updated_by ?>
</td>
<?php echo $con->ConfigValue ?>
</a>
</td>
<?php }else{ ?>
<td><?php echo $con->ConfigValue; ?></td>
<?php } ?>
<td>
<?php if ($con->isActive == 0) { ?>
@ -453,7 +469,9 @@ if (!empty($master)) {
url: "<?php echo base_url('configurationctrl/saveConfigValue'); ?>",
data: {
ConfigID: $('#ConfigId').val(),
ConfigValue: $("#AddConfigValue").val()
ConfigValue: $("#AddConfigValue").val(),
userId : "<?= $_SESSION['userId']?>",
},
method: 'POST',
success: function(response) {
@ -513,7 +531,8 @@ if (!empty($master)) {
data: {
key : $('#key').val(),
ConfigID: $('#Config_ID').val(),
ConfigValue: $("#configValue").val()
ConfigValue: $("#configValue").val(),
userId : "<?= $_SESSION['userId']?>"
},
method: 'POST',
success: function(response) {
@ -594,7 +613,7 @@ if (!empty($master)) {
<td style="text-align:left; overflow: hidden;text-overflow: ellipsis; word-wrap: break-word !important;
white-space: normal !important; width: 100px !important; ">${item.MaterialName}</td>
<td style="text-align:left; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">${item.MaterialType}</td>
<td style="text-align:left; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">${item.IsActive?"Active":"InActive"}</td>
<td style="text-align:left; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">${item.IsActive == 1 ?"Active":"InActive"}</td>
</tr>
`;

View File

@ -198,15 +198,17 @@
</div>
<div class="col-9 text-right d-flex" style="justify-content: end;" id="savebutton">
<input type="text" id="searchInput" placeholder="Search..." style="padding: 8px;margin-bottom: 10px;width: 250px;border: 1px solid #ccc;border-radius: 5px;margin-right:15px;">
<input type="text" id="searchInput" placeholder="Search..." style="padding: 8px;margin-bottom: 10px;width: 250px;
cursor:pointer;
border: 1px solid #ccc;border-radius: 5px;margin-right:15px;">
<!-- <input type="button" id="submit" value="Save" class="btn btn-success" onclick="getAllData();" style="margin-top:0px;"> -->
<i id="exportButton" class="fas fa-download download-icon" style="margin-right: 15px;margin-top: 8px;font-size:25px;" title="Export Excel"></i>
<i id="exportButton" class="fas fa-download download-icon" style="margin-right: 15px;margin-top: 8px;font-size:25px;cursor:pointer;" title="Export Excel"></i>
<i class="fe-maximize noti-icon" onclick="toggleDivFullscreen()" style="margin-right: 15px;margin-top: 5px;font-size: 28px;" title="Full screen view"></i>
<i class="fe-maximize noti-icon" onclick="toggleDivFullscreen()" style="margin-right: 15px;margin-top: 5px;font-size: 28px;cursor:pointer;" title="Full screen view"></i>
<i class="fas fa-save" onclick="getAllData();" style="margin-right: 15px;margin-top: 5px;font-size:28px;" title="Save"></i>
<i class="fas fa-save" onclick="getAllData();" style="margin-right: 15px;margin-top: 5px;font-size:28px;cursor:pointer;" title="Save"></i>
</div>
</div>
@ -770,7 +772,7 @@
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
<script type="text/javascript">
@ -808,25 +810,11 @@ $(document).ready(function () {
function exportTableToExcel(tableId, filename = 'monthlypay.xlsx') {
var table = document.getElementById(tableId);
var rows = table.rows;
var data = [];
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
var cols = row.querySelectorAll('td, th');
var rowData = [];
for (var j = 0; j < cols.length; j++) {
rowData.push(cols[j].innerText);
}
data.push(rowData);
}
var wb = XLSX.utils.book_new();
var ws = XLSX.utils.aoa_to_sheet(data);
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
XLSX.writeFile(wb, filename);
let ws = XLSX.utils.table_to_sheet(table); // Convert modified table to sheet
let wb = XLSX.utils.book_new(); // Create a new workbook
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
}
// Add click event listener to the export button