stock module latest today vadivel J 04-03-2025

This commit is contained in:
vadivelJ96 2025-03-04 11:37:42 +05:30
parent 4977ca5cf6
commit 7739f7d208
47 changed files with 3201 additions and 726 deletions

View File

@ -43,9 +43,9 @@ $routes->get('user/deleteUser', 'User::deleteUser');
$routes->get('user/reActivateUser', 'User::reActivateUser');
// Supplier Routes
$routes->get('supplierlisting', 'Supplier::index'); // list supplier
$routes->match(["GET","POST"],'supplierlisting', 'Supplier::index'); // list supplier
$routes->add('addsupplier', 'Supplier::addsupplier');//load add supplier page
$routes->get('viewsupplier', 'Supplier::viewsupplier');// load edit supplier page
$routes->get('viewsupplier', 'Supplier::viewsupplier');
$routes->post('editsupplier', 'Supplier::updatesupplierdetails'); //save supplier details
$routes->post('addNewsupplier', 'Supplier::savesupplierdetails'); // update supplier details
$routes->post('supplierExist', 'Supplier::checksupplier');
@ -68,7 +68,7 @@ $routes->post('deleteMaterial', 'Rawmaterialdetails::deleteMaterial');
$routes->post('reActivateMaterial', 'Rawmaterialdetails::reActivateMaterial');
// Cost Center Routes
$routes->get('costListing', 'CostCenter::index');
$routes->match(['GET','POST'],'costListing', 'CostCenter::index');
$routes->post('fetchCostCenterDetails', 'CostCenter::fetchCostCenterDetails');// for Ajax both add and edit....
$routes->get('reActivateCostCenter', 'CostCenter::reActivateCostCenter');
$routes->get('deleteCostCenter', 'CostCenter::deleteCostCenter');
@ -97,7 +97,7 @@ $routes->post('getDriver', 'Driver::getDriver');
$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'driverPrintPdf', 'Driver::driverPrintPdf');
// Asset Detail Routes
$routes->get('assetListing', 'Assetdetails::assetListing');
$routes->match(['GET','POST'],'assetListing', 'Assetdetails::assetListing');
$routes->get('addasset', 'Assetdetails::addasset');
$routes->post('assetdetails/getpodetails', 'Assetdetails::getpodetails');
$routes->post('assetdetails/getline', 'Assetdetails::getline');
@ -151,7 +151,7 @@ $routes->get('configurationctrl/deleteConfig', 'Configurationctrl::deleteConfig'
$routes->get('configurationctrl/reActivateConfig', 'Configurationctrl::reActivateConfig');
// Department Master Routes
$routes->get('departmentListing', 'Department::index');
$routes->match(["GET","POST"],'departmentListing', 'Department::index');
$routes->get('adddepartment', 'Department::adddepartment');
$routes->post('savedepartment', 'Department::savedepartment');
$routes->get('editOlddepartment', 'Department::viewdepartment');
@ -295,10 +295,10 @@ $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'storerequisitionlisting', 'Sto
$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'EditStoreRequisition', 'Storerequisitioncontroller::EditStoreRequistion');
// Application IGR Routes
$routes->get('AddIGR', 'Inwardgateregister::addIGR'); // ADD IGR page - working
$routes->get('ViewIGR', 'Inwardgateregister::viewIGR'); // View IGR PAGE - Working
$routes->get( 'AddIGR', 'Inwardgateregister::addIGR'); // ADD IGR page - working
$routes->get( 'ViewIGR', 'Inwardgateregister::viewIGR'); // View IGR PAGE - Working
$routes->post('ViewIGR', 'Inwardgateregister::viewIGR');//for filter purpose
$routes->get('accountsDashboard', 'Inwardgateregister::accountsDashboard'); // View IGR PAGE - Working
$routes->get( 'accountsDashboard', 'Inwardgateregister::accountsDashboard'); // View IGR PAGE - Working
$routes->post('ViewIGRDetails', 'Inwardgateregister::viewIGRDetails');
$routes->post('GetIGRLineItemDetails', 'Inwardgateregister::getIGRLineItemDetails');
$routes->post('SaveIGR', 'Inwardgateregister::SaveIGR');// Save IGR PAGE - Working
@ -309,10 +309,13 @@ $routes->post('getCostCenterData', 'Inwardgateregister::getCostCenterData');
$routes->post('ViewIGRfile', 'Inwardgateregister::ViewIGRfile');
$routes->post('getAdditionalIGRFile', 'Inwardgateregister::getAdditionalIGRFile');
$routes->post('deleteAdditionalIGRFile', 'Inwardgateregister::deleteAdditionalIGRFile');
$routes->get('download-files/(:segment)', 'Inwardgateregister::downloadFilesAsZip/$1');
$routes->get( 'download-files/(:segment)', 'Inwardgateregister::downloadFilesAsZip/$1');
$routes->post('inwardgateregister/edituploadfile', 'Inwardgateregister::edituploadfile');
$routes->post('getIGRRemarks', 'Inwardgateregister::getIGRRemarks');
$routes->post('saveIGRRemarks', 'Inwardgateregister::saveIGRRemarks');
$routes->post('updateGasShortage','Inwardgateregister::updateGasShortage');
$routes->post('gasShortageList','Inwardgateregister::gasShortageList');
$routes->post('getGasShortageDetail',"Inwardgateregister::getGasShortageDetail");
// Non IGR / Expense
@ -439,7 +442,7 @@ $routes->post('download_sales_invoice', 'Sales::download_sales_invoice');
$routes->post('updateInvRecQty', 'Sales::updateInvRecQty');
// transporter Routes
$routes->get('transporterListing', 'Supplier::transporterListing');
$routes->match(['GET', 'POST'],'transporterListing', 'Supplier::transporterListing');
$routes->post('fetchTransporterDetails', 'Supplier::fetchTransporterDetails');// for Ajax both add and edit....
$routes->get('deleteTransporter', 'Supplier::deleteTransporter');
$routes->get('reActivateTransporter', 'Supplier::reActivateTransporter');
@ -449,6 +452,7 @@ $routes->post('checkTransporter', 'Supplier::checkTransporter');
$routes->post('createFactoryMachineMasterDetails', 'FactoryMachineController::createFactoryMachineMasterDetails');
$routes->get('readFactoryMachineMasterDetails', 'FactoryMachineController::readFactoryMachineMasterDetails');
$routes->post('readFactoryMachineMasterDetails', 'FactoryMachineController::readFactoryMachineMasterDetails');
$routes->get('readFactoryMachineMasterDetailsById', 'FactoryMachineController::readFactoryMachineMasterDetailsById');
$routes->post('updateFactoryMachineMasterDetails', 'FactoryMachineController::updateFactoryMachineMasterDetails');
$routes->get('deleteFactoryMachineMasterDetails', 'FactoryMachineController::deleteFactoryMachineMasterDetails');

View File

