diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php index 51e5b359..e612bec5 100644 --- a/app/Controllers/StockController.php +++ b/app/Controllers/StockController.php @@ -3,6 +3,7 @@ namespace App\Controllers; use App\Controllers\BaseController; +use App\Models\Supplier_model; use App\Models\PowerConsumptionDetails; use App\Models\CoatingMachineDetailsModel; use App\Models\DrierMachineDetailsModel; @@ -24,6 +25,7 @@ use DateInterval; class StockController extends BaseController { + protected $supplier_model; protected $powerConsumptionDetails_model; protected $coatingMachineDetails_model; protected $drierMachineDetails_model; @@ -47,7 +49,9 @@ class StockController extends BaseController { $this->db = \Config\Database::connect(); parent::__construct(); - + + $this->supplier_model = new Supplier_model(); + $this->powerConsumptionDetails_model = new PowerConsumptionDetails(); $this->coatingMachineDetails_model = new CoatingMachineDetailsModel(); @@ -941,45 +945,7 @@ class StockController extends BaseController return $dates; } - function fillMissingDates($monthData, $drierDetails) { - - $filledDetails = []; - $drierDetailsByDate = []; - foreach ($drierDetails as $detail) { - $drierDetailsByDate[$detail['date']] = $detail; - } - - foreach ($monthData as $day) { - $date = $day['database']; - - if (isset($drierDetailsByDate[$date])) { - $filledDetails[] = $drierDetailsByDate[$date]; - } else { - $filledDetails[] = [ - 'id' => null, - 'date' => $date, - 'drier_on_time' => null, - 'drier_off_time' => null, - 'drier_running_hours' => '0.00', - 'supplier_name' => null, - 'input_sand_moisture' => '0.00', - 'total_gas_consumption' => '0.00', - 'gas_per_ton' => '0.00', - 'input_sand_qty' => '0.00', - 'moisture_loss_qty' => '0.00', - 'sand_dried_qty' => '0.00', - 'qty_per_hours' => '0.00', - 'dust_qty' => '0.00', - 'customer_name' => null, - 'created_at' => null, - 'updated_at' => null - ]; - } - } - return $filledDetails; - } - function generateTimeOptions() { $times = []; $start = strtotime('00:00'); // Start at midnight (12:00 AM) @@ -1006,14 +972,24 @@ class StockController extends BaseController $data['startDate'] = $monthData[0]['database']; $data['endDate'] = $monthData[count($monthData)-1]['database']; $data['timeDropdown'] = $this->generateTimeOptions(); + $data['supplierData'] = $this->supplier_model->supplierlisting(); + + $data['drierDetails'] = $this->drierMachineDetails_model->where('date >=', $data['startDate'])->where('date <=', $data['endDate'])->findAll(); + if(!count($data['drierDetails'])) + { + //insert empty data + $tempInsert = []; + foreach ($monthData as $key => $value) { + array_push($tempInsert,[ 'date'=>$value['database'] ]); + } + $this->drierMachineDetails_model->insertBatch($tempInsert); + + $data['drierDetails'] = $this->drierMachineDetails_model->where('date >=', $data['startDate'])->where('date <=', $data['endDate'])->findAll(); + } - $data['drierDetails'] = $this->drierMachineDetails_model - ->where('date >=', $data['startDate']) - ->where('date <=', $data['endDate']) - ->findAll(); $data['datefordropdown'] = $currentMonth; - $data['data'] = $this->fillMissingDates($monthData, $data['drierDetails']); + $this->global['pageTitle'] = 'Drier Details'; diff --git a/app/Views/attendance.php b/app/Views/attendance.php index de4c5678..b0226044 100755 --- a/app/Views/attendance.php +++ b/app/Views/attendance.php @@ -1,8 +1,4 @@ - - - - +< @@ -178,12 +174,9 @@ $currentday = date('d'); padding-right: 30% ! important; } -/* .fht-table th:nth-child(1), -.fht-table td:nth-child(1), +.fht-table th:nth-child(1), .fht-table th:nth-child(2), -.fht-table td:nth-child(2), -.fht-table th:nth-child(3), -.fht-table td:nth-child(3) +.fht-table th:nth-child(3) { position: sticky; left: 0; @@ -191,7 +184,20 @@ $currentday = date('d'); z-index: 2; border-right: 2px solid #ddd; color: #ffffff; -} */ +} + + +.fht-table td:nth-child(1), +.fht-table td:nth-child(2), +.fht-table td:nth-child(3) +{ + position: sticky; + left: 0; + background-color: #ffffff; + z-index: 2; + border-right: 2px solid #ddd; + color: #0e0b0b; +}
@@ -649,13 +655,9 @@ $currentday = date('d');