stock module changes -vadivel J
This commit is contained in:
parent
084803c4b4
commit
090f91ebf3
@ -434,4 +434,4 @@ $routes->match(['GET', 'POST', 'PUT', 'DELETE'],'addOrEditdrierMachineDetails',
|
|||||||
//incomingSilicaSandDetaails
|
//incomingSilicaSandDetaails
|
||||||
$routes->match(['GET','POST'],'incomingSilicaSandDetails', 'StockController::loadView_incomingSilicaSandDetails');
|
$routes->match(['GET','POST'],'incomingSilicaSandDetails', 'StockController::loadView_incomingSilicaSandDetails');
|
||||||
$routes->post('updateIncomingSilicaSandDetails', 'StockController::updateIncomingSilicaSandDetails');
|
$routes->post('updateIncomingSilicaSandDetails', 'StockController::updateIncomingSilicaSandDetails');
|
||||||
$routes->get('deleteIncomingSilicaSandDetails', 'StockController::deleteIncomingSilicaSandDetails');
|
|
||||||
|
|||||||
@ -143,7 +143,7 @@ class StockController extends BaseController
|
|||||||
$materialCodes = $this->rawmaterialdetails_model->getAllSilicaRawMaterialCode();
|
$materialCodes = $this->rawmaterialdetails_model->getAllSilicaRawMaterialCode();
|
||||||
|
|
||||||
if (!empty($materialCodes)) {
|
if (!empty($materialCodes)) {
|
||||||
$data['igrDetails'] = $this->inwardGateRegister_model->findIgrForSilicaSand($materialCodes,$month);
|
$data['igrDetails'] = $this->inwardGateRegister_model->findIgrDetailsForIncomingSilicaSand($materialCodes,$month);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$data['igrDetails'] = [];
|
$data['igrDetails'] = [];
|
||||||
@ -155,9 +155,68 @@ class StockController extends BaseController
|
|||||||
|
|
||||||
public function updateIncomingSilicaSandDetails(){
|
public function updateIncomingSilicaSandDetails(){
|
||||||
|
|
||||||
}
|
$postData = $this->request->getPost();
|
||||||
|
|
||||||
public function deleteIncomingSilicaSandDetails(){
|
$incomingSilicaSandDetailsData = json_decode($postData['incomingSilicaSandDetailsData'], true);
|
||||||
|
|
||||||
|
|
||||||
|
foreach($incomingSilicaSandDetailsData as $data){
|
||||||
|
|
||||||
|
$IGRNO=$data['IGR No'];
|
||||||
|
$materialCode=$data['MaterialCode'];
|
||||||
|
|
||||||
|
|
||||||
|
$dbData=[
|
||||||
|
'igrNo_fk'=>$data['IGR No'],
|
||||||
|
'materialCode'=>$data['MaterialCode'],
|
||||||
|
'grade'=>$data['Grade'],
|
||||||
|
'gradeCondition'=>$data['Grade Condition'],
|
||||||
|
'_10'=>$data['___10___'],
|
||||||
|
'_20'=>$data['___20___'],
|
||||||
|
'_30'=>$data['___30___'],
|
||||||
|
'_40'=>$data['___40___'],
|
||||||
|
'_50'=>$data['___50___'],
|
||||||
|
'_70'=>$data['___70___'],
|
||||||
|
'_100'=>$data['___100___'],
|
||||||
|
'_140'=>$data['___140___'],
|
||||||
|
'_200'=>$data['___200___'],
|
||||||
|
'_300'=>$data['___300___'],
|
||||||
|
'pan'=>$data['PAN'],
|
||||||
|
'total'=>$data['Total'],
|
||||||
|
'afsSpec'=>$data['AFS Spec'],
|
||||||
|
'afsActual'=>$data['AFS Actual'],
|
||||||
|
'plus20loss'=>$data['Plus 20 loss%'],
|
||||||
|
'plus30Loss'=>$data['Plus 30 Loss %'],
|
||||||
|
'moistureSpec'=>$data['Moisture % Spec'],
|
||||||
|
'moistureActual'=>$data['Moisture Actual'],
|
||||||
|
'moistureLoss'=>$data['Moisture Loss'],
|
||||||
|
'moistureLossQty'=>$data['Moisture loss Qty'],
|
||||||
|
'sieveLossQty'=>$data['Sieve Loss Qty'],
|
||||||
|
'salableQty'=>$data['Salable Qty'],
|
||||||
|
'remark'=>$data['Remark']
|
||||||
|
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
$resultExists=$this->incomingSilicaSandDetails_model
|
||||||
|
->where('igrNo_fk',$IGRNO)
|
||||||
|
->where('materialCode',$materialCode)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if($resultExists){
|
||||||
|
|
||||||
|
$this->incomingSilicaSandDetails_model
|
||||||
|
->where('igrNo_fk', $IGRNO)
|
||||||
|
->where('materialCode', $materialCode)
|
||||||
|
->update($dbData);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$this->incomingSilicaSandDetails_model->insert($dbData);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Data Saved Successfully";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,6 +237,8 @@ class StockController extends BaseController
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------gwm----------------------------------------------
|
// --------------------------------------------gwm----------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -12,14 +12,14 @@ class IncomingSilicaSandDetailsModel extends Model
|
|||||||
protected $returnType = 'array';
|
protected $returnType = 'array';
|
||||||
protected $useSoftDeletes = false;
|
protected $useSoftDeletes = false;
|
||||||
protected $protectFields = true;
|
protected $protectFields = true;
|
||||||
protected $allowedFields = ['igrNo_fk','grade','gradeCondition',
|
protected $allowedFields = ['igrNo_fk','materialCode','grade','gradeCondition',
|
||||||
'_10' ,'_20','_30','_40','_50','_70','_100', '_140','_200','_300',
|
'_10' ,'_20','_30','_40','_50','_70','_100', '_140','_200','_300',
|
||||||
'pan' , 'total' , 'afsSpec' ,'afsActual','plus20Loss','plus30Loss','moistureSpec','moistureActual',
|
'pan' , 'total' , 'afsSpec' ,'afsActual','plus20Loss','plus30Loss','moistureSpec','moistureActual',
|
||||||
'moistureLoss', 'moistureLossQty','sieveLossQty','salableQty', 'remark',
|
'moistureLoss', 'moistureLossQty','sieveLossQty','salableQty', 'remark',
|
||||||
'is_active','created_at','updated_at'];
|
'is_active','created_at','updated_at'];
|
||||||
|
|
||||||
protected bool $allowEmptyInserts = false;
|
protected bool $allowEmptyInserts = true;
|
||||||
protected bool $updateOnlyChanged = true;
|
protected bool $updateOnlyChanged = false;
|
||||||
|
|
||||||
protected array $casts = [];
|
protected array $casts = [];
|
||||||
protected array $castHandlers = [];
|
protected array $castHandlers = [];
|
||||||
|
|||||||
@ -1031,7 +1031,7 @@ class Inwardgateregister_model extends Model
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findIgrForSilicaSand($materialCodes, $month)
|
public function findIgrDetailsForIncomingSilicaSand($materialCodes, $month)
|
||||||
{
|
{
|
||||||
$builder = $this->db->table('t_igr_details')
|
$builder = $this->db->table('t_igr_details')
|
||||||
->select(
|
->select(
|
||||||
@ -1043,7 +1043,7 @@ class Inwardgateregister_model extends Model
|
|||||||
igrMast.MaterialRcvdDate as materialRecievedDate,
|
igrMast.MaterialRcvdDate as materialRecievedDate,
|
||||||
igrMast.VehicleNo,
|
igrMast.VehicleNo,
|
||||||
supplierDetails.SupplierName,
|
supplierDetails.SupplierName,
|
||||||
SUM(t_igr_details.QuantityAsPerInvoice) as Qty,
|
t_igr_details.QuantityAsPerInvoice as Qty,
|
||||||
issd.* ')
|
issd.* ')
|
||||||
->whereIn('t_igr_details.MaterialCode', $materialCodes)
|
->whereIn('t_igr_details.MaterialCode', $materialCodes)
|
||||||
->like('t_igr_details.CreatedDate', $month, 'after')
|
->like('t_igr_details.CreatedDate', $month, 'after')
|
||||||
|
|||||||
@ -210,7 +210,7 @@
|
|||||||
|
|
||||||
<!-- Add table-responsive for horizontal scroll -->
|
<!-- Add table-responsive for horizontal scroll -->
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table id="drierTable" class="fht-table table-striped" style="font-size: small;">
|
<table id="incomingSilicaSandDetailsTable" class="fht-table table-striped" style="font-size: small;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
@ -247,6 +247,7 @@
|
|||||||
<th class="celda_encabezado_general" style="padding: 10px;">Sieve 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;">Salable Qty </th>
|
||||||
<th class="celda_encabezado_general" style="padding: 10px;">Remark</th>
|
<th class="celda_encabezado_general" style="padding: 10px;">Remark</th>
|
||||||
|
<th class="celda_encabezado_general" style="display:none;">MaterialCode</th>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -460,6 +461,11 @@
|
|||||||
<?php echo $record['Remarks']??''; ?>
|
<?php echo $record['Remarks']??''; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
<!-- 'td:eq(33)' -->
|
||||||
|
<td style="display: none;">
|
||||||
|
<?php echo $record['MaterialCode'] ?? ''; ?>
|
||||||
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
@ -503,33 +509,22 @@
|
|||||||
|
|
||||||
$('#save').click(function() {
|
$('#save').click(function() {
|
||||||
|
|
||||||
var alldata = $("#drierTable").tableToJSON();
|
var incomingSilicaSandDetailsData = $("#incomingSilicaSandDetailsTable").tableToJSON();
|
||||||
|
|
||||||
$('#drierTable tbody tr').each(function (index) {
|
incomingSilicaSandDetailsData = JSON.stringify(incomingSilicaSandDetailsData);
|
||||||
|
|
||||||
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();
|
$('#loader').show();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: {
|
data: {
|
||||||
drierData: alldata,
|
incomingSilicaSandDetailsData
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "<?php echo base_url() ?>addOrEditdrierMachineDetails",
|
url: "<?php echo base_url() ?>updateIncomingSilicaSandDetails",
|
||||||
|
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
|
|
||||||
$('#loader').hide();
|
$('#loader').hide();
|
||||||
|
|
||||||
alert(data);
|
alert(data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user