Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme
This commit is contained in:
commit
c9a4177316
@ -18,6 +18,7 @@ class Expense extends BaseController
|
|||||||
$this->expense_model = new Expense_model();
|
$this->expense_model = new Expense_model();
|
||||||
$this->supplier_model = new Supplier_model();
|
$this->supplier_model = new Supplier_model();
|
||||||
$this->session = session();
|
$this->session = session();
|
||||||
|
$this->session = session();
|
||||||
helper('form');
|
helper('form');
|
||||||
$this->isLoggedIn();
|
$this->isLoggedIn();
|
||||||
}
|
}
|
||||||
@ -86,8 +87,9 @@ class Expense extends BaseController
|
|||||||
// Generate the next serial number
|
// Generate the next serial number
|
||||||
$newSerialNumber = $this->generateSerialNumber($financialYear, $lastSerial);
|
$newSerialNumber = $this->generateSerialNumber($financialYear, $lastSerial);
|
||||||
|
|
||||||
|
$sesn_uid = $this->session->get('userId');
|
||||||
$data = [
|
$data = [
|
||||||
|
'created_by' => $sesn_uid,
|
||||||
'transporter_file' => $fileName,
|
'transporter_file' => $fileName,
|
||||||
'supplier_id' => $this->request->getPost('supplierid'),
|
'supplier_id' => $this->request->getPost('supplierid'),
|
||||||
'remarks' => $this->request->getPost('remarks'),
|
'remarks' => $this->request->getPost('remarks'),
|
||||||
@ -141,9 +143,9 @@ class Expense extends BaseController
|
|||||||
$fileName = $this->request->getPost('existing_file'); // Use existing file if no new file is uploaded
|
$fileName = $this->request->getPost('existing_file'); // Use existing file if no new file is uploaded
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sesn_uid = $this->session->get('userId');
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
|
'updated_by' =>$sesn_uid,
|
||||||
'supplier_id' => $this->request->getPost('supplierid'),
|
'supplier_id' => $this->request->getPost('supplierid'),
|
||||||
'remarks' => $this->request->getPost('remarks'),
|
'remarks' => $this->request->getPost('remarks'),
|
||||||
'item_description' => $this->request->getPost('item_description'),
|
'item_description' => $this->request->getPost('item_description'),
|
||||||
|
|||||||
@ -156,7 +156,7 @@ class Inwardgateregister extends BaseController
|
|||||||
});
|
});
|
||||||
$data['emp_data'] = [];
|
$data['emp_data'] = [];
|
||||||
// $data['emp_data'] = $this->inwardgateregister_model->getAdditionalIGRFile();
|
// $data['emp_data'] = $this->inwardgateregister_model->getAdditionalIGRFile();
|
||||||
// print_r($data['PO_NO']);die;
|
// dd($data['PO_NO']);die;
|
||||||
|
|
||||||
$this->loadViews("inwardgateregister", $this->global, $data, NULL);
|
$this->loadViews("inwardgateregister", $this->global, $data, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -410,19 +410,25 @@ class Rawmaterialdetails extends BaseController
|
|||||||
$query = $this->rawmaterialdetails_model->insertvalueintoconfig($config);
|
$query = $this->rawmaterialdetails_model->insertvalueintoconfig($config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// on 28/jan/2025. both add and edit. category condition added.
|
||||||
function checkmaterial()
|
function checkmaterial()
|
||||||
{
|
{
|
||||||
|
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
$materialCode = $data['materialCode'] ?? '';
|
$materialCode = $data['materialCode'] ?? '';
|
||||||
$materialName = str_replace(' ', '', $data['materialName']);
|
$materialName = str_replace(' ', '', $data['materialName']);
|
||||||
|
$materialCategory = $data['materialCategory'] ?? '';
|
||||||
|
|
||||||
$this->rawmaterialdetails_model = new rawmaterialdetails_model();;
|
$query = $this->rawmaterialdetails_model->checkMaterialExists($materialCode , $materialName , $materialCategory);
|
||||||
$query = $this->rawmaterialdetails_model->checkMaterialExists($materialCode , $materialName);
|
|
||||||
|
|
||||||
|
|
||||||
return $this->response->setJSON($query);
|
return $this->response->setJSON($query);
|
||||||
|
|
||||||
|
// if (!empty($query)) {
|
||||||
|
// foreach ((array)$query as $q) {
|
||||||
|
// $text .= $q['MaterialName'] . " " . ($q['IsActive'] == 1 ? '' : ' ( Inactive ) ') . "<br>";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function exportmaterial()
|
function exportmaterial()
|
||||||
|
|||||||
@ -1698,7 +1698,7 @@ class StockController extends BaseController
|
|||||||
|
|
||||||
while ($start <= $end) {
|
while ($start <= $end) {
|
||||||
$timeValue = date('H:i', $start); // 24-hour format for value
|
$timeValue = date('H:i', $start); // 24-hour format for value
|
||||||
$timeLabel = date('h:i A', $start); // 12-hour format with AM/PM for display
|
$timeLabel = date('h:i a', $start); // 12-hour format with AM/PM for display
|
||||||
$times[$timeValue] = $timeLabel; // Store time in associative array
|
$times[$timeValue] = $timeLabel; // Store time in associative array
|
||||||
$start = strtotime('+15 minutes', $start); // Increment by 15 minutes
|
$start = strtotime('+15 minutes', $start); // Increment by 15 minutes
|
||||||
}
|
}
|
||||||
@ -1737,138 +1737,118 @@ class StockController extends BaseController
|
|||||||
|
|
||||||
public function addOrEditdrierMachineDetails()
|
public function addOrEditdrierMachineDetails()
|
||||||
{
|
{
|
||||||
$drierData = [];
|
$drierData = json_decode($this->request->getPost('drierData'), true) ?? [];
|
||||||
$drierData = json_decode($this->request->getPost('drierData'), true);
|
|
||||||
|
|
||||||
|
|
||||||
|
// If drierData is empty, check for additionalEntry
|
||||||
if (empty($drierData)) {
|
if (empty($drierData)) {
|
||||||
|
|
||||||
$additionalEntry = $this->request->getPost();
|
$additionalEntry = $this->request->getPost();
|
||||||
|
if (empty($additionalEntry)) {
|
||||||
if (!empty($additionalEntry)) {
|
|
||||||
$drierData[] = [
|
|
||||||
'Date' => $this->convertToDateWithFlexibleFormats($additionalEntry['Date'], ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "Y-m-d"),
|
|
||||||
'Drier On Time' => $additionalEntry['Drier_On_Time'],
|
|
||||||
'Drier Off Time' => $additionalEntry['Drier_Off_Time'],
|
|
||||||
'Running Hrs' => $additionalEntry['Running_Hrs'],
|
|
||||||
'Supplier Name' => $additionalEntry['Supplier_Name'],
|
|
||||||
'i/p Sand Moisture(%)' => $additionalEntry['i/p_Sand_Moisture(%)'],
|
|
||||||
'Tot Gas Consumption' => $additionalEntry['Tot_Gas_Consumption'],
|
|
||||||
'Gas Per Ton' => $additionalEntry['Gas_Per_Ton'],
|
|
||||||
'i/p Sand Qty' => $additionalEntry['i/p_Sand_Qty'],
|
|
||||||
'Moisture Loss Qty' => $additionalEntry['Moisture_Loss_Qty'],
|
|
||||||
'Sand Dried Qty' => $additionalEntry['Sand_Dried_Qty'],
|
|
||||||
'Qty Per Hrs' => $additionalEntry['Qty_Per_Hrs'],
|
|
||||||
'Dust Qty' => $additionalEntry['Dust_Qty'],
|
|
||||||
'Customer Name' => $additionalEntry['Customer_Name']
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
|
|
||||||
echo "No data received.";
|
echo "No data received.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$drierData[] = $this->mapDrierEntry($additionalEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
$message1 = '';
|
|
||||||
|
|
||||||
$this->db->transBegin();
|
$this->db->transBegin();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$inserts = [];
|
||||||
|
$updates = [];
|
||||||
|
|
||||||
foreach ($drierData as $row) {
|
foreach ($drierData as $row) {
|
||||||
$data = [
|
|
||||||
'date' => $this->convertToDateWithFlexibleFormats($row['Date'], ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "Y-m-d"),
|
|
||||||
'drier_on_time' => $row['Drier On Time'],
|
|
||||||
'drier_off_time' => $row['Drier Off Time'],
|
|
||||||
'drier_running_hours' => $row['Running Hrs'],
|
|
||||||
'supplier_name' => $row['Supplier Name'],
|
|
||||||
'input_sand_moisture' => $row['i/p Sand Moisture(%)'],
|
|
||||||
'total_gas_consumption' => $row['Tot Gas Consumption'],
|
|
||||||
'gas_per_ton' => $row['Gas Per Ton'],
|
|
||||||
'input_sand_qty' => $row['i/p Sand Qty'],
|
|
||||||
'moisture_loss_qty' => $row['Moisture Loss Qty'],
|
|
||||||
'sand_dried_qty' => $row['Sand Dried Qty'],
|
|
||||||
'qty_per_hours' => $row['Qty Per Hrs'],
|
|
||||||
'dust_qty' => $row['Dust Qty'],
|
|
||||||
'customer_name' => $row['Customer Name']
|
|
||||||
];
|
|
||||||
|
|
||||||
// Check if a row with the same date already exists
|
|
||||||
$existingRow = $this->drierMachineDetails_model->where('id', $row['id'] ?? '')->first();
|
$existingRow = $this->drierMachineDetails_model->where('id', $row['id'] ?? '')->first();
|
||||||
|
$data = $this->mapDrierEntry($row, $existingRow);
|
||||||
$inserts = [];
|
|
||||||
$updates = [];
|
|
||||||
|
|
||||||
if ($existingRow) {
|
if ($existingRow) {
|
||||||
// If exists, update the row
|
$this->handleGasStockUpdate($existingRow, $row);
|
||||||
|
|
||||||
//before updating the row update gas stock
|
|
||||||
$existingDrierGasConsumption = $existingRow['total_gas_consumption'];
|
|
||||||
$updatedDrierGasConsumption = $row['Tot Gas Consumption'];
|
|
||||||
|
|
||||||
if ($existingDrierGasConsumption != $updatedDrierGasConsumption) {
|
|
||||||
|
|
||||||
$changeInConsumption = $updatedDrierGasConsumption - $existingDrierGasConsumption;
|
|
||||||
$dateToBeUpdated = $existingRow['date'];
|
|
||||||
$this->updateGasStockConsumption($dateToBeUpdated, $changeInConsumption);
|
|
||||||
}
|
|
||||||
$data['id'] = $existingRow['id'];
|
|
||||||
$updates[] = $data;
|
$updates[] = $data;
|
||||||
} else {
|
} else {
|
||||||
// If not, insert a new row
|
$this->updateGasStockConsumption($data['date'], $data['total_gas_consumption']);
|
||||||
//before inserting the row update gas stock
|
|
||||||
$consumption = $row['Tot Gas Consumption'];
|
|
||||||
$dateToBeInserted = $data['date'];
|
|
||||||
$this->updateGasStockConsumption($dateToBeInserted, $consumption);
|
|
||||||
|
|
||||||
$inserts[] = $data;
|
$inserts[] = $data;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($inserts)) {
|
if (!empty($inserts)) {
|
||||||
$this->drierMachineDetails_model->insertBatch($inserts);
|
$this->drierMachineDetails_model->insertBatch($inserts);
|
||||||
|
}
|
||||||
|
|
||||||
$message1 = "Warning..!! Kindly Update the next subsequent month Gas Stock If older month Gas Stock Updated..!!";
|
if (!empty($updates)) {
|
||||||
}
|
$this->drierMachineDetails_model->updateBatch($updates, 'id');
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($updates)) {
|
if ($this->db->transStatus() === false) {
|
||||||
$this->drierMachineDetails_model->updateBatch($updates, 'id');
|
throw new \Exception('Transaction failed due to database error.');
|
||||||
|
|
||||||
$message1 = "Warning..!! Kindly Update the next subsequent month Gas Stock If older month Gas Stock Updated..!!";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->db->transStatus() === false) {
|
|
||||||
throw new \Exception('Transaction failed due to database error.');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->transCommit();
|
$this->db->transCommit();
|
||||||
|
|
||||||
if (!empty($additionalEntry)) {
|
// Redirect if additional entry was provided
|
||||||
// Data to be sent via POST
|
if (!empty($additionalEntry)) {
|
||||||
$postData = [
|
$this->redirectToDrierMachineDetails($additionalEntry['date']);
|
||||||
'month' => $this->convertToDateWithFlexibleFormats($additionalEntry['Date'], ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "M-Y"),
|
return;
|
||||||
|
|
||||||
];
|
|
||||||
|
|
||||||
echo '<form id="postForm" action="' . base_url('drierMachineDetails') . '" method="POST">';
|
|
||||||
foreach ($postData as $key => $value) {
|
|
||||||
echo '<input type="hidden" name="' . $key . '" value="' . $value . '">';
|
|
||||||
}
|
|
||||||
echo '</form>';
|
|
||||||
echo '<script type="text/javascript">
|
|
||||||
document.getElementById("postForm").submit();
|
|
||||||
</script>';
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Data saved successfully . $message1";
|
echo "Data saved successfully. Warning..!! Kindly Update the next subsequent month Gas Stock If older month Gas Stock Updated..!!";
|
||||||
|
} catch (\Exception $e) {
|
||||||
} catch (\Exception $e) {
|
|
||||||
// Rollback the transaction on any failure
|
|
||||||
$this->db->transRollback();
|
$this->db->transRollback();
|
||||||
echo "Failed to save/Update data: " . $e->getMessage();
|
echo "Failed to save/Update data: " . $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maps input row to expected format.
|
||||||
|
*/
|
||||||
|
private function mapDrierEntry(array $row, $existingRow = null): 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']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates gas stock consumption if the value changes.
|
||||||
|
*/
|
||||||
|
private function handleGasStockUpdate($existingRow, $newRow)
|
||||||
|
{
|
||||||
|
$existingConsumption = $existingRow['total_gas_consumption'];
|
||||||
|
$updatedConsumption = $newRow['total_gas_consumption'];
|
||||||
|
|
||||||
|
if ($existingConsumption != $updatedConsumption) {
|
||||||
|
$changeInConsumption = $updatedConsumption - $existingConsumption;
|
||||||
|
$this->updateGasStockConsumption($existingRow['date'], $changeInConsumption);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 '<form id="postForm" action="' . base_url('drierMachineDetails') . '" method="POST">';
|
||||||
|
foreach ($postData as $key => $value) {
|
||||||
|
echo '<input type="hidden" name="' . $key . '" value="' . $value . '">';
|
||||||
|
}
|
||||||
|
echo '</form>';
|
||||||
|
echo '<script type="text/javascript">document.getElementById("postForm").submit();</script>';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function convertToDateWithFlexibleFormats($dateInput, array $inputFormats, string $outputFormat): ?string
|
function convertToDateWithFlexibleFormats($dateInput, array $inputFormats, string $outputFormat): ?string
|
||||||
{
|
{
|
||||||
|
|||||||
@ -9,7 +9,7 @@ class Expense_model extends Model
|
|||||||
protected $primaryKey = 'id'; // Primary key
|
protected $primaryKey = 'id'; // Primary key
|
||||||
|
|
||||||
protected $allowedFields = [
|
protected $allowedFields = [
|
||||||
'serial_number' , 'transporter_file', 'supplier_id', 'remarks', 'item_description', 'cost', 'cgst', 'sgst', 'igst', 'total', 'bill_no' ,'bill_date','status'
|
'serial_number' , 'transporter_file', 'supplier_id', 'remarks', 'item_description', 'cost', 'cgst', 'sgst', 'igst', 'total', 'bill_no' ,'bill_date','status','created_by','updated_by'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function getLastSerialNumber($financialYear)
|
public function getLastSerialNumber($financialYear)
|
||||||
@ -25,8 +25,15 @@ class Expense_model extends Model
|
|||||||
// Retrieve all active expenses
|
// Retrieve all active expenses
|
||||||
public function getAllExpense($fromDate,$toDate) {
|
public function getAllExpense($fromDate,$toDate) {
|
||||||
|
|
||||||
return $this->db->table('t_expense')
|
return $this->db->table('t_expense')
|
||||||
|
->select([
|
||||||
|
"t_expense.id","t_expense.serial_number","t_expense.transporter_file","t_expense.supplier_id","t_expense.item_description","t_expense.cost","t_expense.cgst","t_expense.sgst","t_expense.igst","t_expense.total","t_expense.remarks","t_expense.status","t_expense.payment_method","t_expense.created_on","t_expense.created_by","t_expense.updated_on","t_expense.updated_by","t_expense.isactive","t_expense.bill_no","t_expense.bill_date",
|
||||||
|
"t_supplierdetailsn.SupplierName",
|
||||||
|
"CONCAT_WS(' ', emp.FirstName, emp.LastName) as created_name"
|
||||||
|
])
|
||||||
->join('t_supplierdetailsn', 't_expense.supplier_id = t_supplierdetailsn.SupplierID', 'left')
|
->join('t_supplierdetailsn', 't_expense.supplier_id = t_supplierdetailsn.SupplierID', 'left')
|
||||||
|
->join('tbl_users as creator', ' t_expense.created_by = creator.userid', 'left')
|
||||||
|
->join('t_employee_details as emp', 'emp.empid=creator.empid', 'left')
|
||||||
->where('t_expense.isactive', 1)
|
->where('t_expense.isactive', 1)
|
||||||
->where('t_expense.created_on >=',"$fromDate")
|
->where('t_expense.created_on >=',"$fromDate")
|
||||||
->orderBy('t_expense.created_on', 'DESC')
|
->orderBy('t_expense.created_on', 'DESC')
|
||||||
|
|||||||
@ -6,7 +6,7 @@ use CodeIgniter\Model;
|
|||||||
|
|
||||||
class PowerConsumptionSummaryModel extends Model
|
class PowerConsumptionSummaryModel extends Model
|
||||||
{
|
{
|
||||||
protected $table = 't_powerConsumptionSummary';
|
protected $table = 't_powerconsumptionsummary';
|
||||||
protected $primaryKey = 'id';
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
protected $allowedFields = [
|
protected $allowedFields = [
|
||||||
|
|||||||
@ -169,7 +169,7 @@ class Rawmaterialdetails_model extends Model
|
|||||||
$builder = $this->db->table('t_materialmaster')
|
$builder = $this->db->table('t_materialmaster')
|
||||||
->select('MaterialCode , MaterialName')
|
->select('MaterialCode , MaterialName')
|
||||||
->where('IsActive', 1)
|
->where('IsActive', 1)
|
||||||
->where('Category', 'bag')
|
->where('Category', 'Packing Material')
|
||||||
->orderBy('MaterialCode', 'asc');
|
->orderBy('MaterialCode', 'asc');
|
||||||
$query = $builder->get();
|
$query = $builder->get();
|
||||||
$materialResults = $query->getResultArray();
|
$materialResults = $query->getResultArray();
|
||||||
@ -199,7 +199,7 @@ class Rawmaterialdetails_model extends Model
|
|||||||
$builder = $this->db->table('t_materialmaster')
|
$builder = $this->db->table('t_materialmaster')
|
||||||
->select('MaterialCode , MaterialName')
|
->select('MaterialCode , MaterialName')
|
||||||
->where('IsActive', 1)
|
->where('IsActive', 1)
|
||||||
->where('Category', 'plastic_chemicals')
|
->where('Category', 'Resin')
|
||||||
->orderBy('MaterialCode', 'asc');
|
->orderBy('MaterialCode', 'asc');
|
||||||
$query = $builder->get();
|
$query = $builder->get();
|
||||||
$materialResults = $query->getResultArray();
|
$materialResults = $query->getResultArray();
|
||||||
@ -327,17 +327,20 @@ class Rawmaterialdetails_model extends Model
|
|||||||
// $this->db->update('T_PurchaseOrderDetails', $POInfo);
|
// $this->db->update('T_PurchaseOrderDetails', $POInfo);
|
||||||
// return $this->db->affectedRows();
|
// return $this->db->affectedRows();
|
||||||
// }
|
// }
|
||||||
function checkMaterialExists($materialCode , $materialName)
|
|
||||||
|
|
||||||
|
// on 28/jan/2025. both add and edit. category condition added.
|
||||||
|
function checkMaterialExists($materialCode , $materialName ,$materialCategory)
|
||||||
{
|
{
|
||||||
$builder = $this->db->table('t_materialmaster')
|
$builder = $this->db->table('t_materialmaster')
|
||||||
->select('MaterialCode,MaterialName,MaterialType,Category,IsActive');
|
->select('MaterialCode,MaterialName,MaterialType,Category,IsActive');
|
||||||
if(!empty($materialCode)){
|
if(!empty($materialCode)){
|
||||||
$builder = $builder->where('MaterialCode !=' , $materialCode);
|
$builder = $builder->where('MaterialCode !=' , $materialCode);
|
||||||
}
|
}
|
||||||
|
$builder->where('Category' , $materialCategory);
|
||||||
$builder->where('REPLACE(MaterialName, " ", "")' , $materialName);
|
$builder->where('REPLACE(MaterialName, " ", "")' , $materialName);
|
||||||
|
|
||||||
$query = $builder->get();
|
$query = $builder->get();
|
||||||
|
|
||||||
if ($query->getNumRows() > 0) {
|
if ($query->getNumRows() > 0) {
|
||||||
return $query->getResultArray();
|
return $query->getResultArray();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -1431,7 +1431,22 @@
|
|||||||
|
|
||||||
function exportTableToExcel(tableID, filename = '') {
|
function exportTableToExcel(tableID, filename = '') {
|
||||||
let table = document.getElementById(tableID);
|
let table = document.getElementById(tableID);
|
||||||
let ws = XLSX.utils.table_to_sheet(table); // Convert table to worksheet
|
|
||||||
|
let cloneTable = table.cloneNode(true); // Clone the table to modify
|
||||||
|
|
||||||
|
// Remove hidden rows
|
||||||
|
$(cloneTable).find('tr').filter(function () {
|
||||||
|
return $(this).css('display') === 'none';
|
||||||
|
}).remove();
|
||||||
|
|
||||||
|
// Remove hidden columns
|
||||||
|
$(cloneTable).find('th, td').each(function () {
|
||||||
|
if ($(this).css('display') === 'none') {
|
||||||
|
$(this).remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let ws = XLSX.utils.table_to_sheet(cloneTable); // Convert modified table to sheet
|
||||||
let wb = XLSX.utils.book_new(); // Create a new workbook
|
let wb = XLSX.utils.book_new(); // Create a new workbook
|
||||||
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
|
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
|
||||||
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
|
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
|
||||||
|
|||||||
@ -304,7 +304,7 @@
|
|||||||
|
|
||||||
var materialName = $('#MaterialName').val().trim();
|
var materialName = $('#MaterialName').val().trim();
|
||||||
var materialCode = '';
|
var materialCode = '';
|
||||||
|
var materialCategory = $('#MatCate').val();
|
||||||
if(materialName == ''){
|
if(materialName == ''){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -315,7 +315,7 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
data: {
|
data: {
|
||||||
materialCode,
|
materialCode,
|
||||||
materialName
|
materialName,materialCategory
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "<?php echo base_url(); ?>materialExist",
|
url: "<?php echo base_url(); ?>materialExist",
|
||||||
|
|||||||
@ -295,10 +295,10 @@
|
|||||||
<a href="#" class="dropdown-toggle arrow-none" data-toggle="dropdown"
|
<a href="#" class="dropdown-toggle arrow-none" data-toggle="dropdown"
|
||||||
aria-expanded="false">
|
aria-expanded="false">
|
||||||
<i class="mdi mdi-dots-vertical m-0 text-muted h3"></i>
|
<i class="mdi mdi-dots-vertical m-0 text-muted h3"></i>
|
||||||
</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="bagStockExport" href="#">Export</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -968,3 +968,44 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
function exportTableToExcel(tableID, filename = '') {
|
||||||
|
let table = document.getElementById(tableID);
|
||||||
|
let cloneTable = table.cloneNode(true); // Clone the table to modify
|
||||||
|
|
||||||
|
// Remove hidden rows
|
||||||
|
$(cloneTable).find('tr').filter(function () {
|
||||||
|
return $(this).css('display') === 'none';
|
||||||
|
}).remove();
|
||||||
|
|
||||||
|
// Remove hidden columns
|
||||||
|
$(cloneTable).find('th, td').each(function () {
|
||||||
|
if ($(this).css('display') === 'none') {
|
||||||
|
$(this).remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let ws = XLSX.utils.table_to_sheet(cloneTable); // Convert modified table to sheet
|
||||||
|
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 = 'bagStockDetailsTableId';
|
||||||
|
|
||||||
|
document.getElementById('bagStockExport').addEventListener('click',function(){
|
||||||
|
|
||||||
|
exportTableToExcel(tableId,'Bag_Stock_Details<?=$month?>.xlsx');
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
@ -631,6 +631,7 @@ foreach ($period as $day) {
|
|||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) { ?>
|
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) { ?>
|
||||||
<tr
|
<tr
|
||||||
|
|
||||||
@ -663,7 +664,10 @@ foreach ($period as $day) {
|
|||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
><?= $previousMonthTotalDieselMachineStockDetails[0]['balance_stock'] ?></td>
|
><?= !empty($previousMonthTotalDieselMachineStockDetails)
|
||||||
|
? $previousMonthTotalDieselMachineStockDetails[0]['balance_stock']
|
||||||
|
:" " ;
|
||||||
|
?></td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -679,7 +683,11 @@ foreach ($period as $day) {
|
|||||||
<td class="celda_normal balanceTD"
|
<td class="celda_normal balanceTD"
|
||||||
data-id="<?= $dateInMonth ?>"
|
data-id="<?= $dateInMonth ?>"
|
||||||
|
|
||||||
><?= $previousMonthTotalDieselMachineStockDetails[0]['balance_stock'] ?></td>
|
><?= !empty($previousMonthTotalDieselMachineStockDetails)
|
||||||
|
? $previousMonthTotalDieselMachineStockDetails[0]['balance_stock']
|
||||||
|
:" " ;
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -709,13 +717,21 @@ foreach ($period as $day) {
|
|||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
><?= $previousMonthDieselMachineStockDetails[$dieselMachineIndex]['closing_reading'] ?>
|
|
||||||
|
|
||||||
|
><?= !empty($previousMonthDieselMachineStockDetails)
|
||||||
|
? $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"><?= !empty($previousMonthDieselMachineStockDetails)
|
||||||
|
? $previousMonthDieselMachineStockDetails[$dieselMachineIndex]['closing_reading']
|
||||||
|
:" " ;
|
||||||
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="celda_normal fillingDiesel"
|
<td class="celda_normal fillingDiesel"
|
||||||
@ -1297,7 +1313,21 @@ foreach ($period as $day) {
|
|||||||
|
|
||||||
function exportTableToExcel(tableID, filename = '') {
|
function exportTableToExcel(tableID, filename = '') {
|
||||||
let table = document.getElementById(tableID);
|
let table = document.getElementById(tableID);
|
||||||
let ws = XLSX.utils.table_to_sheet(table); // Convert table to worksheet
|
let cloneTable = table.cloneNode(true); // Clone the table to modify
|
||||||
|
|
||||||
|
// Remove hidden rows
|
||||||
|
$(cloneTable).find('tr').filter(function () {
|
||||||
|
return $(this).css('display') === 'none';
|
||||||
|
}).remove();
|
||||||
|
|
||||||
|
// Remove hidden columns
|
||||||
|
$(cloneTable).find('th, td').each(function () {
|
||||||
|
if ($(this).css('display') === 'none') {
|
||||||
|
$(this).remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let ws = XLSX.utils.table_to_sheet(cloneTable); // Convert modified table to sheet
|
||||||
let wb = XLSX.utils.book_new(); // Create a new workbook
|
let wb = XLSX.utils.book_new(); // Create a new workbook
|
||||||
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
|
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
|
||||||
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
|
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
|
||||||
|
|||||||
@ -193,7 +193,6 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
padding: 6px 10px;
|
padding: 6px 10px;
|
||||||
text-align: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.celda_encabezado_total {
|
.celda_encabezado_total {
|
||||||
@ -210,7 +209,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
padding: 10px 6px;
|
padding: 4px 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -230,13 +229,19 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
|
|
||||||
/* 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:rgb(80, 187, 217); /* blue background */
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
padding: 10px;
|
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 */
|
/* Sticky First Column */
|
||||||
@ -244,7 +249,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
.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:rgb(80, 187, 217); /* blue background */
|
||||||
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;
|
||||||
@ -286,9 +291,10 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 text-right">
|
<div class="col-4 text-right">
|
||||||
<!-- Right-aligned buttons or links can be added here -->
|
<!-- Right-aligned buttons or links can be added here -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@ -309,6 +315,9 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
<input type="submit" value="Change Month" class="btn btn-success" style="margin-top:0px;">
|
<input type="submit" value="Change Month" class="btn btn-success" style="margin-top:0px;">
|
||||||
|
<button type="button" style="margin-top:0px; background-color:grey" class="btn btn-success" data-target="#additionalEntriesModalId" data-toggle="modal">
|
||||||
|
Add Shift
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
@ -320,8 +329,6 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
<div class="dropdown-menu dropdown-menu-right">
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
<a style="cursor:pointer"
|
<a style="cursor:pointer"
|
||||||
class="dropdown-item" data-toggle="modal" data-target="#filterModalId">Filter</a>
|
class="dropdown-item" data-toggle="modal" data-target="#filterModalId">Filter</a>
|
||||||
<a style="cursor:pointer"
|
|
||||||
class="dropdown-item" data-toggle="modal" data-target="#additionalEntriesModalId">Add Entry</a>
|
|
||||||
<a style="cursor:pointer"
|
<a style="cursor:pointer"
|
||||||
class="dropdown-item" id="drierMachineDetailsExport" href="#">Export</a>
|
class="dropdown-item" id="drierMachineDetailsExport" href="#">Export</a>
|
||||||
</div>
|
</div>
|
||||||
@ -339,20 +346,22 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
|
|
||||||
<th class="celda_encabezado_general" style="padding: 10px;">Date</th>
|
<th class="celda_encabezado_general" style="padding:5px;">Date</th>
|
||||||
<th class="celda_encabezado_general" style="padding: 10px;">Drier On Time</th>
|
<th class="celda_encabezado_general" style="padding:5px;">Drier On Time</th>
|
||||||
<th class="celda_encabezado_general" style="padding: 10px;">Drier Off Time</th>
|
<th class="celda_encabezado_general" style="padding:5px;">Drier Off Time</th>
|
||||||
<th class="celda_encabezado_general" style="padding: 10px;">Running Hrs</th>
|
<th class="celda_encabezado_general" style="padding:5px;">Running Hrs</th>
|
||||||
<th class="celda_encabezado_general" style="padding: 10px;">Supplier Name</th>
|
<th class="celda_encabezado_general" style="padding:5px;">Supplier Name</th>
|
||||||
<th class="celda_encabezado_general" style="padding: 10px;">i/p Sand Moisture(%)</th>
|
|
||||||
<th class="celda_encabezado_general" style="padding: 10px;">Tot Gas Consumption</th>
|
<th class="celda_encabezado_general" style="padding:5px;">Input Sand Qty</th>
|
||||||
<th class="celda_encabezado_general" style="padding: 10px;">Gas Per Ton</th>
|
<th class="celda_encabezado_general" style="padding:5px;">Input Sand Moisture(%)</th>
|
||||||
<th class="celda_encabezado_general" style="padding: 10px;">i/p Sand Qty</th>
|
<th class="celda_encabezado_general" style="padding:5px;">Sand Dried Qty</th>
|
||||||
<th class="celda_encabezado_general" style="padding: 10px;">Moisture Loss Qty</th>
|
<th class="celda_encabezado_general" style="padding:5px;">Total Gas Consumption</th>
|
||||||
<th class="celda_encabezado_general" style="padding: 10px;">Sand Dried Qty</th>
|
<th class="celda_encabezado_general" style="padding:5px;">Gas Per Ton</th>
|
||||||
<th class="celda_encabezado_general" style="padding: 10px;">Qty Per Hrs</th>
|
<th class="celda_encabezado_general" style="padding:5px;">Qty Per Hrs</th>
|
||||||
<th class="celda_encabezado_general" style="padding: 10px;">Dust Qty</th>
|
<th class="celda_encabezado_general" style="padding:5px;">Moisture Loss Qty</th>
|
||||||
<th class="celda_encabezado_general" style="padding: 10px;">Customer Name</th>
|
<th class="celda_encabezado_general" style="padding:5px;">Dust Qty</th>
|
||||||
|
|
||||||
|
<th class="celda_encabezado_general" style="padding:5px;">Customer Name</th>
|
||||||
<th class="celda_encabezado_general" style="display:none;">id</th>
|
<th class="celda_encabezado_general" style="display:none;">id</th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
@ -431,46 +440,54 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- td:eq(5) input_sand_moisture -->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- td:eq(5) input_sand_qty -->
|
||||||
|
<td class="celda_normal" oninput="gasPerTon(this);
|
||||||
|
moistureLossQty(this);
|
||||||
|
qtyPerHrs(this)" contenteditable="true">
|
||||||
|
<?php echo $a['input_sand_qty']; ?>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- td:eq(6) input_sand_moisture -->
|
||||||
<td class="celda_normal" contenteditable="true">
|
<td class="celda_normal" contenteditable="true">
|
||||||
<?php echo $a['input_sand_moisture']; ?>
|
<?php echo $a['input_sand_moisture']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- td:eq(6) total_gas_consumption -->
|
<!-- td:eq(7) sand_dried_qty -->
|
||||||
|
<td class="celda_normal" oninput="gasPerTon(this);
|
||||||
|
moistureLossQty(this);
|
||||||
|
qtyPerHrs(this)" contenteditable="true">
|
||||||
|
<?php echo $a['sand_dried_qty']; ?>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- td:eq(8) total_gas_consumption -->
|
||||||
<td class="celda_normal" oninput="gasPerTon(this);
|
<td class="celda_normal" oninput="gasPerTon(this);
|
||||||
moistureLossQty(this);
|
moistureLossQty(this);
|
||||||
qtyPerHrs(this)" contenteditable="true">
|
qtyPerHrs(this)" contenteditable="true">
|
||||||
<?php echo $a['total_gas_consumption']; ?>
|
<?php echo $a['total_gas_consumption']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- td:eq(7) gas_per_ton -->
|
<!-- td:eq(9) gas_per_ton -->
|
||||||
<td class="celda_normal">
|
<td class="celda_normal">
|
||||||
<?php echo $a['gas_per_ton']; ?>
|
<?php echo $a['gas_per_ton']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- td:eq(8) input_sand_qty -->
|
<!-- td:eq(10) qty_per_hours -->
|
||||||
<td class="celda_normal" oninput="gasPerTon(this);
|
<td class="celda_normal">
|
||||||
moistureLossQty(this);
|
<?php echo $a['qty_per_hours']; ?>
|
||||||
qtyPerHrs(this)" contenteditable="true">
|
|
||||||
<?php echo $a['input_sand_qty']; ?>
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- td:eq(9) moisture_loss_qty -->
|
|
||||||
|
<!-- td:eq(11) moisture_loss_qty -->
|
||||||
<td class="celda_normal">
|
<td class="celda_normal">
|
||||||
<?php echo $a['moisture_loss_qty']; ?>
|
<?php echo $a['moisture_loss_qty']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- td:eq(10) sand_dried_qty -->
|
|
||||||
<td class="celda_normal" oninput="gasPerTon(this);
|
|
||||||
moistureLossQty(this);
|
|
||||||
qtyPerHrs(this)" contenteditable="true">
|
|
||||||
<?php echo $a['sand_dried_qty']; ?>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<!-- td:eq(11) qty_per_hours -->
|
|
||||||
<td class="celda_normal">
|
|
||||||
<?php echo $a['qty_per_hours']; ?>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<!-- td:eq(12) dust_qty -->
|
<!-- td:eq(12) dust_qty -->
|
||||||
<td class="celda_normal" contenteditable="true">
|
<td class="celda_normal" contenteditable="true">
|
||||||
@ -522,21 +539,23 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
<table id="drierTableSummaryId" class="fht-table table-striped">
|
<table id="drierTableSummaryId" class="fht-table table-striped">
|
||||||
|
|
||||||
<thead >
|
<thead >
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th class="celda_encabezado_total"
|
<th class="celda_encabezado_total"
|
||||||
style="padding: 10px; border:#ffffff; background-color: #ffffff;">Date value</th>
|
style="padding:5px; border:#ffffff; background-color: #ffffff;">Date value</th>
|
||||||
<th class="celda_encabezado_total" style="padding: 10px;">Drier On Time </th>
|
<th class="celda_encabezado_total" style="padding:5px;">Drier On Time </th>
|
||||||
<th class="celda_encabezado_total" style="padding: 10px;">Drier Off Time</th>
|
<th class="celda_encabezado_total" style="padding:5px;">Drier Off Time</th>
|
||||||
<th class="celda_encabezado_total" style="padding: 10px;">Running Hrs</th>
|
<th class="celda_encabezado_total" style="padding:5px;">Running Hrs</th>
|
||||||
<th class="celda_encabezado_total" style="padding: 10px;">Supplier Name is a dropdown feature</th>
|
<th class="celda_encabezado_total" style="padding:5px;">Supplier Name </th>
|
||||||
<th class="celda_encabezado_total" style="padding: 10px;">i/p Sand Moisture(%)</th>
|
|
||||||
<th class="celda_encabezado_total" style="padding: 10px;">Tot Gas Consumption</th>
|
<th class="celda_encabezado_total" style="padding:5px;">input Sand Qty</th>
|
||||||
<th class="celda_encabezado_total" style="padding: 10px;">Gas Per Ton</th>
|
<th class="celda_encabezado_total" style="padding:5px;">inputp Sand Moisture(%)</th>
|
||||||
<th class="celda_encabezado_total" style="padding: 10px;">i/p Sand Qty</th>
|
<th class="celda_encabezado_total" style="padding:5px;">Sand Dried Qty</th>
|
||||||
<th class="celda_encabezado_total" style="padding: 10px;">Moisture Loss Qty</th>
|
<th class="celda_encabezado_total" style="padding:5px;">Total Gas Consumption</th>
|
||||||
<th class="celda_encabezado_total" style="padding: 10px;">Sand Dried Qty</th>
|
<th class="celda_encabezado_total" style="padding:5px;">Gas Per Ton</th>
|
||||||
<th class="celda_encabezado_total" style="padding: 10px;">Qty Per Hrs</th>
|
<th class="celda_encabezado_total" style="padding:5px;">Qty Per Hrs</th>
|
||||||
<th class="celda_encabezado_total" style="padding: 10px;">Dust Qty</th>
|
<th class="celda_encabezado_total" style="padding:5px;">Moisture Loss Qty</th>
|
||||||
|
<th class="celda_encabezado_total" style="padding:5px;">Dust Qty</th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -548,17 +567,18 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
|
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
|
||||||
<b> Total </b>
|
<b> Total </b>
|
||||||
</td>
|
</td>
|
||||||
<td class="celda_normal ">-</td>
|
<td class="celda_normal ">-</td>
|
||||||
<td class="celda_normal ">-</td>
|
<td class="celda_normal ">-</td>
|
||||||
<td class="celda_normal "><?=$summary['drier_running_hours']?></td>
|
<td class="celda_normal "><?=$summary['drier_running_hours']?></td>
|
||||||
<td class="celda_normal ">-</td>
|
<td class="celda_normal ">-</td>
|
||||||
<td class="celda_normal ">-</td>
|
|
||||||
<td class="celda_normal "><?=$summary['total_gas_consumption']?></td>
|
|
||||||
<td class="celda_normal ">-</td>
|
|
||||||
<td class="celda_normal "><?=$summary['input_sand_qty']?></td>
|
<td class="celda_normal "><?=$summary['input_sand_qty']?></td>
|
||||||
<td class="celda_normal "><?=$summary['moisture_loss_qty']?></td>
|
|
||||||
<td class="celda_normal "><?=$summary['sand_dried_qty']?></td>
|
|
||||||
<td class="celda_normal ">-</td>
|
<td class="celda_normal ">-</td>
|
||||||
|
<td class="celda_normal "><?=$summary['sand_dried_qty']?></td>
|
||||||
|
<td class="celda_normal "><?=$summary['total_gas_consumption']?></td>
|
||||||
|
<td class="celda_normal "></td>
|
||||||
|
<td class="celda_normal "></td>
|
||||||
|
<td class="celda_normal "><?=$summary['moisture_loss_qty']?></td>
|
||||||
<td class="celda_normal "><?=$summary['dust_qty']?></td>
|
<td class="celda_normal "><?=$summary['dust_qty']?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -581,10 +601,11 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
|
|
||||||
</div><!-- End table-responsive -->
|
</div><!-- End table-responsive -->
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12 text-right">
|
<div class="col-md-12 text-right">
|
||||||
<input type="button" class="btn btn-success" id="save" value="save">
|
<input type="button" class="btn btn-success btn-md px-3" id="save" value="save">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -691,7 +712,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<label class="form" for="additionalEntryDateId">Date</label>
|
<label class="form" for="additionalEntryDateId">Date</label>
|
||||||
<input type="date" class="form-control" id="additionalEntryDateId" name="Date" value="<?= $calendarStartDate?>"
|
<input type="date" class="form-control" id="additionalEntryDateId" name="date" value="<?= $calendarStartDate?>"
|
||||||
min="<?= $calendarStartDate?>" max="<?=$calendarEndDate?>" required>
|
min="<?= $calendarStartDate?>" max="<?=$calendarEndDate?>" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
@ -699,7 +720,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
|
|
||||||
<select onchange="calculateMachineRunningHrs()"
|
<select onchange="calculateMachineRunningHrs()"
|
||||||
class="timeDropdown" style="width: 100px;"
|
class="timeDropdown" style="width: 100px;"
|
||||||
id="additionalEntryDrierOnTimeId" name="Drier On Time">
|
id="additionalEntryDrierOnTimeId" name="drier_on_time">
|
||||||
<option value="">Select</option>
|
<option value="">Select</option>
|
||||||
<?php foreach ($timeDropdown as $key => $time) { ?>
|
<?php foreach ($timeDropdown as $key => $time) { ?>
|
||||||
<option value="<?= $time; ?>"> <?= $time; ?></option>
|
<option value="<?= $time; ?>"> <?= $time; ?></option>
|
||||||
@ -711,7 +732,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
|
|
||||||
<select onchange="calculateMachineRunningHrs()"
|
<select onchange="calculateMachineRunningHrs()"
|
||||||
class="timeDropdown " style="width: 100px;"
|
class="timeDropdown " style="width: 100px;"
|
||||||
id="additionalEntryDrierOffTimeId" name="Drier Off Time">
|
id="additionalEntryDrierOffTimeId" name="drier_off_time">
|
||||||
<option value="">Select</option>
|
<option value="">Select</option>
|
||||||
<?php foreach ($timeDropdown as $key => $time) { ?>
|
<?php foreach ($timeDropdown as $key => $time) { ?>
|
||||||
<option value="<?= $time; ?>"> <?= $time; ?></option>
|
<option value="<?= $time; ?>"> <?= $time; ?></option>
|
||||||
@ -720,7 +741,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<label class="form" for="additionalEntryRunningHrsId">Running hrs</label>
|
<label class="form" for="additionalEntryRunningHrsId">Running hrs</label>
|
||||||
<input type="text" class="form-control" id="additionalEntryRunningHrsId" name="Running Hrs" value=""
|
<input type="text" class="form-control" id="additionalEntryRunningHrsId" name="drier_running_hours" value=""
|
||||||
readonly>
|
readonly>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -728,21 +749,21 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
<div class="row mt-2">
|
<div class="row mt-2">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<label class="form" for="additionalEntryInputSandMoistureId">Input Sand Moisture (%)</label>
|
<label class="form" for="additionalEntryInputSandMoistureId">Input Sand Moisture (%)</label>
|
||||||
<input type="text" class="form-control" id="additionalEntryInputSandMoistureId" name="i/p Sand Moisture(%)" value="">
|
<input type="text" class="form-control" id="additionalEntryInputSandMoistureId" name="input_sand_moisture" value="">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<label class="form" for="additionalEntryTotalGasConsumptionId">Total Gas Consumption</label>
|
<label class="form" for="additionalEntryTotalGasConsumptionId">Total Gas Consumption</label>
|
||||||
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
|
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
|
||||||
type="text" class="form-control" id="additionalEntryTotalGasConsumptionId" name="Tot Gas Consumption" value="">
|
type="text" class="form-control" id="additionalEntryTotalGasConsumptionId" name="total_gas_consumption" value="">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<label class="form" for="additionalEntrySandDriedQtyId">Sand Dried Qty</label>
|
<label class="form" for="additionalEntrySandDriedQtyId">Sand Dried Qty</label>
|
||||||
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
|
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
|
||||||
type="text" class="form-control" id="additionalEntrySandDriedQtyId" name="Sand Dried Qty" value="">
|
type="text" class="form-control" id="additionalEntrySandDriedQtyId" name="sand_dried_qty" value="">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<label class="form" for="additionalEntryGasPerTonId">Gas per Ton</label>
|
<label class="form" for="additionalEntryGasPerTonId">Gas per Ton</label>
|
||||||
<input type="text" class="form-control" id="additionalEntryGasPerTonId" name="Gas Per Ton" value=""
|
<input type="text" class="form-control" id="additionalEntryGasPerTonId" name="gas_per_ton" value=""
|
||||||
readonly>
|
readonly>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -750,21 +771,21 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
<div class="row mt-2">
|
<div class="row mt-2">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<label class="form" for="additionalEntryDustQtyId">Dust Qty</label>
|
<label class="form" for="additionalEntryDustQtyId">Dust Qty</label>
|
||||||
<input type="text" class="form-control" id="additionalEntryDustQtyId" name="Dust Qty" value="">
|
<input type="text" class="form-control" id="additionalEntryDustQtyId" name="dust_qty" value="">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<label class="form" for="additionalEntryInputSandQtyId">Input sand Quantity</label>
|
<label class="form" for="additionalEntryInputSandQtyId">Input sand Quantity</label>
|
||||||
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
|
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
|
||||||
type="text" class="form-control" id="additionalEntryInputSandQtyId" name="i/p Sand Qty" value="">
|
type="text" class="form-control" id="additionalEntryInputSandQtyId" name="input_sand_qty" value="">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<label class="form" for="additionalEntryMoistureLossQtyId">Moisture Loss Qty</label>
|
<label class="form" for="additionalEntryMoistureLossQtyId">Moisture Loss Qty</label>
|
||||||
<input type="text" class="form-control" id="additionalEntryMoistureLossQtyId" name="Moisture Loss Qty" value=""
|
<input type="text" class="form-control" id="additionalEntryMoistureLossQtyId" name="moisture_loss_qty" value=""
|
||||||
readonly>
|
readonly>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<label class="form" for="additionalEntryQtyPerHoursId">Qty per Hours</label>
|
<label class="form" for="additionalEntryQtyPerHoursId">Qty per Hours</label>
|
||||||
<input type="text" class="form-control" id="additionalEntryQtyPerHoursId" name="Qty Per Hrs" value=""
|
<input type="text" class="form-control" id="additionalEntryQtyPerHoursId" name="qty_per_hours" value=""
|
||||||
readonly>
|
readonly>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -773,7 +794,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<label class="form" for="additionalEntrySupplierNameId">Supplier Name</label>
|
<label class="form" for="additionalEntrySupplierNameId">Supplier Name</label>
|
||||||
<select class="timeDropdown supplier_name" style="width: 300px;"
|
<select class="timeDropdown supplier_name" style="width: 300px;"
|
||||||
id="additionalEntrySupplierNameId" name="Supplier Name">
|
id="additionalEntrySupplierNameId" name="supplier_name">
|
||||||
<option value="">Select</option>
|
<option value="">Select</option>
|
||||||
<?php foreach ($supplierData as $key => $value) { ?>
|
<?php foreach ($supplierData as $key => $value) { ?>
|
||||||
<option value="<?= $value->SupplierID; ?>"> <?= $value->SupplierName; ?> </option>
|
<option value="<?= $value->SupplierID; ?>"> <?= $value->SupplierName; ?> </option>
|
||||||
@ -782,7 +803,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<label class="form" for="additionalEntryCustomerNameId">Customer Name</label>
|
<label class="form" for="additionalEntryCustomerNameId">Customer Name</label>
|
||||||
<input type="text" class="form-control" id="additionalEntryCustomerNameId" name="Customer Name" value="">
|
<input type="text" class="form-control" id="additionalEntryCustomerNameId" name="customer_name" value="">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary float-right">Add</button>
|
<button type="submit" class="btn btn-primary float-right">Add</button>
|
||||||
@ -806,56 +827,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<!-- script section starts -->
|
||||||
|
|
||||||
$(document).ready(function(){
|
|
||||||
|
|
||||||
function exportTableToExcel(tableID, filename = '') {
|
|
||||||
let table = document.getElementById(tableID);
|
|
||||||
let rows = table.rows;
|
|
||||||
let data = [];
|
|
||||||
|
|
||||||
for (let i = 0; i < rows.length; i++) {
|
|
||||||
let row = rows[i];
|
|
||||||
let cols = row.querySelectorAll('td, th');
|
|
||||||
let rowData = [];
|
|
||||||
|
|
||||||
for (let j = 0; j < cols.length; j++) {
|
|
||||||
let cell = cols[j];
|
|
||||||
|
|
||||||
// Check if the cell contains a <select> dropdown
|
|
||||||
let select = cell.querySelector('select');
|
|
||||||
if (select) {
|
|
||||||
rowData.push(select.options[select.selectedIndex].text); // Get only selected value
|
|
||||||
} else {
|
|
||||||
rowData.push(cell.innerText.trim()); // Normal text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data.push(rowData);
|
|
||||||
}
|
|
||||||
|
|
||||||
let wb = XLSX.utils.book_new();
|
|
||||||
let ws = XLSX.utils.aoa_to_sheet(data);
|
|
||||||
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
|
||||||
XLSX.writeFile(wb, filename || 'export.xlsx');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let tableId = 'drierTable';
|
|
||||||
|
|
||||||
document.getElementById('drierMachineDetailsExport').addEventListener('click',function(){
|
|
||||||
|
|
||||||
exportTableToExcel(tableId,'drierMachineDetails_<?=$datefordropdown?>.xlsx');
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -867,9 +839,36 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
|
|
||||||
$('#save').click(function() {
|
$('#save').click(function() {
|
||||||
|
|
||||||
var alldata = $("#drierTable").tableToJSON();
|
|
||||||
|
|
||||||
console.log('alldata', alldata);
|
let alldata = [];
|
||||||
|
|
||||||
|
|
||||||
|
$("#drierTable").find('tbody tr').each(function() {
|
||||||
|
|
||||||
|
const rowCells = $(this).find('td');
|
||||||
|
|
||||||
|
const rowData = {
|
||||||
|
date : rowCells.eq(0).text().trim(),
|
||||||
|
drier_on_time : rowCells.eq(1).text().trim(),
|
||||||
|
drier_off_time : rowCells.eq(2).text().trim(),
|
||||||
|
drier_running_hours : rowCells.eq(3).text().trim(),
|
||||||
|
supplier_name : rowCells.eq(4).text().trim(),
|
||||||
|
input_sand_qty : rowCells.eq(5).text().trim(),
|
||||||
|
input_sand_moisture : rowCells.eq(6).text().trim(),
|
||||||
|
sand_dried_qty : rowCells.eq(7).text().trim(),
|
||||||
|
total_gas_consumption : rowCells.eq(8).text().trim(),
|
||||||
|
gas_per_ton : rowCells.eq(9).text().trim(),
|
||||||
|
qty_per_hours : rowCells.eq(10).text().trim(),
|
||||||
|
moisture_loss_qty : rowCells.eq(11).text().trim(),
|
||||||
|
dust_qty : rowCells.eq(12).text().trim(),
|
||||||
|
customer_name : rowCells.eq(13).text().trim(),
|
||||||
|
id : rowCells.eq(14).text().trim()
|
||||||
|
};
|
||||||
|
|
||||||
|
alldata.push(rowData);
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#drierTable tbody tr:visible').each(function(index) {
|
$('#drierTable tbody tr:visible').each(function(index) {
|
||||||
@ -878,9 +877,10 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
let row = alldata[index];
|
let row = alldata[index];
|
||||||
|
|
||||||
// Get the selected values from dropdowns
|
// Get the selected values from dropdowns
|
||||||
row['Drier On Time'] = $(this).find('.drier_on_time').val();
|
row['drier_on_time'] = $(this).find('.drier_on_time').val();
|
||||||
row['Drier Off Time'] = $(this).find('.drier_off_time').val();
|
row['drier_off_time'] = $(this).find('.drier_off_time').val();
|
||||||
row['Supplier Name'] = $(this).find('.supplier_name').val();
|
row['supplier_name'] = $(this).find('.supplier_name').val();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -932,11 +932,24 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
var drierOnTime = $(this).val();
|
var drierOnTime = $(this).val();
|
||||||
var drierOffTime = tr.find('.drier_off_time').val();
|
var drierOffTime = tr.find('.drier_off_time').val();
|
||||||
|
|
||||||
|
|
||||||
|
if(drierOnTime == drierOffTime){
|
||||||
|
|
||||||
|
tr.find('td:eq(3)').text(24.00);
|
||||||
|
|
||||||
|
gasPerTon(this);
|
||||||
|
moistureLossQty(this);
|
||||||
|
qtyPerHrs(this);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (drierOnTime != '' && drierOffTime != '') {
|
if (drierOnTime != '' && drierOffTime != '') {
|
||||||
|
|
||||||
|
|
||||||
const startDate = new Date(`1970-01-01T${convertTo24Hour(drierOnTime)}`);
|
const startDate = new Date(`1970-01-01T${convertTo24Hour(drierOnTime)}`);
|
||||||
const endDate = new Date(`1970-01-01T${convertTo24Hour(drierOffTime)}`);
|
const endDate = new Date(`1970-01-01T${convertTo24Hour(drierOffTime)}`);
|
||||||
|
|
||||||
// Handle the case where end time is on the next day
|
// Handle the case where end time is on the next day
|
||||||
if (endDate < startDate) {
|
if (endDate < startDate) {
|
||||||
@ -959,6 +972,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
qtyPerHrs(this);
|
qtyPerHrs(this);
|
||||||
|
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -969,6 +983,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
var drierOffTime = $(this).val();
|
var drierOffTime = $(this).val();
|
||||||
var drierOnTime = tr.find('.drier_on_time').val();
|
var drierOnTime = tr.find('.drier_on_time').val();
|
||||||
|
|
||||||
|
if(drierOnTime == drierOffTime){
|
||||||
|
|
||||||
|
tr.find('td:eq(3)').text(24.00);
|
||||||
|
|
||||||
|
gasPerTon(this);
|
||||||
|
moistureLossQty(this);
|
||||||
|
qtyPerHrs(this);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (drierOnTime != '' && drierOffTime != '') {
|
if (drierOnTime != '' && drierOffTime != '') {
|
||||||
|
|
||||||
const startDate = new Date(`1970-01-01T${convertTo24Hour(drierOnTime)}`);
|
const startDate = new Date(`1970-01-01T${convertTo24Hour(drierOnTime)}`);
|
||||||
@ -1002,17 +1027,21 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function gasPerTon(value) {
|
function gasPerTon(value) {
|
||||||
|
|
||||||
let tr = $(value).closest('tr');
|
let tr = $(value).closest('tr');
|
||||||
var totalGasConsumption = tr.find('td:eq(6)').text();
|
var totalGasConsumption = tr.find('td:eq(8)').text();
|
||||||
var sandDriedQty = tr.find('td:eq(10)').text();
|
var sandDriedQty = tr.find('td:eq(7)').text();
|
||||||
if (totalGasConsumption != '' && sandDriedQty != '') {
|
if (totalGasConsumption != '' && sandDriedQty != '') {
|
||||||
var gasPerTon = parseFloat(totalGasConsumption) / parseFloat(sandDriedQty);
|
var gasPerTon = parseFloat(totalGasConsumption) / parseFloat(sandDriedQty);
|
||||||
|
|
||||||
if (gasPerTon && gasPerTon != NaN && gasPerTon != Infinity)
|
if (gasPerTon && gasPerTon != NaN && gasPerTon != Infinity)
|
||||||
tr.find('td:eq(7)').text(gasPerTon.toFixed(2));
|
tr.find('td:eq(9)').text(gasPerTon.toFixed(2));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1021,15 +1050,15 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
function moistureLossQty(value) {
|
function moistureLossQty(value) {
|
||||||
|
|
||||||
let tr = $(value).closest('tr');
|
let tr = $(value).closest('tr');
|
||||||
var inputSandQty = tr.find('td:eq(8)').text();
|
var inputSandQty = tr.find('td:eq(5)').text();
|
||||||
var sandDriedQty = tr.find('td:eq(10)').text();
|
var sandDriedQty = tr.find('td:eq(7)').text();
|
||||||
|
|
||||||
if (inputSandQty != '' && sandDriedQty != '') {
|
if (inputSandQty != '' && sandDriedQty != '') {
|
||||||
|
|
||||||
var moistureLossQty = parseFloat(inputSandQty) - parseFloat(sandDriedQty);
|
var moistureLossQty = parseFloat(inputSandQty) - parseFloat(sandDriedQty) ;
|
||||||
|
|
||||||
if (moistureLossQty != NaN && moistureLossQty != Infinity)
|
if (moistureLossQty != NaN && moistureLossQty != Infinity)
|
||||||
tr.find('td:eq(9)').text(moistureLossQty.toFixed(2));
|
tr.find('td:eq(11)').text(moistureLossQty.toFixed(2)) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1039,14 +1068,14 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
|
|
||||||
let tr = $(value).closest('tr');
|
let tr = $(value).closest('tr');
|
||||||
var drierRunninhHrs = tr.find('td:eq(3)').text();
|
var drierRunninhHrs = tr.find('td:eq(3)').text();
|
||||||
var sandDriedQty = tr.find('td:eq(10)').text();
|
var sandDriedQty = tr.find('td:eq(7)').text();
|
||||||
|
|
||||||
if (drierRunninhHrs != '' && sandDriedQty != '') {
|
if (drierRunninhHrs != '' && sandDriedQty != '') {
|
||||||
|
|
||||||
var qtyPerHrs = parseFloat(sandDriedQty) / parseFloat(drierRunninhHrs);
|
var qtyPerHrs = parseFloat(sandDriedQty) / parseFloat(drierRunninhHrs);
|
||||||
|
|
||||||
if (qtyPerHrs && qtyPerHrs != NaN && qtyPerHrs != Infinity)
|
if (qtyPerHrs && qtyPerHrs != NaN && qtyPerHrs != Infinity)
|
||||||
tr.find('td:eq(11)').text(qtyPerHrs.toFixed(3));
|
tr.find('td:eq(10)').text(qtyPerHrs.toFixed(3));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1078,6 +1107,16 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
let dreierMachineOnTime = $('#additionalEntryDrierOnTimeId').val();
|
let dreierMachineOnTime = $('#additionalEntryDrierOnTimeId').val();
|
||||||
let dreierMachineOffTime = $('#additionalEntryDrierOffTimeId').val();
|
let dreierMachineOffTime = $('#additionalEntryDrierOffTimeId').val();
|
||||||
|
|
||||||
|
if(dreierMachineOnTime == dreierMachineOffTime){
|
||||||
|
|
||||||
|
$('#additionalEntryRunningHrsId').val(24.00);
|
||||||
|
additionalEntryGasPerTon();
|
||||||
|
additionalEntryMoistureLossQty();
|
||||||
|
additionalEntryQtyPerHrs();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (dreierMachineOnTime != '' && dreierMachineOffTime != '') {
|
if (dreierMachineOnTime != '' && dreierMachineOffTime != '') {
|
||||||
|
|
||||||
@ -1217,3 +1256,57 @@ function convertToDate(dateString) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- excel export -->
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
function exportTableToExcel(tableID, filename = '') {
|
||||||
|
let table = document.getElementById(tableID);
|
||||||
|
let rows = table.rows;
|
||||||
|
let data = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < rows.length; i++) {
|
||||||
|
let row = rows[i];
|
||||||
|
let cols = row.querySelectorAll('td, th');
|
||||||
|
let rowData = [];
|
||||||
|
|
||||||
|
for (let j = 0; j < cols.length; j++) {
|
||||||
|
let cell = cols[j];
|
||||||
|
|
||||||
|
// Check if the cell contains a <select> dropdown
|
||||||
|
let select = cell.querySelector('select');
|
||||||
|
if (select) {
|
||||||
|
rowData.push(select.options[select.selectedIndex].text); // Get only selected value
|
||||||
|
} else {
|
||||||
|
rowData.push(cell.innerText.trim()); // Normal text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data.push(rowData);
|
||||||
|
}
|
||||||
|
|
||||||
|
let wb = XLSX.utils.book_new();
|
||||||
|
let ws = XLSX.utils.aoa_to_sheet(data);
|
||||||
|
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
||||||
|
XLSX.writeFile(wb, filename || 'export.xlsx');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let tableId = 'drierTable';
|
||||||
|
|
||||||
|
document.getElementById('drierMachineDetailsExport').addEventListener('click',function(){
|
||||||
|
|
||||||
|
exportTableToExcel(tableId,'drierMachineDetails_<?=$datefordropdown?>.xlsx');
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- script section ends -->
|
||||||
|
|||||||
@ -442,6 +442,7 @@ if ($total <= $reorder) {
|
|||||||
|
|
||||||
var materialName = $('#MaterialName').val();
|
var materialName = $('#MaterialName').val();
|
||||||
var materialCode = $('#RMcode').val();
|
var materialCode = $('#RMcode').val();
|
||||||
|
var materialCategory = $('#MaterialCategory').val();
|
||||||
|
|
||||||
if(materialName == ''){
|
if(materialName == ''){
|
||||||
return;
|
return;
|
||||||
@ -453,7 +454,8 @@ if ($total <= $reorder) {
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
data: {
|
data: {
|
||||||
materialCode,
|
materialCode,
|
||||||
materialName
|
materialName,
|
||||||
|
materialCategory
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "<?php echo base_url(); ?>materialExist",
|
url: "<?php echo base_url(); ?>materialExist",
|
||||||
|
|||||||
@ -119,11 +119,12 @@
|
|||||||
<th align="left" style="width: 20%;">Bill No</th>
|
<th align="left" style="width: 20%;">Bill No</th>
|
||||||
<th align="left" style="width: 20%;">Bill Date</th>
|
<th align="left" style="width: 20%;">Bill Date</th>
|
||||||
<th align="left" style="width: 7%;">Cost</th>
|
<th align="left" style="width: 7%;">Cost</th>
|
||||||
<th align="left" style="width: 5%;">CGST</th>
|
<th align="left" style="width: 2%;">CGST</th>
|
||||||
<th align="left" style="width: 5%;">SGST</th>
|
<th align="left" style="width: 2%;">SGST</th>
|
||||||
<th align="left" style="width: 5%;">IGST</th>
|
<th align="left" style="width: 2%;">IGST</th>
|
||||||
<th align="left" style="width: 7%;">Total</th>
|
<th align="left" style="width: 7%;">Total</th>
|
||||||
<th align="left" style="width: 7%;">Status</th>
|
<th align="left" style="width: 7%;">Status</th>
|
||||||
|
<th align="left" style="width: 6%;">Created By</th>
|
||||||
<th align="left" style="width: 8%;">Action</th>
|
<th align="left" style="width: 8%;">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -177,6 +178,7 @@
|
|||||||
<td><?php echo $record['igst']; ?></td>
|
<td><?php echo $record['igst']; ?></td>
|
||||||
<td><?php echo $record['total']; ?></td>
|
<td><?php echo $record['total']; ?></td>
|
||||||
<td><?php echo $record['status']; ?></td>
|
<td><?php echo $record['status']; ?></td>
|
||||||
|
<td><?php echo $record['created_name']; ?></td>
|
||||||
<td>
|
<td>
|
||||||
<?php if ($fileExists == 1) { ?>
|
<?php if ($fileExists == 1) { ?>
|
||||||
<button title="Download FIle" class="download_button" onclick="downloadFile('<?php echo $record['id']; ?>', '<?php echo $record['transporter_file']; ?>')" style="border: none;background-color: white;color: #02a8b5;">
|
<button title="Download FIle" class="download_button" onclick="downloadFile('<?php echo $record['id']; ?>', '<?php echo $record['transporter_file']; ?>')" style="border: none;background-color: white;color: #02a8b5;">
|
||||||
|
|||||||
@ -1695,7 +1695,21 @@ $(document).ready(function() {
|
|||||||
function exportTableToExcel(tableID, filename = '') {
|
function exportTableToExcel(tableID, filename = '') {
|
||||||
|
|
||||||
let table = document.getElementById(tableID);
|
let table = document.getElementById(tableID);
|
||||||
let rows = table.rows;
|
let cloneTable = table.cloneNode(true); // Clone the table to modify
|
||||||
|
|
||||||
|
// Remove hidden rows
|
||||||
|
$(cloneTable).find('tr').filter(function () {
|
||||||
|
return $(this).css('display') === 'none';
|
||||||
|
}).remove();
|
||||||
|
|
||||||
|
// Remove hidden columns
|
||||||
|
$(cloneTable).find('th, td').each(function () {
|
||||||
|
if ($(this).css('display') === 'none') {
|
||||||
|
$(this).remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let rows = cloneTable.rows;
|
||||||
let data = [];
|
let data = [];
|
||||||
|
|
||||||
for (let i = 0; i < rows.length; i++) {
|
for (let i = 0; i < rows.length; i++) {
|
||||||
|
|||||||
@ -131,8 +131,8 @@
|
|||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label class="col-form-label">Supplier Name</label>
|
<label class="col-form-label">Supplier Name</label>
|
||||||
<?php
|
<?php
|
||||||
$data = array('name' => 'SupplierName', 'value' => set_value('SupplierName'), 'id' => 'Sup', 'class' => 'form-control', 'readonly' => 'true');
|
$data = array('name' => 'SupplierName', 'value' => set_value('SupplierName'), 'id' => 'Sup', 'class' => 'form-control', 'readonly' => 'true','rows' => 3);
|
||||||
echo form_input($data);
|
echo form_textarea($data);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -482,7 +482,7 @@
|
|||||||
var newUrl = baseUrl + '?PONO=' + obj.PONO + '&ReqType=' + obj.POType;
|
var newUrl = baseUrl + '?PONO=' + obj.PONO + '&ReqType=' + obj.POType;
|
||||||
$('#printLink').attr('href', newUrl);
|
$('#printLink').attr('href', newUrl);
|
||||||
$("#po").val(obj.PONO);
|
$("#po").val(obj.PONO);
|
||||||
$("#Sup").val(obj.SupplierName);
|
$("#Sup").val(obj.SupplierName + "\n" + obj.Address);
|
||||||
$("#hiddenIsOpenOrder").val(obj.IsOpenOrder);
|
$("#hiddenIsOpenOrder").val(obj.IsOpenOrder);
|
||||||
isOpenOrder = parseInt(obj.IsOpenOrder ? obj.IsOpenOrder : "0", 2);
|
isOpenOrder = parseInt(obj.IsOpenOrder ? obj.IsOpenOrder : "0", 2);
|
||||||
var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "" : "Open";
|
var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "" : "Open";
|
||||||
@ -911,7 +911,7 @@
|
|||||||
var newUrl = baseUrl + '?PONO=' + obj.PONO + '&ReqType=' + obj.POType;
|
var newUrl = baseUrl + '?PONO=' + obj.PONO + '&ReqType=' + obj.POType;
|
||||||
$('#printLink').attr('href', newUrl);
|
$('#printLink').attr('href', newUrl);
|
||||||
$("#po").val(obj.PONO);
|
$("#po").val(obj.PONO);
|
||||||
$("#Sup").val(obj.SupplierName);
|
$("#Sup").val(obj.SupplierName + "\n" + obj.Address);
|
||||||
$("#hiddenIsOpenOrder").val(obj.IsOpenOrder);
|
$("#hiddenIsOpenOrder").val(obj.IsOpenOrder);
|
||||||
isOpenOrder = parseInt(obj.IsOpenOrder ? obj.IsOpenOrder : "0", 2);
|
isOpenOrder = parseInt(obj.IsOpenOrder ? obj.IsOpenOrder : "0", 2);
|
||||||
var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "" : "Open";
|
var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "" : "Open";
|
||||||
|
|||||||
@ -305,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="powerConsumptionExport" href="#">Export</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -776,13 +776,28 @@ foreach ($period as $day) {
|
|||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
><?= $previousMonthPowerConsumptionStockDetails[$powerMachineIndex]['closing_units'] ?>
|
><?php
|
||||||
|
if(empty( $previousMonthPowerConsumptionStockDetails)){
|
||||||
|
echo " " ;
|
||||||
|
}else{
|
||||||
|
echo $previousMonthPowerConsumptionStockDetails[$powerMachineIndex]['closing_units'] ;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="celda_normal closingUnits"
|
<td class="celda_normal closingUnits"
|
||||||
data-id="<?= $dateInMonth ?> <?= $powerMachine['id'] ?>"
|
data-id="<?= $dateInMonth ?> <?= $powerMachine['id'] ?>"
|
||||||
oninput="closingUnitsChange(this)"
|
oninput="closingUnitsChange(this)"
|
||||||
contenteditable="true"><?= $previousMonthPowerConsumptionStockDetails[$powerMachineIndex]['closing_units'] ?>
|
contenteditable="true">
|
||||||
|
<?php
|
||||||
|
if(empty( $previousMonthPowerConsumptionStockDetails)){
|
||||||
|
echo " " ;
|
||||||
|
}else{
|
||||||
|
echo $previousMonthPowerConsumptionStockDetails[$powerMachineIndex]['closing_units'] ;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="celda_normal totalUnits"
|
<td class="celda_normal totalUnits"
|
||||||
@ -1285,3 +1300,46 @@ foreach ($period as $day) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
function exportTableToExcel(tableID, filename = '') {
|
||||||
|
let table = document.getElementById(tableID);
|
||||||
|
let cloneTable = table.cloneNode(true); // Clone the table to modify
|
||||||
|
|
||||||
|
// Remove hidden rows
|
||||||
|
$(cloneTable).find('tr').filter(function () {
|
||||||
|
return $(this).css('display') === 'none';
|
||||||
|
}).remove();
|
||||||
|
|
||||||
|
// Remove hidden columns
|
||||||
|
$(cloneTable).find('th, td').each(function () {
|
||||||
|
if ($(this).css('display') === 'none') {
|
||||||
|
$(this).remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let ws = XLSX.utils.table_to_sheet(cloneTable); // Convert modified table to sheet
|
||||||
|
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 = 'powerStockDetailsTableId';
|
||||||
|
|
||||||
|
document.getElementById('powerConsumptionExport').addEventListener('click',function(){
|
||||||
|
|
||||||
|
exportTableToExcel(tableId,'power_Consumption_details<?=$month?>.xlsx');
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
@ -298,7 +298,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="resinStockExport" href="#">Export</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -908,3 +908,46 @@ foreach ($period as $day) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
function exportTableToExcel(tableID, filename = '') {
|
||||||
|
let table = document.getElementById(tableID);
|
||||||
|
let cloneTable = table.cloneNode(true); // Clone the table to modify
|
||||||
|
|
||||||
|
// Remove hidden rows
|
||||||
|
$(cloneTable).find('tr').filter(function () {
|
||||||
|
return $(this).css('display') === 'none';
|
||||||
|
}).remove();
|
||||||
|
|
||||||
|
// Remove hidden columns
|
||||||
|
$(cloneTable).find('th, td').each(function () {
|
||||||
|
if ($(this).css('display') === 'none') {
|
||||||
|
$(this).remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let ws = XLSX.utils.table_to_sheet(cloneTable); // Convert modified table to sheet
|
||||||
|
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 = 'resinStockDetailsTableId';
|
||||||
|
|
||||||
|
document.getElementById('resinStockExport').addEventListener('click',function(){
|
||||||
|
|
||||||
|
exportTableToExcel(tableId,'Resin_Stock_Details<?=$month?>.xlsx');
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
@ -270,6 +270,19 @@
|
|||||||
<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" data-toggle="modal" data-target="#bs-example-modal-lg">Navigation</a>
|
||||||
|
<a class="dropdown-item" id="trpSandUseStockExport" href="#">Export</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@ -642,3 +655,48 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
function exportTableToExcel(tableID, filename = '') {
|
||||||
|
let table = document.getElementById(tableID);
|
||||||
|
let cloneTable = table.cloneNode(true); // Clone the table to modify
|
||||||
|
|
||||||
|
// Remove hidden rows
|
||||||
|
$(cloneTable).find('tr').filter(function () {
|
||||||
|
return $(this).css('display') === 'none';
|
||||||
|
}).remove();
|
||||||
|
|
||||||
|
// Remove hidden columns
|
||||||
|
$(cloneTable).find('th, td').each(function () {
|
||||||
|
if ($(this).css('display') === 'none') {
|
||||||
|
$(this).remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let ws = XLSX.utils.table_to_sheet(cloneTable); // Convert modified table to sheet
|
||||||
|
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 = 'trpSandUseStockDetailsTableId';
|
||||||
|
|
||||||
|
document.getElementById('trpSandUseStockExport').addEventListener('click',function(){
|
||||||
|
|
||||||
|
exportTableToExcel(tableId,'Trp_Sand_Use_Stock_Details_<?=$month?>.xlsx');
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user