stock module latest today vadivel J 13-1-2025

This commit is contained in:
vadivelJ96 2025-01-13 18:04:03 +05:30
parent 1fbe885b50
commit 9dc77bdae9
4 changed files with 164 additions and 49 deletions

View File

@ -21,6 +21,11 @@ use App\Models\TrpSandUseStockModel;
use App\Models\TrpProductionModel;
use App\Models\TrpProductionMaintenanceModel;
use App\Models\TrpProductionWasteModel;
use App\Models\Employeedetails_model;
use CodeIgniter\HTTP\ResponseInterface;
use DateTime;
use DatePeriod;
@ -56,6 +61,8 @@ class StockController extends BaseController
protected $db;
protected $employeedetails_model;
/**
* This is default constructor of the class
*/
@ -100,6 +107,8 @@ class StockController extends BaseController
$this->TrpProductionWaste_model = new TrpProductionWasteModel();
$this->employeedetails_model = new Employeedetails_model();
$this->session = session();
helper('form');
@ -343,6 +352,18 @@ class StockController extends BaseController
$data['igrDetails'] = [];
}
$data['testedBy'] = [];
$DesignationConfigID = 'C010';
$data['testedBy'] = $this->employeedetails_model->incomingSilicaSandTestedBy($DesignationConfigID);
$data['approvedBy'] = $this->employeedetails_model->incomingSilicaSandApprovedBy($DesignationConfigID);
// dd($data['testedBy']);
// dd($data['approvedBy']);
$date = DateTime::createFromFormat('Y-m', $month);
$formattedDate = $date->format('M-Y');
@ -454,6 +475,9 @@ class StockController extends BaseController
'moistureLossQty' => $postData['moistureLossQty'],
'sieveLossQty' => $postData['sieveLossQty'],
'salableQty' => $postData['salableQty'],
'testedBy' => $postData['testedBy'],
'approvedBy' => $postData['approvedBy'],
'clayOrLossOfIgnitionPercent' => $postData['clayOrLossOfIgnition'],
];
@ -466,7 +490,7 @@ class StockController extends BaseController
} else {
$updated = $this->incomingSilicaSandDetails_model
->insert($dbData);
}
}
if ($updated) {

View File

@ -52,6 +52,36 @@ class Employeedetails_model extends Model
return $query->getResult();
}
function incomingSilicaSandTestedBy($ConfigID){
$builder = $this->db->table('t_employee_details Emp')
->select(' Emp.*')
->whereIn('Designation', ['lab assistant', 'factory manager', 'lab head'])
->orderBy("Emp.EmpID", "asc");
$query = $builder->get();
$result = $query->getResult();
return $result;
}
function incomingSilicaSandApprovedBy($ConfigID){
$builder = $this->db->table('t_employee_details Emp')
->select(' Emp.*')
->whereIn('Designation', ['factory manager', 'lab head'])
->orderBy("Emp.EmpID", "asc");
$query = $builder->get();
$result = $query->getResult();
return $result;
}
/* */
/**
* This function is used to get the Department details from t_departmentdetails

View File

@ -1083,7 +1083,8 @@ class Inwardgateregister_model extends Model
igrMast.DeliveryChellanDate as invoiceDate,
igrMast.MaterialRcvdDate as materialRecievedDate,
igrMast.VehicleNo,
supplierDetails.SupplierName,
supplierDetails.SupplierName,
materialMaster.Category as sandType ,
t_igr_details.QuantityAsPerInvoice as Qty,
issd.*')
->whereIn('t_igr_details.MaterialCode', $materialCodes)
@ -1096,11 +1097,11 @@ class Inwardgateregister_model extends Model
$builder->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_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_purchaseorder_master poMaster', 'poMaster.PONO = igrMast.PONO', 'left')
->join('t_supplierdetailsn supplierDetails', 'supplierDetails.SupplierID = poMaster.SupplierID', 'left')
->orderBy('t_igr_details.CreatedDate', 'DESC');
->orderBy('t_igr_details.CreatedDate', 'asc ');
$query = $builder->get();
$result = $query->getResultArray();

View File

@ -290,9 +290,11 @@
<th class="celda_encabezado_general" style="padding: 10px;">Remark</th>
<th class="celda_encabezado_general" style="display:none;">MaterialCode</th>
<th class="celda_encabezado_general" style="display:none">id</th>
<th class="celda_encabezado_general" style="display:none">testedBy</th>
<th class="celda_encabezado_general" style="display:none">approvedBy</th>
<th class="celda_encabezado_general" style="display:none">clayOrLossOfIgnition</th>
</tr>
@ -348,17 +350,17 @@
</td>
<!-- 'td:eq(6)' -->
<td class="celda_normal" contenteditable="true" >
<?php echo $record['grade']??''; ?>
<td class="celda_normal" >
<?php echo $record['sandType']??''; ?>
</td>
<!-- 'td:eq(7)' -->
<td class="celda_normal" style="color:#02d0eb; background:white;" contenteditable="true">
<select class="status grade-condition select2" style="width:100px;">
<select class="status grade-condition select2" id="gradeCondition" style="width:100px;">
<option value="">Select</option>
<option value="wet"
<?php echo ($record['gradeCondition'] == 'wet') ? "selected":''; ?>
>Wet</option>
>Wet</option>
<option value="dry"
<?php echo ($record['gradeCondition'] == 'dry') ? "selected":''; ?>
>Dry</option>
@ -524,6 +526,22 @@
<td style="display: none;">
<?php echo $record['id'] ?? ''; ?>
</td>
<!-- 'td:eq(36)' -->
<td style="display: none;">
<?php echo $record['clayOrLossOfIgnition'] ?? ''; ?>
</td>
<!-- 'td:eq(37)' -->
<td style="display: none;">
<?php echo $record['testedBy'] ?? ''; ?>
</td>
<!-- 'td:eq(38)' -->
<td style="display: none;">
<?php echo $record['approvedBy'] ?? ''; ?>
</td>
</tr>
<?php } ?>
@ -610,54 +628,63 @@
</tr>
<tr>
<td style="text-align: left !important; width:25%;"><b>Invoice No</b></td>
<td id="dwnldInvoiceNoId">8946551665</td>
<td id="dwnldInvoiceNoId"> </td>
</tr>
<tr>
<td style="text-align: left !important; width:25%;"><b>Invoice Date</b></td>
<td id="dwnldInvoiceDateId">2/12/1996</td>
<td id="dwnldInvoiceDateId"> </td>
</tr>
<tr>
<td style="text-align: left !important; width:25%;"><b>Vehicle No</b></td>
<td id="dwnldVehicleNoId">Tn 25 bb 6919</td>
<td id="dwnldVehicleNoId"> </td>
</tr>
<tr>
<td style="text-align: left !important; width:25%;"><b>IGR No</b></td>
<td id="dwnldIgrNoId">25126919</td>
<td id="dwnldIgrNoId"> </td>
</tr>
<tr>
<td style="text-align: left !important; width:25%;"><b>Igr Date</b></td>
<td id="dwnldIgrDateId">10/12/2024</td>
<td id="dwnldIgrDateId"> </td>
</tr>
<tr>
<td style="text-align: left !important; width:25%;"><b>Quantity</b></td>
<td id="dwnldQtyId">69199</td>
<td id="dwnldQtyId"> </td>
</tr>
<tr>
<td style="text-align: left !important; width:25%;"><b>Time</b></td>
<td contenteditable="true"
id="dwnldTimeId"></td>
id="dwnldTimeId"> </td>
</tr>
<tr>
<td style="text-align: left !important; width:25%;"><b>Grade</b></td>
<td contenteditable="true"
id="dwnldGradeId">50-60</td>
id="dwnldGradeId"> </td>
</tr>
<tr>
<td style="text-align: left !important; width:25%;"><b>Clay %</b></td>
<tr id="dwnldClayRowId">
<td
style="text-align: left !important; width:25%;"><b>Clay %</b></td>
<td contenteditable="true"
id="dwnldClayId">20</td>
id="dwnldClayId">0</td>
</tr>
<tr id="dwnldLossOfIgnitionRowId">
<td
style="text-align: left !important; width:25%;"><b>Loss Of Ignition %</b></td>
<td contenteditable="true"
id="dwnldLossOfIgnitionId"></td>
</tr>
<tr>
<td style="text-align: left !important; width:25%;"><b>Moisture Actual %</b></td>
<td contenteditable="true" oninput="calculateRow(value='moistureValue')"
id="dwnldMoistureActualId">10</td>
id="dwnldMoistureActualId"> </td>
</tr>
<tr>
<td style="text-align: left !important; width:25%;"><b>Moisture Spec %</b></td>
<td contenteditable="true" oninput="calculateRow(value='moistureValue')"
id="dwnldMoistureSpecId">10</td>
id="dwnldMoistureSpecId"> </td>
</tr>
<tr>
@ -785,7 +812,7 @@
</tbody>
<tfoot>
<tr>&nbsp;
<td style="text-align: right;" colspan="3"><strong>&nbsp;TOTAL </strong></td>
<td style="text-align: right;" colspan="3"><strong>&nbsp; TOTAL </strong></td>
<td class="text-right" id="dwnldWeighOfSand"></td>
<td class="text-right" id="dwnldFtotalId" colspan="2"><b></b></td>
</tr>
@ -831,6 +858,12 @@
<select class="test-or-approve select2" name="testedBy" id="testedById">
<option value="0"> </option>
<?php foreach($testedBy as $each ){
?>
<option value="<?php echo $each->FirstName . $each->LastName; ?>">
<?php echo $each->FirstName . $each->LastName; ?>
</option>
<?php }?>
</select>
</th>
@ -838,7 +871,12 @@
style="text-align: center !important; ">
<select class="test-or-approve select2" name="approvedBy" id="approvedById">
<option value="0">Select</option>
<option value="0"> </option>
<?php foreach($approvedBy as $each ){ ?>
<option value="<?php echo $each->FirstName . $each->LastName; ?>" >
<?php echo $each->FirstName . $each->LastName; ?>
</option>
<?php }?>
</select>
</th>
@ -859,6 +897,7 @@
<input type="hidden" name="igrNo" id="igrNo" value="">
<input type="hidden" name="materialCode" id="materialCode" value="">
<input type="hidden" name="qty" id="qty" value="">
<input type="hidden" name="sandType" id="sandType" value="">
<input type="hidden" name="10Mm" id="10Mm" value="0.00">
<input type="hidden" name="20Mm" id="20Mm" value="0.00">
<input type="hidden" name="30Mm" id="30Mm" value="0.00">
@ -877,9 +916,11 @@
<input type="hidden" name="moistureLossQty" id="moistureLossQty" value="0.00">
<input type="hidden" name="plus20Loss" id="plus20Loss" value="">
<input type="hidden" name="plus30Loss" id="plus30Loss" value="">
<input type="hidden" name="sieveLossQty" id="sieveLossQty" value="">
<input type="hidden" name="sieveLossQty" id="sieveLossQty" value="">
<input type="hidden" name="salableQty" id="salableQty" value="">
<input type="hidden" name="testedBy" id="testedBy" value="">
<input type="hidden" name="approvedBy" id="approvedBy" value="">
<input type="hidden" name="clayOrLossOfIgnitionPercent" id="clayOrLossOfIgnitionPercent" value="">
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
@ -911,6 +952,10 @@
let invoiceDate = row.find('td:eq(3)').text().trim();
let igrDate = row.find('td:eq(4)').text().trim();
let supplierName = row.find('td:eq(5)').text().trim();
let sandType = row.find('td:eq(6)').text().trim();
// let sandWetOrDry = row.find('td:eq(7)').text().trim();
let vehicleNo = row.find('td:eq(8)').text().trim();
let qty = row.find('td:eq(9)').text().trim();
let _10Mm = row.find('td:eq(10)').text().trim();
@ -940,6 +985,15 @@
let remark = row.find('.sand-status').val();
let materialCode = row.find('td:eq(34)').text().trim();
let id = row.find('td:eq(35)').text().trim();
let testedBy = row.find('td:eq(36)').text().trim();
let approvedBy = row.find('td:eq(37)').text().trim();
let clayOrLossOfIgnition = row.find('td:eq(38)').text().trim();
console.log(sandType);
console.log(testedBy);
console.log(approvedBy);
console.log(clayOrLossOfIgnition);
// Fill the modal fields with the values
@ -952,6 +1006,21 @@
$('#dwnldVehicleNoId').text(vehicleNo);
$('#dwnldQtyId').text(qty);
if(sandType == "silicasand"){
$('#dwnldLossOfIgnitionRowId').hide();
$('#dwnldClayRowId').show();
$('#dwnldClayId').text(clayOrLossOfIgnition);
}else{ // waste core sand
$('#dwnldClayRowId').hide();
$('#dwnldLossOfIgnitionRowId').show();
$('#dwnldLossOfIgnitionId').text(clayOrLossOfIgnition);
}
let dwnld10MmFId = parseFloat(_10Mm * 5).toFixed(2);
$('#dwnld10MmId').text(_10Mm);
$('#dwnld10MmFId').text(dwnld10MmFId);
@ -1041,6 +1110,7 @@
$('#issdId').val(id);
$('#igrNo').val(igrNo);
$('#materialCode').val(materialCode);
$('#sandType').val(sandType);
$('#10Mm').val(_10Mm);
$('#20Mm').val(_20Mm);
$('#30Mm').val(_30Mm);
@ -1061,6 +1131,9 @@
$('#moistureLossQty').val(moistureLossQty);
$('#sieveLossQty').val(sieveLossQty);
$('#salableQty').val(salableQty);
$('#testedBy').val(testedBy);
$('#approvedBy').val(approvedBy);
$('#clayOrLossOfIgnitionPercent').val(clayOrLossOfIgnition);
// Show the modal
$('#downloadLabReportModel').modal('show');
@ -1098,17 +1171,6 @@
</script>
<script>
$(document).ready(function(){
$('#10Mm , #20Mm, #30Mm, #40Mm, #50Mm, #70Mm, #100Mm, #1400Mm, #200Mm, #300Mm , #pan , #moistureSpec ,#moistureActual').change(function(){
})
})
</script>
<!-- Save All Data in Incoming Silica Sand Details -->
<script type="text/javascript">
@ -1277,13 +1339,9 @@
<script>
$(document).ready(function() {
$('.sand-status' ).select2({
placeholder: "Select",
});
$('.grade-condition' ).select2({
placeholder: "Select",
});
$('.test-or-approve' ).select2({
placeholder: "Select",
});
@ -1328,12 +1386,14 @@ $(document).ready(function() {
sieveLossQty : $('#sieveLossQty').val(),
salableQty : $('#salableQty').val(),
remark : $('#dwnldAcceptedId').text(),
gradeCondition : $('#dwnldGradeId').text()
gradeCondition : $('#dwnldGradeId').text(),
testedBy : $('#testedById').val(),
approvedBy : $('#approvedById').val(),
clayOrLossOfIgnition : $('#sandType').val() == 'silica sand' ? $('#dwnldClayId').text(): $('#dwnldLossOfIgnitionId').text()
},
success: function(data){
alert("Data Saved Successfully..!!");
console.log(data);
window.location.reload();
alert("Data Saved Successfully..!!");
// window.location.reload();
},
error : function(xhr, status, error){
alert("An error occurred while processing the request. Please try again.");