Merge : GWM

This commit is contained in:
Smart 2024-10-22 09:01:58 +05:30
commit 3426ca1b04
8 changed files with 888 additions and 128 deletions

View File

@ -420,7 +420,8 @@ $routes->post('getSilicaIGR', 'Supplier::getSilicaIGR');
//Stock Module
$routes->get('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');
@ -430,7 +431,12 @@ $routes->get('deleteCoatingMachineDetails' , 'StockController::deleteCoatingMach
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'drierMachineDetails', 'StockController::drierMachineDetails');
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'addOrEditdrierMachineDetails', 'StockController::addOrEditdrierMachineDetails');
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'factoryVehicleDieselDetails', 'StockController::factoryVehicleDieselDetails');
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'addOrEditfactoryVehicleDieselDetails', 'StockController::addOrEditfactoryVehicleDieselDetails');
//incomingSilicaSandDetaails
$routes->match(['GET','POST'],'incomingSilicaSandDetails', 'StockController::loadView_incomingSilicaSandDetails');
$routes->post('updateIncomingSilicaSandDetails', 'StockController::updateIncomingSilicaSandDetails');
$routes->get('deleteIncomingSilicaSandDetails', 'StockController::deleteIncomingSilicaSandDetails');

View File

@ -8,6 +8,9 @@ use App\Models\DrierMachineDetailsModel;
use App\Models\FactoryMachineModel;
use App\Models\FactoryVehicleDieselDetailsModel;
use App\Models\FactoryVehicleDieselStockSummaryModel;
use App\Models\IncomingSilicaSandDetailsModel;
use App\Models\Inwardgateregister_model;
use App\Models\Rawmaterialdetails_model;
use CodeIgniter\HTTP\ResponseInterface;
use DateTime;
@ -20,6 +23,10 @@ class StockController extends BaseController
protected $factoryVehicleDieselDetails_model;
protected $factoryVehicleDieselStockSummary_model;
protected $session;
protected $incomingSilicaSandDetails_model;
protected $inwardGateRegister_model;
protected $rawmaterialdetails_model;
protected $session;
/**
* This is default constructor of the class
@ -32,6 +39,9 @@ class StockController extends BaseController
$this->factoryMachine_model = new FactoryMachineModel();
$this->factoryVehicleDieselDetails_model = new FactoryVehicleDieselDetailsModel();
$this->factoryVehicleDieselStockSummary_model = new FactoryVehicleDieselStockSummaryModel();
$this->rawmaterialdetails_model = new Rawmaterialdetails_model();
$this->incomingSilicaSandDetails_model = new IncomingSilicaSandDetailsModel();
$this->inwardGateRegister_model = new Inwardgateregister_model();
$this->session = session();
helper('form');
@ -46,13 +56,33 @@ class StockController extends BaseController
public function loadView_coatingMachineDetails(){
if ($this->request->getMethod() === 'POST'){
$month = $this->request->getPost('month');
$date = DateTime::createFromFormat('M-Y', $month);
$formattedDate = $date->format('Y-m');
$month=$formattedDate;
}
else{
$month = date('Y-m');
}
$this->global['pageTitle'] = 'Coating Machine Details ';
$data['coatingMachineDetails']= $this->coatingMachineDetails_model
->where('is_active', 1)
->orderBy('created_at','DESC')
->like('created_at', $month, 'after')
->findAll();
$date = DateTime::createFromFormat('Y-m', $month);
$formattedDate = $date->format('M-Y');
$data['month']=$formattedDate;
return $this->loadViews("CoatingMachineDetail", $this->global, $data, NULL);
}
@ -113,6 +143,33 @@ class StockController extends BaseController
public function loadView_incomingSilicaSandDetails(){
$month='2024-09';
$data['month']=$month;
$this->global['pageTitle']='Incoming Silica Sand Details';
$materialCodes = $this->rawmaterialdetails_model->getAllSilicaRawMaterialCode();
if (!empty($materialCodes)) {
$data['igrDetails'] = $this->inwardGateRegister_model->findIgrForSilicaSand($materialCodes,$month);
} else {
$data['igrDetails'] = [];
}
return $this->loadViews("incomingSilicaSandDetails", $this->global, $data, NULL);
}
public function updateIncomingSilicaSandDetails(){
}
public function deleteIncomingSilicaSandDetails(){
}

View 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 = [];
}

View File

@ -1030,5 +1030,36 @@ class Inwardgateregister_model extends Model
$result = $query->getResult();
return $result;
}
public function findIgrForSilicaSand($materialCodes, $month)
{
$builder = $this->db->table('t_igr_details')
->select(
't_igr_details.IGRNO,
t_igr_details.Remarks,
t_igr_details.MaterialCode,
igrMast.DeliveryChellanOrInvoiceNo as invoiceNo,
igrMast.DeliveryChellanDate as invoiceDate,
igrMast.MaterialRcvdDate as materialRecievedDate,
igrMast.VehicleNo,
supplierDetails.SupplierName,
SUM(t_igr_details.QuantityAsPerInvoice) as Qty,
issd.* ')
->whereIn('t_igr_details.MaterialCode', $materialCodes)
->like('t_igr_details.CreatedDate', $month, 'after')
->groupBy('t_igr_details.IGRNO, t_igr_details.MaterialCode')
->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_purchaseorder_master poMaster', 'poMaster.PONO = igrMast.PONO', 'left')
->join('t_supplierdetailsn supplierDetails', 'supplierDetails.SupplierID = poMaster.SupplierID', 'left')
->orderBy('t_igr_details.CreatedDate', 'DESC');
}
$query = $builder->get();
$result = $query->getResultArray();
return $result;
}
}

View File

@ -123,6 +123,19 @@ class Rawmaterialdetails_model extends Model
return $query->getResult();
}
function getAllSilicaRawMaterialCode(){
$builder = $this->db->table('t_materialmaster')
->select('MaterialCode')
->where('IsActive', 1)
->like('LOWER(MaterialName)', 'silica sand')
->orderBy('CreatedDate', 'desc');
$query = $builder->get();
$materialResults = $query->getResultArray();
return $materialCodes = array_column($materialResults, 'MaterialCode');
}
function getMaterialstock($MaterialCode, $currentdate)

View File

@ -64,10 +64,6 @@
}
</style>
<div class="content-page">
<div class="content">
<!-- Start Content-->
@ -75,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">
@ -113,8 +95,27 @@
<div class="row">
<div class="col-12">
<div class="card">
<form method='post' action="<?= base_url('/coatingMachineDetails');?>">
<div class="card-body">
<div class="card-body">
<div class=form-row>
<div class="form-group col-md-2 mt-2 ">
<input type="text"
value="<?= $month; ?>" name="month"
class="form-control monthpicker" id="monthpicker">
</div>
<div class="form-group col-md-2">
<button type="submit" class="btn btn-success"> Change Month </button>
</div>
</div>
</form>
<table id="datatable" class="table table-hover table-bordered"
style="background-color:#fff;">
@ -126,12 +127,12 @@
<th style="text-align:center !important;">Shift</th>
<th style="text-align:center !important;">Machine On Time</th>
<th style="text-align:center !important;">Machine Off Time</th>
<th style="text-align:center !important;">Machine Running (hr)</th>
<th style="text-align:center !important;">Machine Running(hr)</th>
<th style="text-align:center !important;">Total Coating</th>
<th style="text-align:center !important;">Total Coating Sand (kg)</th>
<th style="text-align:center !important;">Total Coating Sand(kg)</th>
<th style="text-align:center !important;">Total Gas Consumption</th>
<th style="text-align:center !important;">Per Hour Gas Consumption</th>
<th style="text-align:center !important;">Per Hour Coating Sand QTY (kg)
<th style="text-align:center !important;">Hour Gas</th>
<th style="text-align:center !important;">Hour QTY(kg)
</th>
<th style="text-align:center !important;">Customer Name</th>
<th style="text-align:center !important;">Action</th>
@ -231,9 +232,9 @@
<div class="form-group col-md-3">
<label for="machineOnTimeHrId">Machine On Time</label>
<span class="badge mandatory">*</span>
<select class="form-control" name="machineOnTime" id="machineOnTimeHrId">
<select class="form-control" name="machineOnTime" id="machineOnTimeHrId" required>
<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
@ -248,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);
@ -272,7 +273,7 @@
<div class="form-group col-md-3">
<label for="machineOffTimeHrId">Machine Off Time</label>
<span class="badge mandatory">*</span>
<select class="form-control" name="machineOffTime" id="machineOffTimeHrId">
<select class="form-control" name="machineOffTime" id="machineOffTimeHrId" required>
<option value="">Select Time</option>
<option value="12:00 AM" > 12:00 AM</option>
<option value="12:30 AM"> 12:30 AM</option>
@ -292,7 +293,7 @@
<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);
echo '<option value="' . $formattedHour . ':00 PM"> ' . $formattedHour . ':00 PM</option>';
@ -412,10 +413,10 @@
<div class="form-group col-md-3">
<label for="editMachineOnTimeHrId">Machine On Time</label>
<span class="badge mandatory">*</span>
<select class="form-control" name="machineOnTime" id="editMachineOnTimeHrId">
<select class="form-control" name="machineOnTime" id="editMachineOnTimeHrId" required>
<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++) {
@ -429,11 +430,11 @@
}
?>
<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);
@ -450,13 +451,13 @@
<div class="form-group col-md-3">
<label for="editMachineOffTimeHrId">Machine Off Time</label>
<span class="badge mandatory">*</span>
<select class="form-control" name="machineOffTime" id="editMachineOffTimeHrId">
<select class="form-control" name="machineOffTime" id="editMachineOffTimeHrId" required>
<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++) {
for ($hour = 1; $hour <= 12; $hour++) {
// Display each hour with ":00"
$formattedHour = str_pad($hour, 2, '0', STR_PAD_LEFT);
@ -466,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++) {
@ -569,7 +570,7 @@
var table = $('#datatable').DataTable({
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
buttons: [
'csv', 'excel', 'pdf' // Export buttons
'csv', 'excel', 'pdf', // Export buttons
],
pageLength: 10, // Default rows per page
lengthMenu: [[10, 20, 30, 50, -1], [10, 20, 30, 50, "All"]], // Rows per page options
@ -669,23 +670,20 @@
$(document).ready(function () {
$('#machineOnTimeHrId').change(function () {
$('#machineOnTimeHrId , #dateId').change(function () {
let machineOnDate = $('#dateId').val();
if (machineOnDate == '') {
alert('Please Select Date before entering Machine On and Off Time ..!!');
$('#machineOnTimeHrId').val('');
$('#machineOnTimeHrId').val("");
return false;
}
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 machineOnTimeHr = $('#machineOnTimeHrId').val();
let machineOffTimeHr = $('#machineOffTimeHrId').val();
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOnTimeAmOrPm, machineOffTimeHr, machineOffTimeAmOrPm);
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr );
if (!machineRunningInHrs) {
$('machineOnTimeHrId').val('');
@ -700,7 +698,7 @@
});
$('#machineOffTimeHrId').change(function () {
$('#machineOffTimeHrId , #dateId').change(function () {
let machineOnDate = $('#dateId').val();
@ -710,13 +708,12 @@
return false;
}
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 machineOffTimeHr = $('#machineOffTimeHrId').val();
let machineOnTimeHr = $('#machineOnTimeHrId').val();
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOnTimeAmOrPm, machineOffTimeHr, machineOffTimeAmOrPm);
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr);
if (!machineRunningInHrs) {
@ -766,7 +763,7 @@
$(document).ready(function () {
$('#editMachineOnTimeHrId').change(function () {
$('#editMachineOnTimeHrId , #editDateId').change(function () {
let machineOnDate = $('#editDateId').val();
@ -776,12 +773,10 @@
return false;
}
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 machineOnTimeHr = $('#editMachineOnTimeHrId').val();
let machineOffTimeHr = $('#editMachineOffTimeHrId').val();
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOnTimeAmOrPm, machineOffTimeHr, machineOffTimeAmOrPm);
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr);
if (!machineRunningInHrs) {
$('#editMachineOnTimeHrId').val('');
@ -796,7 +791,7 @@
});
$('#editMachineOffTimeHrId').change(function () {
$('#editMachineOffTimeHrId , #editDateId').change(function () {
let machineOnDate = $('#editDateId').val();
@ -807,12 +802,10 @@
}
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 machineOnTimeHr = $('#editMachineOnTimeHrId').val();
let machineOffTimeHr = $('#editMachineOffTimeHrId').val();
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOnTimeAmOrPm, machineOffTimeHr, machineOffTimeAmOrPm);
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr);
if (!machineRunningInHrs) {
@ -859,75 +852,63 @@
<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(`${machineOnDate}T${machineOnTime24}`);
const endDate = new Date(`${machineOnDate}T${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}:00`;
}
// Increment the date by 1 day
date.setDate(date.getDate() + 1);
// Output the updated date
return date.toISOString().split('T')[0];
</script>
}
<script>
$('#monthpicker').datepicker({
format: 'M-yyyy',
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom'
})
</script>

View File

@ -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-info-line align-middle mr-1"></i>incoming silica sand Details</a>
</div>
</div>
</li>

View File

@ -0,0 +1,615 @@
<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 "$month" ?>" 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 ($igrDetails as $record) {
$row++;
$index++; ?>
<tr id="<?php echo $row; ?>">
<!-- 'td:eq(0)' -->
<td width="45" height="45" class="celda_normal"><?php echo $index; ?></td>
<!-- 'td:eq(1)' -->
<td class="celda_normal">
<?php echo $record['IGRNO']??''; ?>
</td>
<!-- 'td:eq(2)' -->
<td class="celda_normal" contenteditable="true">
<?php echo $record['invoiceNo']??''; ?>
</td>
<!-- 'td:eq(3)' -->
<td class="celda_normal" contenteditable="true" >
<?php
$dateString = $record['invoiceDate'];
$date = new DateTime($dateString);
$record['invoiceDate'] = $date->format('d-m-Y');
?>
<?php echo $record['invoiceDate']??''; ?>
</td>
<!-- 'td:eq(4)' -->
<td class="celda_normal" contenteditable="true" >
<?php
$dateString = $record['materialRecievedDate'];
$date = new DateTime($dateString);
$record['materialRecievedDate'] = $date->format('d-m-Y');
?>
<?php echo $record['materialRecievedDate']??''; ?>
</td>
<!-- 'td:eq(5)' -->
<td class="celda_normal">
<?php echo $record['SupplierName']??''; ?>
</td>
<!-- 'td:eq(6)' -->
<td class="celda_normal" contenteditable="true" >
<?php echo $record['grade']??''; ?>
</td>
<!-- 'td:eq(7)' -->
<td class="celda_normal" contenteditable="true" >
<?php echo $record['gradeCondition']??''; ?>
</td>
<!-- 'td:eq(8)' -->
<td class="celda_normal" contenteditable="true" >
<?php echo $record['VehicleNo']??''; ?>
</td>
<!-- calculateRow() for every td change below -->
<!-- 'td:eq(9)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['Qty']??'0'; ?>
</td>
<!-- 'td:eq(10)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);" >
<?php echo $record['_10']??'0.00'; ?>
</td>
<!-- 'td:eq(11)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['_20']??'0.00'; ?>
</td>
<!-- 'td:eq(12)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['_30']??'0.00'; ?>
</td>
<!-- 'td:eq(13)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['_40']??'0.00'; ?>
</td>
<!-- 'td:eq(14)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['_50']??'0.00'; ?>
</td>
<!-- 'td:eq(15)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['_70']??'0.00'; ?>
</td>
<!-- 'td:eq(16)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['_100']??'0.00'; ?>
</td>
<!-- 'td:eq(17)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['_140']??'0.00'; ?>
</td>
<!-- 'td:eq(18)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['_200']??'0.00'; ?>
</td>
<!-- 'td:eq(19)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['_300']??'0.00'; ?>
</td>
<!-- 'td:eq(20)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['pan']??'0.00'; ?>
</td>
<!-- 'td:eq(21)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['total']??'0.00'; ?>
</td>
<!-- 'td:eq(22)' -->
<td class="celda_normal" contenteditable="true">
<?php echo $record['afsSpec']??'0.00'; ?>
</td>
<!-- 'td:eq(23)' -->
<td class="celda_normal" contenteditable="true">
<?php echo $record['afsActual']??'0.00'; ?>
</td>
<!-- 'td:eq(24)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['plus20Loss']??'0.00'; ?>
</td>
<!-- 'td:eq(25)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['plus30Loss']??'0.00'; ?>
</td>
<!-- 'td:eq(26)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['moistureSpec']??'0.00'; ?>
</td>
<!-- 'td:eq(27)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['moistureActual']??'0.00'; ?>
</td>
<!-- 'td:eq(28)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['moistureLoss']??'0.00'; ?>
</td>
<!-- 'td:eq(29)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['moistureLossQty']??'0.00'; ?>
</td>
<!-- 'td:eq(30)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['sieveLossQty']??'0.00'; ?>
</td>
<!-- 'td:eq(31)' -->
<td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['salableQty']??'0.00'; ?>
</td>
<!-- 'td:eq(32)' -->
<td class="celda_normal" contenteditable="true">
<?php echo $record['Remarks']??''; ?>
</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()
{
$('#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);
}
}
});
});
});
</script>
<script>
function calculateRow(rowId){
var tr=$(`#`+rowId);
var qty=tr.find('td:eq(9)').text();
var _10 = tr.find('td:eq(10)').text();
var _20 = tr.find('td:eq(11)').text();
var _30 = tr.find('td:eq(12)').text();
var _40 = tr.find('td:eq(13)').text();
var _50 = tr.find('td:eq(14)').text();
var _70 = tr.find('td:eq(15)').text();
var _100 = tr.find('td:eq(16)').text();
var _140 = tr.find('td:eq(17)').text();
var _200 = tr.find('td:eq(18)').text();
var _300 = tr.find('td:eq(19)').text();
var pan = tr.find('td:eq(20)').text();
var total = tr.find('td:eq(21)').text();
var afsSpec = tr.find('td:eq(22)').text();
var afsActual = tr.find('td:eq(23)').text();
var plus20Loss = tr.find('td:eq(24)').text();
var plus30Loss = tr.find('td:eq(25)').text();
var moistureSpec = tr.find('td:eq(26)').text();
var moistureActual = tr.find('td:eq(27)').text();
var moistureLoss = tr.find('td:eq(28)').text();
var moistureLossQty = tr.find('td:eq(29)').text();
var sieveLossQty = tr.find('td:eq(30)').text();
var salableQty = tr.find('td:eq(31)').text();
let newTotal =parseFloat(_10) +parseFloat(_20) +parseFloat(_30) +parseFloat(_40) +parseFloat(_50) +parseFloat(_70) +parseFloat(_100) +
parseFloat(_140) +parseFloat(_200) +parseFloat(_300) +parseFloat(pan);
//total td
tr.find('td:eq(21)').text(newTotal);
let newPlus20Loss = parseFloat(_10) +parseFloat(_20) ;
//plus20Loss td
tr.find('td:eq(24)').text(newPlus20Loss);
let newPlus30Loss = parseFloat(_10) +parseFloat(_20) + parseFloat(_30) ;
//plus30Loss td
tr.find('td:eq(25)').text(newPlus30Loss);
let newMoistureLoss = parseFloat(moistureActual) - parseFloat(moistureSpec) ;
//moistureLoss td
tr.find('td:eq(28)').text(newMoistureLoss);
let newMoistureLossQty = Math.round((parseFloat(qty) * newMoistureLoss) / 100 ) ;
//moistureLossqty td
tr.find('td:eq(29)').text(newMoistureLossQty.toLocaleString());
let newSieveLossQty = Math.floor((parseFloat(qty) * newPlus30Loss) / 100) ;
//sieveLossQty td
tr.find('td:eq(30)').text(newSieveLossQty.toLocaleString());
let newSalableQty = Math.floor(parseFloat(qty) - newMoistureLossQty - newSieveLossQty) ;
//salableQty td
tr.find('td:eq(31)').text(newSalableQty.toLocaleString());
}
</script>