Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme
This commit is contained in:
commit
c58c62ae19
@ -463,16 +463,9 @@ $routes->post('updateDieselMachineDetails' , 'StockController::updateDieselMachi
|
|||||||
|
|
||||||
//power consumption details
|
//power consumption details
|
||||||
$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'powerConsumptionDetails', 'StockController::powerConsumptionDetails');
|
$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'powerConsumptionDetails', 'StockController::powerConsumptionDetails');
|
||||||
$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'addOrEditPowerConsumptionDetails', 'StockController::addOrEditPowerConsumptionDetails');
|
|
||||||
|
|
||||||
|
|
||||||
//new power consumption details
|
|
||||||
$routes->match(['GET','POST'] , 'newPowerConsumptionDetails' , 'StockController::newPowerConsumptionDetails');
|
|
||||||
$routes->post('updatePowerConsumptionDetails','StockController::updatePowerConsumptionDetails');
|
$routes->post('updatePowerConsumptionDetails','StockController::updatePowerConsumptionDetails');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//incoming Silica Sand Detaails
|
//incoming Silica Sand Detaails
|
||||||
$routes->match(['GET', 'POST'], 'incomingSilicaSandDetails', 'StockController::loadView_incomingSilicaSandDetails');
|
$routes->match(['GET', 'POST'], 'incomingSilicaSandDetails', 'StockController::loadView_incomingSilicaSandDetails');
|
||||||
$routes->post('updateIncomingSilicaSandDetails', 'StockController::updateIncomingSilicaSandDetails');
|
$routes->post('updateIncomingSilicaSandDetails', 'StockController::updateIncomingSilicaSandDetails');
|
||||||
|
|||||||
@ -22,6 +22,7 @@ use App\Models\TrpProductionModel;
|
|||||||
use App\Models\TrpProductionMaintenanceModel;
|
use App\Models\TrpProductionMaintenanceModel;
|
||||||
use App\Models\TrpProductionWasteModel;
|
use App\Models\TrpProductionWasteModel;
|
||||||
use App\Models\Employeedetails_model;
|
use App\Models\Employeedetails_model;
|
||||||
|
use App\Models\PowerConsumptionSummaryModel;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -36,6 +37,7 @@ class StockController extends BaseController
|
|||||||
|
|
||||||
protected $supplier_model;
|
protected $supplier_model;
|
||||||
protected $powerConsumptionDetails_model;
|
protected $powerConsumptionDetails_model;
|
||||||
|
protected $powerConsumptionSummary_model;
|
||||||
protected $coatingMachineDetails_model;
|
protected $coatingMachineDetails_model;
|
||||||
protected $drierMachineDetails_model;
|
protected $drierMachineDetails_model;
|
||||||
protected $factoryMachine_model;
|
protected $factoryMachine_model;
|
||||||
@ -109,6 +111,8 @@ class StockController extends BaseController
|
|||||||
|
|
||||||
$this->employeedetails_model = new Employeedetails_model();
|
$this->employeedetails_model = new Employeedetails_model();
|
||||||
|
|
||||||
|
$this->powerConsumptionSummary_model = new PowerConsumptionSummaryModel();
|
||||||
|
|
||||||
|
|
||||||
$this->session = session();
|
$this->session = session();
|
||||||
helper('form');
|
helper('form');
|
||||||
@ -1702,12 +1706,6 @@ class StockController extends BaseController
|
|||||||
return $times;
|
return $times;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function drierMachineDetails()
|
public function drierMachineDetails()
|
||||||
{
|
{
|
||||||
@ -1892,131 +1890,281 @@ class StockController extends BaseController
|
|||||||
return $dateInput;
|
return $dateInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function powerConsumptionDetails(){
|
||||||
|
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
|
||||||
public function powerConsumptionDetails()
|
$month = $this->request->getPost('month');
|
||||||
{
|
|
||||||
$currentMonth = $this->request->getPost('month') ? $this->request->getPost('month') : date('M-Y');
|
|
||||||
|
|
||||||
$monthData = $this->getMonthDatesFromInput($currentMonth);
|
$date = DateTime::createFromFormat('M-Y', $month);
|
||||||
|
|
||||||
$data['startDate'] = $monthData[0]['database'];
|
$formattedDate = $date->format('Y-m');
|
||||||
$data['endDate'] = $monthData[count($monthData) - 1]['database'];
|
|
||||||
$data['datefordropdown'] = $currentMonth;
|
|
||||||
|
|
||||||
//Machine Details
|
$month = $formattedDate;
|
||||||
$data['machineDetails'] = $this->factoryMachine_model->where('energy_type', 'electric')->where('is_active', 1)->findAll();
|
} else {
|
||||||
if (!count([$data['machineDetails']])) {
|
|
||||||
return $this->response->setBody("<script>alert('No Machine data available');</script>");
|
// $month = '2024-12';
|
||||||
|
|
||||||
|
$month = date('Y-m');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
$data['month'] = $month;
|
||||||
|
|
||||||
|
$this->global['pageTitle'] = 'Power Consumption Stock Details';
|
||||||
|
|
||||||
|
|
||||||
//Diesel Consumption Details
|
// Get the previous month's last date power consumption stock details for next month updation
|
||||||
$data['powerConsumptionDetails'] = $this->getElectricConsumptionPivot($data['machineDetails'], $data['startDate'], $data['endDate']);
|
|
||||||
if (!count($data['powerConsumptionDetails'])) {
|
$previousMonth = DateTime::createFromFormat('Y-m', $month)->modify('-1 month')->format('Y-m');
|
||||||
//insert empty data
|
$previousMonthStartDate = "$previousMonth-01";
|
||||||
$tempInsert = [];
|
$previousMonthEndDate = date("Y-m-t", strtotime($previousMonthStartDate));
|
||||||
foreach ($monthData as $key => $value) {
|
|
||||||
array_push($tempInsert, ['date' => $value['database'], 'machine_id' => $data['machineDetails'][0]['id']]);
|
$data['previousMonthPowerConsumptionStockDetails'] = $this->powerConsumptionDetails_model
|
||||||
|
->select(['machine_id', 'date', 'closing_units'])
|
||||||
|
->distinct()
|
||||||
|
->where('date =', $previousMonthEndDate)
|
||||||
|
->groupBy(['machine_id', 'date'])
|
||||||
|
->orderBy('date', 'desc')
|
||||||
|
->orderBy('machine_id', 'asc')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
$data['previousMonthTotalPowerMachineStockDetails'] = $this->powerConsumptionSummary_model
|
||||||
|
->select(['id', 'date', 'final_reading'])
|
||||||
|
->distinct()
|
||||||
|
->where('date =', $previousMonthEndDate)
|
||||||
|
->groupBy(['id', 'date'])
|
||||||
|
->orderBy('date', 'desc')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// checking in database if the data is available for the month
|
||||||
|
|
||||||
|
$startDate = "$month-01";
|
||||||
|
$endDate = date("Y-m-t", strtotime($startDate));
|
||||||
|
|
||||||
|
$data['powerConsumptionStockDetails'] = $this->powerConsumptionDetails_model
|
||||||
|
->where('date >=', $startDate)
|
||||||
|
->where('date <=', $endDate)
|
||||||
|
->groupBy(['machine_id', 'date'])
|
||||||
|
->orderBy('date', 'asc')
|
||||||
|
->orderBy('machine_id', 'asc')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
$data['totalPower'] = $this->powerConsumptionSummary_model
|
||||||
|
->where('date >=', $startDate)
|
||||||
|
->where('date <=', $endDate)
|
||||||
|
->orderBy('date', 'asc')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
// Initialize an empty array to hold the grouped data
|
||||||
|
$data['groupedPowerConsumptionStockDetails'] = [];
|
||||||
|
|
||||||
|
// Temporary array to store grouped data by date
|
||||||
|
$groupedByDate = [];
|
||||||
|
|
||||||
|
// Group by 'date'
|
||||||
|
foreach ($data['powerConsumptionStockDetails'] as $detail) {
|
||||||
|
$date = $detail['date'];
|
||||||
|
|
||||||
|
// Initialize the outer array for this date if it doesn't exist
|
||||||
|
if (!isset($groupedByDate[$date])) {
|
||||||
|
$groupedByDate[$date] = [];
|
||||||
}
|
}
|
||||||
$this->powerConsumptionDetails_model->insertBatch($tempInsert);
|
|
||||||
|
|
||||||
$data['powerConsumptionDetails'] = $this->getElectricConsumptionPivot($data['machineDetails'], $data['startDate'], $data['endDate']);
|
/*******************************************************************************************************************
|
||||||
|
creating an sub array (inner array) for date wise and append the detail into an array as sub-array
|
||||||
|
|
||||||
|
$groupedByDate[] outer array
|
||||||
|
|
||||||
|
$groupedByDate[$date]
|
||||||
|
will look like [[material1],[material2],[material3],[material4],[material5]] inner array
|
||||||
|
|
||||||
|
the above process is done for single row (date wise) and the same process is repeated for all the rows
|
||||||
|
*******************************************************************************************************************/
|
||||||
|
|
||||||
|
$groupedByDate[$date][] = $detail;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset the structure to have indexed arrays without the date keys
|
||||||
|
$data['groupedPowerConsumptionStockDetails'] = array_values($groupedByDate);
|
||||||
|
|
||||||
|
|
||||||
|
// getting electric machines for creating table headers
|
||||||
|
// checking already existing stock if yes then get the electric machines id from the existing stock
|
||||||
|
// if not get all the electric machines from the factory Machine master table
|
||||||
|
|
||||||
|
if (!empty($data['groupedPowerConsumptionStockDetails'])) {
|
||||||
|
|
||||||
|
$result = $groupedByDate[$date];
|
||||||
|
|
||||||
|
$distinctMachineId = [];
|
||||||
|
|
||||||
|
foreach ($result as $index => $eachResult) {
|
||||||
|
$distinctMachineId[] = $result[$index]['machine_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$electricMachines = $this->factoryMachine_model
|
||||||
|
->whereIn('id', $distinctMachineId)
|
||||||
|
->orderBy('id', 'asc')
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$electricMachines = $this->factoryMachine_model
|
||||||
|
->where('is_active', 1)
|
||||||
|
->where('energy_type', 'Electric')
|
||||||
|
->orderBy('id', 'asc')
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$electricMachinesCount = count($electricMachines);
|
||||||
|
|
||||||
$data['machineName'] = array_column($data['machineDetails'], 'machine_name');
|
$data['electricMachinesCount'] = $electricMachinesCount;
|
||||||
|
$data['electricMachines'] = $electricMachines;
|
||||||
|
|
||||||
|
$date = DateTime::createFromFormat('Y-m', $month);
|
||||||
|
|
||||||
|
$formattedDate = $date->format('M-Y');
|
||||||
|
|
||||||
|
$data['month'] = $formattedDate;
|
||||||
|
|
||||||
|
// return $this->response->setJSON(['status' =>'success' ,'message' => $data['electricMachines']]);
|
||||||
|
|
||||||
|
return $this->loadViews("powerConsumptionDetails", $this->global, $data, NULL);
|
||||||
|
|
||||||
$this->global['pageTitle'] = 'Power Consumption Details';
|
|
||||||
$this->loadViews("powerConsumptionDetails", $this->global, $data, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getElectricConsumptionPivot($machineDetails, $startDate, $endDeate)
|
public function updatePowerConsumptionDetails(){
|
||||||
{
|
|
||||||
$machineIds = array_column($machineDetails, 'id');
|
|
||||||
|
|
||||||
if (empty($machineIds)) {
|
//pm stands for power machine
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
$postData = $this->request->getPost();
|
||||||
|
|
||||||
$fields = ['opening_units', 'closing_units', 'total_units'];
|
$updatePowerConsumptionDetailsData = json_decode($postData['updatePowerConsumptionDetails'], true);
|
||||||
|
|
||||||
$pivotColumns = [];
|
$updateTotalPmDetailsData = $updatePowerConsumptionDetailsData[0];
|
||||||
foreach ($machineIds as $machineId) {
|
$updatePmDetailsData = $updatePowerConsumptionDetailsData[1];
|
||||||
foreach ($fields as $field) {
|
|
||||||
$pivotColumns[] = "MAX(CASE WHEN machine_id = $machineId THEN $field ELSE 0 END) AS {$field}_{$machineId}";
|
//PmR stands for power machine readings
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$pivotColumnString = implode(", ", $pivotColumns);
|
$updatesPmR = [];
|
||||||
|
$insertsPmR = [];
|
||||||
|
|
||||||
$sql = "SELECT `date`, $pivotColumnString FROM `t_powerConsumptionDetails`
|
$updatesTotalPmR = [];
|
||||||
WHERE machine_id IN (" . implode(",", $machineIds) . ") AND `date` >= ? AND `date` <= ?
|
$insertsTotalPmR = [];
|
||||||
GROUP BY `date`";
|
|
||||||
|
|
||||||
$query = $this->db->query($sql, [$startDate, $endDeate]);
|
// Fetch existing records in bulk for power machine details
|
||||||
$result = $query->getResultArray();
|
$dates = array_column($updatePmDetailsData, 'date');
|
||||||
|
$machineIds = array_column($updatePmDetailsData, 'machine_id');
|
||||||
return $result;
|
$existingPmRecords = $this->powerConsumptionDetails_model
|
||||||
}
|
->whereIn('date', $dates)
|
||||||
|
->whereIn('machine_id', $machineIds)
|
||||||
public function addOrEditPowerConsumptionDetails()
|
->findAll();
|
||||||
{
|
|
||||||
$electricMachineTableData = json_decode($this->request->getPost('electricMachineTableData'), true);
|
$existingPmMap = [];
|
||||||
|
foreach ($existingPmRecords as $record) {
|
||||||
$transformedData = [];
|
$existingPmMap[$record['date']][$record['machine_id']] = $record;
|
||||||
foreach ($electricMachineTableData as $entry) {
|
|
||||||
$date = $entry['date'];
|
|
||||||
|
|
||||||
foreach ($entry as $key => $value) {
|
|
||||||
|
|
||||||
if ($key === 'date') {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
preg_match('/(.*?)_(\d+)$/', $key, $matches);
|
foreach ($updatePmDetailsData as $data) {
|
||||||
|
$date = $data['date'];
|
||||||
if (count($matches) === 3) {
|
$machineId = $data['machine_id'];
|
||||||
$field = $matches[1];
|
|
||||||
$machineId = $matches[2];
|
$dbData = [
|
||||||
|
'date' => $data['date'],
|
||||||
$insertKey = "{$date}_{$machineId}";
|
'machine_id' => $data['machine_id'],
|
||||||
if (!isset($transformedData[$insertKey])) {
|
'opening_units' => $data['opening_units'],
|
||||||
$transformedData[$insertKey] = [
|
'closing_units' => $data['closing_units'],
|
||||||
'date' => DateTime::createFromFormat('d-m-Y', $date)->format('Y-m-d'),
|
'total_units' => $data['total_units'],
|
||||||
'machine_id' => $machineId,
|
];
|
||||||
'opening_units' => 0.00,
|
|
||||||
'closing_units' => 0.00,
|
if (isset($existingPmMap[$date][$machineId])) {
|
||||||
'total_units' => 0.00
|
$dbData['id'] = $existingPmMap[$date][$machineId]['id'];
|
||||||
];
|
$updatesPmR[] = $dbData;
|
||||||
|
} else {
|
||||||
|
$insertsPmR[] = $dbData;
|
||||||
}
|
}
|
||||||
|
|
||||||
$transformedData[$insertKey][$field] = (float) $value;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
// Fetch existing records in bulk for power stock summary
|
||||||
|
$dates = array_column($updateTotalPmDetailsData, 'date');
|
||||||
|
$existingTotalPmRecords = $this->powerConsumptionSummary_model
|
||||||
|
->whereIn('date', $dates)
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
$existingTotalPmMap = [];
|
||||||
|
foreach ($existingTotalPmRecords as $record) {
|
||||||
|
$existingTotalPmMap[$record['date']] = $record;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($updateTotalPmDetailsData as $data) {
|
||||||
|
$date = $data['date'];
|
||||||
|
|
||||||
|
$dbData = [
|
||||||
|
'date' => $data['date'],
|
||||||
|
'opening_reading' => $data['opening_reading'],
|
||||||
|
'final_reading' => $data['final_reading'],
|
||||||
|
'total_reading' => $data['total_reading'],
|
||||||
|
'total_units' => $data['total_units'],
|
||||||
|
'average_pf' => $data['average_pf'],
|
||||||
|
'present_pf' => $data['present_pf'],
|
||||||
|
'md' => $data['md'],
|
||||||
|
'mf' => $data['mf']
|
||||||
|
];
|
||||||
|
|
||||||
|
if (isset($existingTotalPmMap[$date])) {
|
||||||
|
$dbData['id'] = $existingTotalPmMap[$date]['id'];
|
||||||
|
$updatesTotalPmR[] = $dbData;
|
||||||
|
} else {
|
||||||
|
$insertsTotalPmR[] = $dbData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start the transaction
|
||||||
|
$this->db->transBegin();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!empty($insertsPmR)) {
|
||||||
|
$this->powerConsumptionDetails_model->insertBatch($insertsPmR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($updatesPmR)) {
|
||||||
|
$this->powerConsumptionDetails_model->updateBatch($updatesPmR, 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($insertsTotalPmR)) {
|
||||||
|
$this->powerConsumptionSummary_model->insertBatch($insertsTotalPmR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($updatesTotalPmR)) {
|
||||||
|
$this->powerConsumptionSummary_model->updateBatch($updatesTotalPmR, 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit the transaction if all operations are successful
|
||||||
|
$this->db->transCommit();
|
||||||
|
echo "Data Saved Successfully";
|
||||||
|
|
||||||
|
} catch (\Exception $error) {
|
||||||
|
// Rollback the transaction in case of any errors
|
||||||
|
$this->db->transRollback();
|
||||||
|
echo "An error occurred: " . $error->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach ($transformedData as $row) {
|
|
||||||
|
|
||||||
$existingRow = $this->powerConsumptionDetails_model->where('date', $row['date'])->where('machine_id', $row['machine_id'])->first();
|
|
||||||
if ($existingRow) {
|
|
||||||
$this->powerConsumptionDetails_model->update($existingRow['id'], $row);
|
|
||||||
} else {
|
|
||||||
$this->powerConsumptionDetails_model->insert($row);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
echo "Data successfully saved.";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function dieselMachineStockDetails(){
|
public function dieselMachineStockDetails(){
|
||||||
|
|
||||||
|
|
||||||
@ -2290,208 +2438,7 @@ class StockController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function newPowerConsumptionDetails(){
|
|
||||||
|
|
||||||
|
|
||||||
if ($this->request->getMethod() === 'POST') {
|
|
||||||
|
|
||||||
$month = $this->request->getPost('month');
|
|
||||||
|
|
||||||
$date = DateTime::createFromFormat('M-Y', $month);
|
|
||||||
|
|
||||||
$formattedDate = $date->format('Y-m');
|
|
||||||
|
|
||||||
$month = $formattedDate;
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// $month = '2024-12';
|
|
||||||
|
|
||||||
$month = date('Y-m');
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = [];
|
|
||||||
|
|
||||||
$data['month'] = $month;
|
|
||||||
|
|
||||||
$this->global['pageTitle'] = 'Power Consumption Stock Details';
|
|
||||||
|
|
||||||
|
|
||||||
// Get the previous month's last date power consumption stock details for next month updation
|
|
||||||
|
|
||||||
$previousMonth = DateTime::createFromFormat('Y-m', $month)->modify('-1 month')->format('Y-m');
|
|
||||||
$previousMonthStartDate = "$previousMonth-01";
|
|
||||||
$previousMonthEndDate = date("Y-m-t", strtotime($previousMonthStartDate));
|
|
||||||
|
|
||||||
$data['previousMonthPowerConsumptionStockDetails'] = $this->powerConsumptionDetails_model
|
|
||||||
->select(['machine_id', 'date', 'closing_units'])
|
|
||||||
->distinct()
|
|
||||||
->where('date =', $previousMonthEndDate)
|
|
||||||
->groupBy(['machine_id', 'date'])
|
|
||||||
->orderBy('date', 'desc')
|
|
||||||
->orderBy('machine_id', 'asc')
|
|
||||||
->findAll();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// checking in database if the data is available for the month
|
|
||||||
|
|
||||||
$startDate = "$month-01";
|
|
||||||
$endDate = date("Y-m-t", strtotime($startDate));
|
|
||||||
|
|
||||||
$data['powerConsumptionStockDetails'] = $this->powerConsumptionDetails_model
|
|
||||||
->where('date >=', $startDate)
|
|
||||||
->where('date <=', $endDate)
|
|
||||||
->groupBy(['machine_id', 'date'])
|
|
||||||
->orderBy('date', 'asc')
|
|
||||||
->orderBy('machine_id', 'asc')
|
|
||||||
->findAll();
|
|
||||||
|
|
||||||
// Initialize an empty array to hold the grouped data
|
|
||||||
$data['groupedPowerConsumptionStockDetails'] = [];
|
|
||||||
|
|
||||||
// Temporary array to store grouped data by date
|
|
||||||
$groupedByDate = [];
|
|
||||||
|
|
||||||
// Group by 'date'
|
|
||||||
foreach ($data['powerConsumptionStockDetails'] as $detail) {
|
|
||||||
$date = $detail['date'];
|
|
||||||
|
|
||||||
// Initialize the outer array for this date if it doesn't exist
|
|
||||||
if (!isset($groupedByDate[$date])) {
|
|
||||||
$groupedByDate[$date] = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************************************************
|
|
||||||
creating an sub array (inner array) for date wise and append the detail into an array as sub-array
|
|
||||||
|
|
||||||
$groupedByDate[] outer array
|
|
||||||
|
|
||||||
$groupedByDate[$date]
|
|
||||||
will look like [[material1],[material2],[material3],[material4],[material5]] inner array
|
|
||||||
|
|
||||||
the above process is done for single row (date wise) and the same process is repeated for all the rows
|
|
||||||
*******************************************************************************************************************/
|
|
||||||
|
|
||||||
$groupedByDate[$date][] = $detail;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset the structure to have indexed arrays without the date keys
|
|
||||||
$data['groupedPowerConsumptionStockDetails'] = array_values($groupedByDate);
|
|
||||||
|
|
||||||
|
|
||||||
// getting electric machines for creating table headers
|
|
||||||
// checking already existing stock if yes then get the electric machines id from the existing stock
|
|
||||||
// if not get all the electric machines from the factory Machine master table
|
|
||||||
|
|
||||||
if (!empty($data['groupedPowerConsumptionStockDetails'])) {
|
|
||||||
|
|
||||||
$result = $groupedByDate[$date];
|
|
||||||
|
|
||||||
$distinctMachineId = [];
|
|
||||||
|
|
||||||
foreach ($result as $index => $eachResult) {
|
|
||||||
$distinctMachineId[] = $result[$index]['machine_id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$electricMachines = $this->factoryMachine_model
|
|
||||||
->whereIn('id', $distinctMachineId)
|
|
||||||
->orderBy('id', 'asc')
|
|
||||||
->get()
|
|
||||||
->getResultArray();
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
$electricMachines = $this->factoryMachine_model
|
|
||||||
->where('is_active', 1)
|
|
||||||
->where('energy_type', 'Diesel')
|
|
||||||
->orderBy('id', 'asc')
|
|
||||||
->get()
|
|
||||||
->getResultArray();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$electricMachinesCount = count($electricMachines);
|
|
||||||
|
|
||||||
$data['electricMachinesCount'] = $electricMachinesCount;
|
|
||||||
$data['electricMachines'] = $electricMachines;
|
|
||||||
|
|
||||||
$date = DateTime::createFromFormat('Y-m', $month);
|
|
||||||
|
|
||||||
$formattedDate = $date->format('M-Y');
|
|
||||||
|
|
||||||
$data['month'] = $formattedDate;
|
|
||||||
|
|
||||||
return $this->response->setJSON(['status' =>'success' ,'message' => $data['electricMachines']]);
|
|
||||||
|
|
||||||
// return $this->loadViews("powerConsumptionStockDetails", $this->global, $data, NULL);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function updatePowerConsumptionDetails(){
|
|
||||||
|
|
||||||
|
|
||||||
$postData = $this->request->getPost();
|
|
||||||
|
|
||||||
$updatePowerConsumptionDetailsData = json_decode($postData['updatePowerConsumptionDetails'], true);
|
|
||||||
|
|
||||||
$updates = [];
|
|
||||||
|
|
||||||
$inserts = [];
|
|
||||||
|
|
||||||
foreach ($updatePowerConsumptionDetailsData as $data) {
|
|
||||||
|
|
||||||
$date = $data['date'];
|
|
||||||
$machineId = $data['machine_id'];
|
|
||||||
|
|
||||||
|
|
||||||
$dbData = [
|
|
||||||
'date' => $data['date'],
|
|
||||||
'machine_id' => $data['machine_id'],
|
|
||||||
'opening_units' => $data['opening'],
|
|
||||||
'closing_units' => $data['receipt'],
|
|
||||||
'total_units' => $data['used']
|
|
||||||
];
|
|
||||||
|
|
||||||
$resultExists = $this->factoryVehicleDieselDetails_model
|
|
||||||
->where('date', $date)
|
|
||||||
->where('machine_id', $machineId)
|
|
||||||
->first();
|
|
||||||
|
|
||||||
|
|
||||||
if (empty($resultExists)) {
|
|
||||||
$inserts[] = $dbData;
|
|
||||||
} else {
|
|
||||||
$dbData['id'] = $resultExists['id'];
|
|
||||||
$updates[] = $dbData;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!empty($inserts)) {
|
|
||||||
$this->factoryVehicleDieselDetails_model->insertBatch($inserts);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($updates)) {
|
|
||||||
|
|
||||||
$updateResult = $this->factoryVehicleDieselDetails_model->updateBatch($updates, 'id');
|
|
||||||
|
|
||||||
if ($updateResult === FALSE) {
|
|
||||||
echo "Error during update";
|
|
||||||
} else {
|
|
||||||
echo "Data Updated Successfully";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "Data Saved Successfully";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
30
app/Models/PowerConsumptionSummaryModel.Php
Normal file
30
app/Models/PowerConsumptionSummaryModel.Php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class PowerConsumptionSummaryModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 't_powerConsumptionSummary';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
protected $allowedFields = [
|
||||||
|
'date',
|
||||||
|
'machine_id',
|
||||||
|
'opening_reading',
|
||||||
|
'final_reading',
|
||||||
|
'total_reading',
|
||||||
|
'total_units',
|
||||||
|
'present_pf',
|
||||||
|
'average_pf',
|
||||||
|
'md',
|
||||||
|
'mf'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $useTimestamps = true;
|
||||||
|
protected $createdField = 'created_at';
|
||||||
|
protected $updatedField = 'updated_at';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -1441,7 +1441,7 @@
|
|||||||
|
|
||||||
document.getElementById('coatingMachineDetailsExport').addEventListener('click',function(){
|
document.getElementById('coatingMachineDetailsExport').addEventListener('click',function(){
|
||||||
|
|
||||||
exportTableToExcel(tableId,'coatingMachineDetails.xlsx');
|
exportTableToExcel(tableId,'coatingMachineDetails_<?=$month?>.xlsx');
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -97,29 +97,7 @@
|
|||||||
padding-bottom: 8px;
|
padding-bottom: 8px;
|
||||||
padding-top: 8px;
|
padding-top: 8px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.celda_encabezado_general {
|
|
||||||
background-color: #00a65a;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
color: #ffffff;
|
|
||||||
font-weight: bold;
|
|
||||||
padding: 6px 10px;;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.celda_encabezado_total {
|
|
||||||
background-color:#ffffff;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
color: #ffffff;
|
|
||||||
font-weight: bold;
|
|
||||||
padding: 6px 10px;
|
|
||||||
;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
._Separador {
|
._Separador {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
@ -133,14 +111,6 @@
|
|||||||
width: 4px;
|
width: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.celda_normal {
|
|
||||||
/*background-color: #fff;*/
|
|
||||||
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
|
||||||
text-align: center;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
padding: 2px 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*style excel*/
|
/*style excel*/
|
||||||
.excel_cell {
|
.excel_cell {
|
||||||
border: 1px solid #CCC;
|
border: 1px solid #CCC;
|
||||||
@ -167,37 +137,82 @@
|
|||||||
height: 20px;
|
height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#bagStockDetailsTableId th:nth-child(1),
|
|
||||||
#bagStockDetailsTableId td:nth-child(1) {
|
|
||||||
position: sticky;
|
.celda_encabezado_general {
|
||||||
left: 0;
|
|
||||||
background-color: #00a65a;
|
background-color: #00a65a;
|
||||||
z-index: 2;
|
border: 1px solid #ccc;
|
||||||
border-right: 2px solid #ddd;
|
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 6px 10px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.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;*/
|
||||||
|
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 10px 6px;
|
||||||
|
}
|
||||||
|
|
||||||
#bagStockDetailsTableSummaryId th:nth-child(1),
|
|
||||||
#bagStockDetailsTableSummaryId td:nth-child(1) {
|
/* Make entire thead sticky */
|
||||||
|
.fht-table thead {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 20; /* Ensure the entire header stays above table rows */
|
||||||
|
background-color: #00a65a; /* Header background color */
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-menu {
|
||||||
|
z-index :25 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Ensure each <th> 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: #00a65a; /* Green background */
|
||||||
|
color: #ffffff;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sticky First Column */
|
||||||
|
.fht-table th:nth-child(1),
|
||||||
|
.fht-table td:nth-child(1) {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
left: 0;
|
left: 0;
|
||||||
background-color: #00a65a;
|
background-color: #00a65a;
|
||||||
z-index: 2;
|
z-index: 15; /* Ensures it stays above other cells */
|
||||||
border-right: 2px solid #ddd;
|
border-right: 2px solid #ddd;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Table Wrapper for Scrolling */
|
||||||
|
|
||||||
.table-responsive {
|
.table-responsive {
|
||||||
overflow-y: auto;
|
overflow-x: auto;
|
||||||
|
overflow-y: auto;
|
||||||
|
max-height: 450px; /* Adjust as needed */
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fht-table thead th {
|
td{
|
||||||
top: 0;
|
min-width: 100px;
|
||||||
z-index: 5!important;
|
max-width: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -395,7 +410,7 @@
|
|||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
><?= $bagStock['opening']?>
|
><?= $bagStock['opening'] ?? " " ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="celda_normal receiptStock"
|
<td class="celda_normal receiptStock"
|
||||||
@ -403,7 +418,7 @@
|
|||||||
oninput="receiptStockChange(this)"
|
oninput="receiptStockChange(this)"
|
||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
>
|
>
|
||||||
<?= $bagStock['receipt']?>
|
<?= $bagStock['receipt'] ?? " " ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="celda_normal usedStock"
|
<td class="celda_normal usedStock"
|
||||||
@ -412,12 +427,12 @@
|
|||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
|
|
||||||
>
|
>
|
||||||
<?= $bagStock['used']?>
|
<?= $bagStock['used'] ?? " " ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="celda_normal balanceStock"
|
<td class="celda_normal balanceStock"
|
||||||
data-id="<?=$bagStock['date']?> <?=$bagStock['materialCode']?>">
|
data-id="<?=$bagStock['date']?> <?=$bagStock['materialCode']?>">
|
||||||
<?= $bagStock['balanceStock']?>
|
<?= $bagStock['balanceStock'] ?? " " ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@ -439,10 +454,10 @@
|
|||||||
|
|
||||||
// Sum values for the material
|
// Sum values for the material
|
||||||
|
|
||||||
$summary[$materialCode]['opening'] = "-" ;
|
$summary[$materialCode]['opening'] = "-" ;
|
||||||
$summary[$materialCode]['receipt'] += $bagStock['receipt'] == '-' ? 0 : $bagStock['receipt'] ;
|
$summary[$materialCode]['receipt'] += is_numeric( $bagStock['receipt']) ? $bagStock['receipt'] : 0 ;
|
||||||
$summary[$materialCode]['used'] += $bagStock['used'] == '-' ? 0 : $bagStock['used'] ;
|
$summary[$materialCode]['used'] += is_numeric( $bagStock['used']) ? $bagStock['used'] : 0 ;
|
||||||
$summary[$materialCode]['balanceStock'] = $bagStock['balanceStock'] == '-' ? 0 : $bagStock['balanceStock'] ;
|
$summary[$materialCode]['balanceStock'] = is_numeric( $bagStock['balanceStock']) ? $bagStock['balanceStock'] : 0 ;
|
||||||
|
|
||||||
|
|
||||||
} ?>
|
} ?>
|
||||||
@ -461,7 +476,7 @@
|
|||||||
<th class="celda_encabezado_total">Receipt</th>
|
<th class="celda_encabezado_total">Receipt</th>
|
||||||
<th class="celda_encabezado_total">Used</th>
|
<th class="celda_encabezado_total">Used</th>
|
||||||
<th class="celda_encabezado_total">Balance Stock</th>
|
<th class="celda_encabezado_total">Balance Stock</th>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -540,20 +555,20 @@
|
|||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
|
|
||||||
<?php }?>
|
<?php }?>
|
||||||
><?= $previousMonthBagStockDetails[$bagMaterialIndex]['balanceStock']??'-' ?></td>
|
><?= $previousMonthBagStockDetails[$bagMaterialIndex]['balanceStock'] ?? ' ' ?></td>
|
||||||
|
|
||||||
<td class="celda_normal receiptStock"
|
<td class="celda_normal receiptStock"
|
||||||
data-id="<?=$dateInMonth?> <?=$bagMaterial['MaterialCode']?>"
|
data-id="<?=$dateInMonth?> <?=$bagMaterial['MaterialCode']?>"
|
||||||
oninput="receiptStockChange(this)"
|
oninput="receiptStockChange(this)"
|
||||||
contenteditable="true"> - </td>
|
contenteditable="true"> <?= " " ?> </td>
|
||||||
|
|
||||||
<td class="celda_normal usedStock"
|
<td class="celda_normal usedStock"
|
||||||
data-id="<?=$dateInMonth?> <?=$bagMaterial['MaterialCode']?>"
|
data-id="<?=$dateInMonth?> <?=$bagMaterial['MaterialCode']?>"
|
||||||
oninput="usedStockChange(this)" contenteditable="true"> - </td>
|
oninput="usedStockChange(this)" contenteditable="true"> <?= " " ?> </td>
|
||||||
|
|
||||||
<td class="celda_normal balanceStock"
|
<td class="celda_normal balanceStock"
|
||||||
data-id="<?=$dateInMonth?> <?=$bagMaterial['MaterialCode']?>"
|
data-id="<?=$dateInMonth?> <?=$bagMaterial['MaterialCode']?>"
|
||||||
><?= $previousMonthBagStockDetails[$bagMaterialIndex]['balanceStock']??'-' ?></td>
|
><?= $previousMonthBagStockDetails[$bagMaterialIndex]['balanceStock'] ?? ' ' ?></td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@ -812,7 +827,7 @@
|
|||||||
|
|
||||||
let currentBalanceStock = (Number(openingStock) + Number(receiptStock)) - Number(usedStock);
|
let currentBalanceStock = (Number(openingStock) + Number(receiptStock)) - Number(usedStock);
|
||||||
|
|
||||||
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
|
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock == 0 ? " " : currentBalanceStock;
|
||||||
|
|
||||||
updateStockValue( date,materialCode,currentBalanceStock )
|
updateStockValue( date,materialCode,currentBalanceStock )
|
||||||
|
|
||||||
@ -839,7 +854,7 @@
|
|||||||
|
|
||||||
let currentBalanceStock = (Number(openingStock) + Number(receiptStock)) - Number(usedStock);
|
let currentBalanceStock = (Number(openingStock) + Number(receiptStock)) - Number(usedStock);
|
||||||
|
|
||||||
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
|
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = ccurrentBalanceStock == 0 ? " " : currentBalanceStock ;
|
||||||
|
|
||||||
updateStockValue( date,materialCode,currentBalanceStock )
|
updateStockValue( date,materialCode,currentBalanceStock )
|
||||||
|
|
||||||
@ -869,7 +884,7 @@
|
|||||||
|
|
||||||
let currentBalanceStock = ( Number(openingStock) + Number(receiptStock) ) - Number(usedStock);
|
let currentBalanceStock = ( Number(openingStock) + Number(receiptStock) ) - Number(usedStock);
|
||||||
|
|
||||||
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
|
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock == 0 ? " " : currentBalanceStock ;
|
||||||
|
|
||||||
updateStockValue( date,materialCode,currentBalanceStock )
|
updateStockValue( date,materialCode,currentBalanceStock )
|
||||||
|
|
||||||
@ -901,7 +916,7 @@
|
|||||||
|
|
||||||
let dataId = `${otherDate} ${materialCode}`;
|
let dataId = `${otherDate} ${materialCode}`;
|
||||||
|
|
||||||
document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
|
document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText = currentBalanceStock == 0 ? " " : currentBalanceStock;
|
||||||
|
|
||||||
let usedStock = validateInput(document.querySelector(`td.usedStock[data-id="${dataId}"]`).innerText);
|
let usedStock = validateInput(document.querySelector(`td.usedStock[data-id="${dataId}"]`).innerText);
|
||||||
|
|
||||||
@ -909,10 +924,8 @@
|
|||||||
|
|
||||||
currentBalanceStock = (Number(currentBalanceStock) + Number(receiptStock)) - Number(usedStock);
|
currentBalanceStock = (Number(currentBalanceStock) + Number(receiptStock)) - Number(usedStock);
|
||||||
|
|
||||||
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
|
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock == 0 ? " " : currentBalanceStock;
|
||||||
|
|
||||||
// console.log( 'other date' , new Date(otherDate));
|
|
||||||
// console.log('new balance stock' , currentBalanceStock)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -100,25 +100,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.celda_encabezado_general {
|
|
||||||
background-color: #00a65a;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
color: #ffffff;
|
|
||||||
font-weight: bold;
|
|
||||||
padding: 6px 10px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.celda_encabezado_total {
|
|
||||||
background-color:#ffffff !important;
|
|
||||||
border: 1px solid #ffffff;
|
|
||||||
color: #ffffff !important;
|
|
||||||
font-weight: bold;
|
|
||||||
padding: 6px 10px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
._Separador {
|
._Separador {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
height: 12px;
|
height: 12px;
|
||||||
@ -131,13 +112,7 @@
|
|||||||
width: 4px;
|
width: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.celda_normal {
|
|
||||||
/*background-color: #fff;*/
|
|
||||||
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
|
||||||
text-align: center;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
padding: 10px 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*style excel*/
|
/*style excel*/
|
||||||
.excel_cell {
|
.excel_cell {
|
||||||
@ -166,54 +141,81 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Make entire thead sticky */
|
.celda_encabezado_general {
|
||||||
.fht-table thead {
|
background-color: #00a65a;
|
||||||
position: sticky;
|
border: 1px solid #ccc;
|
||||||
top: 0;
|
color: #ffffff;
|
||||||
z-index: 20; /* Ensure the entire header stays above table rows */
|
font-weight: bold;
|
||||||
background-color: #00a65a; /* Header background color */
|
padding: 6px 10px;
|
||||||
}
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
.dropdown-menu {
|
.celda_encabezado_total {
|
||||||
z-index :25 ;
|
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;*/
|
||||||
|
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 10px 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: #00a65a; /* Header background color */
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-menu {
|
||||||
|
z-index :25 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Ensure each <th> in thead stays sticky */
|
/* Ensure each <th> in thead stays sticky */
|
||||||
.fht-table thead th {
|
.fht-table thead th {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 11; /* Higher than table rows but lower than first column */
|
z-index: 11; /* Higher than table rows but lower than first column */
|
||||||
background-color: #00a65a; /* Green background */
|
background-color: #00a65a; /* Green background */
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sticky First Column */
|
/* Sticky First Column */
|
||||||
.fht-table th:nth-child(1),
|
.fht-table th:nth-child(1),
|
||||||
.fht-table td:nth-child(1) {
|
.fht-table td:nth-child(1) {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
left: 0;
|
left: 0;
|
||||||
background-color: #00a65a;
|
background-color: #00a65a;
|
||||||
z-index: 15; /* Ensures it stays above other cells */
|
z-index: 15; /* Ensures it stays above other cells */
|
||||||
border-right: 2px solid #ddd;
|
border-right: 2px solid #ddd;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Table Wrapper for Scrolling */
|
/* Table Wrapper for Scrolling */
|
||||||
.table-responsive {
|
.table-responsive {
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
max-height: 450px; /* Adjust as needed */
|
max-height: 450px; /* Adjust as needed */
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
td{
|
td{
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
max-width: 100px;
|
max-width: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -303,7 +305,7 @@ foreach ($period as $day) {
|
|||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu dropdown-menu-right">
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
<a class="dropdown-item" data-toggle="modal" data-target="#bs-example-modal-lg">Navigation</a>
|
<a class="dropdown-item" data-toggle="modal" data-target="#bs-example-modal-lg">Navigation</a>
|
||||||
<a class="dropdown-item" href="#">Export</a>
|
<a class="dropdown-item" id="dieselMachineStockDetailsExport" href="#">Export</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -661,7 +663,7 @@ foreach ($period as $day) {
|
|||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
><?= $previousMonthTotalDieselMachineStockDetails[0]['balance_stock'] !=0 ?? " " ?></td>
|
><?= $previousMonthTotalDieselMachineStockDetails[0]['balance_stock'] ?></td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -677,7 +679,7 @@ foreach ($period as $day) {
|
|||||||
<td class="celda_normal balanceTD"
|
<td class="celda_normal balanceTD"
|
||||||
data-id="<?= $dateInMonth ?>"
|
data-id="<?= $dateInMonth ?>"
|
||||||
|
|
||||||
><?= $previousMonthTotalDieselMachineStockDetails[0]['balance_stock'] !=0 ?? " " ?></td>
|
><?= $previousMonthTotalDieselMachineStockDetails[0]['balance_stock'] ?></td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -707,13 +709,13 @@ foreach ($period as $day) {
|
|||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
><?= $previousMonthDieselMachineStockDetails[$dieselMachineIndex]['closing_reading'] ?? ' ' ?>
|
><?= $previousMonthDieselMachineStockDetails[$dieselMachineIndex]['closing_reading'] ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="celda_normal closingReading"
|
<td class="celda_normal closingReading"
|
||||||
data-id="<?= $dateInMonth ?> <?= $dieselMachine['id'] ?>"
|
data-id="<?= $dateInMonth ?> <?= $dieselMachine['id'] ?>"
|
||||||
oninput="closingReadingChange(this)"
|
oninput="closingReadingChange(this)"
|
||||||
contenteditable="true"><?= $previousMonthDieselMachineStockDetails[$dieselMachineIndex]['closing_reading'] ?? ' ' ?>
|
contenteditable="true"><?= $previousMonthDieselMachineStockDetails[$dieselMachineIndex]['closing_reading'] ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="celda_normal fillingDiesel"
|
<td class="celda_normal fillingDiesel"
|
||||||
@ -1286,4 +1288,32 @@ foreach ($period as $day) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
function exportTableToExcel(tableID, filename = '') {
|
||||||
|
let table = document.getElementById(tableID);
|
||||||
|
let ws = XLSX.utils.table_to_sheet(table); // Convert table to worksheet
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
let tableId = 'dieselStockDetailsTableId';
|
||||||
|
|
||||||
|
document.getElementById('dieselMachineStockDetailsExport').addEventListener('click',function(){
|
||||||
|
|
||||||
|
exportTableToExcel(tableId,'Diesel_Machine_Stock_<?=$month?>.xlsx');
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -187,57 +187,75 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#drierTable th:nth-child(1),
|
.celda_encabezado_general {
|
||||||
#drierTable td:nth-child(1) {
|
|
||||||
position: sticky;
|
|
||||||
left: 0;
|
|
||||||
background-color: #00a65a;
|
|
||||||
z-index: 2;
|
|
||||||
border-right: 2px solid #ddd;
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#drierTableSummaryId td:nth-child(1) {
|
|
||||||
position: sticky;
|
|
||||||
left: 0;
|
|
||||||
background-color: #ffffff;
|
|
||||||
z-index: 2;
|
|
||||||
border-right: 2px solid #ddd;
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fht-table th:nth-child(1)
|
|
||||||
{
|
|
||||||
position: sticky;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
background-color: #00a65a;
|
|
||||||
z-index: 7!important;
|
|
||||||
border-right: 2px solid #ddd;
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.fht-table td:nth-child(1)
|
|
||||||
{
|
|
||||||
position: sticky;
|
|
||||||
left: 0;
|
|
||||||
background-color: #00a65a;
|
background-color: #00a65a;
|
||||||
z-index: 2;
|
border: 1px solid #ccc;
|
||||||
border-right: 2px solid #ddd;
|
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 6px 10px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-responsive {
|
.celda_encabezado_total {
|
||||||
overflow-y: auto;
|
background-color:#ffffff !important;
|
||||||
max-height: 450px;
|
border: 1px solid #ffffff;
|
||||||
|
color: #ffffff !important;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 6px 10px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.celda_normal {
|
||||||
|
/*background-color: #fff;*/
|
||||||
|
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 10px 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: #00a65a; /* Header background color */
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-menu {
|
||||||
|
z-index :25 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Ensure each <th> in thead stays sticky */
|
||||||
.fht-table thead th {
|
.fht-table thead th {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 5!important;
|
z-index: 11; /* Higher than table rows but lower than first column */
|
||||||
|
background-color: #00a65a; /* Green background */
|
||||||
|
color: #ffffff;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sticky First Column */
|
||||||
|
.fht-table th:nth-child(1),
|
||||||
|
.fht-table td:nth-child(1) {
|
||||||
|
position: sticky;
|
||||||
|
left: 0;
|
||||||
|
background-color: #00a65a;
|
||||||
|
z-index: 15; /* Ensures it stays above other cells */
|
||||||
|
border-right: 2px solid #ddd;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Table Wrapper for Scrolling */
|
||||||
|
.table-responsive {
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: auto;
|
||||||
|
max-height: 450px; /* Adjust as needed */
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -828,7 +846,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
|
|
||||||
document.getElementById('drierMachineDetailsExport').addEventListener('click',function(){
|
document.getElementById('drierMachineDetailsExport').addEventListener('click',function(){
|
||||||
|
|
||||||
exportTableToExcel(tableId,'drierMachineDetails.xlsx');
|
exportTableToExcel(tableId,'drierMachineDetails_<?=$datefordropdown?>.xlsx');
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -885,6 +903,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
|
|
||||||
$('#loader').hide();
|
$('#loader').hide();
|
||||||
alert(data);
|
alert(data);
|
||||||
|
window.location.reload();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -98,17 +98,7 @@
|
|||||||
padding-top: 8px;
|
padding-top: 8px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.celda_encabezado_general {
|
|
||||||
background-color: #00a65a;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
color: #ffffff;
|
|
||||||
font-weight: bold;
|
|
||||||
padding: 6px 10px;;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
._Separador {
|
._Separador {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
@ -122,13 +112,7 @@
|
|||||||
width: 4px;
|
width: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.celda_normal {
|
|
||||||
/*background-color: #fff;*/
|
|
||||||
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
|
||||||
text-align: center;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
padding: 2px 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*style excel*/
|
/*style excel*/
|
||||||
.excel_cell {
|
.excel_cell {
|
||||||
@ -156,18 +140,11 @@
|
|||||||
height: 20px;
|
height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#dustAndRoughStockDetailsTableId th:nth-child(1),
|
|
||||||
#dustAndRoughStockDetailsTableId td:nth-child(1) {
|
|
||||||
position: sticky;
|
|
||||||
left: 0;
|
|
||||||
background-color: #00a65a;
|
|
||||||
z-index: 2;
|
|
||||||
border-right: 2px solid #ddd;
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.celda_encabezado_total {
|
|
||||||
background-color:#ffffff;
|
.celda_encabezado_general {
|
||||||
|
background-color: #00a65a;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@ -175,9 +152,79 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal {
|
.celda_encabezado_total {
|
||||||
padding-right: 30% ! important;
|
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;*/
|
||||||
|
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 10px 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: #00a65a; /* Header background color */
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-menu {
|
||||||
|
z-index :25 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Ensure each <th> 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: #00a65a; /* Green background */
|
||||||
|
color: #ffffff;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sticky First Column */
|
||||||
|
.fht-table th:nth-child(1),
|
||||||
|
.fht-table td:nth-child(1) {
|
||||||
|
position: sticky;
|
||||||
|
left: 0;
|
||||||
|
background-color: #00a65a;
|
||||||
|
z-index: 15; /* Ensures it stays above other cells */
|
||||||
|
border-right: 2px solid #ddd;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Table Wrapper for Scrolling */
|
||||||
|
.table-responsive {
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: auto;
|
||||||
|
max-height: 450px; /* Adjust as needed */
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
td{
|
||||||
|
min-width: 150px;
|
||||||
|
max-width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<div class="content-page">
|
<div class="content-page">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
@ -223,6 +270,18 @@
|
|||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<button type="submit" class="btn btn-success"> Change Month </button>
|
<button type="submit" class="btn btn-success"> Change Month </button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-1"></div>
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="dropdown float-right">
|
||||||
|
<a href="#" class="dropdown-toggle arrow-none" data-toggle="dropdown"
|
||||||
|
aria-expanded="false">
|
||||||
|
<i class="mdi mdi-dots-vertical m-0 text-muted h3"></i>
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
|
<a class="dropdown-item" id="dustAndRoughStockExport" href="#">Export</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@ -277,17 +336,17 @@
|
|||||||
data-id="<?= $dustAndRoughStockDetail['date'] ?>"
|
data-id="<?= $dustAndRoughStockDetail['date'] ?>"
|
||||||
oninput="finalRoughStockChange(this)"
|
oninput="finalRoughStockChange(this)"
|
||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
><?= $dustAndRoughStockDetail['finalRough'] ?></td>
|
><?= $dustAndRoughStockDetail['finalRough'] ?? ' ' ?></td>
|
||||||
|
|
||||||
<td class="celda_normal dust"
|
<td class="celda_normal dust"
|
||||||
data-id="<?= $dustAndRoughStockDetail['date'] ?>"
|
data-id="<?= $dustAndRoughStockDetail['date'] ?>"
|
||||||
oninput="dustStockChange(this)"
|
oninput="dustStockChange(this)"
|
||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
><?= $dustAndRoughStockDetail['dust'] ?></td>
|
><?= $dustAndRoughStockDetail['dust'] ?? ' ' ?></td>
|
||||||
|
|
||||||
<td class="celda_normal total"
|
<td class="celda_normal total"
|
||||||
data-id="<?= $dustAndRoughStockDetail['date'] ?>"
|
data-id="<?= $dustAndRoughStockDetail['date'] ?>"
|
||||||
><?= $dustAndRoughStockDetail['total'] ?></td>
|
><?= $dustAndRoughStockDetail['total'] ?? ' ' ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<div class="table-responsive" style="width: 700px;">
|
<div class="table-responsive" style="width: 700px;">
|
||||||
@ -308,7 +367,7 @@
|
|||||||
|
|
||||||
$summary['finalRough'] += $dustAndRoughStockDetail['finalRough'] == "-" ? 0 : (float) $dustAndRoughStockDetail['finalRough'] ;
|
$summary['finalRough'] += $dustAndRoughStockDetail['finalRough'] == "-" ? 0 : (float) $dustAndRoughStockDetail['finalRough'] ;
|
||||||
$summary['dust'] += $dustAndRoughStockDetail['dust'] == "-" ? 0 : (float) $dustAndRoughStockDetail['dust'] ;
|
$summary['dust'] += $dustAndRoughStockDetail['dust'] == "-" ? 0 : (float) $dustAndRoughStockDetail['dust'] ;
|
||||||
$summary['total'] += $dustAndRoughStockDetail['total'] == "-" ? 0 :(float) $dustAndRoughStockDetail['total'] ;
|
$summary['total'] += $dustAndRoughStockDetail['total'] == "-" ? 0 : (float) $dustAndRoughStockDetail['total'] ;
|
||||||
|
|
||||||
} ?>
|
} ?>
|
||||||
|
|
||||||
@ -377,17 +436,17 @@
|
|||||||
data-id="<?= $dateInMonth ?>"
|
data-id="<?= $dateInMonth ?>"
|
||||||
oninput="finalRoughStockChange(this)"
|
oninput="finalRoughStockChange(this)"
|
||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
><?= 0 ?></td>
|
><?= ' ' ?></td>
|
||||||
|
|
||||||
<td class="celda_normal dust"
|
<td class="celda_normal dust"
|
||||||
data-id="<?= $dateInMonth ?>"
|
data-id="<?= $dateInMonth ?>"
|
||||||
oninput="dustStockChange(this)"
|
oninput="dustStockChange(this)"
|
||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
><?= 0 ?></td>
|
><?= ' ' ?></td>
|
||||||
|
|
||||||
<td class="celda_normal total"
|
<td class="celda_normal total"
|
||||||
data-id="<?= $dateInMonth ?>"
|
data-id="<?= $dateInMonth ?>"
|
||||||
><?= 0 ?></td>
|
><?= ' ' ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
@ -509,8 +568,8 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
let dataId = tdElement.getAttribute('data-id')
|
let dataId = tdElement.getAttribute('data-id')
|
||||||
let finalRoughStock = tdElement.innerText;
|
let finalRoughStock = validateInput(tdElement.innerText);
|
||||||
let dustStock = document.querySelector(`td.dust[data-id="${dataId}"]`).innerText;
|
let dustStock = validateInput(document.querySelector(`td.dust[data-id="${dataId}"]`).innerText);
|
||||||
let total = (Number(finalRoughStock) + Number(dustStock)) ;
|
let total = (Number(finalRoughStock) + Number(dustStock)) ;
|
||||||
document.querySelector(`td.total[data-id="${dataId}"]`).innerText=total;
|
document.querySelector(`td.total[data-id="${dataId}"]`).innerText=total;
|
||||||
|
|
||||||
@ -522,8 +581,8 @@
|
|||||||
function dustStockChange(tdElement) {
|
function dustStockChange(tdElement) {
|
||||||
try{
|
try{
|
||||||
let dataId = tdElement.getAttribute('data-id')
|
let dataId = tdElement.getAttribute('data-id')
|
||||||
let finalRoughStock = document.querySelector(`td.finalRough[data-id="${dataId}"]`).innerText;
|
let finalRoughStock = validateInput(document.querySelector(`td.finalRough[data-id="${dataId}"]`).innerText);
|
||||||
let dustStock = tdElement.innerText;
|
let dustStock = validateInput(tdElement.innerText);
|
||||||
let total = (Number(finalRoughStock) + Number(dustStock)) ;
|
let total = (Number(finalRoughStock) + Number(dustStock)) ;
|
||||||
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total;
|
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total;
|
||||||
|
|
||||||
@ -536,6 +595,58 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function validateInput(input) {
|
||||||
|
|
||||||
|
|
||||||
|
if (input == '' || input == ' ' || input == '-') {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof input === 'string' && input.split('').map(char => char.charCodeAt(0))[0] == 10) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate against the regex
|
||||||
|
const isValid = /^-?\d*\.?\d*$/.test(input);
|
||||||
|
if (!isValid) {
|
||||||
|
alert('Invalid input! Please enter a valid number.');
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
function exportTableToExcel(tableID, filename = '') {
|
||||||
|
let table = document.getElementById(tableID);
|
||||||
|
let ws = XLSX.utils.table_to_sheet(table); // Convert table to worksheet
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
let tableId = 'dustAndRoughStockDetailsTableId';
|
||||||
|
|
||||||
|
document.getElementById('dustAndRoughStockExport').addEventListener('click',function(){
|
||||||
|
|
||||||
|
exportTableToExcel(tableId ,'dustAndRoughStockDetails.xlsx');
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -1729,7 +1729,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
document.getElementById('incomingSilicaSandDetailsExport').addEventListener('click',function(){
|
document.getElementById('incomingSilicaSandDetailsExport').addEventListener('click',function(){
|
||||||
|
|
||||||
exportTableToExcel(tableId,'incomingSilicaSandDetails.xlsx');
|
exportTableToExcel(tableId,'incomingSilicaSandDetails_<?=$month?>.xlsx');
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -100,26 +100,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.celda_encabezado_general {
|
|
||||||
background-color: #00a65a;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
color: #ffffff;
|
|
||||||
font-weight: bold;
|
|
||||||
padding: 6px 10px;
|
|
||||||
;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.celda_encabezado_total {
|
|
||||||
background-color:#ffffff;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
color: #ffffff;
|
|
||||||
font-weight: bold;
|
|
||||||
padding: 6px 10px;
|
|
||||||
;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
._Separador {
|
._Separador {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
@ -133,14 +113,6 @@
|
|||||||
width: 4px;
|
width: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.celda_normal {
|
|
||||||
/*background-color: #fff;*/
|
|
||||||
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
|
||||||
text-align: center;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
padding: 2px 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*style excel*/
|
/*style excel*/
|
||||||
.excel_cell {
|
.excel_cell {
|
||||||
border: 1px solid #CCC;
|
border: 1px solid #CCC;
|
||||||
@ -167,36 +139,81 @@
|
|||||||
height: 20px;
|
height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#resinStockDetailsTableId th:nth-child(1),
|
|
||||||
#resinStockDetailsTableId td:nth-child(1) {
|
.celda_encabezado_general {
|
||||||
position: sticky;
|
|
||||||
left: 0;
|
|
||||||
background-color: #00a65a;
|
background-color: #00a65a;
|
||||||
z-index: 2;
|
border: 1px solid #ccc;
|
||||||
border-right: 2px solid #ddd;
|
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 6px 10px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.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;*/
|
||||||
|
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 10px 6px;
|
||||||
|
}
|
||||||
|
|
||||||
#resinStockDetailsTableSummaryId th:nth-child(1),
|
|
||||||
#resinStockDetailsTableSummaryId td:nth-child(1) {
|
/* Make entire thead sticky */
|
||||||
|
.fht-table thead {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
left: 0;
|
top: 0;
|
||||||
background-color: #00a65a;
|
z-index: 20; /* Ensure the entire header stays above table rows */
|
||||||
z-index: 2;
|
background-color: #00a65a; /* Header background color */
|
||||||
border-right: 2px solid #ddd;
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-responsive {
|
.dropdown-menu {
|
||||||
overflow-y: auto;
|
z-index :25 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Ensure each <th> in thead stays sticky */
|
||||||
.fht-table thead th {
|
.fht-table thead th {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 5!important;
|
z-index: 11; /* Higher than table rows but lower than first column */
|
||||||
|
background-color: #00a65a; /* Green background */
|
||||||
|
color: #ffffff;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sticky First Column */
|
||||||
|
.fht-table th:nth-child(1),
|
||||||
|
.fht-table td:nth-child(1) {
|
||||||
|
position: sticky;
|
||||||
|
left: 0;
|
||||||
|
background-color: #00a65a;
|
||||||
|
z-index: 15; /* Ensures it stays above other cells */
|
||||||
|
border-right: 2px solid #ddd;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Table Wrapper for Scrolling */
|
||||||
|
.table-responsive {
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: auto;
|
||||||
|
max-height: 450px; /* Adjust as needed */
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
td{
|
||||||
|
min-width: 100px;
|
||||||
|
max-width: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -365,13 +382,14 @@ foreach ($period as $day) {
|
|||||||
</td>
|
</td>
|
||||||
<td style="display:none"
|
<td style="display:none"
|
||||||
data-id="<?= $resinStock['date'] ?> <?= $resinStock['materialCode'] ?>"
|
data-id="<?= $resinStock['date'] ?> <?= $resinStock['materialCode'] ?>"
|
||||||
class="materialCode"><?= $resinStock['materialCode'] ?>
|
class="materialCode">
|
||||||
|
<?= $resinStock['materialCode'] ?? ' ' ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td style="display:none" class="celda_normal customer"
|
<td style="display:none" class="celda_normal customer"
|
||||||
data-materialCode="<?= $resinStock['materialCode'] ?>"
|
data-materialCode="<?= $resinStock['materialCode'] ?>"
|
||||||
data-id="<?= $resinStock['date'] ?> <?= $resinStock['materialCode'] ?>">
|
data-id="<?= $resinStock['date'] ?> <?= $resinStock['materialCode'] ?>">
|
||||||
<?= $resinStock['customer'] ?>
|
<?= $resinStock['customer'] ?? ' ' ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="celda_normal openingStock"
|
<td class="celda_normal openingStock"
|
||||||
@ -380,25 +398,25 @@ foreach ($period as $day) {
|
|||||||
<?php if ($groupedResinStockDetailsIndex == 0): ?>
|
<?php if ($groupedResinStockDetailsIndex == 0): ?>
|
||||||
oninput="openingStockChange(this)"
|
oninput="openingStockChange(this)"
|
||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
<?php endif; ?>><?= $resinStock['opening'] ?>
|
<?php endif; ?>><?= $resinStock['opening'] ?? ' ' ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="celda_normal receiptStock"
|
<td class="celda_normal receiptStock"
|
||||||
data-id="<?= $resinStock['date'] ?> <?= $resinStock['materialCode'] ?>"
|
data-id="<?= $resinStock['date'] ?> <?= $resinStock['materialCode'] ?>"
|
||||||
oninput="receiptStockChange(this)"
|
oninput="receiptStockChange(this)"
|
||||||
contenteditable="true">
|
contenteditable="true">
|
||||||
<?= $resinStock['receipt'] ?>
|
<?= $resinStock['receipt'] ?? ' ' ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="celda_normal usedStock"
|
<td class="celda_normal usedStock"
|
||||||
data-id="<?= $resinStock['date'] ?> <?= $resinStock['materialCode'] ?>"
|
data-id="<?= $resinStock['date'] ?> <?= $resinStock['materialCode'] ?>"
|
||||||
oninput="usedStockChange(this)"
|
oninput="usedStockChange(this)"
|
||||||
contenteditable="true"><?= $resinStock['used'] ?>
|
contenteditable="true"><?= $resinStock['used'] ?? ' ' ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="celda_normal balanceStock"
|
<td class="celda_normal balanceStock"
|
||||||
data-id="<?= $resinStock['date'] ?> <?= $resinStock['materialCode'] ?>">
|
data-id="<?= $resinStock['date'] ?> <?= $resinStock['materialCode'] ?>">
|
||||||
<?= $resinStock['balanceStock'] ?>
|
<?= $resinStock['balanceStock'] ?? ' ' ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
@ -421,10 +439,10 @@ foreach ($period as $day) {
|
|||||||
|
|
||||||
// Sum values for the material
|
// Sum values for the material
|
||||||
;
|
;
|
||||||
$summary[$materialCode]['opening'] = "-" ;
|
$summary[$materialCode]['opening'] = "-" ;
|
||||||
$summary[$materialCode]['receipt'] += $resinStock['receipt'] == '-' ? 0 :$resinStock['receipt'] ;
|
$summary[$materialCode]['receipt'] += is_numeric($resinStock['receipt']) ? $resinStock['receipt'] : 0;
|
||||||
$summary[$materialCode]['used'] += $resinStock['used'] == '-' ? 0 :$resinStock['used'] ;
|
$summary[$materialCode]['used'] += is_numeric($resinStock['used']) ? $resinStock['used'] : 0;
|
||||||
$summary[$materialCode]['balanceStock'] = $resinStock['balanceStock'] == '-' ? 0 :$resinStock['balanceStock'] ;
|
$summary[$materialCode]['balanceStock'] = is_numeric($resinStock['balanceStock']) ? $resinStock['balanceStock'] : 0;
|
||||||
|
|
||||||
} ?>
|
} ?>
|
||||||
|
|
||||||
@ -522,20 +540,20 @@ foreach ($period as $day) {
|
|||||||
oninput="openingStockChange(this)"
|
oninput="openingStockChange(this)"
|
||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
|
|
||||||
<?php } ?>><?= $previousMonthResinStockDetails[$resinMaterialIndex]['balanceStock'] ?? '-' ?></td>
|
<?php } ?>><?= $previousMonthResinStockDetails[$resinMaterialIndex]['balanceStock'] ?? ' ' ?></td>
|
||||||
|
|
||||||
<td class="celda_normal receiptStock"
|
<td class="celda_normal receiptStock"
|
||||||
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"
|
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"
|
||||||
oninput="receiptStockChange(this)"
|
oninput="receiptStockChange(this)"
|
||||||
contenteditable="true">-</td>
|
contenteditable="true"> <?= ' ' ?> </td>
|
||||||
|
|
||||||
<td class="celda_normal usedStock"
|
<td class="celda_normal usedStock"
|
||||||
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"
|
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"
|
||||||
oninput="usedStockChange(this)"
|
oninput="usedStockChange(this)"
|
||||||
contenteditable="true">-</td>
|
contenteditable="true"> <?= ' ' ?> </td>
|
||||||
|
|
||||||
<td class="celda_normal balanceStock"
|
<td class="celda_normal balanceStock"
|
||||||
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"><?= $previousMonthResinStockDetails[$resinMaterialIndex]['balanceStock'] ?? '-' ?></td>
|
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"><?= $previousMonthResinStockDetails[$resinMaterialIndex]['balanceStock'] ?? ' ' ?></td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@ -816,9 +834,9 @@ foreach ($period as $day) {
|
|||||||
try {
|
try {
|
||||||
let dataId = tdElement.getAttribute('data-id');
|
let dataId = tdElement.getAttribute('data-id');
|
||||||
let [date, materialCode] = tdElement.getAttribute('data-id').split(' ');
|
let [date, materialCode] = tdElement.getAttribute('data-id').split(' ');
|
||||||
let openingStock = document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText;
|
let openingStock = validateInput(document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText);
|
||||||
let receiptStock = document.querySelector(`td.receiptStock[data-id="${dataId}"]`).innerText;
|
let receiptStock = validateInput(document.querySelector(`td.receiptStock[data-id="${dataId}"]`).innerText);
|
||||||
let usedStock = tdElement.innerText;
|
let usedStock = validateInput(tdElement.innerText);
|
||||||
let currentBalanceStock = (Number(openingStock) + Number(receiptStock)) - Number(usedStock);
|
let currentBalanceStock = (Number(openingStock) + Number(receiptStock)) - Number(usedStock);
|
||||||
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock;
|
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock;
|
||||||
|
|
||||||
@ -876,7 +894,7 @@ foreach ($period as $day) {
|
|||||||
|
|
||||||
let dataId = `${otherDate} ${materialCode}`;
|
let dataId = `${otherDate} ${materialCode}`;
|
||||||
|
|
||||||
document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText = currentBalanceStock;
|
document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText = currentBalanceStock == 0 ? " " : currentBalanceStock;
|
||||||
|
|
||||||
let usedStock = validateInput(document.querySelector(`td.usedStock[data-id="${dataId}"]`).innerText);
|
let usedStock = validateInput(document.querySelector(`td.usedStock[data-id="${dataId}"]`).innerText);
|
||||||
|
|
||||||
@ -884,8 +902,7 @@ foreach ($period as $day) {
|
|||||||
|
|
||||||
currentBalanceStock = (Number(currentBalanceStock) + Number(receiptStock)) - Number(usedStock);
|
currentBalanceStock = (Number(currentBalanceStock) + Number(receiptStock)) - Number(usedStock);
|
||||||
|
|
||||||
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock;
|
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock == 0 ? " " : currentBalanceStock;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -98,16 +98,6 @@
|
|||||||
padding-top: 8px;
|
padding-top: 8px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.celda_encabezado_general {
|
|
||||||
background-color: #00a65a;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
color: #ffffff;
|
|
||||||
font-weight: bold;
|
|
||||||
padding: 6px 10px;;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
._Separador {
|
._Separador {
|
||||||
@ -122,13 +112,7 @@
|
|||||||
width: 4px;
|
width: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.celda_normal {
|
|
||||||
/*background-color: #fff;*/
|
|
||||||
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
|
||||||
text-align: center;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
padding: 2px 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*style excel*/
|
/*style excel*/
|
||||||
.excel_cell {
|
.excel_cell {
|
||||||
@ -156,18 +140,10 @@
|
|||||||
height: 20px;
|
height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#trpSandUseStockDetailsTableId th:nth-child(1),
|
|
||||||
#trpSandUseStockDetailsTableId td:nth-child(1) {
|
|
||||||
position: sticky;
|
|
||||||
left: 0;
|
|
||||||
background-color: #00a65a;
|
|
||||||
z-index: 2;
|
|
||||||
border-right: 2px solid #ddd;
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.celda_encabezado_total {
|
|
||||||
background-color:#ffffff;
|
.celda_encabezado_general {
|
||||||
|
background-color: #00a65a;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@ -175,9 +151,77 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal {
|
.celda_encabezado_total {
|
||||||
padding-right: 30% ! important;
|
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;*/
|
||||||
|
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 10px 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: #00a65a; /* Header background color */
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-menu {
|
||||||
|
z-index :25 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Ensure each <th> 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: #00a65a; /* Green background */
|
||||||
|
color: #ffffff;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sticky First Column */
|
||||||
|
.fht-table th:nth-child(1),
|
||||||
|
.fht-table td:nth-child(1) {
|
||||||
|
position: sticky;
|
||||||
|
left: 0;
|
||||||
|
background-color: #00a65a;
|
||||||
|
z-index: 15; /* Ensures it stays above other cells */
|
||||||
|
border-right: 2px solid #ddd;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Table Wrapper for Scrolling */
|
||||||
|
.table-responsive {
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: auto;
|
||||||
|
max-height: 450px; /* Adjust as needed */
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
td{
|
||||||
|
min-width: 150px;
|
||||||
|
max-width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
@ -234,7 +278,7 @@
|
|||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table style="width: 700px;" id="trpSandUseStockDetailsTableId" class="fht-table table-striped">
|
<table style="width: 700px;" id="trpSandUseStockDetailsTableId" class="fht-table table-striped">
|
||||||
|
|
||||||
<thead class="celda_encabezado_general" style="padding: 10px;">
|
<thead class="celda_encabezado_general" >
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th class="celda_encabezado_general" colspan="5" >Trp Sand To Use Coating Sand </th>
|
<th class="celda_encabezado_general" colspan="5" >Trp Sand To Use Coating Sand </th>
|
||||||
@ -281,26 +325,26 @@
|
|||||||
data-id="<?= $trpSandUseStockDetail['date'] ?>"
|
data-id="<?= $trpSandUseStockDetail['date'] ?>"
|
||||||
oninput="roughStockChange(this)"
|
oninput="roughStockChange(this)"
|
||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
><?= $trpSandUseStockDetail['rough_kgs'] ?></td>
|
><?= $trpSandUseStockDetail['rough_kgs'] ?? " " ?></td>
|
||||||
|
|
||||||
<td class="celda_normal fine"
|
<td class="celda_normal fine"
|
||||||
data-id="<?= $trpSandUseStockDetail['date'] ?>"
|
data-id="<?= $trpSandUseStockDetail['date'] ?>"
|
||||||
oninput="fineStockChange(this)"
|
oninput="fineStockChange(this)"
|
||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
><?= $trpSandUseStockDetail['fine_kgs'] ?></td>
|
><?= $trpSandUseStockDetail['fine_kgs'] ?? " " ?></td>
|
||||||
|
|
||||||
<td class="celda_normal total"
|
<td class="celda_normal total"
|
||||||
data-id="<?= $trpSandUseStockDetail['date'] ?>"
|
data-id="<?= $trpSandUseStockDetail['date'] ?>"
|
||||||
><?= $trpSandUseStockDetail['total_kgs'] ?></td>
|
><?= $trpSandUseStockDetail['total_kgs'] ?? " " ?></td>
|
||||||
|
|
||||||
<td class="celda_normal customerName"
|
<td class="celda_normal customerName"
|
||||||
data-id="<?= $trpSandUseStockDetail['date'] ?>"
|
data-id="<?= $trpSandUseStockDetail['date'] ?>"
|
||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
><?= $trpSandUseStockDetail['customer_name'] ?></td>
|
><?= $trpSandUseStockDetail['customer_name'] ?? " " ?></td>
|
||||||
|
|
||||||
<td style="display:none"
|
<td style="display:none"
|
||||||
data-id="<?= $trpSandUseStockDetail['date'] ?>"
|
data-id="<?= $trpSandUseStockDetail['date'] ?>"
|
||||||
><?= $trpSandUseStockDetail['id'] ?></td>
|
><?= $trpSandUseStockDetail['id'] ?? " " ?></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -318,17 +362,18 @@
|
|||||||
$summary['rough_kgs'] += $trpSandUseStockDetail['rough_kgs'] == "-" ? 0 : (float) $trpSandUseStockDetail['rough_kgs'] ;
|
$summary['rough_kgs'] += $trpSandUseStockDetail['rough_kgs'] == "-" ? 0 : (float) $trpSandUseStockDetail['rough_kgs'] ;
|
||||||
$summary['fine_kgs'] += $trpSandUseStockDetail['fine_kgs'] == "-" ? 0 : (float) $trpSandUseStockDetail['fine_kgs'] ;
|
$summary['fine_kgs'] += $trpSandUseStockDetail['fine_kgs'] == "-" ? 0 : (float) $trpSandUseStockDetail['fine_kgs'] ;
|
||||||
$summary['total_kgs'] += $trpSandUseStockDetail['total_kgs'] == "-" ? 0 :(float) $trpSandUseStockDetail['total_kgs'] ;
|
$summary['total_kgs'] += $trpSandUseStockDetail['total_kgs'] == "-" ? 0 :(float) $trpSandUseStockDetail['total_kgs'] ;
|
||||||
} ?>
|
|
||||||
|
} ?>
|
||||||
|
|
||||||
<div class="table-responsive" style="width: 700px;">
|
<div class="table-responsive" style="width: 700px;">
|
||||||
|
|
||||||
<table id="trpSandUseStockDetailsTableSummaryId" class="fht-table table-striped">
|
<table id="trpSandUseStockDetailsTableSummaryId" class="fht-table table-striped">
|
||||||
|
|
||||||
<thead >
|
<thead >
|
||||||
<th class="celda_encabezado_total" style="width: 100px;">Total </th>
|
<th class="celda_encabezado_total" >Total </th>
|
||||||
<th class="celda_encabezado_total" style="width: 150px;">Rough Kgs </th>
|
<th class="celda_encabezado_total" >Rough Kgs </th>
|
||||||
<th class="celda_encabezado_total" style="width: 120px;">Fine Kgs </th>
|
<th class="celda_encabezado_total" >Fine Kgs </th>
|
||||||
<th class="celda_encabezado_total" style="width: 130px;">Total Kgs </th>
|
<th class="celda_encabezado_total" >Total Kgs </th>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -394,31 +439,31 @@
|
|||||||
data-id="<?= $dateInMonth ?>"
|
data-id="<?= $dateInMonth ?>"
|
||||||
oninput="roughStockChange(this)"
|
oninput="roughStockChange(this)"
|
||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
><?= 0 ?></td>
|
><?= " " ?></td>
|
||||||
|
|
||||||
<!-- td:eq(2) -->
|
<!-- td:eq(2) -->
|
||||||
<td class="celda_normal fine"
|
<td class="celda_normal fine"
|
||||||
data-id="<?= $dateInMonth ?>"
|
data-id="<?= $dateInMonth ?>"
|
||||||
oninput="fineStockChange(this)"
|
oninput="fineStockChange(this)"
|
||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
><?= 0 ?></td>
|
><?= " " ?></td>
|
||||||
|
|
||||||
<!-- td:eq(3) -->
|
<!-- td:eq(3) -->
|
||||||
<td class="celda_normal total"
|
<td class="celda_normal total"
|
||||||
data-id="<?= $dateInMonth ?>"
|
data-id="<?= $dateInMonth ?>"
|
||||||
><?= 0 ?></td>
|
><?= " " ?></td>
|
||||||
|
|
||||||
<!-- td:eq(4) -->
|
<!-- td:eq(4) -->
|
||||||
<td class="celda_normal customer"
|
<td class="celda_normal customer"
|
||||||
data-id="<?= $dateInMonth ?>"
|
data-id="<?= $dateInMonth ?>"
|
||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
><?= " " ?></td>
|
><?= " " ?></td>
|
||||||
|
|
||||||
<!-- td:eq(5) -->
|
<!-- td:eq(5) -->
|
||||||
<td style="display:none"
|
<td style="display:none"
|
||||||
data-id="<?= $dateInMonth ?>"
|
data-id="<?= $dateInMonth ?>"
|
||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
><?= " " ?></td>
|
><?= " " ?></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
@ -537,10 +582,10 @@
|
|||||||
console.log("just an alert from RoughStockChange..!!")
|
console.log("just an alert from RoughStockChange..!!")
|
||||||
console.log(tdElement.innerText)
|
console.log(tdElement.innerText)
|
||||||
let dataId = tdElement.getAttribute('data-id')
|
let dataId = tdElement.getAttribute('data-id')
|
||||||
let roughStock = tdElement.innerText;
|
let roughStock = validateInput(tdElement.innerText);
|
||||||
let fineStock = document.querySelector(`td.fine[data-id="${dataId}"]`).innerText;
|
let fineStock = validateInput(document.querySelector(`td.fine[data-id="${dataId}"]`).innerText);
|
||||||
let total = (Number(roughStock) + Number(fineStock)) ;
|
let total = (Number(roughStock) + Number(fineStock)) ;
|
||||||
document.querySelector(`td.total[data-id="${dataId}"]`).innerText=total;
|
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total == 0 ? " " : total;
|
||||||
|
|
||||||
|
|
||||||
} catch(error){
|
} catch(error){
|
||||||
@ -554,10 +599,10 @@
|
|||||||
console.log("just an alert from fineStockChange..!!")
|
console.log("just an alert from fineStockChange..!!")
|
||||||
console.log(tdElement.innerText)
|
console.log(tdElement.innerText)
|
||||||
let dataId = tdElement.getAttribute('data-id')
|
let dataId = tdElement.getAttribute('data-id')
|
||||||
let roughStock = document.querySelector(`td.rough[data-id="${dataId}"]`).innerText;
|
let roughStock = validateInput(document.querySelector(`td.rough[data-id="${dataId}"]`).innerText);
|
||||||
let fineStock = tdElement.innerText;
|
let fineStock = validateInput(tdElement.innerText) ;
|
||||||
let total = (Number(roughStock) + Number(fineStock)) ;
|
let total = (Number(roughStock) + Number(fineStock)) ;
|
||||||
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total;
|
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total == 0 ? " " : total ;
|
||||||
|
|
||||||
} catch(error){
|
} catch(error){
|
||||||
|
|
||||||
@ -567,6 +612,33 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function validateInput(input) {
|
||||||
|
|
||||||
|
|
||||||
|
if (input == '' || input == ' ' || input == '-') {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof input === 'string' && input.split('').map(char => char.charCodeAt(0))[0] == 10) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate against the regex
|
||||||
|
const isValid = /^-?\d*\.?\d*$/.test(input);
|
||||||
|
if (!isValid) {
|
||||||
|
alert('Invalid input! Please enter a valid number.');
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return input;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user