diff --git a/app/Controllers/Expense.php b/app/Controllers/Expense.php
index ce24b8f8..4483e649 100755
--- a/app/Controllers/Expense.php
+++ b/app/Controllers/Expense.php
@@ -18,6 +18,7 @@ class Expense extends BaseController
$this->expense_model = new Expense_model();
$this->supplier_model = new Supplier_model();
$this->session = session();
+ $this->session = session();
helper('form');
$this->isLoggedIn();
}
@@ -86,8 +87,9 @@ class Expense extends BaseController
// Generate the next serial number
$newSerialNumber = $this->generateSerialNumber($financialYear, $lastSerial);
-
+ $sesn_uid = $this->session->get('userId');
$data = [
+ 'created_by' => $sesn_uid,
'transporter_file' => $fileName,
'supplier_id' => $this->request->getPost('supplierid'),
'remarks' => $this->request->getPost('remarks'),
@@ -141,9 +143,9 @@ class Expense extends BaseController
$fileName = $this->request->getPost('existing_file'); // Use existing file if no new file is uploaded
}
-
-
+ $sesn_uid = $this->session->get('userId');
$data = [
+ 'updated_by' =>$sesn_uid,
'supplier_id' => $this->request->getPost('supplierid'),
'remarks' => $this->request->getPost('remarks'),
'item_description' => $this->request->getPost('item_description'),
diff --git a/app/Controllers/Inwardgateregister.php b/app/Controllers/Inwardgateregister.php
index 46b9cbc8..1b58896b 100755
--- a/app/Controllers/Inwardgateregister.php
+++ b/app/Controllers/Inwardgateregister.php
@@ -156,7 +156,7 @@ class Inwardgateregister extends BaseController
});
$data['emp_data'] = [];
// $data['emp_data'] = $this->inwardgateregister_model->getAdditionalIGRFile();
- // print_r($data['PO_NO']);die;
+ // dd($data['PO_NO']);die;
$this->loadViews("inwardgateregister", $this->global, $data, NULL);
}
diff --git a/app/Controllers/Rawmaterialdetails.php b/app/Controllers/Rawmaterialdetails.php
index d9d328c6..7effb98c 100755
--- a/app/Controllers/Rawmaterialdetails.php
+++ b/app/Controllers/Rawmaterialdetails.php
@@ -410,18 +410,24 @@ class Rawmaterialdetails extends BaseController
$query = $this->rawmaterialdetails_model->insertvalueintoconfig($config);
}
+ // on 28/jan/2025. both add and edit. category condition added.
function checkmaterial()
{
$data = $this->request->getPost();
$materialCode = $data['materialCode'] ?? '';
$materialName = str_replace(' ', '', $data['materialName']);
+ $materialCategory = $data['materialCategory'] ?? '';
- $this->rawmaterialdetails_model = new rawmaterialdetails_model();;
- $query = $this->rawmaterialdetails_model->checkMaterialExists($materialCode , $materialName);
-
+ $query = $this->rawmaterialdetails_model->checkMaterialExists($materialCode , $materialName , $materialCategory);
return $this->response->setJSON($query);
+
+ // if (!empty($query)) {
+ // foreach ((array)$query as $q) {
+ // $text .= $q['MaterialName'] . " " . ($q['IsActive'] == 1 ? '' : ' ( Inactive ) ') . "
";
+ // }
+ // }
}
diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php
index 553668ba..79451166 100644
--- a/app/Controllers/StockController.php
+++ b/app/Controllers/StockController.php
@@ -1698,7 +1698,7 @@ class StockController extends BaseController
while ($start <= $end) {
$timeValue = date('H:i', $start); // 24-hour format for value
- $timeLabel = date('h:i A', $start); // 12-hour format with AM/PM for display
+ $timeLabel = date('h:i a', $start); // 12-hour format with AM/PM for display
$times[$timeValue] = $timeLabel; // Store time in associative array
$start = strtotime('+15 minutes', $start); // Increment by 15 minutes
}
@@ -1737,138 +1737,118 @@ class StockController extends BaseController
public function addOrEditdrierMachineDetails()
{
- $drierData = [];
- $drierData = json_decode($this->request->getPost('drierData'), true);
-
-
+ $drierData = json_decode($this->request->getPost('drierData'), true) ?? [];
+
+ // If drierData is empty, check for additionalEntry
if (empty($drierData)) {
-
$additionalEntry = $this->request->getPost();
-
- if (!empty($additionalEntry)) {
- $drierData[] = [
- 'Date' => $this->convertToDateWithFlexibleFormats($additionalEntry['Date'], ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "Y-m-d"),
- 'Drier On Time' => $additionalEntry['Drier_On_Time'],
- 'Drier Off Time' => $additionalEntry['Drier_Off_Time'],
- 'Running Hrs' => $additionalEntry['Running_Hrs'],
- 'Supplier Name' => $additionalEntry['Supplier_Name'],
- 'i/p Sand Moisture(%)' => $additionalEntry['i/p_Sand_Moisture(%)'],
- 'Tot Gas Consumption' => $additionalEntry['Tot_Gas_Consumption'],
- 'Gas Per Ton' => $additionalEntry['Gas_Per_Ton'],
- 'i/p Sand Qty' => $additionalEntry['i/p_Sand_Qty'],
- 'Moisture Loss Qty' => $additionalEntry['Moisture_Loss_Qty'],
- 'Sand Dried Qty' => $additionalEntry['Sand_Dried_Qty'],
- 'Qty Per Hrs' => $additionalEntry['Qty_Per_Hrs'],
- 'Dust Qty' => $additionalEntry['Dust_Qty'],
- 'Customer Name' => $additionalEntry['Customer_Name']
- ];
- } else {
-
+ if (empty($additionalEntry)) {
echo "No data received.";
return;
}
+
+ $drierData[] = $this->mapDrierEntry($additionalEntry);
}
-
- $message1 = '';
-
+
$this->db->transBegin();
-
try {
+ $inserts = [];
+ $updates = [];
+
foreach ($drierData as $row) {
- $data = [
- 'date' => $this->convertToDateWithFlexibleFormats($row['Date'], ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "Y-m-d"),
- 'drier_on_time' => $row['Drier On Time'],
- 'drier_off_time' => $row['Drier Off Time'],
- 'drier_running_hours' => $row['Running Hrs'],
- 'supplier_name' => $row['Supplier Name'],
- 'input_sand_moisture' => $row['i/p Sand Moisture(%)'],
- 'total_gas_consumption' => $row['Tot Gas Consumption'],
- 'gas_per_ton' => $row['Gas Per Ton'],
- 'input_sand_qty' => $row['i/p Sand Qty'],
- 'moisture_loss_qty' => $row['Moisture Loss Qty'],
- 'sand_dried_qty' => $row['Sand Dried Qty'],
- 'qty_per_hours' => $row['Qty Per Hrs'],
- 'dust_qty' => $row['Dust Qty'],
- 'customer_name' => $row['Customer Name']
- ];
-
- // Check if a row with the same date already exists
$existingRow = $this->drierMachineDetails_model->where('id', $row['id'] ?? '')->first();
-
- $inserts = [];
- $updates = [];
-
+ $data = $this->mapDrierEntry($row, $existingRow);
+
if ($existingRow) {
- // If exists, update the row
-
- //before updating the row update gas stock
- $existingDrierGasConsumption = $existingRow['total_gas_consumption'];
- $updatedDrierGasConsumption = $row['Tot Gas Consumption'];
-
- if ($existingDrierGasConsumption != $updatedDrierGasConsumption) {
-
- $changeInConsumption = $updatedDrierGasConsumption - $existingDrierGasConsumption;
- $dateToBeUpdated = $existingRow['date'];
- $this->updateGasStockConsumption($dateToBeUpdated, $changeInConsumption);
- }
- $data['id'] = $existingRow['id'];
+ $this->handleGasStockUpdate($existingRow, $row);
$updates[] = $data;
} else {
- // If not, insert a new row
- //before inserting the row update gas stock
- $consumption = $row['Tot Gas Consumption'];
- $dateToBeInserted = $data['date'];
- $this->updateGasStockConsumption($dateToBeInserted, $consumption);
-
+ $this->updateGasStockConsumption($data['date'], $data['total_gas_consumption']);
$inserts[] = $data;
}
-
- if (!empty($inserts)) {
- $this->drierMachineDetails_model->insertBatch($inserts);
-
- $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..!!";
- }
-
- if ($this->db->transStatus() === false) {
- throw new \Exception('Transaction failed due to database error.');
- }
}
-
+
+ if (!empty($inserts)) {
+ $this->drierMachineDetails_model->insertBatch($inserts);
+ }
+
+ if (!empty($updates)) {
+ $this->drierMachineDetails_model->updateBatch($updates, 'id');
+ }
+
+ if ($this->db->transStatus() === false) {
+ throw new \Exception('Transaction failed due to database error.');
+ }
+
$this->db->transCommit();
-
- if (!empty($additionalEntry)) {
- // Data to be sent via POST
- $postData = [
- 'month' => $this->convertToDateWithFlexibleFormats($additionalEntry['Date'], ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "M-Y"),
-
- ];
-
- echo '
| Date value | -Drier On Time | -Drier Off Time | -Running Hrs | -Supplier Name is a dropdown feature | -i/p Sand Moisture(%) | -Tot Gas Consumption | -Gas Per Ton | -i/p Sand Qty | -Moisture Loss Qty | -Sand Dried Qty | -Qty Per Hrs | -Dust Qty | + style="padding:5px; border:#ffffff; background-color: #ffffff;">Date value +Drier On Time | +Drier Off Time | +Running Hrs | +Supplier Name | + +input Sand Qty | +inputp Sand Moisture(%) | +Sand Dried Qty | +Total Gas Consumption | +Gas Per Ton | +Qty Per Hrs | +Moisture Loss Qty | +Dust Qty | Total | -- | -- | +- | +- | =$summary['drier_running_hours']?> | - | -- | -=$summary['total_gas_consumption']?> | -- | +=$summary['input_sand_qty']?> | -=$summary['moisture_loss_qty']?> | -=$summary['sand_dried_qty']?> | - | +=$summary['sand_dried_qty']?> | +=$summary['total_gas_consumption']?> | ++ | + | =$summary['moisture_loss_qty']?> | =$summary['dust_qty']?> | @@ -581,10 +601,11 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); +Bill No | Bill Date | Cost | -CGST | -SGST | -IGST | +CGST | +SGST | +IGST | Total | Status | +Created By | Action | @@ -177,6 +178,7 @@+ | = $previousMonthPowerConsumptionStockDetails[$powerMachineIndex]['closing_units'] ?> + contenteditable="true"> + |
\ No newline at end of file
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/resinStockDetails.php b/app/Views/resinStockDetails.php
index 71e07a48..3f19bb07 100644
--- a/app/Views/resinStockDetails.php
+++ b/app/Views/resinStockDetails.php
@@ -298,7 +298,7 @@ foreach ($period as $day) {
@@ -907,4 +907,47 @@ foreach ($period as $day) {
}
})
}
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/trpSandUseStockDetails.php b/app/Views/trpSandUseStockDetails.php
index 7f60fcc4..2df367eb 100644
--- a/app/Views/trpSandUseStockDetails.php
+++ b/app/Views/trpSandUseStockDetails.php
@@ -270,6 +270,19 @@
+
@@ -642,3 +655,48 @@
+
+
+
+
+
+
+
+
+
+
+
+ |
|---|