diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php
index fb13d7d8..d5011c57 100644
--- a/app/Controllers/StockController.php
+++ b/app/Controllers/StockController.php
@@ -2113,18 +2113,12 @@ class StockController extends BaseController
public function addOrEditdrierMachineDetails()
{
- $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)) {
- echo "No data received.";
- return;
- }
-
- $drierData[] = $this->mapDrierEntry($additionalEntry);
- }
+ $data = $this->request->getPost();
+
+ $drierData[] = $this->mapDrierEntry($data);
+
$this->db->transBegin();
try {
@@ -2132,13 +2126,18 @@ class StockController extends BaseController
$updates = [];
foreach ($drierData as $row) {
- $existingRow = $this->drierMachineDetails_model->where('id', $row['id'] ?? '')->first();
- $data = $this->mapDrierEntry($row, $existingRow);
+ $existingRow = $row['id'];
+ $data = $row;
+
- if ($existingRow) {
+ if (($existingRow)) {
+ // dd("inside update");
+ $existingRow = $this->drierMachineDetails_model->where('id', $row['id'] ?? '')->first();
+
$this->handleGasStockUpdate($existingRow, $row);
$updates[] = $data;
} else {
+ // dd("inside insert");
$this->updateGasStockConsumption($data['date'], $data['total_gas_consumption']);
$inserts[] = $data;
}
@@ -2157,41 +2156,36 @@ class StockController extends BaseController
}
$this->db->transCommit();
-
- // Redirect if additional entry was provided
- if (!empty($additionalEntry)) {
- $this->redirectToDrierMachineDetails($additionalEntry['date']);
- return;
+
+ return redirect()->to("/drierMachineDetails")->with('success', "Data Saved Successfully");
+
+ } catch (\Exception $error) {
+ $this->db->transRollback();
+ return redirect()->back()->with('error', ' ' . $error->getMessage());
}
-
- echo "Data saved successfully. Warning..!! Kindly Update the next subsequent month Gas Stock If older month Gas Stock Updated..!!";
- } catch (\Exception $e) {
- $this->db->transRollback();
- echo "Failed to save/Update data: " . $e->getMessage();
- }
}
/**
* Maps input row to expected format.
*/
- private function mapDrierEntry(array $row, $existingRow = null): array
+ private function mapDrierEntry(array $data): array
{
return [
- 'id' => $existingRow['id'] ?? null,
- '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['drier_running_hours'],
- 'supplier_name' => $row['supplier_name'],
- 'input_sand_moisture' => $row['input_sand_moisture'],
- 'total_gas_consumption' => $row['total_gas_consumption'],
- 'gas_per_ton' => $row['gas_per_ton'],
- 'input_sand_qty' => $row['input_sand_qty'],
- 'moisture_loss_qty' => $row['moisture_loss_qty'],
- 'sand_dried_qty' => $row['sand_dried_qty'],
- 'qty_per_hours' => $row['qty_per_hours'],
- 'dust_qty' => $row['dust_qty'],
- 'customer_name' => $row['customer_name']
+ 'id' => $data['id'] ?? null,
+ 'date' => $this->convertToDateWithFlexibleFormats($data['date'], ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "Y-m-d"),
+ 'drier_on_time' => $data['drier_on_time'],
+ 'drier_off_time' => $data['drier_off_time'],
+ 'drier_running_hours' => $data['drier_running_hours'],
+ 'supplier_name' => $data['supplier_name'],
+ 'input_sand_moisture' => $data['input_sand_moisture'],
+ 'total_gas_consumption' => $data['total_gas_consumption'],
+ 'gas_per_ton' => $data['gas_per_ton'],
+ 'input_sand_qty' => $data['input_sand_qty'],
+ 'moisture_loss_qty' => $data['moisture_loss_qty'],
+ 'sand_dried_qty' => $data['sand_dried_qty'],
+ 'qty_per_hours' => $data['qty_per_hours'],
+ 'dust_qty' => $data['dust_qty'],
+ 'customer_name' => $data['customer_name']
];
}
@@ -2209,22 +2203,7 @@ class StockController extends BaseController
}
}
- /**
- * Redirects to the drier machine details page.
- */
- private function redirectToDrierMachineDetails(string $date)
- {
- $postData = ['month' => $this->convertToDateWithFlexibleFormats($date, ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "M-Y")];
-
- echo '
';
- echo '';
- exit;
- }
-
+
function convertToDateWithFlexibleFormats($dateInput, array $inputFormats, string $outputFormat): ?string
{
diff --git a/app/Views/stock/CoatingMachineDetail.php b/app/Views/stock/CoatingMachineDetail.php
index bf975bca..6dea2e9d 100644
--- a/app/Views/stock/CoatingMachineDetail.php
+++ b/app/Views/stock/CoatingMachineDetail.php
@@ -256,7 +256,7 @@
-
+
*/
border: 1px solid #ccc;
- padding: 6px 4px;
- min-width: 120px; /* Set a fixed width */
- max-width: 120px; /* Ensure it doesn't exceed this width */
- white-space: nowrap; /* Prevent text from wrapping */
- overflow: hidden; /* Hide overflowing content */
- text-overflow: ellipsis; /* Show "..." for overflow text */
+ padding: 10px 4px;
+ min-width: 120px;
+ max-width: 120px;
}
/*style excel*/
@@ -186,87 +203,40 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
-
- .celda_encabezado_general {
- background-color: #50bbd9;
- border: 1px solid #ccc;
- color: #ffffff;
- font-weight: bold;
- padding: 6px 10px;
- }
-
- .celda_encabezado_total {
- background-color:#ffffff !important;
- border: 1px solid #ffffff;
- color: #ffffff !important;
- font-weight: bold;
- padding: 6px 10px;
- text-align: center;
- }
-
- .celda_normal {
- /*background-color: #fff;*/
- /* */
- text-align: center;
- border: 1px solid #ccc;
- padding: 4px 6px;
- }
-
-
- /* Make entire thead sticky */
- .fht-table thead {
- position: sticky;
- top: 0;
- z-index: 20; /* Ensure the entire header stays above table rows */
- background-color: #50bbd9; /* Header background color */
- }
-
- .dropdown-menu {
- z-index :25 ;
- }
-
-
-
- /* Ensure each
in thead stays sticky */
- .fht-table thead th {
-
- position: sticky;
- top: 0;
- z-index: 11; /* Higher than table rows but lower than first column */
- background-color:rgb(80, 187, 217); /* blue background */
- color: #ffffff;
- border: 1px solid #ddd;
- padding:5px;
- white-space: normal; /* Allows text to wrap */
- word-wrap: break-word; /* Breaks long words if needed */
- text-align: center; /* Centers text for better alignment */
- max-width: 150px; /* Set a max width to control wrapping */
-
- }
-
- /* Sticky First Column */
.fht-table th:nth-child(1),
- .fht-table td:nth-child(1) {
+ .fht-table th:nth-child(1)
+ {
+ position: sticky;
+ left: 0;
+ top: 0;
+ background-color:rgb(80, 187, 217); /* blue background */
+ z-index: 7!important;
+ border-right: 2px solid #ddd;
+ color: #ffffff;
+ }
+
+
+ .fht-table td:nth-child(1)
+ {
position: sticky;
left: 0;
background-color:rgb(80, 187, 217); /* blue background */
- z-index: 15; /* Ensures it stays above other cells */
- border-right: 2px solid #ddd;
+ z-index: 2;
+ border-right: 2px solid #ddd;
color: #ffffff;
+
}
- /* Table Wrapper for Scrolling */
.table-responsive {
- overflow-x: auto;
- overflow-y: auto;
- max-height: 500px; /* Adjust as needed */
- position: relative;
+ overflow-y: auto;
+ max-height: 500px;
}
-
-
-
-
+ .fht-table thead th {
+ position: sticky;
+ top: 0;
+ z-index: 5!important;
+ }
@@ -276,7 +246,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
-
+
@@ -287,16 +257,30 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
+
+
+
-
-
-
-
+ getFlashdata('error')): ?>
+
+ = session()->getFlashdata('error'); ?>
+
+
+
+ getFlashdata('success')): ?>
+
+ = session()->getFlashdata('success'); ?>
+
+
+
@@ -315,9 +299,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
-
+
@@ -341,28 +323,29 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
-
+
- | Date |
- Drier On Time |
- Drier Off Time |
- Running Hrs |
- Supplier Name |
+ Date |
+ Drier On Time |
+ Drier Off Time |
+ Running Hrs |
+ Supplier Name |
- Input Sand Qty (Metric Ton) |
- Input Sand Moisture(%) |
- Sand Dried Qty (Metric Ton) |
- Total Gas Consumption |
- Gas Per Ton |
- Qty Per Hrs (Metric Ton) |
- Moisture Loss Qty (Metric Ton) |
- Dust Qty (Metric Ton) |
+ Input Sand Qty (Metric Ton) |
+ Input Sand Moisture(%) |
+ Sand Dried Qty (Metric Ton) |
+ Total Gas Consumption |
+ Gas Per Ton |
+ Qty Per Hrs (Metric Ton) |
+ Moisture Loss Qty (Metric Ton) |
+ Dust Qty (Metric Ton) |
- Customer Name |
+ Customer Name |
id |
+ Action |
@@ -372,15 +355,15 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
-
+ $row++; ?>
format('Y-m-d');
$currentDate = date('Y-m-d');
if ($date === $currentDate) {
@@ -389,38 +372,27 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
?>
format('d-m-Y');
?>
>
-
+
- |
+
+
+ |
-
+ = $a['drier_on_time'] ?>
|
-
+ = $a['drier_off_time'] ?>
|
@@ -429,46 +401,31 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
-
-
+ |
+ $value) {
+ if ($a['supplier_name'] == $value->SupplierID) {
+ echo $value->SupplierName;
+ }
+ } ?>
|
-
-
-
-
-
-
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
@@ -490,12 +447,12 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
-
+ |
|
-
+ |
|
@@ -504,6 +461,21 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
+
+
+
+
+
+
+ |
+
+
+
+
+ |
+
+
+
-
+
| Date value |
- Drier On Time |
- Drier Off Time |
- Running Hrs |
- Supplier Name |
+ Drier On Time |
+ Drier Off Time |
+ Running Hrs |
+ Supplier Name |
- input Sand Qty (Metric Ton) |
- inputp Sand Moisture(%) |
- Sand Dried Qty (Metric Ton) |
- Total Gas Consumption |
- Gas Per Ton |
- Qty Per Hrs (Metric Ton) |
- Moisture Loss Qty (Metric Ton) |
- Dust Qty (Metric Ton) |
+ input Sand Qty (Metric Ton) |
+ inputp Sand Moisture(%) |
+ Sand Dried Qty (Metric Ton) |
+ Total Gas Consumption |
+ Gas Per Ton |
+ Qty Per Hrs (Metric Ton) |
+ Moisture Loss Qty (Metric Ton) |
+ Dust Qty (Metric Ton) |
@@ -601,14 +573,6 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
-
-
-
-
@@ -852,8 +816,162 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
+
+
@@ -862,7 +980,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
-
+
+
+
+
-
+
-
+
|