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 <=', $endDate)
|
||||
->groupBy(['materialCode','date'])
|
||||
->orderBy('date','desc')
|
||||
->orderBy('date','asc')
|
||||
->orderBy('materialCode','asc')
|
||||
->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);
|
||||
|
||||
$formattedDate = $date->format('M-Y');
|
||||
|
||||
@ -205,104 +205,84 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="bagStockDetailsTableId" class="fht-table table-striped"
|
||||
style="font-size: small;">
|
||||
<table id="bagStockDetailsTableId" class="fht-table table-striped">
|
||||
|
||||
<thead class="celda_encabezado_general" style="padding: 10px;">
|
||||
|
||||
<tr>
|
||||
|
||||
<th colspan="1">material </th>
|
||||
|
||||
<!-- this will loop till materials present -->
|
||||
<th colspan="4">material 1</th>
|
||||
|
||||
<th colspan="4">material 2</th>
|
||||
<th class="celda_encabezado_general" colspan="1">material </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>
|
||||
<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 -->
|
||||
<th colspan="4" contenteditable="true">
|
||||
<?php echo $customer??'Customer' ?>
|
||||
<th class="celda_encabezado_general" colspan="4" contenteditable="true">
|
||||
<?php echo $customer??"customer$index" ?>
|
||||
</th>
|
||||
|
||||
<th colspan="4" contenteditable="true">
|
||||
<?php echo $customer??'Customer2' ?>
|
||||
</th>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<th 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>
|
||||
<th class="celda_encabezado_general" colspan="1">Date </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>
|
||||
|
||||
|
||||
</thead>
|
||||
|
||||
<tbody style="background-color: #fff;" >
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="celda_normal" >23-10-2024</td>
|
||||
<td style="display:none">23-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>
|
||||
<?php if(!empty($groupedBagStockDetails))
|
||||
{
|
||||
//dd($groupedBagStockDetails);
|
||||
foreach($groupedBagStockDetails as $index => $bagStockDetails){
|
||||
?>
|
||||
|
||||
<td style="display:none">23-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>
|
||||
<?php foreach($bagStockDetails as $index => $bagStockDetail){ ?>
|
||||
<?php if ($index === 0): ?>
|
||||
<td class="celda_normal"><?= $bagStockDetail['date'] ?></td>
|
||||
<?php endif; ?>
|
||||
<td style="display:none"><?= $bagStockDetail['date']?></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>
|
||||
<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>
|
||||
<?php } ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user