changes in bag stock module - vadivel J
This commit is contained in:
parent
439909fda0
commit
4a28f03d1a
@ -28,6 +28,7 @@ class StockController extends BaseController
|
||||
protected $inwardGateRegister_model;
|
||||
protected $rawmaterialdetails_model;
|
||||
protected $bagStockDetails_model;
|
||||
protected $Rawmaterialdetails_model;
|
||||
|
||||
/**
|
||||
* This is default constructor of the class
|
||||
@ -45,6 +46,7 @@ class StockController extends BaseController
|
||||
$this->incomingSilicaSandDetails_model = new IncomingSilicaSandDetailsModel();
|
||||
$this->inwardGateRegister_model = new Inwardgateregister_model();
|
||||
$this->bagStockDetails_model = new BagStockDetailsModel();
|
||||
|
||||
|
||||
$this->session = session();
|
||||
helper('form');
|
||||
@ -285,7 +287,7 @@ class StockController extends BaseController
|
||||
->where('date >=', $startDate)
|
||||
->where('date <=', $endDate)
|
||||
->groupBy(['materialCode','date'])
|
||||
->orderBy('date','asc')
|
||||
->orderBy('date','asc')
|
||||
->orderBy('materialCode','asc')
|
||||
->findAll();
|
||||
|
||||
@ -311,18 +313,35 @@ class StockController extends BaseController
|
||||
// Reset the structure to have indexed arrays without the date keys
|
||||
$data['groupedBagStockDetails'] = array_values($groupedByDate);
|
||||
|
||||
$data['distinctMaterialCodes'] = $this->bagStockDetails_model
|
||||
->distinct()
|
||||
->select('materialCode')
|
||||
->findAll();
|
||||
|
||||
$date = DateTime::createFromFormat('Y-m', $month);
|
||||
|
||||
$formattedDate = $date->format('M-Y');
|
||||
$bagMaterials= $this->rawmaterialdetails_model->getAllBagMaterialCode();
|
||||
|
||||
$data['month']=$formattedDate;
|
||||
|
||||
|
||||
foreach($bagMaterials as $key => $bagMaterial){
|
||||
$materialCode = $bagMaterial['MaterialCode'];
|
||||
$bagMaterials[$key]['customers'] = $this->bagStockDetails_model
|
||||
->select('customer')
|
||||
->where('date >=', $startDate)
|
||||
->where('date <=', $endDate)
|
||||
->where('materialCode', $materialCode)
|
||||
->first()['customer'] ?? '';
|
||||
}
|
||||
|
||||
$bagMaterialcount = count($bagMaterials);
|
||||
|
||||
$data['bagMaterialcount'] = $bagMaterialcount;
|
||||
$data['bagMaterials'] = $bagMaterials;
|
||||
|
||||
$date = DateTime::createFromFormat('Y-m', $month);
|
||||
|
||||
$formattedDate = $date->format('M-Y');
|
||||
|
||||
$data['month']=$formattedDate;
|
||||
|
||||
return $this->loadViews("bagStockDetails", $this->global, $data, NULL);
|
||||
|
||||
return $this->loadViews("bagStockDetails", $this->global, $data, NULL);
|
||||
}
|
||||
|
||||
public function updateBagStockDetails(){
|
||||
|
||||
@ -136,6 +136,20 @@ class Rawmaterialdetails_model extends Model
|
||||
return $materialCodes = array_column($materialResults, 'MaterialCode');
|
||||
}
|
||||
|
||||
function getAllBagMaterialCode(){
|
||||
|
||||
$builder = $this->db->table('t_materialmaster')
|
||||
->select('MaterialCode , MaterialName')
|
||||
->where('IsActive', 1)
|
||||
->where('Category', 'bag')
|
||||
->orderBy('MaterialCode', 'asc');
|
||||
$query = $builder->get();
|
||||
$materialResults = $query->getResultArray();
|
||||
|
||||
return $materialResults;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getMaterialstock($MaterialCode, $currentdate)
|
||||
|
||||
|
||||
@ -105,9 +105,10 @@
|
||||
border: 1px solid #ccc;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
padding: 2px 4px;
|
||||
padding: 6px 10px;;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
._Separador {
|
||||
background-color: #fff;
|
||||
@ -124,6 +125,7 @@
|
||||
.celda_normal {
|
||||
/*background-color: #fff;*/
|
||||
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||
text-align: center;
|
||||
border: 1px solid #ccc;
|
||||
padding: 2px 4px;
|
||||
}
|
||||
@ -216,19 +218,24 @@
|
||||
|
||||
<th class="celda_encabezado_general" colspan="1">material </th>
|
||||
|
||||
<?php foreach($distinctMaterialCodes as $index => $distinctMaterialCode){ ?>
|
||||
|
||||
|
||||
<?php foreach($bagMaterials as $bagMaterial){ ?>
|
||||
<!-- this will loop till materials present -->
|
||||
<th class="celda_encabezado_general" colspan="4">material<?php echo $index?></th>
|
||||
<th class="celda_encabezado_general" colspan="4">
|
||||
<?= $bagMaterial['MaterialName']?>
|
||||
<!-- (<?= $bagMaterial['MaterialCode']?>) -->
|
||||
</th>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th class="celda_encabezado_general" colspan="1">Customer </th>
|
||||
|
||||
<?php foreach($distinctMaterialCodes as $index => $distinctMaterialCode){ ?>
|
||||
<?php foreach($bagMaterials as $bagMaterial){ ?>
|
||||
<!-- this will loop till materials present -->
|
||||
<th class="celda_encabezado_general" colspan="4" contenteditable="true">
|
||||
<?php echo $customer??"customer$index" ?>
|
||||
<?= $bagMaterial['customers']?>
|
||||
</th>
|
||||
|
||||
</th>
|
||||
@ -236,11 +243,10 @@
|
||||
<?php } ?>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<tr>
|
||||
<th class="celda_encabezado_general" colspan="1">Date </th>
|
||||
|
||||
<?php foreach($distinctMaterialCodes as $index => $distinctMaterialCode){ ?>
|
||||
<?php foreach($bagMaterials as $bagMaterial){ ?>
|
||||
<!-- this will loop till materials present -->
|
||||
<th class="celda_encabezado_general" style="display:none">Date</th>
|
||||
<th class="celda_encabezado_general" style="display:none"> material</th>
|
||||
@ -266,7 +272,7 @@
|
||||
<tr>
|
||||
|
||||
<?php foreach($bagStockDetails as $bagStockIndex => $bagStock){ ?>
|
||||
<?php if ($bagStockIndex === 0): ?>
|
||||
<?php if ($bagStockIndex == 0): ?>
|
||||
<td class="celda_normal">
|
||||
<?= $bagStock['date'] ?>
|
||||
</td>
|
||||
@ -285,7 +291,10 @@
|
||||
<td class="celda_normal openingStock"
|
||||
data-id="<?=$bagStock['date']?> <?=$bagStock['materialCode']?>"
|
||||
oninput="openingStockChange(this)"
|
||||
contenteditable="true"><?= $bagStock['opening']?>
|
||||
<?php if ($groupedBagStockDetailsIndex == 0): ?>
|
||||
contenteditable="true"
|
||||
<?php endif; ?>
|
||||
><?= $bagStock['opening']?>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal receiptStock"
|
||||
@ -309,7 +318,55 @@
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php } ?>
|
||||
<?php } else{?>
|
||||
|
||||
<?php
|
||||
|
||||
$date = DateTime::createFromFormat('M-Y', $month);
|
||||
$month = $date->format('m-Y');
|
||||
$startDate = "01-$month";
|
||||
|
||||
?>
|
||||
<th class="celda_normal" colspan="1"><?= $startDate?> </th>
|
||||
|
||||
<?php foreach($bagMaterials as $bagMaterial){ ?>
|
||||
<!-- this will loop till materials present -->
|
||||
|
||||
<td class="celda_normal" style="display:none">
|
||||
<?= $startDate?>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal" style="display:none"
|
||||
data-id="<?=$startDate?> <?=$bagMaterial['MaterialCode']?>">
|
||||
<?= $bagMaterial['MaterialCode']?>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal" style="display:none">
|
||||
<?= $bagMaterial['customers']?>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal openingStock"
|
||||
data-id="<?=$startDate?> <?=$bagMaterial['MaterialCode']?>"
|
||||
oninput="openingStockChange(this)"
|
||||
contenteditable="true">0</td>
|
||||
|
||||
<td class="celda_normal receiptStock"
|
||||
data-id="<?=$startDate?> <?=$bagMaterial['MaterialCode']?>"
|
||||
oninput="openingStockChange(this)"
|
||||
contenteditable="true">0</td>>0</td>
|
||||
|
||||
<td class="celda_normal usedStock"
|
||||
data-id="<?=$startDate?> <?=$bagMaterial['MaterialCode']?>"
|
||||
oninput="usedStockChange(this)"
|
||||
contenteditable="true">0</td>
|
||||
|
||||
<td class="celda_normal balanceStock"
|
||||
data-id="<?=$startDate?> <?=$bagMaterial['MaterialCode']?>"
|
||||
oninput="usedStockChange(this)"
|
||||
contenteditable="true">0</td>
|
||||
<?php } ?>
|
||||
<?php }?>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user