@ -50,9 +50,22 @@ class Assetdetails extends BaseController
*/
function assetListing()
{
$isActiveFilter = 1 ; // default showing active data
$showArchive = 0 ; //
if ($this->request->getMethod() === 'POST') {
$showArchive = $this->request->getPost('showArchive');
//reversing condition that when user wants deleted data to be shown then we are making active filter 0
if($showArchive){
$isActiveFilter = 0;
}
}
$data['showArchive'] = $showArchive;
$data['userRecords'] = $this->assetdetails_model->assetListing();
$data['userRecords'] = $this->assetdetails_model->assetListing($isActiveFilter);
$this->global['pageTitle'] = 'Asset List';
//print_r($data);die();

View File

@ -45,7 +45,21 @@ class CostCenter extends BaseController
*/
public function index()
{
$data['userRecords'] = $this->costcenter_model->CostListing();
$isActiveFilter = 1 ; // default showing active data
$showArchive = 0 ; //
if ($this->request->getMethod() === 'POST') {
$showArchive = $this->request->getPost('showArchive');
//reversing condition that when user wants deleted data to be shown we are making active filter
if($showArchive){
$isActiveFilter = 0;
}
}
$data['showArchive'] = $showArchive;
$data['userRecords'] = $this->costcenter_model->CostListing($isActiveFilter);
$this->global['pageTitle'] = 'Cost List';
$this->loadViews("costListing", $this->global, $data, NULL);

View File

@ -48,20 +48,25 @@ class Department extends BaseController
public function index()
{
// if($this->isAdmin() == TRUE)
// {
// $this->loadThis();
// }
// else
// {
$isActiveFilter = 1 ; // default showing active data
$showArchive = 0 ; //
if ($this->request->getMethod() === 'POST') {
$showArchive = $this->request->getPost('showArchive');
//reversing condition that when user wants deleted data to be shown then we are making active filter 0
if($showArchive){
$isActiveFilter = 0;
}
}
$data['showArchive'] = $showArchive;
$this->department_model = new department_model();
//$searchText = $this->request->getPost('searchText');
//$data['searchText'] = $searchText;
//$count = $this->department_model->departmentListing($searchText);
//$returns = $this->paginationCompress ( "departmentListing/", $count, 20 );
$data['userRecords'] = $this->department_model->departmentListing(); //$searchText, $returns["page"], $returns["segment"]);
$data['userRecords'] = $this->department_model->departmentListing($isActiveFilter); //$searchText, $returns["page"], $returns["segment"]);
$this->global['pageTitle'] = 'Department Listing';

View File

@ -25,6 +25,8 @@ class Expense extends BaseController
public function index()
{
$isActiveFilter = 1 ;
if ($this->request->getMethod() === 'GET')
{
@ -38,7 +40,7 @@ class Expense extends BaseController
}
$data['expense_list'] = $this->expense_model->getAllExpense($fromDate,$toDate);
$data['supplier_list'] = json_encode($this->supplier_model->supplierlisting());
$data['supplier_list'] = json_encode($this->supplier_model->supplierlisting($isActiveFilter));
$this->global['pageTitle'] = 'Non IGR / Expense List';
$data['fromDate'] = date('d-m-Y', strtotime($fromDate));
$data['toDate'] = date('d-m-Y', strtotime($toDate));

View File

@ -80,9 +80,25 @@ class FactoryMachineController extends BaseController
public function readFactoryMachineMasterDetails(){
$isActiveFilter = 1 ; // default showing active data
$showArchive = 0 ; //
if ($this->request->getMethod() === 'POST') {
$showArchive = $this->request->getPost('showArchive');
//reversing condition that when user wants deleted data to be shown then we are making active filter 0
if($showArchive){
$isActiveFilter = 0;
}
}
$data['showArchive'] = $showArchive;
$this->global['pageTitle'] = 'Factory Machine Master Details';
$data['masterData'] = $this->factoryMachineMaster_model
->where('is_active',$isActiveFilter)
->orderBy('created_at','DESC')
->findAll();

View File

@ -8,6 +8,7 @@ use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Inwardgateregister_model;
use App\Models\IGRRemarks_model;
use App\Models\GasShortageModel;
use App\Helpers\Notification;
use DateTime;
@ -25,6 +26,7 @@ class Inwardgateregister extends BaseController
{
protected $inwardgateregister_model;
protected $IGRRemarks_model;
protected $gasShortage_model;
protected $session;
protected $logger;
@ -37,6 +39,7 @@ class Inwardgateregister extends BaseController
parent::__construct();
$this->inwardgateregister_model = new Inwardgateregister_model();
$this->IGRRemarks_model = new IGRRemarks_model();
$this->gasShortage_model = new GasShortageModel();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
@ -1472,4 +1475,62 @@ function updateIGRWeight(){
}
}
public function gasShortageList(){
$postData = $this->request->getPost();
$allShortages = $this->gasShortage_model->where('invoiceNo',$postData['invoiceNo'])->findAll();
return $this->response->setJSON(['status' => 'success', 'data' => $allShortages]);
}
public function getGasShortageDetail(){
$postData = $this->request->getPost();
$shortage = $this->gasShortage_model->where('id',$postData['id'])->find();
return $this->response->setJSON(['status' => 'success', 'data' => $shortage]);
}
public function updateGasShortage()
{
$postData = $this->request->getPost();
// Validate required data
if (!$postData) {
return $this->response->setJSON(['status' => 'error', 'message' => 'Invalid request. No data received.']);
}
// Validate required fields for adding
if ( !isset($postData['invoiceNo']) ) {
return $this->response->setJSON(['status' => 'error', 'message' => 'Missing required fields: invoice No.']);
}
// Handle update (edit)
if (isset($postData["id"])) {
return $this->gasShortage_model->update($postData["id"], $postData)
? $this->response->setJSON(['status' => 'success', 'message' => 'Gas shortage details updated successfully.'])
: $this->response->setJSON(['status' => 'error', 'message' => 'Failed to update gas shortage details.']);
}
// Insert new shortage (add)
return ($insertId = $this->gasShortage_model->insert($postData))
? $this->response->setJSON(['status' => 'success', 'message' => 'Gas shortage details added successfully.', 'data' => ['id' => $insertId]])
: $this->response->setJSON(['status' => 'error', 'message' => 'Failed to save gas shortage details.']);
}
}

View File

@ -66,9 +66,22 @@ class Rawmaterialdetails extends BaseController
function rawmaterialListing()
{
$this->rawmaterialdetails_model = new rawmaterialdetails_model();;
$isActiveFilter = 1 ; // default showing active data
$showArchive = 0 ; //
$data['userRecords'] = $this->rawmaterialdetails_model->rawmaterialListing();
if ($this->request->getMethod() === 'POST') {
$showArchive = $this->request->getPost('showArchive');
//reversing condition that when user wants deleted data to be shown we are making active filter
if($showArchive){
$isActiveFilter = 0;
}
}
$this->rawmaterialdetails_model = new rawmaterialdetails_model();
$data['userRecords'] = $this->rawmaterialdetails_model->rawmaterialListing($isActiveFilter);
$data['showArchive'] = $showArchive ;
$data['materialCategoryList']= $this->materialCategories_model->where('is_active',1)->findAll();
$this->global['pageTitle'] = 'RawMaterial Listing';

View File

@ -17,14 +17,16 @@ use App\Models\BagStockDetailsModel;
use App\Models\DustAndRoughModel;
use App\Models\ResinStockModel;
use App\Models\GasStockModel;
use App\Models\TrpAbstract;
use App\Models\TrpAbstractParticulars;
use App\Models\TrpSandUseStockModel;
use App\Models\TrpProductionModel;
use App\Models\TrpProductionMaintenanceModel;
use App\Models\TrpProductionWasteModel;
use App\Models\Employeedetails_model;
use App\Models\PowerConsumptionSummaryModel;
use App\Models\MonthWiseMaterialInStockModel;
use App\Models\MonthWiseMachinesInStockModel;
use App\Models\TrpAbstractModel;
@ -68,9 +70,11 @@ class StockController extends BaseController
protected $employeedetails_model;
protected $trpAbstractParticularsModel ;
protected $monthWiseMaterialInStockModel ;
protected $trpAbstractModel ;
protected $monthWiseMachineInStockModel ;
protected $trpAbstract_model ;
/**
@ -120,10 +124,12 @@ class StockController extends BaseController
$this->employeedetails_model = new Employeedetails_model();
$this->powerConsumptionSummary_model = new PowerConsumptionSummaryModel();
$this->monthWiseMaterialInStockModel = new MonthWiseMaterialInStockModel();
$this->trpAbstractParticularsModel = new TrpAbstractParticulars();
$this->monthWiseMachineInStockModel = new MonthWiseMachinesInStockModel();
$this->trpAbstractModel = new TrpAbstract();
$this->trpAbstract_model = new TrpAbstractModel();
$this->session = session();
@ -791,6 +797,98 @@ class StockController extends BaseController
$this->global['pageTitle'] = 'Bag Stock Details';
$startDate = "$month-01";
$endDate = date("Y-m-t", strtotime($startDate));
$customisedMaterialCodes = $this->request->getPost('customisedMaterialCodes') ?? [];
$existingCustomMaterialCodes = $this->monthWiseMaterialInStockModel
->select('materialCode')
->where('date',"$month-01")
->where('stock_category','packing_material')
->findAll();
//check user applies for filter currently
if(!empty($customisedMaterialCodes)){
//user applied filter,
//check already filter existing , if exists remove that ,
if(!empty($existingCustomMaterialCodes)){
//hard delete done..!!
$existingCustomMaterialCodes = $this->monthWiseMaterialInStockModel
->where('date',"$month-01")
->where('stock_category','packing_material')
->delete();
}
//if no filter already exists or removed current one , just add current filter for that month ....!!
$inserts = [];
foreach($customisedMaterialCodes as $index => $customisedMaterialCode){
$inserts [] = [
'date' => "$month-01",
'stock_category' => "packing_material",
'materialCode' => $customisedMaterialCode
];
//checking filtered material code present in table , if not create dummy one for whole month
$findMaterialCode = $this->bagStockDetails_model
->where('date >=', $startDate)
->where('date <=', $endDate)
->where('materialCode',$customisedMaterialCode)
->findAll();
//check any material code is not present in stock table but applied in filter
if(empty($findMaterialCode)){
//create dummy entry for that
$this->createDummyEntryForBag($customisedMaterialCode,$startDate,$endDate);
}
}
if(!empty($inserts)){
//insert all the latest applied filter
$this->monthWiseMaterialInStockModel->insertBatch($inserts);
//get the currently applied filter
$existingCustomMaterialCodes = $this->monthWiseMaterialInStockModel
->select('materialCode')
->where('date',"$month-01")
->where('stock_category','packing_material')
->get()->getResultArray();
}
}
//possible if no filter applied at all...!!!
if(empty($existingCustomMaterialCodes)){
//no filter applied at all just present all active material codes
$existingCustomMaterialCodes = $this->rawmaterialdetails_model
->getAllBagMaterialCode();
}else{
//if filter present,get that material codes
$existingCustomMaterialCodes = $this->rawmaterialdetails_model
->getSelectedBagMaterialCode(array_column($existingCustomMaterialCodes, 'materialCode'));
}
$materialCodeList = array_column($existingCustomMaterialCodes, 'MaterialCode');
$bagMaterials = $existingCustomMaterialCodes ;
$data['activeBagMaterials'] = $this->rawmaterialdetails_model->getAllBagMaterialCode();
// Get the previous month's last date bag stock details for next month updation
$previousMonth = DateTime::createFromFormat('Y-m', $month)->modify('-1 month')->format('Y-m');
@ -809,11 +907,10 @@ class StockController extends BaseController
// checking in database if the data is available for the month
$startDate = "$month-01";
$endDate = date("Y-m-t", strtotime($startDate));
$data['bagStockDetails'] = $this->bagStockDetails_model
->where('date >=', $startDate)
->where('date <=', $endDate)
->whereIn('materialCode',$materialCodeList)
->groupBy(['materialCode', 'date'])
->orderBy('date', 'asc')
->orderBy('materialCode', 'asc')
@ -856,25 +953,28 @@ class StockController extends BaseController
//temp_code_s_2025_02
// getting bag material for creating table headers
// checking already existing stock if yes then get the material code from the existing bag
// if not get all the material codes from the raw material details table
// // getting bag material for creating table headers
// // checking already existing stock if yes then get the material code from the existing bag
// // if not get all the material codes from the raw material details table
if (!empty($data['groupedBagStockDetails'])) {
$result = $groupedByDate[$date];
// if (!empty($data['groupedBagStockDetails'])) {
// $result = $groupedByDate[$date];
$distinctMaterialCodes = [];
// $distinctMaterialCodes = [];
foreach ($result as $index => $eachResult) {
$distinctMaterialCodes[] = $result[$index]['materialCode'];
}
// foreach ($result as $index => $eachResult) {
// $distinctMaterialCodes[] = $result[$index]['materialCode'];
// }
$bagMaterials = $this->rawmaterialdetails_model->getSelectedBagMaterialCode($distinctMaterialCodes);
// $bagMaterials = $this->rawmaterialdetails_model->getSelectedBagMaterialCode($distinctMaterialCodes);
} else {
$bagMaterials = $this->rawmaterialdetails_model->getAllBagMaterialCode();
}
// } else {
// $bagMaterials = $this->rawmaterialdetails_model->getAllBagMaterialCode();
// }
//temp_code_e_2025_02
// getting customer for creating table headers
@ -1104,6 +1204,97 @@ class StockController extends BaseController
$this->global['pageTitle'] = 'Resin Stock Details';
$startDate = "$month-01";
$endDate = date("Y-m-t", strtotime($startDate));
$customisedMaterialCodes = $this->request->getPost('customisedMaterialCodes') ?? [];
$existingCustomMaterialCodes = $this->monthWiseMaterialInStockModel
->select('materialCode')
->where('date',"$month-01")
->where('stock_category','resin')
->findAll();
//check user applies for filter currently
if(!empty($customisedMaterialCodes)){
//user applied filter,
//check already filter existing , if exists remove that ,
if(!empty($existingCustomMaterialCodes)){
//hard delete done..!!
$existingCustomMaterialCodes = $this->monthWiseMaterialInStockModel
->where('date',"$month-01")
->where('stock_category','resin')
->delete();
}
//if no filter already exists or removed current one , just add current filter for that month ....!!
$inserts = [];
foreach($customisedMaterialCodes as $index => $customisedMaterialCode){
$inserts [] = [
'date' => "$month-01",
'stock_category' => "resin",
'materialCode' => $customisedMaterialCode
];
//checking filtered material code present in table , if not create dummy one for whole month
$findMaterialCode = $this->resinStockDetails_model
->where('date >=', $startDate)
->where('date <=', $endDate)
->where('materialCode',$customisedMaterialCode)
->findAll();
//check any material code is not present in stock table but applied in filter
if(empty($findMaterialCode)){
//create dummy entry for that
$this->createDummyEntryForResin($customisedMaterialCode,$startDate,$endDate);
}
}
if(!empty($inserts)){
//insert all the latest applied filter
$this->monthWiseMaterialInStockModel->insertBatch($inserts);
//get the currently applied filter
$existingCustomMaterialCodes = $this->monthWiseMaterialInStockModel
->select('materialCode')
->where('date',"$month-01")
->where('stock_category','resin')
->get()->getResultArray();
}
}
//possible if no filter applied at all...!!!
if(empty($existingCustomMaterialCodes)){
//no filter applied at all just present all active material codes
$existingCustomMaterialCodes = $this->rawmaterialdetails_model->getAllResinMaterialCode();
}else{
//if filter present,get that material codes
$existingCustomMaterialCodes = $this->rawmaterialdetails_model
->getSelectedResinMaterialCode(array_column($existingCustomMaterialCodes, 'materialCode'));
}
$materialCodeList = array_column($existingCustomMaterialCodes, 'MaterialCode');
$resinMaterials = $existingCustomMaterialCodes ;
$data['activeResinMaterials'] = $this->rawmaterialdetails_model->getAllResinMaterialCode();
// Get the previous month's last date resin stock details for next month updation
@ -1123,11 +1314,12 @@ class StockController extends BaseController
// checking in database if the data is available for the month
$startDate = "$month-01";
$endDate = date("Y-m-t", strtotime($startDate));
$data['resinStockDetails'] = $this->resinStockDetails_model
->where('date >=', $startDate)
->where('date <=', $endDate)
->whereIn('materialCode',$materialCodeList)
->groupBy(['materialCode', 'date'])
->orderBy('date', 'asc')
->orderBy('materialCode', 'asc')
@ -1166,28 +1358,31 @@ class StockController extends BaseController
$data['groupedResinStockDetails'] = array_values($groupedByDate);
//temp_code_s_2025_02
// getting resin material for creating table headers
// checking already existing stock if yes then get the material code from the existing stock
// if not get all the material codes from the raw material details table
// if not get all the material codes currently isActive from the raw material details table
if (!empty($data['groupedResinStockDetails'])) {
// if (!empty($data['groupedResinStockDetails'])) {
$result = $groupedByDate[$date];
// $result = $groupedByDate[$date];
$distinctMaterialCodes = [];
// $distinctMaterialCodes = [];
foreach ($result as $index => $eachResult) {
$distinctMaterialCodes[] = $result[$index]['materialCode'];
}
// foreach ($result as $index => $eachResult) {
// $distinctMaterialCodes[] = $result[$index]['materialCode'];
// }
$resinMaterials = $this->rawmaterialdetails_model->getSelectedResinMaterialCode($distinctMaterialCodes);
// $resinMaterials = $this->rawmaterialdetails_model->getSelectedResinMaterialCode($distinctMaterialCodes);
} else {
// } else {
$resinMaterials = $this->rawmaterialdetails_model->getAllResinMaterialCode();
// $resinMaterials = $this->rawmaterialdetails_model->getAllResinMaterialCode();
}
// }
//temp_code_e_2025_02
// getting customer for creating table headers
@ -1218,6 +1413,119 @@ class StockController extends BaseController
return $this->loadViews("stock/resinStockDetails", $this->global, $data, NULL);
}
public function createDummyEntryForResin($customisedMaterialCode, $startDate, $endDate)
{
if (!empty($customisedMaterialCode)) {
$inserts = [];
// Convert start and end date to timestamps
$startTimestamp = strtotime($startDate);
$endTimestamp = strtotime($endDate);
while ($startTimestamp <= $endTimestamp) {
$inserts[] = [
'date' => date('Y-m-d', $startTimestamp), // Convert timestamp to date format
'materialCode' => $customisedMaterialCode,
'customer' => ' ',
'opening' => ' ',
'receipt' => ' ',
'used' => ' ',
'balanceStock' => ' ',
];
$startTimestamp = strtotime('+1 day', $startTimestamp); // Move to the next day
}
if (!empty($inserts)) {
$this->resinStockDetails_model->insertBatch($inserts);
}
}
}
public function createDummyEntryForBag($customisedMaterialCode, $startDate, $endDate)
{
if (!empty($customisedMaterialCode)) {
$inserts = [];
// Convert start and end date to timestamps
$startTimestamp = strtotime($startDate);
$endTimestamp = strtotime($endDate);
while ($startTimestamp <= $endTimestamp) {
$inserts[] = [
'date' => date('Y-m-d', $startTimestamp), // Convert timestamp to date format
'materialCode' => $customisedMaterialCode,
'customer' => ' ',
'opening' => ' ',
'receipt' => ' ',
'used' => ' ',
'balanceStock' => ' ',
];
$startTimestamp = strtotime('+1 day', $startTimestamp); // Move to the next day
}
if (!empty($inserts)) {
$this->bagStockDetails_model->insertBatch($inserts);
}
}
}
public function createDummyEntryForDieselMachine($customisedMachineCode, $startDate, $endDate)
{
if (!empty($customisedMachineCode)) {
$inserts = [];
// Convert start and end date to timestamps
$startTimestamp = strtotime($startDate);
$endTimestamp = strtotime($endDate);
while ($startTimestamp <= $endTimestamp) {
$inserts[] = [
'date' => date('Y-m-d', $startTimestamp), // Convert timestamp to date format
'machine_id' => $customisedMachineCode,
'opening_units' => ' ',
'closing_units' => ' ',
'total_units' => ' ',
];
$startTimestamp = strtotime('+1 day', $startTimestamp); // Move to the next day
}
if (!empty($inserts)) {
$this->factoryVehicleDieselDetails_model->insertBatch($inserts);
}
}
}
public function createDummyEntryForElectricMachine($customisedMachineCode, $startDate, $endDate)
{
if (!empty($customisedMachineCode)) {
$inserts = [];
// Convert start and end date to timestamps
$startTimestamp = strtotime($startDate);
$endTimestamp = strtotime($endDate);
while ($startTimestamp <= $endTimestamp) {
$inserts[] = [
'date' => date('Y-m-d', $startTimestamp), // Convert timestamp to date format
'machine_id' => $customisedMachineCode,
'opening_units' => ' ',
'closing_units' => ' ',
'total_units' => ' ',
];
$startTimestamp = strtotime('+1 day', $startTimestamp); // Move to the next day
}
if (!empty($inserts)) {
$this->powerConsumptionDetails_model->insertBatch($inserts);
}
}
}
public function updateResinStockDetails()
{
@ -1737,6 +2045,7 @@ class StockController extends BaseController
$data['wcsSupplierList'] = $result[2] ;
$data['trpAbstract'] = $this->trpAbstract_model->currentMonthTrpAbstract($startDate,$endDate);
$date = DateTime::createFromFormat('Y-m', $month);
@ -1931,24 +2240,6 @@ class StockController extends BaseController
foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
if($datesInMonthIndex == 0){
$trpAbstractParticulars =$this->trpAbstractParticularsModel->findAll();
foreach($trpAbstractParticulars as $index => $trpAbstractParticular){
$trpAbstract[] = [
'date' => $dateInMonth ,
'abs_opening_stock' => 0 ,
'abs_physical_stock'=> 0 ,
'abs_remarks' => " " ,
'abs_particular_id' => $trpAbstractParticular['id'],
];
}
}
$inserts[] = [
'Date' => $dateInMonth,
@ -2091,10 +2382,11 @@ class StockController extends BaseController
$monthData = $this->getMonthDatesFromInput($currentMonth);
$isActiveFilter = 1 ;
$data['startDate'] = $monthData[0]['database'];
$data['endDate'] = $monthData[count($monthData) - 1]['database'];
$data['timeDropdown'] = $this->generateTimeOptions();
$data['supplierData'] = $this->supplier_model->supplierlisting();
$data['supplierData'] = $this->supplier_model->supplierlisting($isActiveFilter);
$data['drierDetails'] = $this->drierMachineDetails_model
->where('date >=', $data['startDate'])
@ -2130,14 +2422,12 @@ class StockController extends BaseController
$data = $row;
if (($existingRow)) {
// dd("inside update");
if (($existingRow)) {
$existingRow = $this->drierMachineDetails_model->where('id', $row['id'] ?? '')->first();
$this->handleGasStockUpdate($existingRow, $row);
$updates[] = $data;
} else {
// dd("inside insert");
$this->updateGasStockConsumption($data['date'], $data['total_gas_consumption']);
$inserts[] = $data;
}
@ -2261,6 +2551,121 @@ class StockController extends BaseController
$this->global['pageTitle'] = 'Power Consumption Stock Details';
//filter part starts
//start date dynamic from front-end
$startDate = "$month-01";
//end date of given month
$endDate = date("Y-m-t", strtotime($startDate));
//filter applied currently
$customisedMachineCodes = $this->request->getPost('customisedMachineCodes') ?? [];
//already applied filter
$existingCustomMachineCodes = $this->monthWiseMachineInStockModel
->select('machine_id')
->where('date',"$month-01")
->where('machine_category','electric')
->findAll();
//check user applies for filter currently
if(!empty($customisedMachineCodes)){
//user applied filter,
//check already filter existing , if exists remove that ,
if(!empty($existingCustomMachineCodes)){
//hard delete done..!!
$existingCustomMachineCodes = $this->monthWiseMachineInStockModel
->where('date',"$month-01")
->where('machine_category','electric')
->delete();
}
//if no filter already exists or removed current one , just add current filter for that month ....!!
$inserts = [];
foreach($customisedMachineCodes as $index => $customisedMachineCode){
$inserts [] = [
'date' => "$month-01",
'machine_category' => "electric",
'machine_id' => $customisedMachineCode
];
//checking filtered material code present in table , if not create dummy one for whole month
$findMachineCode = $this->powerConsumptionDetails_model
->where('date >=', $startDate)
->where('date <=', $endDate)
->where('machine_id',$customisedMachineCode)
->findAll();
//check any material code is not present in stock table but applied in filter
if(empty($findMachineCode)){
//create dummy entry for this
$this->createDummyEntryForElectricMachine($customisedMachineCode,$startDate,$endDate);
}
}
if(!empty($inserts)){
//insert all the latest applied filter
$this->monthWiseMachineInStockModel->insertBatch($inserts);
//get the currently applied filter
$existingCustomMachineCodes = $this->monthWiseMachineInStockModel
->select('machine_id')
->where('date',"$month-01")
->where('machine_category','electric')
->get()
->getResultArray();
}
}
//possible if no filter applied at all...!!!
if(empty($existingCustomMachineCodes)){
//no filter applied at all just present all active material codes
$existingCustomMachineCodes = $this->factoryMachine_model
->getAllActiveElectricMachines();
}else{
//if filter present,get that material codes
$existingCustomMachineCodes = $this->factoryMachine_model
->getSelectedElectricMachines(array_column($existingCustomMachineCodes, 'machine_id'));
}
//this existingCustomMachineCodes gets its machine after visiting factory machine master table
$machineCodeList = array_column($existingCustomMachineCodes, 'id');
$electricMachines = $existingCustomMachineCodes;
$data['activeElectricMachines'] = $this->factoryMachine_model->getAllActiveElectricMachines();
// 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');
@ -2288,12 +2693,12 @@ class StockController extends BaseController
// 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)
->whereIn('machine_id',$machineCodeList)
->groupBy(['machine_id', 'date'])
->orderBy('date', 'asc')
->orderBy('machine_id', 'asc')
@ -2338,37 +2743,32 @@ class StockController extends BaseController
$data['groupedPowerConsumptionStockDetails'] = array_values($groupedByDate);
//temp_code_s_2025_02
// 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'])) {
// if (!empty($data['groupedPowerConsumptionStockDetails'])) {
$result = $groupedByDate[$date];
// $result = $groupedByDate[$date];
$distinctMachineId = [];
// $distinctMachineId = [];
foreach ($result as $index => $eachResult) {
$distinctMachineId[] = $result[$index]['machine_id'];
}
// foreach ($result as $index => $eachResult) {
// $distinctMachineId[] = $result[$index]['machine_id'];
// }
$electricMachines = $this->factoryMachine_model
->whereIn('id', $distinctMachineId)
->orderBy('id', 'asc')
->get()
->getResultArray();
// $electricMachines = $this->factoryMachine_model->getSelectedElectricMachines($distinctMachineId);
} else {
// } else {
$electricMachines = $this->factoryMachine_model
->where('is_active', 1)
->where('energy_type', 'Electric')
->orderBy('id', 'asc')
->get()
->getResultArray();
// $electricMachines = $this->factoryMachine_model->getAllActiveElectricMachines();
}
// }
//temp_code_e_2025_02
@ -2545,6 +2945,119 @@ class StockController extends BaseController
$this->global['pageTitle'] = 'Diesel Machine Stock Details';
//filter part starts
//start date dynamic from front-end
$startDate = "$month-01";
//end date of given month
$endDate = date("Y-m-t", strtotime($startDate));
//filter applied currently
$customisedMachineCodes = $this->request->getPost('customisedMachineCodes') ?? [];
//already applied filter
$existingCustomMachineCodes = $this->monthWiseMachineInStockModel
->select('machine_id')
->where('date',"$month-01")
->where('machine_category','diesel')
->findAll();
//check user applies for filter currently
if(!empty($customisedMachineCodes)){
//user applied filter,
//check already filter existing , if exists remove that ,
if(!empty($existingCustomMachineCodes)){
//hard delete done..!!
$existingCustomMachineCodes = $this->monthWiseMachineInStockModel
->where('date',"$month-01")
->where('machine_category','diesel')
->delete();
}
//if no filter already exists or removed current one , just add current filter for that month ....!!
$inserts = [];
foreach($customisedMachineCodes as $index => $customisedMachineCode){
$inserts [] = [
'date' => "$month-01",
'machine_category' => "diesel",
'machine_id' => $customisedMachineCode
];
//checking filtered material code present in table , if not create dummy one for whole month
$findMachineCode = $this->factoryVehicleDieselDetails_model
->where('date >=', $startDate)
->where('date <=', $endDate)
->where('machine_id',$customisedMachineCode)
->findAll();
//check any material code is not present in stock table but applied in filter
if(empty($findMachineCode)){
//create dummy entry for this
$this->createDummyEntryForDieselMachine($customisedMachineCode,$startDate,$endDate);
}
}
if(!empty($inserts)){
//insert all the latest applied filter
$this->monthWiseMachineInStockModel->insertBatch($inserts);
//get the currently applied filter
$existingCustomMachineCodes = $this->monthWiseMachineInStockModel
->select('machine_id')
->where('date',"$month-01")
->where('machine_category','diesel')
->get()
->getResultArray();
}
}
//possible if no filter applied at all...!!!
if(empty($existingCustomMachineCodes)){
//no filter applied at all just present all active material codes
$existingCustomMachineCodes = $this->factoryMachine_model
->getAllActiveDieselMachines();
}else{
//if filter present,get that material codes
$existingCustomMachineCodes = $this->factoryMachine_model
->getSelectedDieselMachines(array_column($existingCustomMachineCodes, 'machine_id'));
}
//this existingCustomMachineCodes gets its machine 'id' after visiting factory machine master table in above step,
$machineCodeList = array_column($existingCustomMachineCodes, 'id');
$dieselMachines = $existingCustomMachineCodes;
$data['activeDieselMachines'] = $this->factoryMachine_model->getAllActiveDieselMachines();
// Get the previous month's last date diesel stock details for next month updation
$previousMonth = DateTime::createFromFormat('Y-m', $month)->modify('-1 month')->format('Y-m');
@ -2579,6 +3092,7 @@ class StockController extends BaseController
$data['dieselMachineStockDetails'] = $this->factoryVehicleDieselDetails_model
->where('date >=', $startDate)
->where('date <=', $endDate)
->whereIn('machine_id',$machineCodeList)
->groupBy(['machine_id', 'date'])
->orderBy('date', 'asc')
->orderBy('machine_id', 'asc')
@ -2625,38 +3139,41 @@ class StockController extends BaseController
//temp_code_s_2025_02
// getting diesel machines for creating table headers
// checking already existing stock if yes then get the diesel machines id from the existing stock
// if not get all the diesel machines from the factory Machine master table
if (!empty($data['groupedDieselMachineStockDetails'])) {
// if (!empty($data['groupedDieselMachineStockDetails'])) {
$result = $groupedByDate[$date];
// $result = $groupedByDate[$date];
$distinctMachineId = [];
// $distinctMachineId = [];
foreach ($result as $index => $eachResult) {
$distinctMachineId[] = $result[$index]['machine_id'];
}
// foreach ($result as $index => $eachResult) {
// $distinctMachineId[] = $result[$index]['machine_id'];
// }
$dieselMachines = $this->factoryMachine_model
->whereIn('id', $distinctMachineId)
->orderBy('id', 'asc')
->get()
->getResultArray();
// $dieselMachines = $this->factoryMachine_model
// ->whereIn('id', $distinctMachineId)
// ->orderBy('id', 'asc')
// ->get()
// ->getResultArray();
} else {
// } else {
$dieselMachines = $this->factoryMachine_model
->where('is_active', 1)
->where('energy_type', 'Diesel')
->orderBy('id', 'asc')
->get()
->getResultArray();
// $dieselMachines = $this->factoryMachine_model
// ->where('is_active', 1)
// ->where('energy_type', 'Diesel')
// ->orderBy('id', 'asc')
// ->get()
// ->getResultArray();
}
// }
//temp_code_e_2025_02

View File

@ -47,7 +47,22 @@ class Supplier extends BaseController
*/
public function index()
{
$data['userRecords'] = $this->supplier_model->supplierlisting();
$isActiveFilter = 1 ; // default showing active transporters data
$showArchive = 0 ; //
if ($this->request->getMethod() === 'POST') {
$showArchive = $this->request->getPost('showArchive');
//reversing condition that when user wants deleted data to be shown we are making active filter
if($showArchive){
$isActiveFilter = 0;
}
}
$data['userRecords'] = $this->supplier_model->supplierlisting($isActiveFilter);
$data['showArchive'] = $showArchive ;
$this->global['pageTitle'] = 'Supplier Listing';
$this->loadViews("supplierListing", $this->global, $data, NULL);
}
@ -473,7 +488,20 @@ class Supplier extends BaseController
*/
public function transporterListing()
{
$data['userRecords'] = $this->supplier_model->transporterListing();
$isActiveFilter = 1 ; // default showing active transporters data
$showArchive = 0 ; //
if ($this->request->getMethod() === 'POST') {
$showArchive = $this->request->getPost('showArchive');
//reversing condition that when user wants deleted data to be shown we are making active filter
if($showArchive){
$isActiveFilter = 0;
}
}
$data['userRecords'] = $this->supplier_model->transporterListing($isActiveFilter);
$data['showArchive'] = $showArchive ;
$this->global['pageTitle'] = 'Transporter List';
$this->loadViews("transporterListing", $this->global, $data, NULL);
}

View File

@ -891,14 +891,26 @@ class User extends BaseController
*/
function userListing()
{
// if($this->isAdmin() == TRUE)
// {
// $this->loadThis();
// }
// else
// {
$isDeleted = 0 ; // default showing active data
$showArchive = 0 ; //
if ($this->request->getMethod() === 'POST') {
$showArchive = $this->request->getPost('showArchive');
//reversing condition that when user wants deleted data to be shown then we are making active filter 0
if($showArchive){
$isDeleted = 1;
}
}
$data['showArchive'] = $showArchive;
// dd($data);
$data['userRecords'] = $this->user_model->userListing($isDeleted);
$data['userRecords'] = $this->user_model->userListing();
$this->global['pageTitle'] = 'User Listing';
// dd($data);

View File

@ -14,12 +14,13 @@ class Assetdetails_model extends Model
* @param number $segment : This is pagination limit
* @return array $result : This is result
*/
function assetListing()
function assetListing($isActiveFilter)
{
$builder = $this->db->table('t_asset_details asd')
->select('asd.*,dep.DepartmentName,sup.SupplierName')
->join('t_departmentdetails dep', ' dep.DEPCode = asd.DEPCode', 'left')
->join('t_supplierdetailsn sup', 'sup.SupplierID = asd.SupplierCode', 'left')
->where('asd.IsActive',$isActiveFilter)
->orderBy('asd.CreatedDt', 'desc');
$query = $builder->get();

View File

@ -13,12 +13,13 @@ class Costcenter_model extends Model
* @param number $segment : This is pagination limit
* @return array $result : This is result
*/
function CostListing()
function CostListing($isActiveFilter)
{
$builder = $this->db->table('t_costcenter_master as Cost')
->select('Cost.id as id, Cost.CostCenterCode as code,Cost.CostCenterName as CostCenterName , Cost.ApprovedBy as ApprovedBy,Emp.FirstName as FirstName,Emp.Designation as Designation ,Cost.CreatedDate,Cost.IsActive,Cost.DeletedBy,Cost.DeletedBy')
->join('t_employee_details as Emp', 'Emp.EmpID=Cost.ApprovedBy')
->where('Cost.IsActive',$isActiveFilter)
->orderBy('Cost.CreatedDate', 'desc');
$query =$builder->get();

View File

@ -49,11 +49,13 @@ class Department_model extends Model
* @param number $segment : This is pagination limit
* @return array $result : This is result
*/
function departmentListing()
function departmentListing($isActiveFilter)
{
$builder = $this->db->table('t_departmentdetails as BaseT')
->select('BaseT.CreatedDt,BaseT.DepartmentName, BaseT.DEPCode, BaseT.HeadDept, BaseT.IsActive ,
BaseT.HeadDept')
BaseT.HeadDept,HeadDept.DepartmentName as headDepartmentName')
->join('t_departmentdetails as HeadDept', 'BaseT.HeadDept = HeadDept.DEPCode' ,'left')
->where('BaseT.IsActive',$isActiveFilter)
->orderBy("BaseT.DEPCode", "desc");
$query = $builder->get();
$result = $query->getResult();

View File

@ -62,6 +62,57 @@ class FactoryMachineModel extends Model
}
public function getAllActiveElectricMachines(){
$result = $this->db->table('t_factoryMachineMaster')
->where('is_active', 1)
->where('energy_type', 'electric')
->orderBy('id', 'asc')
->get()
->getResultArray();
return $result ;
}
public function getSelectedElectricMachines($distinctMachineId){
$result = $this->db->table('t_factoryMachineMaster')
->whereIn('id', $distinctMachineId)
->orderBy('id', 'asc')
->get()
->getResultArray();
return $result;
}
public function getAllActiveDieselMachines(){
$result = $this->db->table('t_factoryMachineMaster')
->where('is_active', 1)
->where('energy_type', 'diesel')
->orderBy('id', 'asc')
->get()
->getResultArray();
return $result ;
}
public function getSelectedDieselMachines($distinctMachineId){
$result = $this->db->table('t_factoryMachineMaster')
->whereIn('id', $distinctMachineId)
->orderBy('id', 'asc')
->get()
->getResultArray();
return $result;
}
}

View File

@ -0,0 +1,49 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class GasShortageModel extends Model
{
protected $table = 't_gasShortageDetails';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields =
['fullCylinderDate','emptyCylinderDate','invoiceNo',
'cylinderNo','grossWeight','tareWeight','netWeight','actualWeight','shortage'
];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
protected array $casts = [];
protected array $castHandlers = [];
// Dates
protected $useTimestamps = false;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $validationRules = [];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
}

View File

@ -552,8 +552,18 @@ class Inwardgateregister_model extends Model
$builder = $this->db->table('t_igr_master igr')
->distinct()
->select("igr.IGRNO,igr.*,igrd.*,MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity,POL.Rate,POM.POType,POM.IsOpenOrder,
POM.CapitalRange,POM.CapitalRange,st.CGST as service_cgst,st.SGST as service_sgst,st.IGST as service_igst,it.IGST as import_igst,rt.CGST as revenue_cgst,rt.SGST as revenue_sgst,rt.IGST as revenue_igst")
->select("
igr.IGRNO,igr.*,igrd.*,
MM.MaterialName,MM.UOM,
sup.Address,sup.SupplierName,
POL.Rate,
POM.ServiceDescription,POL.Quantity,POM.POType,POM.IsOpenOrder,
POM.CapitalRange,POM.CapitalRange,
st.CGST as service_cgst,st.SGST as service_sgst,st.IGST as service_igst,
it.IGST as import_igst,
rt.CGST as revenue_cgst,rt.SGST as revenue_sgst,rt.IGST as revenue_igst,
cd.ConfigValue As MaterialCategory")
->join('t_igr_details igrd', 'igrd.IGRNO = igr.IGRNO')
->join('t_purchaseorder_master POM', 'igr.PONO = POM.PONO')
->join('t_purchaseorder_lineitem POL', 'igr.PONO = POL.PONO and POL.MaterialCode=igrd.MaterialCode ')
@ -562,6 +572,7 @@ class Inwardgateregister_model extends Model
->join('t_service_tax st', 'st.LineItemNo = POL.LineItemNo' , 'left')
->join('t_revenue_tax rt', 'rt.LineItemNo = POL.LineItemNo' , 'left')
->join('t_import_tax it', 'it.LineItemNo = POL.LineItemNo' , 'left')
->join('t_configdetails cd','cd.key = MM.Category','left')
->where('igr.IGRNO', $IGRNO);
$query = $builder->get();
@ -1189,7 +1200,7 @@ class Inwardgateregister_model extends Model
igrMast.MaterialRcvdDate as materialRecievedDate,
igrMast.VehicleNo,
supplierDetails.SupplierName,
materialMaster.Category as sandType ,
cd.ConfigValue as sandType ,
t_igr_details.QuantityAsPerInvoice as Qty,
issd.*')
->whereIn('t_igr_details.MaterialCode', $materialCodes)
@ -1205,6 +1216,7 @@ class Inwardgateregister_model extends Model
->join('t_igr_master igrMast', 'igrMast.IGRNO = t_igr_details.IGRNO')
->join('t_incomingSilicaSandDetails issd','issd.igrNo_fk = t_igr_details.IGRNO AND issd.materialCode = t_igr_details.MaterialCode','left')
->join('t_materialmaster materialMaster', 'materialMaster.MaterialCode = t_igr_details.MaterialCode')
->join('t_configdetails cd','cd.key = materialMaster.Category','left')
->join('t_purchaseorder_master poMaster', 'poMaster.PONO = igrMast.PONO', 'left')
->join('t_supplierdetailsn supplierDetails', 'supplierDetails.SupplierID = poMaster.SupplierID', 'left')
->orderBy('t_igr_details.CreatedDate', 'asc ');
@ -1336,5 +1348,6 @@ $builder = $this->db->table('t_igr_history')
return $result;
}
}

View File

@ -4,15 +4,15 @@ namespace App\Models;
use CodeIgniter\Model;
class TrpAbstractParticulars extends Model
class MonthWiseMachinesInStockModel extends Model
{
protected $table = 't_trp_abstract_particulars';
protected $table = 't_monthwisemachinesinstock';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['particular'];
protected $allowedFields = ['date','machine_id','machine_category'];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;

View File

@ -4,15 +4,15 @@ namespace App\Models;
use CodeIgniter\Model;
class TrpAbstract extends Model
class MonthWiseMaterialInStockModel extends Model
{
protected $table = 't_trp_abstract';
protected $table = 't_monthwisematerialinstock';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['abs_opening_stock','abs_physical_stock','abs_remarks','abs_particular_id'];
protected $allowedFields = ['date','materialCode','stock_category'];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;

View File

@ -14,7 +14,7 @@ class Rawmaterialdetails_model extends Model
* @param number $segment : This is pagination limit
* @return array $result : This is result
*/
function rawmaterialListing()
function rawmaterialListing($isActiveFilter)
{
$builder = $this->db->table('t_materialmaster')
@ -22,6 +22,7 @@ class Rawmaterialdetails_model extends Model
->join('tbl_users as user', 'user.UserId = t_materialmaster.createdby', 'left')
->join('t_employee_details as emp', 'emp.EmpID = user.EmpID', 'left')
->join('t_configdetails as cd', 'cd.Key = t_materialmaster.Category', 'left')
->where('t_materialmaster.IsActive',$isActiveFilter)
->orderBy('CreatedDate','desc');
$query = $builder->get();
$result = $query->getResult();

View File

@ -14,7 +14,7 @@ class Supplier_model extends Model
* @param number $segment : This is pagination limit
* @return array $result : This is result
*/
function supplierlisting()
function supplierlisting($isActiveFilter)
{
$builder = $this->db->table('t_supplierdetailsn as BaseT')
@ -22,6 +22,7 @@ class Supplier_model extends Model
->join('t_paymentterms as pmt', 'pmt.PaymentID = BaseT.PaymentID', 'left')
->join('tbl_users as user', 'user.UserId = BaseT.createdby', 'left')
->join('t_employee_details as emp', 'emp.EmpID = user.EmpID', 'left')
->where('BaseT.IsActive',$isActiveFilter)
->orderBy('BaseT.CreatedOn', 'desc');
$query = $builder->get();
@ -224,17 +225,19 @@ class Supplier_model extends Model
}
/*SUPPLIER */
/** for transporter listing */
function transporterListing()
function transporterListing($isActiveFilter)
{
$builder = $this->db->table('t_transporter as t')
->select('t.id,t.name,t_employee_details.FirstName as FirstName,t.created_on,t.isactive')
->join('tbl_users', 'tbl_users.userId = t.created_by')
->join('t_employee_details', 't_employee_details.EmpID=tbl_users.EmpID')
->orderBy('t.created_on', 'desc');
->where('t.isactive',$isActiveFilter);
$builder->orderBy('t.created_on', 'desc');
$query =$builder->get();
$result = $query->getResult();
// echo $this->db->getLastQuery()->getQuery();die;
// echo $this->db->getLastQuery()->getQuery();die;
return $result;
}

View File

@ -0,0 +1,73 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class TrpAbstractModel extends Model
{
protected $table = 't_trp_abstract';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = [
'date','particulars','opening_stock','physical_stock','remarks'
];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
protected array $casts = [];
protected array $castHandlers = [];
// Dates
protected $useTimestamps = false;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $validationRules = [];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
public function currentMonthTrpAbstract($startDate,$endDate){
$currentMonthTrpAbstract = $this->db->table('t_trp_abstract')
->where('date',$startDate)
->where('date',$endDate)
->get()
->getResultArray();
return $currentMonthTrpAbstract;
}
}

View File

@ -66,6 +66,8 @@ class TrpProductionModel extends Model
$materialCodes = array_column($subquery, 'materialCode'); // Extracts 'materialCode' values
// dd($this->db->getLastQuery());
// Convert the array of material codes to a comma-separated string

View File

@ -15,14 +15,16 @@ class User_model extends Model
* @param number $segment : This is pagination limit
* @return array $result : This is result
*/
function userListing()
function userListing($isDeleted)
{
$builder = $this->db->table('t_employee_details EMP')
->select('user.isDeleted,user.createdDtm,EMP.EmpID,EMP.FirstName,EMP.LastName,EMP.Designation,user.email as EmailId,EMP.ContactNumber,
->select('user.isDeleted,user.createdDtm,EMP.EmpID,EMP.FirstName,
EMP.LastName,EMP.Designation,user.email as EmailId,EMP.ContactNumber,
DEPT.DEPCode,DEPT.DepartmentName,role.role,user.userId')
->join('t_departmentdetails DEPT', 'EMP.Departmentcode = DEPT.DEPCode')
->join('tbl_users user', 'user.EmpID = EMP.EmpID')
->join('tbl_roles role', 'user.roleId = role.roleId')
->join('t_departmentdetails DEPT', 'EMP.Departmentcode = DEPT.DEPCode','left')
->join('tbl_users user', 'user.EmpID = EMP.EmpID','left')
->join('tbl_roles role', 'user.roleId = role.roleId','left')
->where('user.isDeleted',$isDeleted)
->orderBy('user.createdDtm', 'desc');
$query = $builder->get();

View File

@ -102,7 +102,7 @@
</div>
<div class="col-md-3">
<label for="Quantity">Purchase Date<span style="color:red">*</span></label>
<input id="DateOfPurchase" name="DateOfPurchase" onkeypress="return false;" maxlength="10" class="form-control" value="<?php echo isset($_POST['DateOfPurchase']) ? $_POST['DateOfPurchase'] : '' ?>">
<input id="DateOfPurchase" name="DateOfPurchase" onkeypress="return false;" maxlength="10" class="form-control" value="<?php echo isset($_POST['DateOfPurchase']) ? $_POST['DateOfPurchase'] : '' ?>" required>
</div>
<div class="col-md-3">
<label for="SupplierName">Supplier Name</label>
@ -355,6 +355,13 @@
$("#User").focus();
return false;
}
if ($('#DateOfPurchase').val().length < 1) {
alert('Please Enter the purchase date');
$("#DateOfPurchase").focus();
return false;
}
if ($('#Location').val().length < 1) {
alert('Please Enter the Asset Location');
$("#Location").focus();

View File

@ -115,6 +115,12 @@
let departmentName = $("#DepartmentName").val().trim();
let headDepCode =$("#HeadDept").val()??'';
let depCode =$("#DEPCode").val() ?? '';
if(departmentName.length<1){
alert(`Department Name cannot be empty..!!`);
return;
}
$('#loader').show();
$.ajax({
type:"POST",

View File

@ -79,22 +79,30 @@
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button"
id="resetButton" title="Reset"></i>
<div style="margin-left:auto">
<div class="error" id="error"></div>
</form>
<div style="margin-left:auto">
<div class="form-check" style="margin-right: 25px;">
<input class="form-check-input" type="checkbox" id="showArchiveId"
name="showArchive" value="1" onchange="showArchiveList()"
style="width: 18px; height: 18px;">
<label class="form-check-label" for="showArchiveId"
style="font-size: 1rem; margin-left: 8px;">
Show Archive
</label>
<form id="archiveFormId" action="<?php echo base_url()?>/assetListing" method="post">
<input class="form-check-input" type="checkbox" id="showArchiveId"
name="showArchive" value="1" <?php echo $showArchive ? "checked" : " " ?>
style="width: 18px; height: 18px;">
<label class="form-check-label" for="showArchiveId"
style="font-size: 1rem; margin-left: 8px;">
Show Archive
</label>
</form>
</div>
</div>
<div class="error" id="error"></div>
</form>
<div class="card-body" style="overflow-x:scroll;">
<table class="table dt-responsive nowrap w-100" id="asset_list_table">
@ -121,12 +129,7 @@
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
?>
<tr class="<?php if ($record->IsActive == 0) {
echo "deactivatedRow";
} ?>"
style="<?php if ($record->IsActive == 0) {
echo "display:none";
} ?>">
<tr>
<?php if (date('d-m-Y', strtotime($record->CreatedDt)) == "30-11--0001") {
$cdate = '00-00-0000';
@ -150,7 +153,7 @@
<td>
<?php if ($record->IsActive == 0) { ?>
<a onclick="confirmReActivatingAsset()"
<a onclick="confirmReActivatingAsset(event)"
href="<?php echo base_url() . 'assetdetails/reActivateAsset/?AssetID=' . $record->AssetCode ?>"
data-toggle="tooltip"
title="<?php echo $record->AssetCode; ?> - Click here to Re-Activate Asset Details">
@ -288,29 +291,6 @@
</script>
<script>
function showArchiveList() {
let isChecked = $("#showArchiveId").prop('checked');
// Show or hide the rows based on checkbox status
$(".deactivatedRow").each(function () {
if (isChecked) {
$(this).show();
} else {
$(this).hide();
}
});
}
$(document).ready(function () {
let table = $('#asset_list_table').DataTable();
showArchiveList();
table.on('draw', function () {
showArchiveList();
});
});
function confirmReActivatingAsset(event) {
let result = confirm("Do You Want to Re-Activate Asset details ?");
@ -318,10 +298,21 @@
if (result) { return; } else { event.preventDefault(); }
}
function confirmDeleteAsset() {
function confirmDeleteAsset(event) {
let result = confirm("Do You Want to Delete Asset details ?");
if (result) { return; } else { event.preventDefault(); }
}
</script>
<script>
$(document).on("change", "#showArchiveId", function () {
console.log("Checkbox changed, submitting form...");
$("#archiveFormId").submit();
});
</script>

View File

@ -78,21 +78,26 @@
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button"
id="resetButton" title="Reset"></i>
<div style="margin-left:auto">
<div class="form-check" style="margin-right: 25px;">
<input class="form-check-input" type="checkbox" id="showArchiveId"
name="showArchive" value="1" onchange="showArchiveList()"
style="width: 18px; height: 18px;">
<label class="form-check-label" for="showArchiveId"
style="font-size: 1rem; margin-left: 8px;">
Show Archive
</label>
</div>
</div>
<div class="error" id="error"></div>
</form>
<div style="margin-left:auto">
<div class="form-check" style="margin-right: 25px;">
<form id="archiveFormId" action="<?php echo base_url()?>/costListing" method="post">
<input class="form-check-input" type="checkbox" id="showArchiveId"
name="showArchive" value="1" <?php echo $showArchive ? "checked" : " " ?>
style="width: 18px; height: 18px;">
<label class="form-check-label" for="showArchiveId"
style="font-size: 1rem; margin-left: 8px;">
Show Archive
</label>
</form>
</div>
</div>
<div class="card-body" style="overflow-x:scroll;">
<table id="cost_listing" class="table dt-responsive nowrap w-100">
@ -114,11 +119,7 @@
$date = $createdat->format('d-m-Y');
$time = $createdat->format('h:i A');
?>
<tr class="<?php if ($record->IsActive == 0) {
echo "deactivatedRow";
} ?>" style="<?php if ($record->IsActive == 0) {
echo "display:none";
} ?>">
<tr>
<td><?php echo $date; ?></td>
<td><?php echo $record->code ?></td>
<td><?php echo $record->CostCenterName ?></td>
@ -406,29 +407,6 @@
function showArchiveList() {
let isChecked = $("#showArchiveId").prop('checked');
// Show or hide the rows based on checkbox status
$(".deactivatedRow").each(function () {
if (isChecked) {
$(this).show();
} else {
$(this).hide();
}
});
}
$(document).ready(function () {
let table = $('#cost_listing').DataTable();
showArchiveList();
table.on('draw', function () {
showArchiveList();
});
});
</script>
@ -440,4 +418,12 @@ $(document).on('keydown', function(event) {
}
});
</script>
<script>
$(document).on("change", "#showArchiveId", function () {
console.log("Checkbox changed, submitting form...");
$("#archiveFormId").submit();
});
</script>

View File

@ -107,20 +107,23 @@
title="Reset"></i>
<div style="margin-left:auto">
<div class="form-check" style="margin-right: 25px;">
<input class="form-check-input" type="checkbox" id="showArchiveId" name="showArchive" value="1"
onchange="showArchiveList()" style="width: 18px; height: 18px;">
<label class="form-check-label" for="showArchiveId" style="font-size: 1rem; margin-left: 8px;">
Show Archive
</label>
</div>
</div>
<div class="error" id="error"></div>
</form>
<div style="margin-left:auto">
<div class="form-check" style="margin-right: 25px;">
<form id="archiveFormId" action="<?php echo base_url()?>/departmentListing" method="post">
<input class="form-check-input" type="checkbox" id="showArchiveId"
name="showArchive" value="1" <?php echo $showArchive ? "checked" : " " ?>
style="width: 18px; height: 18px;">
<label class="form-check-label" for="showArchiveId"
style="font-size: 1rem; margin-left: 8px;">
Show Archive
</label>
</form>
</div>
</div>
<div class="card-body" style="overflow-x:scroll;">
<table id="department_list_table" class="table dt-responsive nowrap w-100">
<thead>
@ -139,13 +142,7 @@
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
?>
<tr
class="<?php if ($record->IsActive == 0) {
echo "deactivatedRow";
} ?>"
style="<?php if ($record->IsActive == 0) {
echo "display:none";
} ?>">
<tr>
<!-- <td title=" - Click here to view department details"> </td> -->
<?php if (date('d-m-Y', strtotime($record->CreatedDt)) == "30-11--0001") {
$cdate = '00-00-0000';
@ -155,7 +152,7 @@
<td><?php echo $cdate; ?> </td>
<td><?php echo $record->DEPCode; ?></td>
<td><?php echo $record->DepartmentName ?></td>
<td><?php echo $record->HeadDept ?></td>
<td><?php echo empty($record->headDepartmentName)?$record->DepartmentName:$record->headDepartmentName ?></td>
<td><?php if ($record->IsActive == 1) {echo"Active";}else{echo "InActive";}?></td>
<td>
<?php if ($record->IsActive == 0) { ?>
@ -339,4 +336,14 @@
if(result){return;}else{event.preventDefault();}
}
</script>
<script>
$(document).on("change", "#showArchiveId", function () {
console.log("Checkbox changed, submitting form...");
$("#archiveFormId").submit();
});
</script>

View File

@ -176,7 +176,7 @@ if (!empty($assetList)) {
<div class="form-row" style="margin-top:20px">
<div class="col-md-3">
<label class="col-form-label" for="PDate">Purchase Date<span class="badge">*</span></label>
<input type="text" class="form-control" id="PDate" name="PDate" value="<?php echo $PDate; ?>">
<input type="text" class="form-control" id="PDate" name="PDate" value="<?php echo $PDate; ?>" required>
</div>
<div class="col-md-3">
<label class="col-form-label" for="Vendor">Vendor<span class="badge">*</span></label>

View File

@ -111,18 +111,20 @@
<div class="card">
<br>
<div style="margin-left:auto">
<div class="form-check" style="margin-right: 25px;">
<input class="form-check-input" type="checkbox" id="showArchiveId"
name="showArchive" value="1" onchange="showArchiveList()"
style="width: 18px; height: 18px;">
<label class="form-check-label" for="showArchiveId"
style="font-size: 1rem; margin-left: 8px;">
Show Archive
</label>
<div style="margin-left:auto">
<div class="form-check" style="margin-right: 25px;">
<form id="archiveFormId" action="<?php echo base_url()?>/readFactoryMachineMasterDetails" method="post">
<input class="form-check-input" type="checkbox" id="showArchiveId"
name="showArchive" value="1" <?php echo $showArchive ? "checked" : " " ?>
style="width: 18px; height: 18px;">
<label class="form-check-label" for="showArchiveId"
style="font-size: 1rem; margin-left: 8px;">
Show Archive
</label>
</form>
</div>
</div>
</div>
<div class="card-body" style="overflow-x:scroll;">
@ -147,11 +149,7 @@
foreach ($masterData as $record) {
?>
<tr class="<?php if ($record['is_active'] == 0) {
echo "deactivatedRow";
} ?>" style="<?php if ($record['is_active'] == 0) {
echo "display:none";
} ?>">
<tr>
<td><?php echo $record['machine_name']; ?></td>
<td><?php echo $record['machine_type'] ?></td>
@ -260,30 +258,11 @@
function showArchiveList() {
let isChecked = $("#showArchiveId").prop('checked');
// Show or hide the rows based on checkbox status
$(".deactivatedRow").each(function () {
if (isChecked) {
$(this).show();
} else {
$(this).hide();
}
});
}
$(document).ready(function () {
let table = $('#datatable').DataTable();
showArchiveList();
table.on('draw', function () {
showArchiveList();
});
</script>
<script>
$(document).on("change", "#showArchiveId", function () {
console.log("Checkbox changed, submitting form...");
$("#archiveFormId").submit();
});
</script>

View File

@ -97,19 +97,27 @@
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton"
title="Reset"></i>
<div style="margin-left:auto">
<div class="form-check" style="margin-right: 25px;">
<input class="form-check-input" type="checkbox" id="showArchiveId" name="showArchive" value="1"
onchange="showArchiveList()" style="width: 18px; height: 18px;">
<label class="form-check-label" for="showArchiveId" style="font-size: 1rem; margin-left: 8px;">
Show Archive
</label>
</div>
</div>
<div class="error" id="error"></div>
</form>
<div style="margin-left:auto">
<div class="form-check" style="margin-right: 25px;">
<form id="archiveFormId" action="<?php echo base_url()?>/rawmaterialListing" method="post">
<input class="form-check-input" type="checkbox" id="showArchiveId"
name="showArchive" value="1" <?php echo $showArchive ? "checked" : " " ?>
style="width: 18px; height: 18px;">
<label class="form-check-label" for="showArchiveId"
style="font-size: 1rem; margin-left: 8px;">
Show Archive
</label>
</form>
</div>
</div>
<div class="card-body" style="overflow-x:scroll;">
<table id="raw_material_list_table" class="table dt-responsive nowrap w-100">
<thead>
@ -134,12 +142,7 @@
foreach ($userRecords as $record) {
$date = date("Y-m-d");
?>
<tr class="<?php if ($record->IsActive == 0) {
echo "deactivatedRow";
} ?>"
style="<?php if ($record->IsActive == 0) {
echo "display:none";
} ?>">
<tr>
<?php if (date('d-m-Y', strtotime($record->CreatedDate)) == "30-11--0001") {
$cdate = '00-00-0000';
@ -156,7 +159,7 @@
<td><?php echo $record->stock ?></td>
<?php } else { ?>
<td>0</td>
<?php } ?>
<?php } ?>
<td><?php echo $record->CategoryName ?></td>
<td><?php echo $record->HSNCODE ?></td>
<td><?php if ($record->IsActive == 1) {
@ -501,32 +504,6 @@ $(document).ready(function () {
</script>
<script>
function showArchiveList() {
let isChecked = $("#showArchiveId").prop('checked');
console.log($(".deactivatedRow").length);
// Show or hide the rows based on checkbox status
$(".deactivatedRow").each(function () {
if (isChecked) {
$(this).show();
} else {
$(this).hide();
}
});
}
$(document).ready(function () {
let table = $('#raw_material_list_table').DataTable();
showArchiveList();
table.on('draw', function () {
showArchiveList();
});
});
function deleteMaterial(mid) {
@ -595,4 +572,11 @@ $(document).ready(function () {
}
}
</script>
<script>
$(document).on("change", "#showArchiveId", function () {
console.log("Checkbox changed, submitting form...");
$("#archiveFormId").submit();
});
</script>

View File

@ -296,7 +296,7 @@
<input type="text"
value="<?= $month; ?>" name="month"
class="form-control monthpicker" id="monthpicker">
class="form-control monthpicker" id="monthpicker" readonly>

View File

@ -13,6 +13,14 @@
margin: 0;
}
.grab {
cursor: grab; /* Default open-hand cursor */
}
.grab:active {
cursor: grabbing; /* Closed-hand cursor when dragging */
}
.fht-table td {
text-align: center;
}
@ -297,12 +305,26 @@
<div class="col-3">
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control mt-2" data-provide="datepicker"
data-date-format="M-yyyy" data-date-min-view-mode="1">
data-date-format="M-yyyy" data-date-min-view-mode="1" readonly>
</div>
<div class="form-group col-md-2">
<div class="form-group col-md-3">
<button type="submit" class="btn btn-success"> Change Month </button>
<?php
//check it is current month , then only show the custom option
if($month == date('M-Y') ){
?>
<button type="button" class="btn" style="background-color:maroon;color:white" data-target="#customizeModalId"
data-toggle="modal">
Customize
</button>
<?php
}
?>
</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"
@ -318,6 +340,91 @@
</div>
</form>
<form action="<?= base_url('bagStockDetails'); ?>" method="post">
<!-- modal placed here for submission of form -->
<!---------------------------------------
this modal is used to customize table header
1)list table header order
2)choose which material/machines you want
------------------------------------------------------------>
<div>
<div class="modal fade" id="customizeModalId" tabindex="-1" role="dialog" aria-labelledby="customizeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="customizeModalLabel">Customize</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="row">
<!-- Dropdown to add back removed items -->
<div class="col">
<div class="form-group">
<label for="customizeHeader"> Add For This Month </label>
<select id="customizeHeader" class="form-control" onchange="addBackToList()">
<option value="">Select</option>
<?php
foreach($activeBagMaterials as $index => $activeBagMaterial){ ?>
<option value="<?=$activeBagMaterial['MaterialCode']?>">
<?=$activeBagMaterial['MaterialCode']?> - <?=$activeBagMaterial['MaterialName']?>
</option>
<?php
}
?>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col">
<h5>List of Selected Items</h5>
<div id="selectedItemsContainer">
<ul id="sortableList">
<?php foreach ($bagMaterials as $bagMaterial): ?>
<div class="sortable-item" draggable="true" id="<?=$bagMaterial['MaterialCode']?>_container">
<input type = "checkbox"
id = "<?=$bagMaterial['MaterialCode']?>_checkboxId"
name = "customisedMaterialCodes[]"
value = "<?= $bagMaterial['MaterialCode'] ?>"
onclick = "removeSelectedMaterial(this)"
checked>
<label class="grab" for="<?= $bagMaterial['MaterialCode'] ?>_checkboxId">
<?= $bagMaterial['MaterialCode'] ?> - <?= $bagMaterial['MaterialName']; ?>
</label>
<br>
</div>
<?php endforeach; ?>
</ul>
</div>
</div>
</div>
<button type="submit" class="btn btn-primary float-right"> Apply </button>
</div>
</div>
</div>
</div>
</div>
<!-- hidden fields -->
<input type="hidden" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control mt-2" data-provide="datepicker"
data-date-format="M-yyyy" data-date-min-view-mode="1">
</form>
<div class="table-responsive">
@ -327,7 +434,7 @@
<tr>
<th class="celda_encabezado_general" colspan="1">material </th>
<th class="celda_encabezado_general" colspan="1">Material </th>
<?php foreach($bagMaterials as $bagMaterial){ ?>
<!-- this will loop till materials present -->
@ -1080,4 +1187,89 @@
}
});
</script>
<script>
document.addEventListener("DOMContentLoaded", function () {
const list = document.getElementById("sortableList");
let draggedItem = null;
function attachDragEvents(item) {
item.setAttribute("draggable", "true");
item.addEventListener("dragstart", (event) => {
draggedItem = event.target;
event.target.classList.add("dragging");
});
item.addEventListener("dragend", (event) => {
event.target.classList.remove("dragging");
});
}
list.addEventListener("dragover", (event) => {
event.preventDefault(); // Allow dropping
const dragging = document.querySelector(".dragging");
const closestItem = getClosestItem(list, event.clientY);
if (closestItem) {
list.insertBefore(dragging, closestItem);
} else {
list.appendChild(dragging);
}
});
function getClosestItem(container, y) {
const items = [...container.querySelectorAll(".sortable-item:not(.dragging)")];
return items.reduce((closest, child) => {
const box = child.getBoundingClientRect();
const offset = y - box.top - box.height / 2;
return offset < 0 && offset > closest.offset
? { offset, element: child }
: closest;
}, { offset: Number.NEGATIVE_INFINITY }).element;
}
// Attach drag events to existing items
document.querySelectorAll(".sortable-item").forEach(attachDragEvents);
window.removeSelectedMaterial = function (checkbox) {
let container = checkbox.closest(".sortable-item");
let materialCode = checkbox.value;
let materialName = container.querySelector("label").innerText;
container.remove();
};
window.addBackToList = function () {
let dropdown = document.getElementById("customizeHeader");
let selectedOption = dropdown.options[dropdown.selectedIndex];
if (selectedOption.value !== "") {
let materialCode = selectedOption.value;
let materialName = selectedOption.text;
let container = document.createElement("div");
container.classList.add("sortable-item");
container.id = materialCode + "_container";
container.innerHTML = `
<input type="checkbox" id="${materialCode}_checkboxId"
name="customisedMaterialCodes[]" value="${materialCode}"
onclick="removeSelectedMaterial(this)" checked>
<label class="grab" for="${materialCode}_checkboxId"> ${materialName} </label>
<br>
`;
attachDragEvents(container);
document.getElementById("sortableList").appendChild(container);
}
};
});
</script>

View File

@ -3,6 +3,15 @@
text-align: right;
}
.grab {
cursor: grab; /* Default open-hand cursor */
}
.grab:active {
cursor: grabbing; /* Closed-hand cursor when dragging */
}
.fht-table,
.fht-table thead,
.fht-table tfoot,
@ -291,12 +300,27 @@ foreach ($period as $day) {
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control mt-2" data-provide="datepicker"
style="z-index:30;"
data-date-format="M-yyyy" data-date-min-view-mode="1">
data-date-format="M-yyyy" data-date-min-view-mode="1" readonly>
</div>
<div class="form-group col-md-2">
<div class="form-group col-md-3">
<button type="submit" class="btn btn-success"> Change Month </button>
<?php
//check it is current month , then only show the custom option
if($month == date('M-Y') ){
?>
<button type="button" class="btn" style="background-color:maroon;color:white" data-target="#customizeModalId"
data-toggle="modal">
Customize
</button>
<?php
}
?>
</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"
@ -312,6 +336,91 @@ foreach ($period as $day) {
</div>
</form>
<form action="<?= base_url('dieselMachineDetails'); ?>" method="post">
<!-- modal placed here for submission of form -->
<!---------------------------------------
this modal is used to customize table header
1)list table header order
2)choose which material/machines you want
------------------------------------------------------------>
<div>
<div class="modal fade" id="customizeModalId" tabindex="-1" role="dialog" aria-labelledby="customizeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="customizeModalLabel">Customize</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="row">
<!-- Dropdown to add back removed items -->
<div class="col">
<div class="form-group">
<label for="customizeHeader"> Add For This Month </label>
<select id="customizeHeader" class="form-control" onchange="addBackToList()">
<option value="">Select</option>
<?php
foreach($activeDieselMachines as $index => $activeDieselMachine){ ?>
<option value="<?=$activeDieselMachine['id']?>">
<?=$activeDieselMachine['id']?> - <?=$activeDieselMachine['machine_name']?>
</option>
<?php
}
?>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col">
<h5>List of Selected Items</h5>
<div id="selectedItemsContainer">
<ul id="sortableList">
<?php foreach ($dieselMachines as $dieselMachine): ?>
<div class="sortable-item" draggable="true" id="<?= $dieselMachine['id'] ?>_container">
<input type = "checkbox"
id = "<?= $dieselMachine['id'] ?>_checkboxId"
name = "customisedMachineCodes[]"
value = "<?= $dieselMachine['id'] ?>"
onclick = "removeSelectedMaterial(this)"
checked>
<label class="grab" for="<?= $dieselMachine['id'] ?>_checkboxId">
<?= $dieselMachine['id'] ?> - <?= $dieselMachine['machine_name']; ?>
</label>
<br>
</div>
<?php endforeach; ?>
</ul>
</div>
</div>
</div>
<button type="submit" class="btn btn-primary float-right"> Apply </button>
</div>
</div>
</div>
</div>
</div>
<!-- hidden fields -->
<input type="hidden" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control mt-2" data-provide="datepicker"
data-date-format="M-yyyy" data-date-min-view-mode="1">
</form>
<div class="table-responsive">
@ -364,13 +473,11 @@ foreach ($period as $day) {
<tbody style="background-color: #fff;">
<?php if (!empty($groupedDieselMachineStockDetails)) {
<?php if (!empty($totalDiesel)) {
$summary = [];
foreach ($groupedDieselMachineStockDetails as $groupedDieselMachineStockDetailsIndex => $dieselStockDetails) {
?>
<tr
@ -1401,4 +1508,89 @@ foreach ($period as $day) {
}
});
</script>
<script>
document.addEventListener("DOMContentLoaded", function () {
const list = document.getElementById("sortableList");
let draggedItem = null;
function attachDragEvents(item) {
item.setAttribute("draggable", "true");
item.addEventListener("dragstart", (event) => {
draggedItem = event.target;
event.target.classList.add("dragging");
});
item.addEventListener("dragend", (event) => {
event.target.classList.remove("dragging");
});
}
list.addEventListener("dragover", (event) => {
event.preventDefault(); // Allow dropping
const dragging = document.querySelector(".dragging");
const closestItem = getClosestItem(list, event.clientY);
if (closestItem) {
list.insertBefore(dragging, closestItem);
} else {
list.appendChild(dragging);
}
});
function getClosestItem(container, y) {
const items = [...container.querySelectorAll(".sortable-item:not(.dragging)")];
return items.reduce((closest, child) => {
const box = child.getBoundingClientRect();
const offset = y - box.top - box.height / 2;
return offset < 0 && offset > closest.offset
? { offset, element: child }
: closest;
}, { offset: Number.NEGATIVE_INFINITY }).element;
}
// Attach drag events to existing items
document.querySelectorAll(".sortable-item").forEach(attachDragEvents);
window.removeSelectedMaterial = function (checkbox) {
let container = checkbox.closest(".sortable-item");
let materialCode = checkbox.value;
let materialName = container.querySelector("label").innerText;
container.remove();
};
window.addBackToList = function () {
let dropdown = document.getElementById("customizeHeader");
let selectedOption = dropdown.options[dropdown.selectedIndex];
if (selectedOption.value !== "") {
let materialCode = selectedOption.value;
let materialName = selectedOption.text;
let container = document.createElement("div");
container.classList.add("sortable-item");
container.id = materialCode + "_container";
container.innerHTML = `
<input type="checkbox" id="${materialCode}_checkboxId"
name="customisedMachineCodes[]" value="${materialCode}"
onclick="removeSelectedMaterial(this)" checked>
<label class="grab" for="${materialCode}_checkboxId"> ${materialName} </label>
<br>
`;
attachDragEvents(container);
document.getElementById("sortableList").appendChild(container);
}
};
});
</script>

View File

@ -294,7 +294,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<div class="col-3">
<?php $today = date('M-Y'); ?>
<input type="text" name="month" id="month" value="<?php echo $datefordropdown; ?>" class="form-control" data-provide="datepicker" data-date-format="M-yyyy" data-date-min-view-mode="1">
<input type="text" name="month" id="month" value="<?php echo $datefordropdown; ?>" class="form-control" data-provide="datepicker" data-date-format="M-yyyy" data-date-min-view-mode="1" readonly>
</div>
<div class="col-3">
@ -343,7 +343,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<th class="celda_encabezado_general" >Moisture Loss Qty (Metric Ton)</th>
<th class="celda_encabezado_general" >Dust Qty (Metric Ton)</th>
<th class="celda_encabezado_general" >Customer Name</th>
<th class="celda_encabezado_general" align="left" >Customer Name</th>
<th class="celda_encabezado_general" style="display:none;">id</th>
<th class="celda_encabezado_general" > Action</th>
@ -452,7 +452,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
</td>
<!-- td:eq(13) customer_name -->
<td class="celda_normal" >
<td class="celda_normal" style="text-align: left !important;">
<?php echo $a['customer_name']; ?>
</td>
@ -682,7 +682,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<div class="col-md-3">
<label class="form" for="additionalEntryDrierOnTimeId">Drier On Time</label>
<select onchange="calculateMachineRunningHrs()"
<select onchange="calculateMachineRunningHrs()" required
class="timeDropdown" style="width: 100px;"
id="additionalEntryDrierOnTimeId" name="drier_on_time">
<option value="">Select</option>
@ -694,7 +694,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<div class="col-md-3">
<label class="form" for="additionalEntryDrierOffTimeId">Drier Off Time</label>
<select onchange="calculateMachineRunningHrs()"
<select onchange="calculateMachineRunningHrs()" required
class="timeDropdown " style="width: 100px;"
id="additionalEntryDrierOffTimeId" name="drier_off_time">
<option value="">Select</option>
@ -717,7 +717,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- supplier name -->
<div class="col-md-3">
<label class="form" for="additionalEntrySupplierNameId">Supplier Name</label>
<select class="timeDropdown supplier_name" style="width: 300px;"
<select class="timeDropdown supplier_name" style="width: 300px;" required
id="additionalEntrySupplierNameId" name="supplier_name">
<option value="">Select</option>
<?php foreach ($supplierData as $key => $value) { ?>
@ -730,13 +730,13 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<div class="col-md-3">
<label class="form" for="additionalEntryInputSandQtyId">Input sand Quantity (Metric Ton)</label>
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
type="text" class="form-control" id="additionalEntryInputSandQtyId" name="input_sand_qty" value="">
type="text" class="form-control" id="additionalEntryInputSandQtyId" name="input_sand_qty" value="" required>
</div>
<!-- input sand moisture -->
<div class="col-md-3">
<label class="form" for="additionalEntryInputSandMoistureId">Input Sand Moisture (%)</label>
<input type="text" class="form-control" id="additionalEntryInputSandMoistureId" name="input_sand_moisture" value="">
<input type="text" class="form-control" id="additionalEntryInputSandMoistureId" name="input_sand_moisture" value="" required>
</div>
@ -745,7 +745,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<div class="col-md-3">
<label class="form" for="additionalEntrySandDriedQtyId">Sand Dried Qty (Metric Ton)</label>
<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="" required>
</div>
@ -758,13 +758,13 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<div class="col-md-3">
<label class="form" for="additionalEntryTotalGasConsumptionId">Total Gas Consumption</label>
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
type="text" class="form-control" id="additionalEntryTotalGasConsumptionId" name="total_gas_consumption" value="">
type="text" class="form-control" id="additionalEntryTotalGasConsumptionId" name="total_gas_consumption" value="" required>
</div>
<!-- gas per ton -->
<div class="col-md-3">
<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="" required
readonly>
</div>
@ -772,7 +772,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- qty per hours -->
<div class="col-md-3">
<label class="form" for="additionalEntryQtyPerHoursId">Qty per Hours</label>
<input type="text" class="form-control" id="additionalEntryQtyPerHoursId" name="qty_per_hours" value=""
<input type="text" class="form-control" id="additionalEntryQtyPerHoursId" name="qty_per_hours" value="" required
readonly>
</div>
@ -780,7 +780,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- moisture loss qty -->
<div class="col-md-3">
<label class="form" for="additionalEntryMoistureLossQtyId">Moisture Loss Qty (Metric Ton)</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="" required
readonly>
</div>
</div>
@ -792,14 +792,14 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- dust qty -->
<div class="col-md-3">
<label class="form" for="additionalEntryDustQtyId">Dust Qty (Metric Ton)</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="" required>
</div>
<!-- customer name -->
<div class="col-md-3">
<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="" required>
</div>
</div>

View File

@ -172,12 +172,14 @@
.fht-table thead {
position: sticky;
top: 0;
z-index: 20; /* Ensure the entire header stays above table rows */
background-color: #50bbd9; /* Header background color */
z-index: 20;
/* Ensure the entire header stays above table rows */
background-color: #50bbd9;
/* Header background color */
}
.dropdown-menu {
z-index :25 ;
.dropdown-menu {
z-index: 25;
}
@ -186,8 +188,10 @@
.fht-table thead th {
position: sticky;
top: 0;
z-index: 11; /* Higher than table rows but lower than first column */
background-color: #50bbd9; /* Green background */
z-index: 11;
/* Higher than table rows but lower than first column */
background-color: #50bbd9;
/* Green background */
color: #ffffff;
border: 1px solid #ddd;
padding: 10px;
@ -199,7 +203,8 @@
position: sticky;
left: 0;
background-color: #50bbd9;
z-index: 15; /* Ensures it stays above other cells */
z-index: 15;
/* Ensures it stays above other cells */
border-right: 2px solid #ddd;
color: #ffffff;
}
@ -207,23 +212,25 @@
/* Table Wrapper for Scrolling */
.table-responsive {
overflow-x: auto;
overflow-y: auto;
max-height: 500px; /* Adjust as needed */
overflow-y: auto;
max-height: 500px;
/* Adjust as needed */
position: relative;
}
td{
min-width: 100px;
max-width: 100px;
td {
min-width: 150px;
max-width: 150px;
}
th {
min-width: 150px;
max-width: 150px;
}
</style>
<div class="content-page">
<div class="content">
<!-- Start Content-->
@ -263,7 +270,7 @@
<div class="col-3">
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control mt-2" data-provide="datepicker"
data-date-format="M-yyyy" data-date-min-view-mode="1">
data-date-format="M-yyyy" data-date-min-view-mode="1" readonly>
</div>
<div class="form-group col-md-2">
<button type="submit" class="btn btn-success"> Change Month </button>
@ -372,10 +379,10 @@
<table id="dustAndRoughStockDetailsTableSummaryId" class="fht-table table-striped">
<thead >
<th class="celda_encabezado_total" style="width: 100px;">Total </th>
<th class="celda_encabezado_total" style="width: 230px;">Final Rough </th>
<th class="celda_encabezado_total" style="width: 240px;">Dust </th>
<th class="celda_encabezado_total" style="width: 130px;">Total </th>
<th class="celda_encabezado_total" >Total </th>
<th class="celda_encabezado_total" >Final Rough </th>
<th class="celda_encabezado_total" >Dust </th>
<th class="celda_encabezado_total" >Total </th>
</thead>
<tbody>
@ -509,6 +516,7 @@
$('#loader').hide();
console.log(data);
alert(data);
window.location.reload();
}
},

View File

@ -262,7 +262,7 @@
<div class="col-md-3">
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control mt-2" data-provide="datepicker"
data-date-format="M-yyyy" data-date-min-view-mode="1">
data-date-format="M-yyyy" data-date-min-view-mode="1" readonly>
</div>
<div class="form-group col-md-3">
<button type="submit" class="btn btn-success"> Change Month </button>
@ -478,14 +478,14 @@
// Sum values for the material
$summary["opening"] = 0 ;
$summary["purchaseBharath"] = is_numeric($gasStockDetail['purchaseBharath']) ? $gasStockDetail['purchaseBharath'] : 0 ;
$summary["purchaseBharath"] += is_numeric($gasStockDetail['purchaseBharath']) ? $gasStockDetail['purchaseBharath'] : 0 ;
$summary["purchaseIndian"] += is_numeric($gasStockDetail['purchaseIndian']) ? $gasStockDetail['purchaseIndian'] : 0 ;
$summary["total"] += is_numeric($gasStockDetail['total']) ? $gasStockDetail['total'] : 0 ;
$summary["consumption"] += is_numeric($gasStockDetail['consumption']) ? $gasStockDetail['consumption'] : 0 ;
$summary["balanceStock"] += is_numeric($gasStockDetail['balanceStock']) ? $gasStockDetail['balanceStock'] : 0 ;
$summary["drierMachineGasConsumption"] = is_numeric( $gasStockDetail['drierMachineGasConsumption']) ? $gasStockDetail['drierMachineGasConsumption'] : 0 ;
$summary["sandDried"] = is_numeric( $gasStockDetail['sandDried']) ? $gasStockDetail['sandDried'] : 0 ;
$summary["drierMachineGasConsumption"] += is_numeric( $gasStockDetail['drierMachineGasConsumption']) ? $gasStockDetail['drierMachineGasConsumption'] : 0 ;
$summary["sandDried"] += is_numeric( $gasStockDetail['sandDried']) ? $gasStockDetail['sandDried'] : 0 ;
$summary["coatingMachineGasconsumption"] += is_numeric($gasStockDetail['coatingMachineGasconsumption']) ? $gasStockDetail['coatingMachineGasconsumption'] : 0 ;
$summary["coatedSand"] += is_numeric($gasStockDetail['coatedSand']) ? $gasStockDetail['coatedSand'] : 0 ;
$summary["trp_panel_gas_consumption"] += is_numeric($gasStockDetail['trp_panel_gas_consumption']) ? $gasStockDetail['trp_panel_gas_consumption'] : 0 ;

View File

@ -4,6 +4,10 @@
text-align: right;
}
.side-table tbody td{
padding:3px !important ;
}
.fht-table,
.fht-table thead,
.fht-table tfoot,
@ -292,7 +296,7 @@
<div class="col-3">
<?php $today = date('M-Y'); ?>
<input type="text" name="month" id="month" value="<?php echo "$month" ?>" class="form-control mt-2" data-provide="datepicker" data-date-format="M-yyyy" data-date-min-view-mode="1">
<input type="text" name="month" id="month" value="<?php echo "$month" ?>" class="form-control mt-2" data-provide="datepicker" data-date-format="M-yyyy" data-date-min-view-mode="1" readonly>
<input type="hidden" name="remark" id="remark" value="<?php echo $remark ?>">
</div>
<div class="form-group col-md-3">
@ -704,7 +708,7 @@
<tr>
<td class="celda_normal" > -</td>
<td class="celda_normal" style="background-color:rgb(189, 9, 6); color:#fff ;"> <h5 style="color:#fff;"> total </h5> </td>
<td class="celda_normal" style="background-color:rgb(189, 9, 6); color:#fff ;"> <h5 style="color:#fff;"> Total </h5> </td>
<td class="celda_normal" > -</td>
@ -813,7 +817,7 @@
</thead>
<tbody >
<tr>
<td style="text-align: left !important; width:25%;"><b>Supplier Name</b></td>
<td style="text-align: left !important; width:25%; "><b>Supplier Name</b></td>
<td id="dwnldSupplierNameId"></td>
</tr>
<tr>
@ -1018,7 +1022,7 @@
<br>
<table class="side-table " border="1" width="100%">
<table class="side-table" id="resultTableId" border="1" width="100%">
<tbody >
<tr>
<td style="text-align: left !important; width:25%;"><b>Accepted</b></td>
@ -1497,7 +1501,7 @@
function calculateRow(value){
var table = $('#meshTableId');
var table = $('#meshTableId');
if( value != "moistureValue" ){
var tr = $(value).closest('tr');
@ -1610,7 +1614,7 @@ $(document).ready(function() {
<!-- submitting calculated data of sand reports in ajax call from sand lab report modal -->
<script>
$('#labReportSubmitId').click(function(){
$('#labReportSubmitId').click(function(){
$.ajax({
url : "<?php echo base_url('/updateLabReport')?>",
@ -1800,4 +1804,31 @@ $(document).ready(function() {
}
});
</script>
<script>
$(document).ready(function () {
$("resultTableId td ,#basicDetailsTableId td, #meshTableId td, #incomingSilicaSandDetailsTable td").on("paste", function (e) {
console.log("Inside paste event");
let clipboardData = e.originalEvent.clipboardData || window.clipboardData;
let pastedText = clipboardData.getData("text/plain"); // Get plain text
let pastedHtml = clipboardData.getData("text/html"); // Get HTML (Excel pastes as <table>)
console.log("Plain Text:", pastedText);
console.log("HTML Data:", pastedHtml);
// Excel typically pastes tab-separated values or HTML tables
if (pastedText.includes("\t") || (pastedHtml && pastedHtml.includes("<table"))) {
console.log("Preventing Excel paste!");
e.preventDefault(); // Block Excel paste
alert("Pasting from Excel is disabled. Please enter data manually.");
}
});
// Ensure <td> elements are editable (optional) 456
$("#basicDetailsTableId td, #meshTableId td, #incomingSilicaSandDetailsTable td").attr("contenteditable", "true");
});
</script>

View File

@ -17,6 +17,14 @@
text-align: center;
}
.grab {
cursor: grab; /* Default open-hand cursor */
}
.grab:active {
cursor: grabbing; /* Closed-hand cursor when dragging */
}
/* .fht-table td[contenteditable="true"] {
background-color: lightyellow;
color:rgb(13, 7, 7);
@ -295,12 +303,26 @@ foreach ($period as $day) {
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control mt-2" data-provide="datepicker"
style="z-index:30;"
data-date-format="M-yyyy" data-date-min-view-mode="1">
data-date-format="M-yyyy" data-date-min-view-mode="1" readonly>
</div>
<div class="form-group col-md-2">
<div class="form-group col-md-3">
<button type="submit" class="btn btn-success"> Change Month </button>
<?php
//check it is current month , then only show the custom option
if($month == date('M-Y') ){
?>
<button type="button" class="btn" style="background-color:maroon;color:white" data-target="#customizeModalId"
data-toggle="modal">
Customize
</button>
<?php
}
?>
</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"
@ -316,6 +338,91 @@ foreach ($period as $day) {
</div>
</form>
<form action="<?= base_url('powerConsumptionDetails'); ?>" method="post">
<!-- modal placed here for submission of form -->
<!---------------------------------------
this modal is used to customize table header
1)list table header order
2)choose which material/machines you want
------------------------------------------------------------>
<div>
<div class="modal fade" id="customizeModalId" tabindex="-1" role="dialog" aria-labelledby="customizeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="customizeModalLabel">Customize</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="row">
<!-- Dropdown to add back removed items -->
<div class="col">
<div class="form-group">
<label for="customizeHeader"> Add For This Month </label>
<select id="customizeHeader" class="form-control" onchange="addBackToList()">
<option value="">Select</option>
<?php
foreach($activeElectricMachines as $index => $activeElectricMachine){ ?>
<option value="<?=$activeElectricMachine['id']?>">
<?=$activeElectricMachine['id']?> - <?=$activeElectricMachine['machine_name']?>
</option>
<?php
}
?>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col">
<h5>List of Selected Items</h5>
<div id="selectedItemsContainer">
<ul id="sortableList">
<?php foreach ($electricMachines as $electricMachine): ?>
<div class="sortable-item" draggable="true" id="<?= $electricMachine['id'] ?>_container">
<input type = "checkbox"
id = "<?= $electricMachine['id'] ?>_checkboxId"
name = "customisedMachineCodes[]"
value = "<?= $electricMachine['id'] ?>"
onclick = "removeSelectedMaterial(this)"
checked>
<label class="grab" for="<?= $electricMachine['id'] ?>_checkboxId">
<?= $electricMachine['id'] ?> - <?= $electricMachine['machine_name']; ?>
</label>
<br>
</div>
<?php endforeach; ?>
</ul>
</div>
</div>
</div>
<button type="submit" class="btn btn-primary float-right"> Apply </button>
</div>
</div>
</div>
</div>
</div>
<!-- hidden fields -->
<input type="hidden" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control mt-2" data-provide="datepicker"
data-date-format="M-yyyy" data-date-min-view-mode="1">
</form>
<div class="table-responsive">
@ -372,7 +479,7 @@ foreach ($period as $day) {
<tbody style="background-color: #fff;">
<?php if (!empty($groupedPowerConsumptionStockDetails)) {
<?php if (!empty($totalPower)){
$summary = [];
@ -1334,4 +1441,88 @@ foreach ($period as $day) {
}
}
});
</script>
<script>
document.addEventListener("DOMContentLoaded", function () {
const list = document.getElementById("sortableList");
let draggedItem = null;
function attachDragEvents(item) {
item.setAttribute("draggable", "true");
item.addEventListener("dragstart", (event) => {
draggedItem = event.target;
event.target.classList.add("dragging");
});
item.addEventListener("dragend", (event) => {
event.target.classList.remove("dragging");
});
}
list.addEventListener("dragover", (event) => {
event.preventDefault(); // Allow dropping
const dragging = document.querySelector(".dragging");
const closestItem = getClosestItem(list, event.clientY);
if (closestItem) {
list.insertBefore(dragging, closestItem);
} else {
list.appendChild(dragging);
}
});
function getClosestItem(container, y) {
const items = [...container.querySelectorAll(".sortable-item:not(.dragging)")];
return items.reduce((closest, child) => {
const box = child.getBoundingClientRect();
const offset = y - box.top - box.height / 2;
return offset < 0 && offset > closest.offset
? { offset, element: child }
: closest;
}, { offset: Number.NEGATIVE_INFINITY }).element;
}
// Attach drag events to existing items
document.querySelectorAll(".sortable-item").forEach(attachDragEvents);
window.removeSelectedMaterial = function (checkbox) {
let container = checkbox.closest(".sortable-item");
let materialCode = checkbox.value;
let materialName = container.querySelector("label").innerText;
container.remove();
};
window.addBackToList = function () {
let dropdown = document.getElementById("customizeHeader");
let selectedOption = dropdown.options[dropdown.selectedIndex];
if (selectedOption.value !== "") {
let materialCode = selectedOption.value;
let materialName = selectedOption.text;
let container = document.createElement("div");
container.classList.add("sortable-item");
container.id = materialCode + "_container";
container.innerHTML = `
<input type="checkbox" id="${materialCode}_checkboxId"
name="customisedMachineCodes[]" value="${materialCode}"
onclick="removeSelectedMaterial(this)" checked>
<label class="grab" for="${materialCode}_checkboxId"> ${materialName} </label>
<br>
`;
attachDragEvents(container);
document.getElementById("sortableList").appendChild(container);
}
};
});
</script>

View File

@ -302,15 +302,23 @@ foreach ($period as $day) {
<div class="col-3">
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control mt-2" data-provide="datepicker"
data-date-format="M-yyyy" data-date-min-view-mode="1">
data-date-format="M-yyyy" data-date-min-view-mode="1" readonly>
</div>
<div class="form-group col-md-3">
<button type="submit" class="btn btn-success"> Change Month </button>
<?php
//check it is current month , then only show the custom option
if($month == date('M-Y') ){
?>
<button type="button" class="btn" style="background-color:maroon;color:white" data-target="#customizeModalId"
data-toggle="modal">
Customize
</button>
<?php
}
?>
</div>
<div class="col-6">
<div class="dropdown float-right">
@ -325,6 +333,95 @@ foreach ($period as $day) {
</div>
</div>
</div>
</form>
<form action="<?= base_url('resinStockDetails'); ?>" method="post">
<!-- modal placed here for submission of form -->
<!---------------------------------------
this modal is used to customize table header
1)list table header order
2)choose which material/machines you want
------------------------------------------------------------>
<div>
<div class="modal fade" id="customizeModalId" tabindex="-1" role="dialog" aria-labelledby="customizeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="customizeModalLabel">Customize</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="row">
<!-- Dropdown to add back removed items -->
<div class="col">
<div class="form-group">
<label for="customizeHeader"> Add For This Month </label>
<select id="customizeHeader" class="form-control" onchange="addBackToList()">
<option value="">Select</option>
<?php
foreach($activeResinMaterials as $index => $activeResinMaterial){ ?>
<option value="<?=$activeResinMaterial['MaterialCode']?>">
<?=$activeResinMaterial['MaterialCode']?> - <?=$activeResinMaterial['MaterialName']?>
</option>
<?php
}
?>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col">
<h5>List of Selected Items</h5>
<div id="selectedItemsContainer">
<ul id="sortableList">
<?php foreach ($resinMaterials as $resinMaterial): ?>
<div class="sortable-item" draggable="true" id="<?= $resinMaterial['MaterialCode'] ?>_container">
<input type = "checkbox"
id = "<?= $resinMaterial['MaterialCode'] ?>_checkboxId"
name = "customisedMaterialCodes[]"
value = "<?= $resinMaterial['MaterialCode'] ?>"
onclick = "removeSelectedMaterial(this)"
checked>
<label class="grab" for="<?= $resinMaterial['MaterialCode'] ?>_checkboxId">
<?= $resinMaterial['MaterialCode'] ?> - <?= $resinMaterial['MaterialName']; ?>
</label>
<br>
</div>
<?php endforeach; ?>
</ul>
</div>
</div>
</div>
<button type="submit" class="btn btn-primary float-right"> Apply </button>
</div>
</div>
</div>
</div>
</div>
<!-- hidden fields -->
<input type="hidden" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control mt-2" data-provide="datepicker"
data-date-format="M-yyyy" data-date-min-view-mode="1">
</form>
@ -336,7 +433,7 @@ foreach ($period as $day) {
<tr>
<th class="celda_encabezado_general" colspan="1">material </th>
<th class="celda_encabezado_general" colspan="1">Material </th>
<?php foreach ($resinMaterials as $resinMaterial) { ?>
<!-- this will loop till materials present -->
@ -656,71 +753,7 @@ foreach ($period as $day) {
<!---------------------------------------
this modal is used to customize table header
1)list table header order
2)choose which material/machines you want
------------------------------------------------------------>
<div>
<div class="modal fade" id="customizeModalId" tabindex="-1" role="dialog" aria-labelledby="customizeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="customizeModalLabel">Customize</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="row">
<!-- Dropdown to add back removed items -->
<div class="col">
<div class="form-group">
<label for="customizeHeader"> Add For This Month </label>
<select id="customizeHeader" class="form-control" onchange="addBackToList()">
<option value="">Select</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col">
<h5>List of Selected Items</h5>
<div id="selectedItemsContainer">
<ul id="sortableList">
<?php foreach ($resinMaterials as $resinMaterial): ?>
<div class="sortable-item" draggable="true" id="<?= $resinMaterial['MaterialCode'] ?>_container">
<input type="checkbox"
id="<?= $resinMaterial['MaterialCode'] ?>_checkboxId"
name="materialCodes[]"
value="<?= $resinMaterial['MaterialCode'] ?>"
onclick="removeSelectedMaterial(this)"
checked>
<label class="grab" for="<?= $resinMaterial['MaterialCode'] ?>_checkboxId">
<?= $resinMaterial['MaterialName']; ?>
</label>
<br>
</div>
<?php endforeach; ?>
</ul>
</div>
</div>
</div>
<button type="button" class="btn btn-primary float-right"> Apply </button>
</div>
</div>
</div>
</div>
</div>
@ -1140,12 +1173,6 @@ foreach ($period as $day) {
let materialCode = checkbox.value;
let materialName = container.querySelector("label").innerText;
let dropdown = document.getElementById("customizeHeader");
let newOption = document.createElement("option");
newOption.value = materialCode;
newOption.text = materialName;
dropdown.appendChild(newOption);
container.remove();
};
@ -1162,7 +1189,7 @@ foreach ($period as $day) {
container.id = materialCode + "_container";
container.innerHTML = `
<input type="checkbox" id="${materialCode}_checkboxId"
name="materialCodes[]" value="${materialCode}"
name="customisedMaterialCodes[]" value="${materialCode}"
onclick="removeSelectedMaterial(this)" checked>
<label class="grab" for="${materialCode}_checkboxId"> ${materialName} </label>
<br>
@ -1171,7 +1198,6 @@ foreach ($period as $day) {
attachDragEvents(container);
document.getElementById("sortableList").appendChild(container);
dropdown.removeChild(selectedOption);
}
};
});

View File

@ -321,7 +321,7 @@ $timeOtions[] = "12:00 AM";
<div class="col-3">
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control mt-2" data-provide="datepicker"
data-date-format="M-yyyy" data-date-min-view-mode="1">
data-date-format="M-yyyy" data-date-min-view-mode="1" readonly>
</div>
<div class="form-group col-md-2">
<button type="submit" class="btn btn-success"> Change Month </button>
@ -494,6 +494,9 @@ $timeOtions[] = "12:00 AM";
<?php if (!empty($trpProductionDetails)) {
$totalWcsReceived = 0 ;
$totalCrsReceived = 0 ;
// dd(array_keys($trpProductionDetails[0]));
// dd($trpProductionDetails);
@ -963,8 +966,11 @@ $timeOtions[] = "12:00 AM";
$summary['panelGasConsumption'] += is_numeric($trpProductionDetail['panelGasConsumption']) ? $trpProductionDetail['panelGasConsumption'] : 0;
$summary['panelGasPerTon'] += is_numeric($trpProductionDetail['panelGasPerTon']) ? $trpProductionDetail['panelGasPerTon'] : 0;
//total of all incoming waste core sand
foreach($wcsSupplierList as $supplier){
$summary[$supplier] += is_numeric($trpProductionDetail[$supplier]) ? $trpProductionDetail[$supplier] : 0;
$totalWcsReceived += is_numeric($trpProductionDetail[$supplier]) ? $trpProductionDetail[$supplier] : 0;
}
$summary['edRunningHours'] += is_numeric($trpProductionDetail['edRunningHours']) ? $trpProductionDetail['edRunningHours'] : 0;
@ -974,8 +980,11 @@ $timeOtions[] = "12:00 AM";
$summary['trpProductionPerHour'] += is_numeric($trpProductionDetail['trpProductionPerHour']) ? $trpProductionDetail['trpProductionPerHour'] : 0;
$summary['coating'] += is_numeric($trpProductionDetail['coating']) ? $trpProductionDetail['coating'] : 0;
// total of all core reclaimed sand
foreach($crsClientList as $client){
$summary[$client] += is_numeric($trpProductionDetail[$client]) ? $trpProductionDetail[$client] : 0;
$totalCrsReceived += is_numeric($trpProductionDetail[$client]) ? $trpProductionDetail[$client] : 0;
}
$summary['waterReceipt'] += is_numeric($trpProductionDetail['waterReceipt']) ? $trpProductionDetail['waterReceipt'] : 0;
@ -1442,13 +1451,7 @@ $timeOtions[] = "12:00 AM";
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<?php $abstractDetails = [
] ?>
<div class="card-body">
<h4 style="text-align:center">Abstract for the month <?=$month?></h4>
@ -1457,7 +1460,7 @@ $timeOtions[] = "12:00 AM";
<table id="abstractTableId" class="fht-table table-striped">
<thead class="celda_encabezado_general" style="padding: 10px ;">
<tr>
<th class="celda_encabezado_general">Particulars</th>
<th class="celda_encabezado_general" style="width: 200px;">Particulars</th>
<th class="celda_encabezado_general">Running Hours</th>
<th class="celda_encabezado_general">Per Hour</th>
<th class="celda_encabezado_general">Opening Stock</th>
@ -1466,25 +1469,409 @@ $timeOtions[] = "12:00 AM";
<th class="celda_encabezado_general">Consumption</th>
<th class="celda_encabezado_general">Closing Stock</th>
<th class="celda_encabezado_general">Physical Stock</th>
<th class="celda_encabezado_general">Remarks</th>
<th class="celda_encabezado_general" style="width: 200px;">Remarks</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($trpAbstract)){
foreach($trpAbstract as $index => $trpAbstractEach){
$particulars = $trpAbstractEach['particulars'];
switch ($particulars) {
case "Incoming Raw Sand Details": ?>
<!-- Incoming Raw Sand Details -->
<tr>
<!-- particulars -->
<td class="celda_normal"> <?= $trpAbstractEach['particulars']; ?> </td>
<!-- running hours no need -->
<td class="celda_normal"> </td>
<!-- per hour no need -->
<td class="celda_normal"> </td>
<!-- opening stock be -->
<td class="celda_normal"> <?= $trpAbstractEach['opening_stock']; ?> </td>
<!-- receipt total of all incoming waste core sand-->
<td class="celda_normal"> <?= $totalWcsReceived ?> </td>
<!-- Total fe -->
<td class="celda_normal"> <?= $trpAbstractEach['opening_stock'] + $totalWcsReceived ?> </td>
<!-- consumption fe-->
<td class="celda_normal"> <?= $summary['edProduction']?> </td>
<!-- closing stock fe -->
<td class="celda_normal"> <?= ( $trpAbstractEach['opening_stock'] + $totalWcsReceived ) - $summary['edProduction'] ?> </td>
<!-- physical stock be -->
<td class="celda_normal"> <?= $trpAbstractEach['physical_stock']; ?> </td>
<!-- remarks be -->
<td class="celda_normal"> <?= $trpAbstractEach['remarks']; ?> </td>
</tr>
<?php break;
case "ED Details": ?>
<!-- ED Details -->
<tr>
<!-- particulars be -->
<td class="celda_normal"> <?= $trpAbstractEach['particulars']; ?> </td>
<!-- running hours fe -->
<td class="celda_normal"><?= $summary['edRunningHours'] ?> </td>
<!-- per hour fe -->
<td class="celda_normal"> <?= number_format( $summary['edProduction'] / ($summary['edRunningHours'] == 0 ? 1 : $summary['edRunningHours']) ,2) ?> </td>
<!-- opening stock be -->
<td class="celda_normal"> <?= $trpAbstractEach['opening_stock']; ?> </td>
<!-- receipt fe-->
<td class="celda_normal"><?= $summary['edProduction']; ?> </td>
<!-- Total fe -->
<td class="celda_normal"><?= $trpAbstractEach['opening_stock'] + $summary['edProduction']?> </td>
<!-- consumption fe-->
<td class="celda_normal">
<?= $summary['edUsage'] + ($summary['coolerBags'] * 1250 ) + ($summary['cycloneWaste'] * 1250 )
+ ( $summary['edWaste'] * 1250 )
?>
</td>
<!-- closing stock fe -->
<td class="celda_normal"> <?=
($trpAbstractEach['opening_stock'] + $summary['edProduction'])
-
($summary['edUsage'] + ($summary['coolerBags'] * 1250 ) + ($summary['cycloneWaste'] * 1250 )
+ ( $summary['edWaste'] * 1250 ) )?> </td>
<!-- physical stock be -->
<td class="celda_normal"> <?= $trpAbstractEach['physical_stock']; ?> </td>
<!-- remarks be -->
<td class="celda_normal"> <?= $trpAbstractEach['remarks']; ?> </td>
</tr>
<?php break;
case "TRP Total Sand": ?>
<!-- TRP Total Sand -->
<tr>
<!-- particulars be -->
<td class="celda_normal"> <?= $trpAbstractEach['particulars']; ?> </td>
<!-- running hours fe -->
<td class="celda_normal"><?= $summary['sandFeedingHours']; ?> </td>
<!-- per hour fe -->
<td class="celda_normal"> <?= $summary['trpProductionPerHour']; ?> </td>
<!-- opening stock be -->
<td class="celda_normal"> <?= $trpAbstractEach['opening_stock']; ?> </td>
<!-- receipt fe-->
<td class="celda_normal"><?= $summary['trpProduction'];?> </td>
<!-- Total fe -->
<td class="celda_normal"><?= $trpAbstractEach['opening_stock'] + $summary['trpProduction'] ?> </td>
<!-- consumption fe-->
<td class="celda_normal"><?= $totalCrsReceived ?>
</td>
<!-- closing stock fe -->
<td class="celda_normal"><?= ($trpAbstractEach['opening_stock'] + $summary['trpProduction']) - $totalCrsReceived ?> </td>
<!-- physical stock be -->
<td class="celda_normal"><?= $trpAbstractEach['physical_stock']; ?> </td>
<!-- remarks be -->
<td class="celda_normal"><?= $trpAbstractEach['remarks']; ?> </td>
</tr>
<?php break;
case "TRP Phy Gas Consumption": ?>
<!-- Trp Phy Gas Consumption -->
<tr>
<!-- particulars be -->
<td class="celda_normal"> <?= $trpAbstractEach['particulars']; ?> </td>
<!-- running hours fe -->
<td class="celda_normal"> </td>
<!-- per hour fe -->
<td class="celda_normal"><?= number_format(($summary['trpPlusDrierGasConsumption']) / ( ( $summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction'] )/1000), 2, '.', '') ?></td>
<!-- opening stock be -->
<td class="celda_normal"> <?= $trpAbstractEach['opening_stock']; ?> </td>
<!-- receipt fe-->
<td class="celda_normal"><?= $summary['gasReceiptBg'] + $summary['gasReceiptPg'] ?> </td>
<!-- Total fe -->
<td class="celda_normal"><?= $trpAbstractEach['opening_stock'] + ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) ?> </td>
<!-- consumption fe-->
<td class="celda_normal"><?= $summary['physicalGasConsumption'] ?></td>
<!-- closing stock fe -->
<td class="celda_normal"> <?= $trpAbstractEach['opening_stock'] + ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['physicalGasConsumption'] ?></td>
<!-- physical stock be -->
<td class="celda_normal"> <?= $trpAbstractEach['physical_stock']; ?> </td>
<!-- remarks be -->
<td class="celda_normal"> <?= $trpAbstractEach['remarks']; ?> </td>
</tr>
<?php break;
case "TRP Panel Gas Consumption": ?>
<!-- Trp Panel Gas Consumption -->
<tr>
<!-- particulars be -->
<td class="celda_normal"> <?= $trpAbstractEach['particulars']; ?> </td>
<!-- running hours fe -->
<td class="celda_normal"> </td>
<!-- per hour fe -->
<td class="celda_normal"><?= number_format(($summary['panelGasConsumption']) / ( ( $summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction'] )/1000) ,2) ?> </td>
<!-- opening stock be -->
<td class="celda_normal"> <?= $trpAbstractEach['opening_stock']; ?> </td>
<!-- receipt fe-->
<td class="celda_normal"><?=$summary['gasReceiptBg'] + $summary['gasReceiptPg'];?> </td>
<!-- Total fe -->
<td class="celda_normal"><?= $trpAbstractEach['opening_stock'] + ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) ?> </td>
<!-- consumption fe-->
<td class="celda_normal"><?= $summary['panelGasConsumption']?> </td>
<!-- closing stock fe -->
<td class="celda_normal"> <?= $trpAbstractEach['opening_stock'] + ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['panelGasConsumption'] ?> </td>
<!-- physical stock be -->
<td class="celda_normal"> <?= $trpAbstractEach['physical_stock']; ?> </td>
<!-- remarks be -->
<td class="celda_normal"> <?= $trpAbstractEach['remarks']; ?> </td>
</tr>
<?php break;
case "Water Consumption": ?>
<!-- Water Consumption -->
<tr>
<!-- particulars be -->
<td class="celda_normal"> <?= $trpAbstractEach['particulars']; ?> </td>
<!-- running hours fe -->
<td class="celda_normal"> </td>
<!-- per hour fe -->
<td class="celda_normal"> </td>
<!-- opening stock be -->
<td class="celda_normal"> <?= $trpAbstractEach['opening_stock']; ?> </td>
<!-- receipt fe-->
<td class="celda_normal"><?= $summary['waterReceipt']; ?> </td>
<!-- Total fe -->
<td class="celda_normal"><?= $trpAbstractEach['opening_stock'] + $summary['waterReceipt'] ?></td>
<!-- consumption fe-->
<td class="celda_normal"><?= $summary['waterConsumption'] ?> </td>
<!-- closing stock fe -->
<td class="celda_normal"><?= ($trpAbstractEach['opening_stock'] + $summary['waterReceipt']) - $summary['waterConsumption'] ?> </td>
<!-- physical stock be -->
<td class="celda_normal"> <?= $trpAbstractEach['physical_stock']; ?> </td>
<!-- remarks be -->
<td class="celda_normal"> <?= $trpAbstractEach['remarks']; ?> </td>
</tr>
<?php break;
case "Power Consumption": ?>
<!-- Power Consumption -->
<tr>
<!-- particulars be -->
<td class="celda_normal"> <?= $trpAbstractEach['particulars']; ?> </td>
<!-- running hours fe -->
<td class="celda_normal"><?= $summary['ebReadingPerUnitTon'] ?> </td>
<!-- per hour fe -->
<td class="celda_normal"> </td>
<!-- opening stock be -->
<td class="celda_normal"> <?= $trpAbstractEach['opening_stock']; ?> </td>
<!-- receipt fe-->
<td class="celda_normal"> </td>
<!-- Total fe -->
<td class="celda_normal"> </td>
<!-- consumption fe-->
<td class="celda_normal"><?= $summary['ebReading'] ?> </td>
<!-- closing stock fe -->
<td class="celda_normal"> </td>
<!-- physical stock be -->
<td class="celda_normal"> <?= $trpAbstractEach['physical_stock']; ?> </td>
<!-- remarks be -->
<td class="celda_normal"> <?= $trpAbstractEach['remarks']; ?> </td>
</tr>
<?php break;
}
?>
<?php
}
}else{ ?>
<!-- Incoming Raw Sand Details -->
<tr>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
</tr>
<!-- particulars -->
<td class="celda_normal">Incoming Raw Sand Details</td>
<!-- running hours no need -->
<td class="celda_normal"> </td>
<!-- per hour no need -->
<td class="celda_normal"> </td>
<!-- opening stock be -->
<td class="celda_normal"> </td>
<!-- receipt total of all incoming waste core sand-->
<td class="celda_normal"> <?= $totalWcsReceived ?> </td>
<!-- Total fe -->
<td class="celda_normal"> <?= $totalWcsReceived ?> </td>
<!-- consumption fe-->
<td class="celda_normal"> <?= $summary['edProduction']?> </td>
<!-- closing stock fe -->
<td class="celda_normal"> <?= ( $totalWcsReceived ) - $summary['edProduction'] ?> </td>
<!-- physical stock be -->
<td class="celda_normal"> </td>
<!-- remarks be -->
<td class="celda_normal"> </td>
</tr>
<!-- ED Details -->
<tr>
<!-- particulars be -->
<td class="celda_normal">ED Details</td>
<!-- running hours fe -->
<td class="celda_normal"><?= $summary['edRunningHours'] ?> </td>
<!-- per hour fe -->
<td class="celda_normal"> <?= number_format( $summary['edProduction'] / ($summary['edRunningHours'] == 0 ? 1 : $summary['edRunningHours']) ,2) ?> </td>
<!-- opening stock be -->
<td class="celda_normal"> </td>
<!-- receipt fe-->
<td class="celda_normal"><?= $summary['edProduction']; ?> </td>
<!-- Total fe -->
<td class="celda_normal"><?= $summary['edProduction']?> </td>
<!-- consumption fe-->
<td class="celda_normal">
<?= $summary['edUsage'] + ($summary['coolerBags'] * 1250 ) + ($summary['cycloneWaste'] * 1250 )
+ ( $summary['edWaste'] * 1250 )
?>
</td>
<!-- closing stock fe -->
<td class="celda_normal"> <?=
($summary['edProduction'])
-
($summary['edUsage'] + ($summary['coolerBags'] * 1250 ) + ($summary['cycloneWaste'] * 1250 )
+ ( $summary['edWaste'] * 1250 ) )?> </td>
<!-- physical stock be -->
<td class="celda_normal"> </td>
<!-- remarks be -->
<td class="celda_normal"> </td>
</tr>
<!-- TRP Total Sand -->
<tr>
<!-- particulars be -->
<td class="celda_normal">TRP Total Sand</td>
<!-- running hours fe -->
<td class="celda_normal"><?= $summary['sandFeedingHours']; ?> </td>
<!-- per hour fe -->
<td class="celda_normal"> <?= $summary['trpProductionPerHour']; ?> </td>
<!-- opening stock be -->
<td class="celda_normal"> </td>
<!-- receipt fe-->
<td class="celda_normal"><?= $summary['trpProduction'];?> </td>
<!-- Total fe -->
<td class="celda_normal"><?= $summary['trpProduction'] ?> </td>
<!-- consumption fe-->
<td class="celda_normal"><?= $totalCrsReceived ?> </td>
<!-- closing stock fe -->
<td class="celda_normal"><?= ( $summary['trpProduction']) - $totalCrsReceived ?> </td>
<!-- physical stock be -->
<td class="celda_normal"> </td>
<!-- remarks be -->
<td class="celda_normal"> </td>
</tr>
<!-- Trp Physical Gas Consumption -->
<tr>
<!-- particulars be -->
<td class="celda_normal">Trp Physical Gas Consumption</td>
<!-- running hours fe -->
<td class="celda_normal"> </td>
<!-- per hour fe -->
<td class="celda_normal"><?= number_format(($summary['trpPlusDrierGasConsumption']) / ( ( $summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction'] )/1000), 2, '.', '') ?></td>
<!-- opening stock be -->
<td class="celda_normal"> </td>
<!-- receipt fe-->
<td class="celda_normal"><?= $summary['gasReceiptBg'] + $summary['gasReceiptPg'] ?> </td>
<!-- Total fe -->
<td class="celda_normal"><?= ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) ?> </td>
<!-- consumption fe-->
<td class="celda_normal"><?= $summary['physicalGasConsumption'] ?> </td>
<!-- closing stock fe -->
<td class="celda_normal"> <?=($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['physicalGasConsumption'] ?> </td>
<!-- physical stock be -->
<td class="celda_normal"> </td>
<!-- remarks be -->
<td class="celda_normal"> </td>
</tr>
<!-- Trp Panel Gas Consumption -->
<tr>
<!-- particulars be -->
<td class="celda_normal">Trp Panel Gas Consumption</td>
<!-- running hours fe -->
<td class="celda_normal"> </td>
<!-- per hour fe -->
<td class="celda_normal"><?= number_format(($summary['panelGasConsumption']) / ( ( $summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction'] )/1000) ,2) ?> </td>
<!-- opening stock be -->
<td class="celda_normal"> </td>
<!-- receipt fe-->
<td class="celda_normal"><?=$summary['gasReceiptBg'] + $summary['gasReceiptPg'];?> </td>
<!-- Total fe -->
<td class="celda_normal"><?= ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) ?> </td>
<!-- consumption fe-->
<td class="celda_normal"><?= $summary['panelGasConsumption']?> </td>
<!-- closing stock fe -->
<td class="celda_normal"> <?= ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['panelGasConsumption'] ?> </td>
<!-- physical stock be -->
<td class="celda_normal"> </td>
<!-- remarks be -->
<td class="celda_normal"> </td>
</tr>
<!-- Water Consumption -->
<tr>
<!-- particulars be -->
<td class="celda_normal">Water Consumption</td>
<!-- running hours fe -->
<td class="celda_normal"> </td>
<!-- per hour fe -->
<td class="celda_normal"> </td>
<!-- opening stock be -->
<td class="celda_normal"> </td>
<!-- receipt fe-->
<td class="celda_normal"><?= $summary['waterReceipt']; ?> </td>
<!-- Total fe -->
<td class="celda_normal"><?= $summary['waterReceipt'] ?></td>
<!-- consumption fe-->
<td class="celda_normal"><?= $summary['waterConsumption'] ?> </td>
<!-- closing stock fe -->
<td class="celda_normal"><?= ( $summary['waterReceipt']) - $summary['waterConsumption'] ?> </td>
<!-- physical stock be -->
<td class="celda_normal"> </td>
<!-- remarks be -->
<td class="celda_normal"> </td>
</tr>
<!-- Power Consumption -->
<tr>
<!-- particulars be -->
<td class="celda_normal">Power Consumption</td>
<!-- running hours fe -->
<td class="celda_normal"><?= $summary['ebReadingPerUnitTon'] ?> </td>
<!-- per hour fe -->
<td class="celda_normal"> </td>
<!-- opening stock be -->
<td class="celda_normal"> </td>
<!-- receipt fe-->
<td class="celda_normal"> </td>
<!-- Total fe -->
<td class="celda_normal"> </td>
<!-- consumption fe-->
<td class="celda_normal"><?= $summary['ebReading'] ?> </td>
<!-- closing stock fe -->
<td class="celda_normal"> </td>
<!-- physical stock be -->
<td class="celda_normal"> </td>
<!-- remarks be -->
<td class="celda_normal"> </td>
</tr>
<?php }
?>
</tbody>
</table>
@ -2014,74 +2401,3 @@ $timeOtions[] = "12:00 AM";
<script>
// !caution!
// !caution!
// !caution!
// !caution!
// !caution!
// !caution!
// dont delete this commented code , this is used for refernce in getting td values
// let openingTime = tr.find('td:eq(1)').text().trim();
// let closingTime = tr.find('td:eq(2)').text().trim();
// let totalHours = tr.find('td:eq(3)').text().trim();
// let coldStart = tr.find('td:eq(4)').text().trim();
// let breakdownHours = tr.find('td:eq(5)').text().trim();
// let burnerFiringHours = tr.find('td:eq(6)').text().trim();
// let sandFeedingHours = tr.find('td:eq(7)').text().trim();
// let gasReceiptBg = tr.find('td:eq(8)').text().trim();
// let gasReceiptPg = tr.find('td:eq(9)').text().trim();
// let physicalGasConsumption = tr.find('td:eq(10)').text().trim();
// let drierGasConsumption = tr.find('td:eq(11)').text().trim();
// let coatingGasConsumption = tr.find('td:eq(12)').text().trim();
// let trpPlusDrierGasConsumption = tr.find('td:eq(13)').text().trim();
// let trpPhysicalGasPerTon = tr.find('td:eq(14)').text().trim();
// let panelGasConsumption = tr.find('td:eq(15)').text().trim();
// let panelGasPerTon = tr.find('td:eq(16)').text().trim();
// let isolAls = tr.find('td:eq(17)').text().trim();
// let isolAle = tr.find('td:eq(18)').text().trim();
// let isolMe = tr.find('td:eq(19)').text().trim();
// let isolSi = tr.find('td:eq(20)').text().trim();
// let isolCaparo = tr.find('td:eq(21)').text().trim();
// let isolNemak = tr.find('td:eq(22)').text().trim();
// let isolDr = tr.find('td:eq(23)').text().trim();
// let edRunningHours = tr.find('td:eq(24)').text().trim();
// let edProduction = tr.find('td:eq(25)').text().trim();
// let edUsage = tr.find('td:eq(26)').text().trim();
// let trpProduction = tr.find('td:eq(27)').text().trim();
// let trpProductionPerHour = tr.find('td:eq(28)').text().trim();
// let coating = tr.find('td:eq(29)').text().trim();
// let usageHindhuja = tr.find('td:eq(30)').text().trim();
// let usageNemak = tr.find('td:eq(31)').text().trim();
// let usageMe = tr.find('td:eq(32)').text().trim();
// let usageBi = tr.find('td:eq(33)').text().trim();
// let usageKarmen = tr.find('td:eq(34)').text().trim();
// let waterReceipt = tr.find('td:eq(35)').text().trim();
// let waterConsumption = tr.find('td:eq(36)').text().trim();
// let ebReading = tr.find('td:eq(37)').text().trim();
// let ebReadingPerUnitTon = tr.find('td:eq(38)').text().trim();
// let workingPersonEngineers = tr.find('td:eq(39)').text().trim();
// let workingPersonSupervisiors = tr.find('td:eq(40)').text().trim();
// let workingPersonOperators = tr.find('td:eq(41)').text().trim();
// let rollerDrivers = tr.find('td:eq(42)').text().trim();
// let natureOfMaintenance = tr.find('td:eq(43)').text().trim();
// let location = tr.find('td:eq(44)').text().trim();
// let description = tr.find('td:eq(45)').text().trim();
// let msSeperation = tr.find('td:eq(46)').text().trim();
// let edWaste = tr.find('td:eq(47)').text().trim();
// let coolerBags = tr.find('td:eq(48)').text().trim();
// let edPlus20Waste = tr.find('td:eq(49)').text().trim();
// let cycloneWaste = tr.find('td:eq(50)').text().trim();
// !caution!
// !caution!
// !caution!
// !caution!
// !caution!
// !caution!
// dont delete this commented code , this is used for refernce in getting td values
</script>

View File

@ -172,12 +172,14 @@
.fht-table thead {
position: sticky;
top: 0;
z-index: 20; /* Ensure the entire header stays above table rows */
background-color: #50bbd9; /* Header background color */
z-index: 20;
/* Ensure the entire header stays above table rows */
background-color: #50bbd9;
/* Header background color */
}
.dropdown-menu {
z-index :25 ;
.dropdown-menu {
z-index: 25;
}
@ -186,14 +188,13 @@
.fht-table thead th {
position: sticky;
top: 0;
z-index: 11; /* Higher than table rows but lower than first column */
background-color: #50bbd9; /* Green background */
z-index: 11;
/* Higher than table rows but lower than first column */
background-color: #50bbd9;
/* Green background */
color: #ffffff;
border: 1px solid #ddd;
padding: 10px;
white-space: normal; /* Allows text to wrap */
word-wrap: break-word; /* Breaks long words if needed */
text-align: center; /* Centers text for better alignment */
}
/* Sticky First Column */
@ -202,7 +203,8 @@
position: sticky;
left: 0;
background-color: #50bbd9;
z-index: 15; /* Ensures it stays above other cells */
z-index: 15;
/* Ensures it stays above other cells */
border-right: 2px solid #ddd;
color: #ffffff;
}
@ -210,22 +212,16 @@
/* Table Wrapper for Scrolling */
.table-responsive {
overflow-x: auto;
overflow-y: auto;
max-height: 500px; /* Adjust as needed */
overflow-y: auto;
max-height: 500px;
/* Adjust as needed */
position: relative;
}
td{
min-width: 100px;
max-width: 100px;
td {
min-width: 150px;
max-width: 150px;
}
</style>
@ -269,7 +265,7 @@
<div class="col-3">
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control mt-2" data-provide="datepicker"
data-date-format="M-yyyy" data-date-min-view-mode="1">
data-date-format="M-yyyy" data-date-min-view-mode="1" readonly>
</div>
<div class="form-group col-md-2">
<button type="submit" class="btn btn-success"> Change Month </button>
@ -382,7 +378,7 @@
} ?>
<div class="table-responsive" style="width: 700px;">
<div class="table-responsive" >
<table id="trpSandUseStockDetailsTableSummaryId" class="fht-table table-striped">
@ -544,6 +540,7 @@
$('#loader').hide();
console.log(data);
alert(data);
window.location.reload();
}
},

View File

@ -82,24 +82,28 @@
<button type="submit" class="range_search_button"><i class="fe-search"
aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button"
id="resetButton" title="Reset"></i>
<div style="margin-left:auto">
<div class="form-check" style="margin-right: 25px;">
<input class="form-check-input" type="checkbox" id="showArchiveId"
name="showArchive" value="1" onchange="showArchiveList()"
style="width: 18px; height: 18px;">
<label class="form-check-label" for="showArchiveId"
style="font-size: 1rem; margin-left: 8px;">
Show Archive
</label>
</div>
</div>
id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
<div style="margin-left:auto">
<div class="form-check" style="margin-right: 25px;">
<form id="archiveFormId" action="<?php echo base_url()?>/supplierlisting" method="post">
<input class="form-check-input" type="checkbox" id="showArchiveId"
name="showArchive" value="1" <?php echo $showArchive ? "checked" : " " ?>
style="width: 18px; height: 18px;">
<label class="form-check-label" for="showArchiveId"
style="font-size: 1rem; margin-left: 8px;">
Show Archive
</label>
</form>
</div>
</div>
<div class="card-body" style="overflow-x:scroll;">
<table class="table dt-responsive nowrap w-100" id="datatable">
<thead>
@ -124,12 +128,7 @@
foreach ($userRecords as $record) {
?>
<tr class="<?php if ($record->IsActive == 0) {
echo "deactivatedRow";
} ?>"
style="<?php if ($record->IsActive == 0) {
echo "display:none";
} ?>">
<tr >
<?php if (date('d-m-Y', strtotime($record->CreatedOn)) == "30-11--0001") {
$cdate = '00-00-0000';
@ -491,30 +490,16 @@ function formatNumberToIndianCurrency(number) {
}
});
});
</script>
function showArchiveList() {
let isChecked = $("#showArchiveId").prop('checked');
<script>
$(document).on("change", "#showArchiveId", function () {
console.log("Checkbox changed, submitting form...");
$("#archiveFormId").submit();
});
// Show or hide the rows based on checkbox status
$(".deactivatedRow").each(function () {
if (isChecked) {
$(this).show();
} else {
$(this).hide();
}
});
}
$(document).ready(function () {
let table = $('#datatable').DataTable();
showArchiveList();
table.on('draw', function () {
showArchiveList();
});
});
</script>

View File

@ -121,21 +121,27 @@
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button"
id="resetButton" title="Reset"></i>
<div style="margin-left:auto">
<div class="error" id="error"></div>
</form>
<div style="margin-left:auto">
<div class="form-check" style="margin-right: 25px;">
<form id="archiveFormId" action="<?php echo base_url()?>/transporterListing" method="post">
<input class="form-check-input" type="checkbox" id="showArchiveId"
name="showArchive" value="1" onchange="showArchiveList()"
name="showArchive" value="1" <?php echo $showArchive ? "checked" : " " ?>
style="width: 18px; height: 18px;">
<label class="form-check-label" for="showArchiveId"
style="font-size: 1rem; margin-left: 8px;">
Show Archive
</label>
</form>
</div>
</div>
<div class="error" id="error"></div>
</form>
<div class="card-body" style="overflow-x:scroll;">
<table id="transporter_list" class="table dt-responsive nowrap w-100">
@ -156,11 +162,8 @@
$date = $createdat->format('d-m-Y');
$time = $createdat->format('h:i A');
?>
<tr class="<?php if ($record->isactive == 0) {
echo "deactivatedRow";
} ?>" style="<?php if ($record->isactive == 0) {
echo "display:none";
} ?>">
<tr>
<td><?php echo $date; ?></td>
<td><?php echo $record->name ?></td>
<td><?php echo $record->FirstName ?></td>
@ -423,30 +426,6 @@
}
function showArchiveList() {
let isChecked = $("#showArchiveId").prop('checked');
// Show or hide the rows based on checkbox status
$(".deactivatedRow").each(function () {
if (isChecked) {
$(this).show();
} else {
$(this).hide();
}
});
}
$(document).ready(function () {
let table = $('#transporter_list').DataTable();
showArchiveList();
table.on('draw', function () {
showArchiveList();
});
});
</script>
@ -458,4 +437,13 @@ $(document).on('keydown', function(event) {
}
});
</script>
<script>
$(document).on("change", "#showArchiveId", function () {
console.log("Checkbox changed, submitting form...");
$("#archiveFormId").submit();
});
</script>

View File

@ -88,22 +88,26 @@
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div style="margin-left:auto">
<div class="form-check" style="margin-right: 25px;">
<input class="form-check-input" type="checkbox" id="showArchiveId"
name="showArchive" value="1" onchange="showArchiveList()"
style="width: 18px; height: 18px;">
<label class="form-check-label" for="showArchiveId"
style="font-size: 1rem; margin-left: 8px;">
Show Archive
</label>
</div>
</div>
<div class="error" id="error"></div>
</form>
<div style="margin-left:auto">
<div class="form-check" style="margin-right: 25px;">
<form id="archiveFormId" action="<?php echo base_url()?>userListing" method="post">
<input class="form-check-input" type="checkbox" id="showArchiveId"
name="showArchive" value="1" <?php echo $showArchive ? "checked" : " " ?>
style="width: 18px; height: 18px;">
<label class="form-check-label" for="showArchiveId"
style="font-size: 1rem; margin-left: 8px;">
Show Archive
</label>
</form>
</div>
</div>
<div class="card-body" style="overflow-x:scroll;">
<table id="user_list_table" class="table dt-responsive nowrap w-100">
@ -128,12 +132,7 @@
?>
<tr class="<?php if ($record->isDeleted == 1) {
echo "deactivatedRow";
} ?>"
style="<?php if ($record->isDeleted == 1) {
echo "display:none";
} ?>">
<tr>
<?php if (date('d-m-Y', strtotime($record->createdDtm)) == "30-11--0001") {
$cdate = '00-00-0000';
@ -295,29 +294,11 @@
});
});
</script>
function showArchiveList() {
let isChecked = $("#showArchiveId").prop('checked');
// Show or hide the rows based on checkbox status
$(".deactivatedRow").each(function () {
if (isChecked) {
$(this).show();
} else {
$(this).hide();
}
});
}
$(document).ready(function () {
let table = $('#user_list_table').DataTable();
showArchiveList();
table.on('draw', function () {
showArchiveList();
});
<script>
$(document).on("change", "#showArchiveId", function () {
console.log("Checkbox changed, submitting form...");
$("#archiveFormId").submit();
});
</script>

View File

@ -9,6 +9,13 @@
text-align: right;
}
#Inwardgateregistertable1 thead tr th{
width: 150px;
word-wrap: break-word;
white-space: normal;
}
th {
white-space: nowrap;
}
@ -232,7 +239,8 @@
<tbody>
<?php
if(!empty($IGR))
{ $index = 0;
{
$index = 0;
foreach($IGR as $record)
{ $index = $index +1;
$createddate = new DateTime($record->CreatedDate);
@ -242,8 +250,17 @@
<tr id="<?php echo $index ?>" >
<td align="center"><?php echo $date; ?></td>
<td align="center"><?php echo $time; ?></td>
<td style="cursor:pointer; color:#0bb2b5" ><a data-toggle="modal" data-target="#Igrshow" data-id="<?php echo $index;?>" data-inx="<?php echo $index;?>" data-userid="<?php echo $record->IGRNO ?>" data-igrstatus="<?php echo $record->IGRStatus ?>">
<?php echo $record->IGRNO ?></a>
<td style="cursor:pointer; color:#0bb2b5" >
<a data-toggle="modal"
data-target="#Igrshow"
data-id="<?php echo $index;?>"
data-inx="<?php echo $index;?>"
data-userid="<?php echo $record->IGRNO ?>"
data-igrstatus="<?php echo $record->IGRStatus ?>">
<?php echo $record->IGRNO ?>
</a>
</td>
<td style="cursor:pointer; color:#0bb2b5" ><a data-toggle="modal" data-target="#CostCentershow" data-id="<?php echo $index;?>" data-igno="<?php echo $record->IGRNO;?>" data-pono="<?php echo $record->PONO ?>" target="_blank">
<?php echo $record->PONO ?></a>
@ -340,7 +357,7 @@
<!-- modal2 - Edit Igr modal -->
<div id="Igrshow" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-full-width">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
@ -475,7 +492,7 @@
<tr>
<th style="width: 50px;">#</th>
<th style="width: 100px;">Item Code</th>
<th style="width: 150px; word-wrap: break-word; word-break: break-all; white-space: normal;">Item Description</th>
<th style="width: 150px;">Item Description</th>
<th style="width: 50px;">UOM</th>
<th style="width: 100px;">Ordered Qty</th>
<th style="width: 100px;">Received Qty</th>
@ -485,7 +502,9 @@
<th style="width: 50px;">Taxable Amt</th>
<th style="width: 50px;">Total Amt</th>
<th style="width: 150px;">Remarks</th>
<th style="width: 50px;"></th>
<th style="width: 25px;">Calculate Net Weight</th>
<th style="width: 25px; display:none" id="gasShortageHeader">Add Gas Shortage</th>
<th style="width: 25px; display:none" id="gasShortageListHeader">Gas Shortage list</th>
</tr>
</thead>
<tbody id="tbleIGRAppend">
@ -632,6 +651,259 @@
</div>
<!-- /.modal fade closed (Weight Calculator)-->
<!-- gas shortage list gasShortageList-->
<!-- Modal -->
<div id="gasShortageList" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="gasShortageListLabel" aria-hidden="true">
<div class="modal-dialog modal-xl " role="document">
<div class="modal-content" style="border: 1px solid #ddd; margin-top: 73px; box-shadow: 0 0 40px rgb(0 0 0 / 43%);">
<div class="modal-header">
<h5 class="modal-title" id="gasShortageListLabel" align="center">List of Gas Shortages</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body" >
<table id="gasShortageTable" class="table table-bordered table-hover">
<thead>
<tr>
<th>Full Cylinder Date</th>
<th>Empty Cylinder Date</th>
<th>Invoice No</th>
<th>Cylinder No</th>
<th>Gross Weight</th>
<th>Tare Weight</th>
<th>Net Weight</th>
<th>Actual Weight</th>
<th>Shortage</th>
<th style="display:none">ID</th>
<th>Action</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- end of gas shortage list -->
<!-- gas Shortage Calculator modal gasShortageCalculator -->
<div id="gasShortageCalculator" data-form="add" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog modal-large">
<div class="modal-content" style="border: 1px solid #ddd; margin-top: 73px; box-shadow: 0 0 40px rgb(0 0 0 / 43%);">
<div class="modal-header">
<h4 class="modal-title">Add Gas Shortage </h4>
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">×</button>
</div>
<div class="modal-body p-4">
<form action="#">
<!-- first row full cylinder date and empty cylinder date -->
<div class="form-group row">
<div class="col-md-6">
<label for="fullCylinderDateId"> Full Cylinder Date</label>
<input type="date" class="form-control" id="fullCylinderDateId" name="fullCylinderDate" value="" required>
</div>
<div class="col-md-6">
<label for="emptyCylinderDateId"> Empty Cylinder Date</label>
<input type="date" class="form-control" id="emptyCylinderDateId" name="emptyCylinderDate" value="" required>
</div>
</div>
<!-- second row cylinder no and Invoice No-->
<div class="form-group row">
<div class="col-md-6">
<label for="invoiceNoId"> Invoice No / Bill No</label>
<input type="text" class="form-control" id="invoiceNoId" name="invoiceNo" value="" readonly>
</div>
<div class="col-md-6">
<label for="cylinderNoId"> Cylinder No </label>
<input type="text" class="form-control" id="cylinderNoId" name="cylinderNo" value="" required>
</div>
</div>
<!-- third row gross weight and tare weight -->
<div class="form-group row">
<div class="col-md-6">
<label for="grossWeightId"> Gross Weight </label>
<input type="text" class="form-control" id="grossWeightId" name="grossWeight" value="" required>
</div>
<div class="col-md-6">
<label for="tareWeightId"> Tare Weight </label>
<input type="text" class="form-control" id="tareWeightId" name="tareWeight" value="" required>
</div>
</div>
<!-- fourth row NetWeight and actual weight -->
<div class="form-group row">
<div class="col-md-6">
<label for="actualWeightId"> Actual Weight </label>
<input type="text" class="form-control" id="actualWeightId" name="actualWeight" value="" required>
</div>
<div class="col-md-6">
<label for="netWeightId"> Net Weight (Gross-Tare)</label>
<input type="text" class="form-control" id="netWeightId" name="netWeight" value="" readonly>
</div>
</div>
<!-- fifth row Gas Shortage -->
<div class="form-group row">
<div class="col-md-6">
<label for="shortageId"> Gas Shortage(Actual-Net)</label>
<input type="text" class="form-control" id="shortageId" name="shortage" value="" readonly>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary waves-effect"
data-dismiss="modal" value="Cancel">Cancel</button>
<button type="submit"
class="btn btn-info waves-effect waves-light" >Save</button>
</div>
</form>
</div>
</div>
</div>
<!-- end gas shortage calculator modal -->
<!-- Edit gas Shortage Calculator modal editgasShortageCalculator -->
<div id="editGasShortageCalculator" data-form="edit" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog modal-large">
<div class="modal-content" style="border: 1px solid #ddd; margin-top: 73px; box-shadow: 0 0 40px rgb(0 0 0 / 43%);">
<div class="modal-header">
<h4 class="modal-title">Update Gas Shortage </h4>
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">×</button>
</div>
<form action="#">
<div class="modal-body p-4">
<!-- first row full cylinder date and empty cylinder date -->
<div class="form-group row">
<div class="col-md-6">
<label for="editFullCylinderDateId"> Full Cylinder Date</label>
<input type="date" class="form-control" id="editFullCylinderDateId" name="fullCylinderDate" value="" required>
</div>
<div class="col-md-6">
<label for="editEmptyCylinderDateId"> Empty Cylinder Date</label>
<input type="date" class="form-control" id="editEmptyCylinderDateId" name="emptyCylinderDate" value="" required>
</div>
</div>
<!-- second row cylinder no and Invoice No-->
<div class="form-group row">
<div class="col-md-6">
<label for="editInvoiceNoId"> Invoice No / Bill No</label>
<input type="text" class="form-control" id="editInvoiceNoId" name="invoiceNo" value="" readonly>
</div>
<div class="col-md-6">
<label for="editCylinderNoId"> Cylinder No </label>
<input type="text" class="form-control" id="editCylinderNoId" name="cylinderNo" value="" required>
</div>
</div>
<!-- third row gross weight and tare weight -->
<div class="form-group row">
<div class="col-md-6">
<label for="editGrossWeightId"> Gross Weight </label>
<input type="text" class="form-control" id="editGrossWeightId" name="grossWeight" value="" required>
</div>
<div class="col-md-6">
<label for="editTareWeightId"> Tare Weight </label>
<input type="text" class="form-control" id="editTareWeightId" name="tareWeight" value="" required>
</div>
</div>
<!-- fourth row NetWeight and actual weight -->
<div class="form-group row">
<div class="col-md-6">
<label for="editActualWeightId"> Actual Weight </label>
<input type="text" class="form-control" id="editActualWeightId" name="actualWeight" value="" required>
</div>
<div class="col-md-6">
<label for="editNetWeightId"> Net Weight (Gross-Tare)</label>
<input type="text" class="form-control" id="editNetWeightId" name="netWeight" value="" readonly>
</div>
</div>
<!-- fifth row Gas Shortage -->
<div class="form-group row">
<div class="col-md-6">
<label for="editShortageId"> Gas Shortage(Actual-Net)</label>
<input type="text" class="form-control" id="editShortageId" name="shortage" value="" readonly>
</div>
</div>
<!-- hidden fields -->
<input type="hidden" id="editId" name="id" value="" >
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary waves-effect"
data-dismiss="modal" value="Cancel">Cancel</button>
<button type="submit"
class="btn btn-info waves-effect waves-light" >Save</button>
</div>
</form>
</div>
</div>
</div>
<!-- end gas shortage calculator modal -->
<!-- modal4 - IGR history modal -->
<div id="Historyshow" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
@ -793,12 +1065,13 @@
$('#right-modal').modal('show');
}
//recent work of adding gas shortage done here..!!
$("#Igrshow").on("shown.bs.modal", function(e) {
$('#loader').show();
console.log("hello");
var inx = $(e.relatedTarget).data('id');
var igr = $(e.relatedTarget).data('userid');
var igrstatus = $(e.relatedTarget).data('igrstatus');
@ -817,7 +1090,10 @@
modal.find('#MasterFileLabel').hide();
var userRole = "<?php echo (int)$userRole; ?>";
//based on user role some fields are just read only
if (userRole != 1) {
//based on status == ST074
if (igrstatus == "ST074") {
buttonContainer.find("#draftIGR, #generateIGR").css("display", "inline-block");
$(".a_tag_for_mrir").css("display", "block");
@ -896,6 +1172,9 @@
$.each(parsedData['details'], function(i, item) {
if (igr == item.IGRNO) {
console.log(item,"**");
//setting values in the igr modal.. particularly input fields
$('#IgrshowTitle').text(" ( " + item.IGRNO + " ) ");
$("#IGRNO1").val(item.IGRNO);
$("#PONO1").val(item.PONO);
@ -954,8 +1233,10 @@
i = i + 1;
// userrole is system admin also know as admin (if)
//if role is system admin,
if (userRole == 1) {
$("#pendingQuantityHeader").css("display", "table-cell");
trIGRHTML += '<tr>' +
'<td style="width: 50px;" >' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
@ -969,9 +1250,10 @@
'<td style="width: 50px;" id="amount' + i + '">' + amount + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + grand_total_amount + '</td>' +
'<td style="width: 100px;"><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')" style="width: 75px;" value="'+item.Remarks+'"> </td>' +
'<td style="width: 50px;"><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
'<td style="width: 25px;"><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
'<input type="hidden" id="MaterialCategory' + i + '" name="MaterialCategory' + i + '" value="' + item.MaterialCategory + '">' +
'<input type="hidden" id="txtQuantityAsPerInvoice' + i + '" name="txtQuantityAsPerInvoice' + i + '" value="' + item.QuantityAsPerInvoice + '">' +
'<input type="hidden" id="txtOrderedQuantity' + i + '" name="txtOrderedQuantity' + i + '" value="' + item.Quantity + '">' +
'<input type="hidden" id="txtGrossWeight' + i + '" name="txtGrossWeight' + i + '" value="' + item.GrossWeight + '">' +
@ -982,8 +1264,21 @@
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '"value="' + item.Remarks + '">' +
'<input type="hidden" id="txtIGRLineItem' + i + '" name="txtIGRLineItem' + i + '"value="' + item.IGRItemNo + '">' +
'<input type="file" id="txtWeightFile' + i + '" name="txtWeightFile' + i + '"value="' + item.WeightFile + '" style="display:none;">' +
'<input type="hidden" id="txtWeightFileName' + i + '" name="txtWeightFileName' + i + '"value="' + item.WeightFile + '">' +
'</tr>';
'<input type="hidden" id="txtWeightFileName' + i + '" name="txtWeightFileName' + i + '"value="' + item.WeightFile + '">' ;
if(item.MaterialCategory == "gas"){
$('#gasShortageHeader').show();
$('#gasShortageListHeader').show();
trIGRHTML += '<td style="width: 25px;"><a target="_blank" data-toggle="modal" data-target="#gasShortageCalculator" title="gas Shortage Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-gas-pump" style="text-align: center;"></i></a> </td>' ;
trIGRHTML += '<td style="width: 25px;"><a target="_blank" data-toggle="modal" data-target="#gasShortageList" title="gas Shortage List" ><i class="fa fa-solid fa-list" style="text-align: center;"></i></a> </td>' ;
trIGRHTML +='</tr>';
}else{
trIGRHTML +='</tr>';
}
if ((item.Quantity - item.QuantityAsPerInvoice) == 0.00) {
$('#QuantityAsPerInvoice' + i).attr('readonly', 'true');
@ -1009,7 +1304,7 @@
'<td style="width: 50px;" id="amount' + i + '">' + amount + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + grand_total_amount + '</td>' +
'<td style="width: 100px;"><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')" style="width: 75px;" value="'+item.Remarks+'"> </td>' +
'<td style="width: 50px;"><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
'<td style="width: 25px;"><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
'<input type="hidden" id="txtQuantityAsPerInvoice' + i + '" name="txtQuantityAsPerInvoice' + i + '" value="' + item.QuantityAsPerInvoice + '">' +
@ -1022,8 +1317,18 @@
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '"value="' + item.Remarks + '">' +
'<input type="hidden" id="txtIGRLineItem' + i + '" name="txtIGRLineItem' + i + '"value="' + item.IGRItemNo + '">' +
'<input type="file" id="txtWeightFile' + i + '" name="txtWeightFile' + i + '"value="' + item.WeightFile + '" style="display:none;">' +
'<input type="hidden" id="txtWeightFileName' + i + '" name="txtWeightFileName' + i + '"value="' + item.WeightFile + '">' +
'</tr>';
'<input type="hidden" id="txtWeightFileName' + i + '" name="txtWeightFileName' + i + '"value="' + item.WeightFile + '">' ;
if(item.MaterialCategory == "gas"){
$('#gasShortageHeader').show();
$('#gasShortageListHeader').show();
trIGRHTML += '<td style="width: 25px;"><a target="_blank" data-toggle="modal" data-target="#gasShortageCalculator" title="gas Shortage Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-gas-pump" style="text-align: center;"></i></a> </td>' ;
trIGRHTML += '<td style="width: 25px;"><a target="_blank" data-toggle="modal" data-target="#gasShortageList" title="gas Shortage List" ><i class="fa fa-solid fa-list" style="text-align: center;"></i></a> </td>' ;
trIGRHTML +='</tr>';
}else{
trIGRHTML +='</tr>';
}
if ((item.Quantity - item.QuantityAsPerInvoice) == 0.00) {
$('#QuantityAsPerInvoice' + i).attr('readonly', 'true');
@ -1043,7 +1348,7 @@
'<td style="width: 50px;" id="tax_percentage' + i + '">' + tax_percentage + '</td>' +
'<td style="width: 50px;" id="amount' + i + '">' + amount + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + grand_total_amount + '</td>' +
'<td style="width: 50px;"><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
'<td style="width: 25px;"><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
'<input type="hidden" id="txtQuantityAsPerInvoice' + i + '" name="txtQuantityAsPerInvoice' + i + '" value="' + item.QuantityAsPerInvoice + '">' +
@ -1056,8 +1361,18 @@
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '"value="' + item.Remarks + '">' +
'<input type="hidden" id="txtIGRLineItem' + i + '" name="txtIGRLineItem' + i + '"value="' + item.IGRItemNo + '">' +
'<input type="file" id="txtWeightFile' + i + '" name="txtWeightFile' + i + '"value="' + item.WeightFile + '">' +
'<input type="hidden" id="txtWeightFileName' + i + '" name="txtWeightFileName' + i + '"value="' + item.WeightFile + '">' +
'</tr>';
'<input type="hidden" id="txtWeightFileName' + i + '" name="txtWeightFileName' + i + '"value="' + item.WeightFile + '">';
if(item.MaterialCategory == "gas"){
$('#gasShortageHeader').show();
$('#gasShortageListHeader').show();
trIGRHTML += '<td style="width: 25px;"><a target="_blank" data-toggle="modal" data-target="#gasShortageCalculator" title="gas Shortage Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-gas-pump" style="text-align: center;"></i></a> </td>' ;
trIGRHTML += '<td style="width: 25px;"><a target="_blank" data-toggle="modal" data-target="#gasShortageList" title="gas Shortage List" ><i class="fa fa-solid fa-list" style="text-align: center;"></i></a> </td>' ;
trIGRHTML +='</tr>';
}else{
trIGRHTML +='</tr>';
}
}
}
@ -1097,12 +1412,18 @@
<script>
$(document).ready(function(){
$('#Igrshow').on("hide.bs.modal", function(e){
$('#gasShortageHeader').hide();
$('#gasShortageListHeader').hide();
$('#existingContainer').empty();
});
});
</script>
<script>
$('#update').click(function() {
// $('#content').loader('show');
@ -2036,4 +2357,408 @@
}
}
</script>
</script>
<!-- 28/02/2025 -->
<!-- add gas shortage calculator -->
<script>
$('#grossWeightId, #tareWeightId,#actualWeightId').change(function() {
console.log("fine here ");
let grossWeightVal = $('#grossWeightId').val().trim();
let tareWeightVal = $('#tareWeightId').val().trim();
// Ensure both fields have values before calculation
if (grossWeightVal === '' || tareWeightVal === '') {
return;
}
let grossWeight = validateNumber(grossWeightVal);
let tareWeight = validateNumber(tareWeightVal);
let netWeight = grossWeight - tareWeight;
$('#netWeightId').val(netWeight);
let actualWeightVal = $('#actualWeightId').val().trim();
// Ensure both fields have values before calculation
if (actualWeightVal === '' || netWeight === '') {
return;
}
let actualWeight = validateNumber(actualWeightVal);
let shortage = actualWeight - netWeight;
$('#shortageId').val(shortage);
});
function validateNumber(givenValue) {
givenValue = givenValue.trim();
if (/^\d+$/.test(givenValue)) {
return parseInt(givenValue, 10); // Convert string to number
} else {
alert('Please Enter a Valid Number..!!');
return 0; // Invalid number
}
}
</script>
<!-- while opening add gas shortage modal -->
<script>
$(document).ready(function(){
$('#gasShortageCalculator').on("shown.bs.modal", function(e){
//invoice needed to store it in the shortage table ,
// coz based on this we can limit the addition of shortage must not exceed than given qty
let invoiceNo = $('#Invoice_No').val();
let materialReceivedDate = $('#MaterialRcvdDate').val().split("-");
//converting it to y-m-d format;
console.log(`${materialReceivedDate[2]}-${materialReceivedDate[1]}-${materialReceivedDate[0]}`);
$('#invoiceNoId').val(invoiceNo);
$('#fullCylinderDateId').val(`${materialReceivedDate[2]}-${materialReceivedDate[1]}-${materialReceivedDate[0]}`);
});
});
</script>
<!-- while closing add gas shortage modal -->
<script>
$(document).ready(function(){
$('#gasShortageCalculator').on("hide.bs.modal", function(e){
$('#invoiceNoId').val(' ');
$('#fullCylinderDateId').val(" ");
});
});
</script>
<!-- end of add gas shortage calculator -->
<!-- edit gasShortageCalculator -->
<script>
$('#editGrossWeightId,#editTareWeightId,#editActualWeightId').change(function() {
let grossWeightVal = $('#editGrossWeightId').val().trim();
let tareWeightVal = $('#editTareWeightId').val().trim();
// Ensure both fields have values before calculation
if (grossWeightVal === '' || tareWeightVal === '') {
return;
}
let grossWeight = validateNumber(grossWeightVal);
let tareWeight = validateNumber(tareWeightVal);
let netWeight = grossWeight - tareWeight;
$('#editNetWeightId').val(netWeight);
let actualWeightVal = $('#editActualWeightId').val().trim();
// Ensure both fields have values before calculation
if (actualWeightVal === '' || netWeight === '') {
return;
}
let actualWeight = validateNumber(actualWeightVal);
let shortage = actualWeight - netWeight;
$('#editShortageId').val(shortage);
});
</script>
<!-- while opening edit gas shortage modal -->
<script>
$(document).ready(function(){
$('#editGasShortageCalculator').on("shown.bs.modal", function(e){
//invoice needed to store it in the shortage table ,
// coz based on this we can limit the addition of shortage must not exceed than given qty
let invoiceNo = $('#Invoice_No').val();
let materialReceivedDate = $('#MaterialRcvdDate').val().split("-");
//converting it to y-m-d format;
console.log(`${materialReceivedDate[2]}-${materialReceivedDate[1]}-${materialReceivedDate[0]}`);
$('#editInvoiceNoId').val(invoiceNo);
$('#editFullCylinderDateId').val(`${materialReceivedDate[2]}-${materialReceivedDate[1]}-${materialReceivedDate[0]}`);
});
});
</script>
<!-- while closing edit gas shortage modal -->
<script>
$(document).ready(function(){
$('#gasShortageCalculator').on("hide.bs.modal", function(e){
$('#editInvoiceNoId').val(' ');
$('#editFullCylinderDateId').val(" ");
});
});
</script>
<!-- end of edit gasShortageCalculator -->
<!-- while opening gasShortageList -->
<script>
$(document).ready(function(){
$('#gasShortageList').on("shown.bs.modal",function(e){
let invoiceNo = $('#Invoice_No').val();
console.log("invoice no", invoiceNo);
$('#loader').show();
$.ajax({
type: "POST",
url: "<?php echo base_url()?>/gasShortageList", // 🔹 Change this to your actual backend endpoint
data: {invoiceNo},
dataType: "json",
success: function (response) {
if (response.status === "success") {
console.log(response.data);
let data = response.data ;
let tableData = '';
data.forEach((val) => {
tableData += `
<tr>
<td>${val.fullCylinderDate}</td>
<td>${val.emptyCylinderDate}</td>
<td>${val.invoiceNo}</td>
<td>${val.cylinderNo}</td>
<td>${val.grossWeight}</td>
<td>${val.tareWeight}</td>
<td>${val.netWeight}</td>
<td>${val.actualWeight}</td>
<td>${val.shortage}</td>
<td style="display:none">${val.id}</td>
<td style="width: 25px;">
<i class="fa fa-solid fa-edit btnEditGasShortageCalculator"
style="text-align: center;"
data-toggle="modal"
data-target="#editGasShortageCalculator"
data-id="${val.id}"
title="Edit Gas Shortage List">
</i>
</td>
</tr>`;
});
// Assuming you have a table with ID "gasShortageTable"
$("#gasShortageTable tbody").html(tableData);
} else {
alert("Error: " + response.message);
}
},
error: function (xhr, status, error) {
console.log(xhr.responseText);
alert("Something went wrong! Please try again.");
},
complete:function(){
console.log("ajax call is completed..!!");
$('#loader').hide();
}
});
})
})
</script>
<!-- while closing gasShortageList -->
<script>
$(document).ready(function(){
$('#gasShortageList').on("hide.bs.modal",function(){
$("#gasShortageTable tbody").html(" ");
})
})
</script>
<!-- ajax call for gas Shortage -->
<script>
$("#gasShortageCalculator, #editGasShortageCalculator").submit(function (event) {
event.preventDefault(); // Prevent form reload
let formData;
let method = $(this).closest(".modal").data("form");
// Prepare form data
let addFormData = {
fullCylinderDate: $('#fullCylinderDateId').val(),
emptyCylinderDate: $('#emptyCylinderDateId').val(),
invoiceNo: $('#invoiceNoId').val(),
cylinderNo: $('#cylinderNoId').val(),
grossWeight: $('#grossWeightId').val(),
tareWeight: $('#tareWeightId').val(),
actualWeight: $('#actualWeightId').val(),
netWeight: $('#netWeightId').val(),
shortage: $('#shortageId').val()
};
let editFormData = {
fullCylinderDate: $('#editFullCylinderDateId').val(),
emptyCylinderDate: $('#editEmptyCylinderDateId').val(),
invoiceNo: $('#editInvoiceNoId').val(),
cylinderNo: $('#editCylinderNoId').val(),
grossWeight: $('#editGrossWeightId').val(),
tareWeight: $('#editTareWeightId').val(),
actualWeight: $('#editActualWeightId').val(),
netWeight: $('#editNetWeightId').val(),
shortage: $('#editShortageId').val(),
id : $('#editId').val()
};
if(method == "add"){ formData = addFormData ;}
if(method == "edit"){ formData = editFormData ;}
$('#loader').show();
$.ajax({
type: "POST",
url: "<?php echo base_url()?>/updateGasShortage", // 🔹 Change this to your actual backend endpoint
data: formData,
dataType: "json",
success: function (response) {
if (response.status === "success") {
alert("Gas Shortage Data Saved Successfully!");
$('#gasShortageCalculator').modal('hide'); // Close modal
$('#editGasShortageCalculator').modal('hide');
} else {
alert("Error: " + response.message);
}
},
error: function (xhr, status, error) {
console.log(xhr.responseText);
alert("Something went wrong! Please try again.");
},
complete:function(){
console.log("ajax call is completed..!!");
$('#loader').hide();
}
});
});
</script>
<script>
$(document).on("click", ".btnEditGasShortageCalculator", function () {
console.log("Edit modal opening place");
let id = $(this).data("id");
console.log("Editing ID:", id);
// Smooth transition: First hide, then show after 300ms
$("#gasShortageList").modal("hide");
setTimeout(() => {
$("#editGasShortageCalculator").modal("show");
}, 300);
$('#loader').show();
// AJAX request to fetch data
$.ajax({
type: "POST",
url: "<?php echo base_url()?>/getGasShortageDetail",
data: { id: id },
dataType: "json",
success: function (response) {
if (response.status === "success") {
let data = response.data;
console.log(data);
if(data.length > 0){
data = data[0];
console.log(data);
// Populate the modal fields
$("#editFullCylinderDateId").val(data.fullCylinderDate);
$("#editEmptyCylinderDateId").val(data.emptyCylinderDate);
$("#editInvoiceNoId").val(data.invoiceNo);
$("#editCylinderNoId").val(data.cylinderNo);
$("#editGrossWeightId").val(data.grossWeight);
$("#editTareWeightId").val(data.tareWeight);
$("#editNetWeightId").val(data.netWeight);
$("#editActualWeightId").val(data.actualWeight);
$("#editShortageId").val(data.shortage);
$("#editId").val(data.id); // Hidden field for ID
}
} else {
alert("Error: " + response.message);
}
},
error: function (xhr, status, error) {
console.log(xhr.responseText);
alert("Something went wrong! Please try again.");
},
complete:function(){
console.log("ajax call is completed..!!");
$('#loader').hide();
}
});
});
</script>