FIX_Retested : ps

This commit is contained in:
VE10-Sanjeev 2024-08-08 10:15:23 +00:00
parent 0823506fc3
commit 1b49edf414
4 changed files with 14 additions and 6 deletions

View File

@ -65,7 +65,7 @@ $routes->get('rawmaterialdetailsautocomplete' , 'Rawmaterialdetails::autocomplet
// Cost Center Routes
$routes->get('costListing', 'CostCenter::index');
$routes->get('fetchCostCenterDetails', 'CostCenter::fetchCostCenterDetails');// for Ajax both add and edit....
$routes->post('fetchCostCenterDetails', 'CostCenter::fetchCostCenterDetails');// for Ajax both add and edit....
$routes->get('deleteCostCenter', 'CostCenter::deleteCostCenter');
$routes->get('exportcost', 'CostCenter::exportcost');

View File

@ -56,6 +56,7 @@ class CostCenter extends BaseController
*/
public function fetchCostCenterDetails() {
$id = $this->request->getPost('id');
log_message('error', 'id: ' . $id);
$CostCenterName = $this->request->getPost('CostCenterName');
$CostCenterName = ($CostCenterName !== null && is_string($CostCenterName)) ? strtoupper(trim($CostCenterName)) : null;
$userId = $this->session->get('userId');
@ -64,11 +65,15 @@ class CostCenter extends BaseController
$data = ['status' => false, 'message' => 'An error occurred while creating cost details'];
if ($id == 0) {
if ((int)$id == 0) {
$lastccid = $this->costcenter_model->lastCCID();
$lastccid = (int)$lastccid++;
log_message('error', 'LAST CodeCenterID : ' . $lastccid);
$newccid = (int)$lastccid++;
log_message('error', 'CodeCenterID with Incremented : ' . $newccid);
$newccc = generateCostCenterCode($lastccid);
log_message('debug', 'newccc returned: ' . $newccc);
log_message('error', 'newly Generated ccc : ' . $newccc);
$Cost = ['CostCenterCode' => $newccc,
'CostCenterName' => $CostCenterName,

View File

@ -36,6 +36,7 @@ class Costcenter_model extends Model
$builder = $this->db->table('t_costcenter_master');
$builder->insert($Cost);
$aff_row = $this->db->affectedRows();
log_message('error', 'saveCostCenter Query: ' . $this->db->getLastQuery()->getQuery());
$this->db->transComplete();
return $aff_row;
}

View File

@ -20,6 +20,7 @@
<table id="datatable" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
<th style="display:none;"></th>
<th>Create Date</th>
<th>Create Time</th>
<th>Cost Center Code</th>
@ -39,7 +40,8 @@
$date = $createdat->format('d-m-Y');
$time = $createdat->format('h:i A');
?>
<tr></td>
<tr>
<td style="display:none;"><?php echo $record->CreatedDate ?></td>
<td align="right"><?php echo $date; ?></td>
<td align="right"><?php echo $time; ?></td>
<td><?php echo $record->code ?></td>
@ -122,7 +124,7 @@
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
<script type="text/javascript">
$(function() {
$.fn.dataTable.moment('DD-MM-YYYY');
$.fn.dataTable.moment('DD-MM-YYYY HH:mm A');
$('#datatable').DataTable({
"paging": true,
"lengthChange": true,