incoming silica sand details 70% comp

This commit is contained in:
vadivel J 2024-10-21 17:52:38 +05:30
parent 3edca946c4
commit 13b851d4be
6 changed files with 180 additions and 56 deletions

View File

@ -5,6 +5,9 @@ namespace App\Controllers;
use App\Controllers\BaseController;
use App\Models\CoatingMachineDetailsModel;
use App\Models\DrierMachineDetailsModel;
use App\Models\IncomingSilicaSandDetailsModel;
use App\Models\Inwardgateregister_model;
use App\Models\Rawmaterialdetails_model;
use CodeIgniter\HTTP\ResponseInterface;
use DateTime;
@ -13,7 +16,10 @@ class StockController extends BaseController
protected $coatingMachineDetails_model;
protected $drierMachineDetails_model;
protected $session;
protected $incomingSilicaSandDetails_model;
protected $inwardGateRegister_model;
protected $rawmaterialdetails_model;
protected $session;
/**
* This is default constructor of the class
@ -23,6 +29,9 @@ class StockController extends BaseController
parent::__construct();
$this->coatingMachineDetails_model = new CoatingMachineDetailsModel();
$this->drierMachineDetails_model = new DrierMachineDetailsModel();
$this->rawmaterialdetails_model = new Rawmaterialdetails_model();
$this->incomingSilicaSandDetails_model = new IncomingSilicaSandDetailsModel();
$this->inwardGateRegister_model = new Inwardgateregister_model();
$this->session = session();
helper('form');
@ -48,7 +57,6 @@ class StockController extends BaseController
}
else{
$month = date('Y-m');
// dd($month);
}
$this->global['pageTitle'] = 'Coating Machine Details ';
@ -127,6 +135,24 @@ 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)) { // Proceed if there are matching MaterialCodes
$data['igrDetails'] = $this->inwardGateRegister_model->findIgrForSilicaSand($materialCodes,$month);
} else {
$data['igrDetails'] = []; // If no materials found, return an empty array
}
//$data['incomingSilicaSandDetails']=$this->incomingSilicaSandDetails_model->
return $this->loadViews("incomingSilicaSandDetails", $this->global, $data, NULL);
}
public function updateIncomingSilicaSandDetails(){

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.MaterialCode,
igrMast.DeliveryChellanOrInvoiceNo as invoiceNo,
igrMast.DeliveryChellanDate as invoiceDate,
igrMast.MaterialRcvdDate as materialRecievedDate,
supplierDetails.SupplierName,
igrMast.VehicleNo,
t_igr_details.Remarks,
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

@ -767,8 +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>
<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

@ -1,8 +1,4 @@
<?php
$datefordropdown = format_date($datefordropdown, 0, 'M-Y');
?>
<style type="text/css">
.num {
text-align: right;
@ -201,7 +197,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 "$month" ?>" class="form-control" data-provide="datepicker" data-date-format="M-yyyy" data-date-min-view-mode="1">
</div>
<div class="col-3">
@ -210,7 +206,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
</div>
</form>
<!-- Add table-responsive for horizontal scroll -->
<div class="table-responsive">
@ -218,8 +214,8 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<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;">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>
@ -228,16 +224,16 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<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;">___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>
@ -261,61 +257,119 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<?php $index = 0;
$row = 0;
foreach ($data as $a) {
foreach ($igrDetails as $record) {
$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']; ?>
<?php echo $record['IGRNO']??''; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $a['supplier_name']; ?>
<?php echo $record['invoiceNo']??''; ?>
</td>
<td class="celda_normal" contenteditable="true" >
<?php echo $a['input_sand_moisture']; ?>
<?php
$dateString = $record['invoiceDate'];
$date = new DateTime($dateString);
$record['invoiceDate'] = $date->format('d-m-Y');
?>
<?php echo $record['invoiceDate']??''; ?>
</td>
<td class="celda_normal" onkeyup="gasPerTon(this.parentNode.id,this.textContent);" contenteditable="true" >
<?php echo $a['total_gas_consumption']; ?>
<?php
$dateString = $record['materialRecievedDate'];
$date = new DateTime($dateString);
$record['materialRecievedDate'] = $date->format('d-m-Y');
?>
<?php echo $record['materialRecievedDate']??''; ?>
</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']; ?>
<?php echo $record['SupplierName']??''; ?>
</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']; ?>
<?php echo $record['grade']??''; ?>
</td>
<td class="celda_normal" >
<?php echo $a['qty_per_hours']; ?>
<?php echo $record['gradeCondition']??''; ?>
</td>
<td class="celda_normal" onkeyup="moistureLossQty(this.parentNode.id,this.textContent);" contenteditable="true" >
<?php echo $record['VehicleNo']??''; ?>
</td>
<td class="celda_normal" >
<?php echo $record['Qty']??'0'; ?>
</td>
<td class="celda_normal" contenteditable="true" >
<?php echo $a['dust_qty']; ?>
<?php echo $record['_10']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $a['customer_name']; ?>
<?php echo $record['_20']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['_30']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['_40']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['_50']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['_70']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['_100']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['_140']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['_200']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['_300']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['pan']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['total']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['afsSpec']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['afsActual']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['plus20Loss']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['plus30Loss']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['moistureSpec']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['moistureSpec']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['moistureActual']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['moistureLoss']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['moistureLossQty']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['salableQty']??'0.00'; ?>
</td>
<td class="celda_normal" contenteditable="true">
<?php echo $record['Remarks']??''; ?>
</td>
</tr>