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
|
||||
$routes->match(['GET','POST'],'incomingSilicaSandDetails', 'StockController::loadView_incomingSilicaSandDetails');
|
||||
$routes->post('updateIncomingSilicaSandDetails', 'StockController::updateIncomingSilicaSandDetails');
|
||||
$routes->get('deleteIncomingSilicaSandDetails', 'StockController::deleteIncomingSilicaSandDetails');
|
||||
|
||||
|
||||
@ -143,7 +143,7 @@ class StockController extends BaseController
|
||||
$materialCodes = $this->rawmaterialdetails_model->getAllSilicaRawMaterialCode();
|
||||
|
||||
if (!empty($materialCodes)) {
|
||||
$data['igrDetails'] = $this->inwardGateRegister_model->findIgrForSilicaSand($materialCodes,$month);
|
||||
$data['igrDetails'] = $this->inwardGateRegister_model->findIgrDetailsForIncomingSilicaSand($materialCodes,$month);
|
||||
|
||||
} else {
|
||||
$data['igrDetails'] = [];
|
||||
@ -155,11 +155,72 @@ class StockController extends BaseController
|
||||
|
||||
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";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -12,14 +12,14 @@ class IncomingSilicaSandDetailsModel extends Model
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
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',
|
||||
'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 bool $allowEmptyInserts = true;
|
||||
protected bool $updateOnlyChanged = false;
|
||||
|
||||
protected array $casts = [];
|
||||
protected array $castHandlers = [];
|
||||
|
||||
@ -1031,7 +1031,7 @@ class Inwardgateregister_model extends Model
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function findIgrForSilicaSand($materialCodes, $month)
|
||||
public function findIgrDetailsForIncomingSilicaSand($materialCodes, $month)
|
||||
{
|
||||
$builder = $this->db->table('t_igr_details')
|
||||
->select(
|
||||
@ -1043,7 +1043,7 @@ class Inwardgateregister_model extends Model
|
||||
igrMast.MaterialRcvdDate as materialRecievedDate,
|
||||
igrMast.VehicleNo,
|
||||
supplierDetails.SupplierName,
|
||||
SUM(t_igr_details.QuantityAsPerInvoice) as Qty,
|
||||
t_igr_details.QuantityAsPerInvoice as Qty,
|
||||
issd.* ')
|
||||
->whereIn('t_igr_details.MaterialCode', $materialCodes)
|
||||
->like('t_igr_details.CreatedDate', $month, 'after')
|
||||
|
||||
@ -210,7 +210,7 @@
|
||||
|
||||
<!-- Add table-responsive for horizontal scroll -->
|
||||
<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>
|
||||
<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;">Salable Qty </th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Remark</th>
|
||||
<th class="celda_encabezado_general" style="display:none;">MaterialCode</th>
|
||||
|
||||
|
||||
|
||||
@ -459,6 +460,11 @@
|
||||
<td class="celda_normal" contenteditable="true">
|
||||
<?php echo $record['Remarks']??''; ?>
|
||||
</td>
|
||||
|
||||
<!-- 'td:eq(33)' -->
|
||||
<td style="display: none;">
|
||||
<?php echo $record['MaterialCode'] ?? ''; ?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php } ?>
|
||||
@ -503,33 +509,22 @@
|
||||
|
||||
$('#save').click(function() {
|
||||
|
||||
var alldata = $("#drierTable").tableToJSON();
|
||||
var incomingSilicaSandDetailsData = $("#incomingSilicaSandDetailsTable").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);
|
||||
incomingSilicaSandDetailsData = JSON.stringify(incomingSilicaSandDetailsData);
|
||||
|
||||
$('#loader').show();
|
||||
$.ajax({
|
||||
data: {
|
||||
drierData: alldata,
|
||||
incomingSilicaSandDetailsData
|
||||
},
|
||||
type: "POST",
|
||||
url: "<?php echo base_url() ?>addOrEditdrierMachineDetails",
|
||||
url: "<?php echo base_url() ?>updateIncomingSilicaSandDetails",
|
||||
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
|
||||
$('#loader').hide();
|
||||
|
||||
alert(data);
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user