working on incoming silica module -vadivel J
This commit is contained in:
parent
f334492a8b
commit
d14dee5b87
@ -420,8 +420,8 @@ $routes->post('getSilicaIGR', 'Supplier::getSilicaIGR');
|
||||
|
||||
//Stock Module
|
||||
|
||||
$routes->get('coatingMachineDetails' , 'StockController::loadView_coatingMachineDetails');
|
||||
$routes->post('coatingMachineDetails' , 'StockController::loadView_coatingMachineDetails');
|
||||
//coatingMachineDetails
|
||||
$routes->match(['GET','POST'],'coatingMachineDetails' , 'StockController::loadView_coatingMachineDetails');
|
||||
$routes->post('addNewCoatingMachineDetails' , 'StockController::addNewCoatingMachineDetails');
|
||||
$routes->post('updateCoatingMachineDetails','StockController::updateCoatingMachineDetails');
|
||||
$routes->get('deleteCoatingMachineDetails' , 'StockController::deleteCoatingMachineDetails');
|
||||
@ -431,3 +431,7 @@ $routes->get('deleteCoatingMachineDetails' , 'StockController::deleteCoatingMach
|
||||
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'drierMachineDetails', 'StockController::drierMachineDetails');
|
||||
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'addOrEditdrierMachineDetails', 'StockController::addOrEditdrierMachineDetails');
|
||||
|
||||
//incomingSilicaSandDetaails
|
||||
$routes->match(['GET','POST'],'incomingSilicaSandDetails', 'StockController::loadView_incomingSilicaSandDetails');
|
||||
$routes->post('updateIncomingSilicaSandDetails', 'StockController::updateIncomingSilicaSandDetails');
|
||||
$routes->get('deleteIncomingSilicaSandDetails', 'StockController::deleteIncomingSilicaSandDetails');
|
||||
|
||||
@ -125,6 +125,17 @@ class StockController extends BaseController
|
||||
|
||||
|
||||
|
||||
public function loadView_incomingSilicaSandDetails(){
|
||||
|
||||
}
|
||||
|
||||
public function updateIncomingSilicaSandDetails(){
|
||||
|
||||
}
|
||||
|
||||
public function deleteIncomingSilicaSandDetails(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
50
app/Models/incomingSilicaSanddetails_model.php
Normal file
50
app/Models/incomingSilicaSanddetails_model.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class IncomingSilicaSandDetailsModel extends Model
|
||||
{
|
||||
protected $table = 't_incomingSilicaSandDetails';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = ['igrNo_fk','grade','gradeCondition',
|
||||
'_10' ,'_20','_30','_40','_50','_70','_100', '_140','_200','_300',
|
||||
'pan' , 'total' , 'afsSpec' ,'afsActual','plus20Loss','plus30Loss','moistureSpec','moistureActual',
|
||||
'moistureLoss', 'moistureLossQty','sieveLossQty','salableQty', 'remark',
|
||||
'is_active','created_at','updated_at'];
|
||||
|
||||
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 = [];
|
||||
}
|
||||
@ -64,12 +64,6 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Include Bootstrap Datepicker CSS and JS -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.min.css">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<div class="content-page">
|
||||
<div class="content">
|
||||
<!-- Start Content-->
|
||||
@ -77,20 +71,6 @@
|
||||
<!-- start page title -->
|
||||
<div>
|
||||
|
||||
<!-- flash message is removed -->
|
||||
<!-- <?php
|
||||
helper('form');
|
||||
$error = session()->getFlashdata('error');
|
||||
if ($error) {
|
||||
$type = "error";
|
||||
echo show_alert($type, $error);
|
||||
}
|
||||
$success = session()->getFlashdata('success');
|
||||
if ($success) {
|
||||
$type = "success";
|
||||
echo show_alert($type, $success);
|
||||
}
|
||||
?> -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
@ -254,7 +234,7 @@
|
||||
<span class="badge mandatory">*</span>
|
||||
<select class="form-control" name="machineOnTime" id="machineOnTimeHrId">
|
||||
<option value="">Select Time</option>
|
||||
<option value="12:00 AM" > 12:00 AM</option>
|
||||
<option value="12:00 AM" >12:00 AM</option>
|
||||
<option value="12:30 AM"> 12:30 AM</option>
|
||||
<?php
|
||||
// Loop through the hours 1 to 12
|
||||
@ -269,12 +249,12 @@
|
||||
}
|
||||
?>
|
||||
|
||||
<option value="12:00 PM" > 12:00 PM</option>
|
||||
<option value="12:30 PM"> 12:30 PM</option>
|
||||
<option value="12:00 PM">12:00 PM</option>
|
||||
<option value="12:30 PM">12:30 PM</option>
|
||||
|
||||
<?php
|
||||
// Loop through the hours 1 to 12
|
||||
for ($hour = 1; $hour < 12; $hour++) {
|
||||
for ($hour = 1; $hour <= 12; $hour++) {
|
||||
// Display each hour with ":00"
|
||||
$formattedHour = str_pad($hour, 2, '0', STR_PAD_LEFT);
|
||||
|
||||
@ -435,8 +415,8 @@
|
||||
<span class="badge mandatory">*</span>
|
||||
<select class="form-control" name="machineOnTime" id="editMachineOnTimeHrId">
|
||||
<option value="">Select Time</option>
|
||||
<option value="12:00 AM"> 12:00 AM</option>
|
||||
<option value="12:30 AM"> 12:30 AM</option>
|
||||
<option value="12:00 AM">12:00 AM</option>
|
||||
<option value="12:30 AM">12:30 AM</option>
|
||||
<?php
|
||||
// Loop through the hours 1 to 12
|
||||
for ($hour = 1; $hour < 12; $hour++) {
|
||||
@ -450,8 +430,8 @@
|
||||
}
|
||||
?>
|
||||
|
||||
<option value="12:00 PM"> 12:00 PM</option>
|
||||
<option value="12:30 PM"> 12:30 PM</option>
|
||||
<option value="12:00 PM">12:00 PM</option>
|
||||
<option value="12:30 PM">12:30 PM</option>
|
||||
<?php
|
||||
// Loop through the hours 1 to 12
|
||||
for ($hour = 1; $hour < 12; $hour++) {
|
||||
@ -473,8 +453,8 @@
|
||||
<span class="badge mandatory">*</span>
|
||||
<select class="form-control" name="machineOffTime" id="editMachineOffTimeHrId">
|
||||
<option value="">Select Time</option>
|
||||
<option value="12:00 AM"> 12:00 AM</option>
|
||||
<option value="12:30 AM"> 12:30 AM</option>
|
||||
<option value="12:00 AM">12:00 AM</option>
|
||||
<option value="12:30 AM">12:30 AM</option>
|
||||
<?php
|
||||
// Loop through the hours 1 to 12
|
||||
for ($hour = 1; $hour < 12; $hour++) {
|
||||
@ -487,8 +467,8 @@
|
||||
|
||||
}
|
||||
?>
|
||||
<option value="12:00 PM"> 12:00 PM</option>
|
||||
<option value="12:30 PM"> 12:30 PM</option>
|
||||
<option value="12:00 PM">12:00 PM</option>
|
||||
<option value="12:30 PM">12:30 PM</option>
|
||||
<?php
|
||||
// Loop through the hours 1 to 12
|
||||
for ($hour = 1; $hour < 12; $hour++) {
|
||||
@ -701,12 +681,9 @@
|
||||
}
|
||||
|
||||
let machineOnTimeHr = $('#machineOnTimeHrId').val().split(' ')[0];
|
||||
let machineOnTimeAmOrPm = $('#machineOnTimeHrId').val().split(' ')[1];
|
||||
let machineOffTimeHr = $('#machineOffTimeHrId').val().split(' ')[0];
|
||||
let machineOffTimeAmOrPm = $('#machineOffTimeHrId').val().split(' ')[1];
|
||||
|
||||
|
||||
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOnTimeAmOrPm, machineOffTimeHr, machineOffTimeAmOrPm);
|
||||
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr );
|
||||
|
||||
if (!machineRunningInHrs) {
|
||||
$('machineOnTimeHrId').val('');
|
||||
@ -732,12 +709,11 @@
|
||||
}
|
||||
|
||||
let machineOffTimeHr = $('#machineOffTimeHrId').val().split(' ')[0];
|
||||
let machineOffTimeAmOrPm = $('#machineOffTimeHrId').val().split(' ')[1];
|
||||
let machineOnTimeHr = $('#machineOnTimeHrId').val().split(' ')[0];
|
||||
let machineOnTimeAmOrPm = $('#machineOnTimeHrId').val().split(' ')[1];
|
||||
|
||||
|
||||
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOnTimeAmOrPm, machineOffTimeHr, machineOffTimeAmOrPm);
|
||||
|
||||
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr);
|
||||
|
||||
if (!machineRunningInHrs) {
|
||||
|
||||
@ -798,11 +774,9 @@
|
||||
}
|
||||
|
||||
let machineOnTimeHr = $('#editMachineOnTimeHrId').val().split(' ')[0];
|
||||
let machineOnTimeAmOrPm = $('#editMachineOnTimeHrId').val().split(' ')[1];
|
||||
let machineOffTimeHr = $('#editMachineOffTimeHrId').val().split(' ')[0];
|
||||
let machineOffTimeAmOrPm = $('#editMachineOffTimeHrId').val().split(' ')[1];
|
||||
|
||||
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOnTimeAmOrPm, machineOffTimeHr, machineOffTimeAmOrPm);
|
||||
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr);
|
||||
|
||||
if (!machineRunningInHrs) {
|
||||
$('#editMachineOnTimeHrId').val('');
|
||||
@ -829,11 +803,9 @@
|
||||
|
||||
|
||||
let machineOnTimeHr = $('#editMachineOnTimeHrId').val().split(' ')[0];
|
||||
let machineOnTimeAmOrPm = $('#editMachineOnTimeHrId').val().split(' ')[1];
|
||||
let machineOffTimeHr = $('#editMachineOffTimeHrId').val().split(' ')[0];
|
||||
let machineOffTimeAmOrPm = $('#editMachineOffTimeHrId').val().split(' ')[1];
|
||||
|
||||
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOnTimeAmOrPm, machineOffTimeHr, machineOffTimeAmOrPm);
|
||||
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr);
|
||||
|
||||
if (!machineRunningInHrs) {
|
||||
|
||||
@ -880,76 +852,53 @@
|
||||
|
||||
|
||||
<script>
|
||||
function calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOnTimeAmOrPm, machineOffTimeHr, machineOffTimeAmOrPm) {
|
||||
function calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr) {
|
||||
|
||||
let machineOnTime12 = machineOnTimeHr + " " + machineOnTimeAmOrPm; //07:00 PM
|
||||
let machineOffTime12 = machineOffTimeHr + " " + machineOffTimeAmOrPm; //03:00 PM
|
||||
let machineOnTime12 = machineOnTimeHr;
|
||||
let machineOffTime12 = machineOffTimeHr;
|
||||
|
||||
let machineOnTime24 = convertTo24HrFormat(machineOnTime12) + ":00"; //19:00:00
|
||||
let machineOffTime24 = convertTo24HrFormat(machineOffTime12) + ":00"; //15:00:00
|
||||
let machineOnTime24 = convertTo24Hr(machineOnTime12);
|
||||
let machineOffTime24 = convertTo24Hr(machineOffTime12);
|
||||
|
||||
const startDate = new Date(`1970-01-01T${machineOnTime24}`);
|
||||
const endDate = new Date(`1970-01-01T${machineOffTime24}`);
|
||||
|
||||
let machineOnDateAndTime;
|
||||
let machineOffDateAndTime;
|
||||
|
||||
if (machineOnTimeAmOrPm == 'PM' && machineOffTimeAmOrPm == 'AM') {
|
||||
machineOnDateAndTime = machineOnDate + "T" + machineOnTime24;
|
||||
machineOffDateAndTime = getNextDay(machineOnDate) + "T" + machineOffTime24;
|
||||
} else {
|
||||
machineOnDateAndTime = machineOnDate + "T" + machineOnTime24;
|
||||
machineOffDateAndTime = machineOnDate + "T" + machineOffTime24;
|
||||
|
||||
}
|
||||
|
||||
|
||||
let startTime = new Date(machineOnDateAndTime);
|
||||
let endTime = new Date(machineOffDateAndTime);
|
||||
|
||||
console.log(startTime); //Thu Oct 17 2024 01:00:00 GMT+0530 (India Standard Time)
|
||||
|
||||
console.log(endTime); //Thu Oct 17 2024 05:30:00 GMT+0530 (India Standard Time)
|
||||
|
||||
let startDate = machineOnDateAndTime.split('T')[0];
|
||||
let endDate = machineOffDateAndTime.split('T')[0];
|
||||
|
||||
let timeDifferenceInMs = endTime - startTime;
|
||||
|
||||
|
||||
let timeDifferenceInMinutes = Math.floor(timeDifferenceInMs / (1000 * 60));
|
||||
let hours = Math.floor(timeDifferenceInMinutes / 60);
|
||||
let minutes = timeDifferenceInMinutes % 60;
|
||||
|
||||
let timeDifferenceFormatted = `${hours}.${minutes >= 30 ? 5 : 0}`;
|
||||
|
||||
return Math.abs(timeDifferenceFormatted).toFixed(1);
|
||||
// Handle the case where end time is on the next day
|
||||
if (endDate < startDate) {
|
||||
endDate.setDate(endDate.getDate() + 1);
|
||||
}
|
||||
|
||||
// Calculate the difference in milliseconds
|
||||
const diffInMs = endDate - startDate;
|
||||
|
||||
// Convert milliseconds to hours and minutes
|
||||
const hours = Math.floor(diffInMs / (1000 * 60 * 60));
|
||||
const minutes = Math.floor((diffInMs % (1000 * 60 * 60)) / (1000 * 60));
|
||||
|
||||
return `${hours}.${minutes >= 30 ? 5 : 0}`; // Return in HH.MM format
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
function convertTo24HrFormat(timeStr) {
|
||||
const [time, modifier] = timeStr.split(' ');
|
||||
let [hours, minutes] = time.split(':');
|
||||
if (hours === '12') {
|
||||
hours = '00';
|
||||
}
|
||||
if (modifier === 'PM') {
|
||||
hours = parseInt(hours, 10) + 12;
|
||||
}
|
||||
return `${hours}:${minutes}`;
|
||||
function convertTo24Hr(time) {
|
||||
const [timePart, modifier] = time.split(" ");
|
||||
let [hours, minutes] = timePart.split(":");
|
||||
|
||||
// Convert hours to a number
|
||||
hours = parseInt(hours, 10);
|
||||
|
||||
// Adjust hours based on AM/PM
|
||||
if (modifier == "PM" && hours < 12) {
|
||||
hours += 12; // Convert PM times to 24-hour format (e.g., 1 PM becomes 13:00)
|
||||
} else if (modifier == "AM" && hours == 12) {
|
||||
hours = 0; // Convert 12 AM to 00:00 (midnight)
|
||||
}
|
||||
|
||||
function getNextDay(givenDate) {
|
||||
// Given date in 'YYYY-MM-DD' format
|
||||
let date = new Date(givenDate);
|
||||
// Format hours and minutes to ensure two digits
|
||||
return `${String(hours).padStart(2, '0')}:${minutes}`;
|
||||
}
|
||||
|
||||
// Increment the date by 1 day
|
||||
date.setDate(date.getDate() + 1);
|
||||
|
||||
// Output the updated date
|
||||
return date.toISOString().split('T')[0];
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@ -67,6 +67,11 @@
|
||||
<!-- Scroll the table left to right -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js"></script>
|
||||
|
||||
<!-- Bootstrap Datepicker CSS and JS -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.min.css">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<link href="<?php echo base_url(); ?>public/new_assets/libs/bootstrap-datepicker/css/bootstrap-datepicker.min.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
@ -762,6 +767,8 @@
|
||||
<a href="<?php echo base_url(); ?>drierMachineDetails" class="dropdown-item"><i class="ri-file-list-3-line align-middle mr-1"></i>10 TON Drier Details</a>
|
||||
|
||||
<a href="<?php echo base_url(); ?>coatingMachineDetails" class="dropdown-item"><i class="ri-file-list-3-line align-middle mr-1"></i>Coating Machine Details</a>
|
||||
|
||||
<a href="<?php echo base_url(); ?>incomingSilicaSandDetails" class="dropdown-item"><i class="ri-file-list-3-line align-middle mr-1"></i>incoming silica sand Details</a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
553
app/Views/incomingSilicaSanddetails.php
Normal file
553
app/Views/incomingSilicaSanddetails.php
Normal file
@ -0,0 +1,553 @@
|
||||
|
||||
|
||||
<?php
|
||||
$datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
?>
|
||||
<style type="text/css">
|
||||
.num {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.fht-table,
|
||||
.fht-table thead,
|
||||
.fht-table tfoot,
|
||||
.fht-table tbody,
|
||||
.fht-table tr,
|
||||
.fht-table th,
|
||||
.fht-table td {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.fht-table td {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.fht-table td:hover {
|
||||
background-color: #00a65a;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.fht-table {
|
||||
border: 0 none;
|
||||
height: auto;
|
||||
width: auto;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
/*table-layout: fixed; Algoritmo de distribucion fijo */
|
||||
white-space:nowrap;
|
||||
}
|
||||
|
||||
.fht-table th,
|
||||
.fht-table td {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.fht-table-wrapper,
|
||||
.fht-table-wrapper .fht-thead,
|
||||
.fht-table-wrapper .fht-tfoot,
|
||||
.fht-table-wrapper .fht-fixed-column .fht-tbody,
|
||||
.fht-table-wrapper .fht-fixed-body .fht-tbody,
|
||||
.fht-table-wrapper .fht-tbody {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.fht-table-wrapper .fht-fixed-body .fht-tbody,
|
||||
.fht-table-wrapper .fht-tbody {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.fht-table-wrapper .fht-table .fht-cell {
|
||||
overflow: hidden;
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
.fht-table-wrapper .fht-fixed-column,
|
||||
.fht-table-wrapper .fht-fixed-body {
|
||||
top: 0;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.fht-table-wrapper .fht-fixed-column {
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.fht-fixed-body .fht-thead table {
|
||||
margin-right: 20px;
|
||||
border: 0 none;
|
||||
}
|
||||
|
||||
/*For Examples*/
|
||||
|
||||
.ContenedorTabla {
|
||||
height: 500px;
|
||||
margin: 0 auto;
|
||||
overflow: auto;
|
||||
width: auto;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.header,
|
||||
.main {
|
||||
display: inline-block;
|
||||
height: auto;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.titulosHeader {
|
||||
border-bottom: 1px solid #e8bb25;
|
||||
height: auto;
|
||||
margin-bottom: 10px;
|
||||
padding-bottom: 8px;
|
||||
padding-top: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.celda_encabezado_general {
|
||||
background-color: #00a65a;
|
||||
border: 1px solid #ccc;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
padding: 2px 4px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
._Separador {
|
||||
background-color: #fff;
|
||||
height: 12px;
|
||||
border-left: 1px solid #ccc;
|
||||
border-right: 1px solid #ccc;
|
||||
width: 7px;
|
||||
}
|
||||
|
||||
._Separador div {
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
.celda_normal {
|
||||
/*background-color: #fff;*/
|
||||
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||
border: 1px solid #ccc;
|
||||
padding: 2px 4px;
|
||||
}
|
||||
|
||||
/*style excel*/
|
||||
.excel_cell {
|
||||
border: 1px solid #CCC;
|
||||
color: #222;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
font-weight: normal;
|
||||
padding: 4px;
|
||||
white-space: pre-line;
|
||||
empty-cells: show;
|
||||
}
|
||||
|
||||
._cell_header {
|
||||
background-color: #EEE;
|
||||
}
|
||||
|
||||
._cell_Default {
|
||||
background-color: #FFF;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.excel_cell div {
|
||||
width: 30px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.modal {
|
||||
padding-right: 30% ! important;
|
||||
}
|
||||
</style>
|
||||
<div class="content-page">
|
||||
<div class="content">
|
||||
<!-- Start Content-->
|
||||
<div class="container-fluid">
|
||||
<!-- start page title -->
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="javascript: void(0);">Stocks</a></li>
|
||||
<li class="breadcrumb-item active">
|
||||
<h4 class="page-title">Incoming Silica Sand Details </h4>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
<!-- Right-aligned buttons or links can be added here -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<form action="<?= base_url('incomingSilicaSandDetails'); ?>" method="post">
|
||||
<div class="row">
|
||||
|
||||
<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">
|
||||
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<input type="submit" value="Change Month" class="btn btn-success" style="margin-top:0px;">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
<!-- Add table-responsive for horizontal scroll -->
|
||||
<div class="table-responsive">
|
||||
<table id="drierTable" class="fht-table table-striped" style="font-size: small;">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">S.NO</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">IGR No</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Invoice No</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Invoice Date</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Received Date</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Supplier Name</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Grade </th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Grade Condition</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Vehicle No</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Qty</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">10</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">20</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">30</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">40</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">50</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">70</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">100</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">140</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">200</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">300</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">PAN</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Total</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">AFS Spec</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">AFS Actual</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Plus 20 loss%</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Plus 30 Loss %</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Moisture % Spec</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Moisture Actual</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Moisture Loss</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Moisture loss Qty </th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Sieve Loss Qty </th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Salable Qty </th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Remark</th>
|
||||
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
<tbody style="background-color: #fff;">
|
||||
|
||||
<?php $index = 0;
|
||||
$row = 0;
|
||||
foreach ($data as $a) {
|
||||
$row++;
|
||||
$index++; ?>
|
||||
|
||||
<tr id="<?php echo $row; ?>">
|
||||
<td width="45" height="45" class="celda_normal"><?php echo $index; ?></td>
|
||||
<td width="79" height="45" class="celda_normal"><?php echo DateTime::createFromFormat('Y-m-d', $a['date'])->format('d-m-Y'); ?></td>
|
||||
<td class="celda_normal" >
|
||||
<select class="timeDropdown drier_on_time" style="width: 100px;">
|
||||
<option value="">Select</option>
|
||||
<?php foreach ($timeDropdown as $key => $time) { ?>
|
||||
<option value="<?= $time; ?>" <?php if($a['drier_on_time'] == $time){ echo 'selected'; } ?> ><?= $time; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</td>
|
||||
<td class="celda_normal" >
|
||||
<select class="timeDropdown drier_off_time" style="width: 100px;">
|
||||
<option value="">Select</option>
|
||||
<?php foreach ($timeDropdown as $key => $time) { ?>
|
||||
<option value="<?= $time; ?>" <?php if($a['drier_off_time'] == $time){ echo 'selected'; } ?> ><?= $time; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</td>
|
||||
<td class="celda_normal">
|
||||
<?php echo $a['drier_running_hours']; ?>
|
||||
</td>
|
||||
<td class="celda_normal" contenteditable="true">
|
||||
<?php echo $a['supplier_name']; ?>
|
||||
</td>
|
||||
<td class="celda_normal" contenteditable="true" >
|
||||
<?php echo $a['input_sand_moisture']; ?>
|
||||
</td>
|
||||
<td class="celda_normal" onkeyup="gasPerTon(this.parentNode.id,this.textContent);" contenteditable="true" >
|
||||
<?php echo $a['total_gas_consumption']; ?>
|
||||
</td>
|
||||
<td class="celda_normal">
|
||||
<?php echo $a['gas_per_ton']; ?>
|
||||
</td>
|
||||
<td class="celda_normal" onkeyup="moistureLossQty(this.parentNode.id,this.textContent);" contenteditable="true" >
|
||||
<?php echo $a['input_sand_qty']; ?>
|
||||
</td>
|
||||
<td class="celda_normal" >
|
||||
<?php echo $a['moisture_loss_qty']; ?>
|
||||
</td>
|
||||
<td class="celda_normal" onkeyup="gasPerTon(this.parentNode.id, this.textContent); moistureLossQty(this.parentNode.id, this.textContent); qtyPerHrs(this.parentNode.id, this.textContent)" contenteditable="true" >
|
||||
<?php echo $a['sand_dried_qty']; ?>
|
||||
</td>
|
||||
<td class="celda_normal" >
|
||||
<?php echo $a['qty_per_hours']; ?>
|
||||
</td>
|
||||
<td class="celda_normal" contenteditable="true" >
|
||||
<?php echo $a['dust_qty']; ?>
|
||||
</td>
|
||||
<td class="celda_normal" contenteditable="true">
|
||||
<?php echo $a['customer_name']; ?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</div><!-- End table-responsive -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<input type="button" class="btn btn-success" id="save" value="save">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div> <!-- End card-body -->
|
||||
</div> <!-- End card -->
|
||||
</div> <!-- End col -->
|
||||
</div> <!-- End row -->
|
||||
</div>
|
||||
</div> <!-- End container-fluid -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
|
||||
$('.timeDropdown').select2({
|
||||
placeholder: "Select a time",
|
||||
});
|
||||
|
||||
$('#save').click(function() {
|
||||
|
||||
var alldata = $("#drierTable").tableToJSON();
|
||||
|
||||
$('#drierTable tbody tr').each(function (index) {
|
||||
|
||||
let row = alldata[index];
|
||||
|
||||
// Get the selected values from dropdowns
|
||||
row['Drier On Time'] = $(this).find('.drier_on_time').val();
|
||||
row['Drier Off Time'] = $(this).find('.drier_off_time').val();
|
||||
});
|
||||
|
||||
|
||||
|
||||
alldata = JSON.stringify(alldata);
|
||||
|
||||
$('#loader').show();
|
||||
$.ajax({
|
||||
data: {
|
||||
drierData: alldata,
|
||||
},
|
||||
type: "POST",
|
||||
url: "<?php echo base_url() ?>addOrEditdrierMachineDetails",
|
||||
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
|
||||
$('#loader').hide();
|
||||
alert(data);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
// time diff finding script start
|
||||
$('.drier_on_time').change(function() {
|
||||
|
||||
var tr = $(this).closest('tr');
|
||||
|
||||
var drierOnTime = $(this).val();
|
||||
var drierOffTime = tr.find('.drier_off_time').val();
|
||||
|
||||
if(drierOnTime != '' && drierOffTime != ''){
|
||||
|
||||
|
||||
const startDate = new Date(`1970-01-01T${convertTo24Hour(drierOnTime)}`);
|
||||
const endDate = new Date(`1970-01-01T${convertTo24Hour(drierOffTime)}`);
|
||||
|
||||
// Handle the case where end time is on the next day
|
||||
if (endDate < startDate) {
|
||||
endDate.setDate(endDate.getDate() + 1);
|
||||
}
|
||||
|
||||
// Calculate the difference in milliseconds
|
||||
const diffInMs = endDate - startDate;
|
||||
|
||||
// Convert milliseconds to hours and minutes
|
||||
const hours = Math.floor(diffInMs / (1000 * 60 * 60));
|
||||
const minutes = Math.floor((diffInMs % (1000 * 60 * 60)) / (1000 * 60));
|
||||
|
||||
const totalHours = hours + (minutes / 60);
|
||||
|
||||
tr.find('td:eq(4)').text(totalHours);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
$('.drier_off_time').change(function() {
|
||||
|
||||
var tr = $(this).closest('tr');
|
||||
|
||||
var drierOffTime = $(this).val();
|
||||
var drierOnTime = tr.find('.drier_on_time').val();
|
||||
|
||||
if(drierOnTime != '' && drierOffTime != ''){
|
||||
|
||||
|
||||
const startDate = new Date(`1970-01-01T${convertTo24Hour(drierOnTime)}`);
|
||||
const endDate = new Date(`1970-01-01T${convertTo24Hour(drierOffTime)}`);
|
||||
|
||||
// Handle the case where end time is on the next day
|
||||
if (endDate < startDate) {
|
||||
endDate.setDate(endDate.getDate() + 1);
|
||||
}
|
||||
|
||||
// Calculate the difference in milliseconds
|
||||
const diffInMs = endDate - startDate;
|
||||
|
||||
// Convert milliseconds to hours and minutes
|
||||
const hours = Math.floor(diffInMs / (1000 * 60 * 60));
|
||||
const minutes = Math.floor((diffInMs % (1000 * 60 * 60)) / (1000 * 60));
|
||||
|
||||
const totalHours = hours + (minutes / 60);
|
||||
|
||||
tr.find('td:eq(4)').text(totalHours);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
function convertTo24Hour(time)
|
||||
{
|
||||
const [timePart, modifier] = time.split(" ");
|
||||
let [hours, minutes] = timePart.split(":");
|
||||
|
||||
// Convert hours to a number
|
||||
hours = parseInt(hours, 10);
|
||||
|
||||
// Adjust hours based on AM/PM
|
||||
if (modifier === "PM" && hours < 12) {
|
||||
hours += 12;
|
||||
} else if (modifier === "AM" && hours === 12) {
|
||||
hours = 0;
|
||||
}
|
||||
|
||||
return `${String(hours).padStart(2, '0')}:${minutes}`;
|
||||
}
|
||||
// time diff finding script end
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
function gasPerTon(parentId , textContent) {
|
||||
var tr = $('#' + parentId);
|
||||
var totalGasConsumption = tr.find('td:eq(7)').text();
|
||||
var sandDriedQty = tr.find('td:eq(11)').text();
|
||||
if(totalGasConsumption != '' && sandDriedQty != '')
|
||||
{
|
||||
var gasPerTon = totalGasConsumption / sandDriedQty;
|
||||
|
||||
if(gasPerTon != NaN && gasPerTon != Infinity)
|
||||
tr.find('td:eq(8)').text(gasPerTon.toFixed(1));
|
||||
|
||||
}else{
|
||||
tr.find('td:eq(8)').text(0.0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function moistureLossQty(parentId , textContent) {
|
||||
var tr = $('#' + parentId);
|
||||
var inputSandQty = tr.find('td:eq(9)').text();
|
||||
var sandDriedQty = tr.find('td:eq(11)').text();
|
||||
if(inputSandQty != '' && sandDriedQty != '')
|
||||
{
|
||||
var moistureLossQty = inputSandQty - sandDriedQty;
|
||||
|
||||
if(moistureLossQty != NaN && moistureLossQty != Infinity)
|
||||
tr.find('td:eq(10)').text(moistureLossQty.toFixed(1));
|
||||
|
||||
}else{
|
||||
tr.find('td:eq(10)').text(0.0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function qtyPerHrs(parentId , textContent) {
|
||||
var tr = $('#' + parentId);
|
||||
var drierRunninhHrs = tr.find('td:eq(4)').text();
|
||||
var sandDriedQty = tr.find('td:eq(11)').text();
|
||||
if(drierRunninhHrs != '' && sandDriedQty != '')
|
||||
{
|
||||
var qtyPerHrs = sandDriedQty / drierRunninhHrs;
|
||||
|
||||
if(qtyPerHrs != NaN && qtyPerHrs != Infinity)
|
||||
tr.find('td:eq(12)').text(qtyPerHrs.toFixed(3));
|
||||
|
||||
}else{
|
||||
tr.find('td:eq(12)').text(0.000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user