bag stock details view completed -vadivel J
This commit is contained in:
parent
946d4706e2
commit
2a9204f6fd
@ -285,9 +285,37 @@ class StockController extends BaseController
|
|||||||
->where('date >=', $startDate)
|
->where('date >=', $startDate)
|
||||||
->where('date <=', $endDate)
|
->where('date <=', $endDate)
|
||||||
->groupBy(['materialCode','date'])
|
->groupBy(['materialCode','date'])
|
||||||
->orderBy('date','desc')
|
->orderBy('date','asc')
|
||||||
|
->orderBy('materialCode','asc')
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
|
// Initialize an empty array to hold the grouped data
|
||||||
|
$data['groupedBagStockDetails'] = [];
|
||||||
|
|
||||||
|
// Temporary array to store grouped data by date
|
||||||
|
$groupedByDate = [];
|
||||||
|
|
||||||
|
// Group by 'date'
|
||||||
|
foreach ($data['bagStockDetails'] as $detail) {
|
||||||
|
$date = $detail['date'];
|
||||||
|
|
||||||
|
// Initialize the array for this date if it doesn't exist
|
||||||
|
if (!isset($groupedByDate[$date])) {
|
||||||
|
$groupedByDate[$date] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append the detail to the sub-array for this date
|
||||||
|
$groupedByDate[$date][] = $detail;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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);
|
$date = DateTime::createFromFormat('Y-m', $month);
|
||||||
|
|
||||||
$formattedDate = $date->format('M-Y');
|
$formattedDate = $date->format('M-Y');
|
||||||
|
|||||||
@ -205,104 +205,84 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table id="bagStockDetailsTableId" class="fht-table table-striped"
|
<table id="bagStockDetailsTableId" class="fht-table table-striped">
|
||||||
style="font-size: small;">
|
|
||||||
|
|
||||||
<thead class="celda_encabezado_general" style="padding: 10px;">
|
<thead class="celda_encabezado_general" style="padding: 10px;">
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
<th colspan="1">material </th>
|
<th class="celda_encabezado_general" colspan="1">material </th>
|
||||||
|
|
||||||
<!-- this will loop till materials present -->
|
|
||||||
<th colspan="4">material 1</th>
|
|
||||||
|
|
||||||
<th colspan="4">material 2</th>
|
|
||||||
|
|
||||||
|
<?php foreach($distinctMaterialCodes as $index => $distinctMaterialCode){ ?>
|
||||||
|
<!-- this will loop till materials present -->
|
||||||
|
<th class="celda_encabezado_general" colspan="4">material<?php echo $index?></th>
|
||||||
|
<?php } ?>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="1">Customer </th>
|
<th class="celda_encabezado_general" colspan="1">Customer </th>
|
||||||
|
|
||||||
|
<?php foreach($distinctMaterialCodes as $index => $distinctMaterialCode){ ?>
|
||||||
<!-- this will loop till materials present -->
|
<!-- this will loop till materials present -->
|
||||||
<th colspan="4" contenteditable="true">
|
<th class="celda_encabezado_general" colspan="4" contenteditable="true">
|
||||||
<?php echo $customer??'Customer' ?>
|
<?php echo $customer??"customer$index" ?>
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
<th colspan="4" contenteditable="true">
|
|
||||||
<?php echo $customer??'Customer2' ?>
|
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
<th colspan="1">Date </th>
|
<th class="celda_encabezado_general" colspan="1">Date </th>
|
||||||
|
|
||||||
<!-- this will loop till materials present -->
|
|
||||||
<th style="display:none">Date</th>
|
|
||||||
<th style="display:none"> material</th>
|
|
||||||
<th style="display:none"> customer</th>
|
|
||||||
<th>Opening</th>
|
|
||||||
<th>Receipt</th>
|
|
||||||
<th>Used</th>
|
|
||||||
<th>Balance Stock</th>
|
|
||||||
|
|
||||||
<th style="display:none">Date</th>
|
|
||||||
<th style="display:none"> material</th>
|
|
||||||
<th style="display:none"> customer</th>
|
|
||||||
<th>Opening</th>
|
|
||||||
<th>Receipt</th>
|
|
||||||
<th>Used</th>
|
|
||||||
<th>Balance Stock</th>
|
|
||||||
|
|
||||||
|
<?php foreach($distinctMaterialCodes as $index => $distinctMaterialCode){ ?>
|
||||||
|
<!-- 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>
|
||||||
|
<th class="celda_encabezado_general" style="display:none"> customer</th>
|
||||||
|
<th class="celda_encabezado_general">Opening</th>
|
||||||
|
<th class="celda_encabezado_general">Receipt</th>
|
||||||
|
<th class="celda_encabezado_general">Used</th>
|
||||||
|
<th class="celda_encabezado_general">Balance Stock</th>
|
||||||
|
<?php } ?>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody style="background-color: #fff;" >
|
<tbody style="background-color: #fff;" >
|
||||||
|
|
||||||
|
<?php if(!empty($groupedBagStockDetails))
|
||||||
<tr>
|
{
|
||||||
<td class="celda_normal" >23-10-2024</td>
|
//dd($groupedBagStockDetails);
|
||||||
<td style="display:none">23-10-2024</td>
|
foreach($groupedBagStockDetails as $index => $bagStockDetails){
|
||||||
<td style="display:none"> material 1</td>
|
?>
|
||||||
<td style="display:none"> customer 1</td>
|
|
||||||
<td class="celda_normal">472</td>
|
|
||||||
<td class="celda_normal" >11212</td>
|
|
||||||
<td class="celda_normal" contenteditable="true" >-</td>
|
|
||||||
<td class="celda_normal" >472</td>
|
|
||||||
|
|
||||||
<td style="display:none">23-10-2024</td>
|
<tr>
|
||||||
<td style="display:none"> material 2</td>
|
<?php foreach($bagStockDetails as $index => $bagStockDetail){ ?>
|
||||||
<td style="display:none"> customer 2</td>
|
<?php if ($index === 0): ?>
|
||||||
<td class="celda_normal" >472</td>
|
<td class="celda_normal"><?= $bagStockDetail['date'] ?></td>
|
||||||
<td class="celda_normal">11212</td>
|
<?php endif; ?>
|
||||||
<td class="celda_normal" contenteditable="true" >-</td>
|
<td style="display:none"><?= $bagStockDetail['date']?></td>
|
||||||
<td class="celda_normal">472</td>
|
<td style="display:none"><?= $bagStockDetail['materialCode']?></td>
|
||||||
|
<td style="display:none"><?= $bagStockDetail['customer']?></td>
|
||||||
|
<td class="celda_normal"
|
||||||
|
contenteditable="true"><?= $bagStockDetail['opening']?></td>
|
||||||
|
<td class="celda_normal"><?= $bagStockDetail['receipt']?></td>
|
||||||
|
<td class="celda_normal"
|
||||||
|
contenteditable="true"><?= $bagStockDetail['used']?></td>
|
||||||
|
<td class="celda_normal"><?= $bagStockDetail['balanceStock']?></td>
|
||||||
|
<?php } ?>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tr>
|
<?php } ?>
|
||||||
|
|
||||||
<tr>
|
<?php } ?>
|
||||||
<td class="celda_normal" >24-10-2024</td>
|
|
||||||
<td style="display:none">24-10-2024</td>
|
|
||||||
<td style="display:none"> material 1</td>
|
|
||||||
<td style="display:none"> customer 1</td>
|
|
||||||
<td class="celda_normal" >472</td>
|
|
||||||
<td class="celda_normal">11212</td>
|
|
||||||
<td class="celda_normal" contenteditable="true" >-</td>
|
|
||||||
<td class="celda_normal">472</td>
|
|
||||||
|
|
||||||
<td style="display:none">24-10-2024</td>
|
|
||||||
<td style="display:none"> material 2</td>
|
|
||||||
<td style="display:none"> customer 2</td>
|
|
||||||
<td class="celda_normal" >472</td>
|
|
||||||
<td class="celda_normal">11212</td>
|
|
||||||
<td class="celda_normal" contenteditable="true" >-</td>
|
|
||||||
<td class="celda_normal">472</td>
|
|
||||||
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user