stock module latest today vadivel J 20-01-2025

This commit is contained in:
vadivelJ96 2025-01-20 18:03:02 +05:30
parent 002d3a560e
commit 57a23db796
5 changed files with 372 additions and 49 deletions

View File

@ -108,6 +108,17 @@
padding: 6px 10px;;
text-align: center;
}
.celda_encabezado_total {
background-color:#ffffff;
border: 1px solid #ccc;
color: #ffffff;
font-weight: bold;
padding: 6px 10px;
;
text-align: center;
}
._Separador {
@ -166,6 +177,30 @@
color: #ffffff;
}
#bagStockDetailsTableSummaryId th:nth-child(1),
#bagStockDetailsTableSummaryId td:nth-child(1) {
position: sticky;
left: 0;
background-color: #00a65a;
z-index: 2;
border-right: 2px solid #ddd;
color: #ffffff;
}
.table-responsive {
overflow-y: auto;
}
.fht-table thead th {
top: 0;
z-index: 5!important;
}
@ -260,7 +295,7 @@
<div class="table-responsive">
<table id="bagStockDetailsTableId" class="fht-table table-striped">
<thead class="celda_encabezado_general" style="padding: 10px;">
<thead class="celda_encabezado_general bag-table-head" style="padding: 10px;">
<tr>
@ -312,8 +347,11 @@
<?php if(!empty($groupedBagStockDetails))
{
$summary = [] ;
foreach($groupedBagStockDetails as $groupedBagStockDetailsIndex => $bagStockDetails){
foreach($groupedBagStockDetails as $groupedBagStockDetailsIndex => $bagStockDetails){
?>
<tr
@ -382,11 +420,76 @@
<?= $bagStock['balanceStock']?>
</td>
<?php } ?>
<?php
//before closing inner loop we just adding the total values insidde it
$materialCode = $bagStock['materialCode']; // Unique identifier
// Initialize the material entry if it doesn't exist
if (!isset($summary[$materialCode])) {
$summary[$materialCode] = [
'opening' => "-" ,
'receipt' => 0 ,
'used' => 0 ,
'balanceStock' => 0 ,
];
}
// Sum values for the material
$summary[$materialCode]['opening'] = "-" ;
$summary[$materialCode]['receipt'] += $bagStock['receipt'] == '-' ? 0 : $bagStock['receipt'] ;
$summary[$materialCode]['used'] += $bagStock['used'] == '-' ? 0 : $bagStock['used'] ;
$summary[$materialCode]['balanceStock'] = $bagStock['balanceStock'] == '-' ? 0 : $bagStock['balanceStock'] ;
} ?>
</tr>
<?php } ?>
<div class="table-responsive">
<table id="bagStockDetailsTableSummaryId" class="fht-table table-striped">
<thead >
<th class="celda_encabezado_total">Total Sum</th>
<?php foreach($summary as $each){ ?>
<th class="celda_encabezado_total">Opening Stock</th>
<th class="celda_encabezado_total">Receipt</th>
<th class="celda_encabezado_total">Used</th>
<th class="celda_encabezado_total">Balance Stock</th>
<?php } ?>
</thead>
<tbody>
<tr>
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
<b> Total </b>
</td>
<?php foreach($summary as $each){
?>
<td class="celda_normal "><?=$each['opening']?></td>
<td class="celda_normal "><?=$each['receipt']?></td>
<td class="celda_normal "><?=$each['used']?></td>
<td class="celda_normal "><?=$each['balanceStock']?></td>
<?php } ?>
</tr>
</tbody>
</table>
</div>
<!-- this else condition work if groupedBagStockDetails is empty and creating new records
with initial values 0 for entire month -->
<?php } else { ?>

View File

@ -110,6 +110,16 @@
text-align: center;
}
.celda_encabezado_total {
background-color:#ffffff;
border: 1px solid #ccc;
color: #ffffff;
font-weight: bold;
padding: 6px 10px;
;
text-align: center;
}
._Separador {
background-color: #fff;
@ -166,6 +176,18 @@
border-right: 2px solid #ddd;
color: #ffffff;
}
#dieselStockDetailsTableSummaryId th:nth-child(1),
#dieselStockDetailsTableSummaryId td:nth-child(1) {
position: sticky;
left: 0;
background-color: #ffffff;
z-index: 2;
border-right: 2px solid #ddd;
color: #ffffff;
}
.modal {
padding-right: 30% ! important;
@ -311,8 +333,12 @@ foreach ($period as $day) {
<tbody style="background-color: #fff;">
<?php if (!empty($groupedDieselMachineStockDetails)) {
$summary = [];
foreach ($groupedDieselMachineStockDetails as $groupedDieselMachineStockDetailsIndex => $dieselStockDetails) {
?>
<tr
@ -374,6 +400,24 @@ foreach ($period as $day) {
</td>
<?php
//before closing outer loop
if (!isset($summary['totalPurchaseDiesel'])) {
$summary['opening_diesel'] = '-' ;
$summary['totalPurchaseDiesel'] = 0 ;
$summary['totalFillingDiesel'] = 0 ;
$summary['balanceStock'] = 0 ;
}
$summary['totalPurchaseDiesel'] += $totalDiesel[$groupedDieselMachineStockDetailsIndex]['purchase_diesel'] == '-' ? 0 : $totalDiesel[$groupedDieselMachineStockDetailsIndex]['purchase_diesel'] ;
$summary['totalFillingDiesel'] += $totalDiesel[$groupedDieselMachineStockDetailsIndex]['total_filling_diesel'] == '-' ? 0 : $totalDiesel[$groupedDieselMachineStockDetailsIndex]['total_filling_diesel'] ;
$summary['balanceStock'] = $totalDiesel[$groupedDieselMachineStockDetailsIndex]['balance_stock'] == '-' ? 0 : $totalDiesel[$groupedDieselMachineStockDetailsIndex]['balance_stock'] ;
?>
@ -447,12 +491,105 @@ foreach ($period as $day) {
</td>
<?php } ?>
<?php
//before closing inner loop we just adding the total values inside it
$machineId = $dieselStock['machine_id']; // Unique identifier
// Initialize the material entry if it doesn't exist
if (!isset($summary["machineId_$machineId"])) {
$summary["machineId_$machineId"] = [
'opening_reading' => "-" ,
'closing_reading' => 0 ,
'filling_diesel' => 0 ,
'consumption' => 0 ,
'running_hours' => 0 ,
'mileage' => 0 ,
];
}
// Sum values for the material
$summary["machineId_$machineId"]['opening_reading'] = 0 ;
$summary["machineId_$machineId"]['closing_reading'] = $dieselStock['closing_reading'] == '-' ? 0 : $dieselStock['closing_reading'] ;
$summary["machineId_$machineId"]['filling_diesel'] += $dieselStock['filling_diesel'] == '-' ? 0 : $dieselStock['filling_diesel'] ;
$summary["machineId_$machineId"]['consumption'] += $dieselStock['consumption'] == '-' ? 0 : $dieselStock['consumption'] ;
$summary["machineId_$machineId"]['running_hours'] += $dieselStock['running_hours'] == '-' ? 0 : $dieselStock['running_hours'] ;
$summary["machineId_$machineId"]['mileage'] += $dieselStock['mileage'] == '-' ? 0 : $dieselStock['mileage'] ;
} ?>
</tr>
<?php } ?>
<?php
}
?>
<!-- this else condition work if groupedBagStockDetails is empty and creating new records
<div class="table-responsive">
<table id="dieselStockDetailsTableSummaryId" class="fht-table table-striped">
<thead>
<th class="celda_encabezado_total">Total Sum</th>
<th class="celda_encabezado_total"> Opening</th>
<th class="celda_encabezado_total"> Purchase Diesel</th>
<th class="celda_encabezado_total"> Filling Diesel</th>
<th class="celda_encabezado_total"> Balance Stock</th>
<?php foreach($summary as $each){
if(is_array($each)){
?>
<th class="celda_encabezado_total">Opening Reading</th>
<th class="celda_encabezado_total">Closing Reading</th>
<th class="celda_encabezado_total">Filling Diesel</th>
<th class="celda_encabezado_total">Consumption</th>
<th class="celda_encabezado_total">Running Hours</th>
<th class="celda_encabezado_total">Mileage</th>
<?php }
} ?>
</thead>
<tbody>
<tr>
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
<b> Total </b>
</td>
<td><?= $summary['opening_diesel'] ?></td>
<td><?= $summary['totalPurchaseDiesel'] ?></td>
<td><?= $summary['totalFillingDiesel'] ?></td>
<td><?= $summary['balanceStock'] ?></td>
<?php foreach($summary as $each){
if(is_array($each)){
?>
<td class="celda_normal "><?=$each['opening_reading']?> </td>
<td class="celda_normal "><?=$each['closing_reading']?></td>
<td class="celda_normal "><?=$each['filling_diesel']?></td>
<td class="celda_normal "><?=$each['consumption']?></td>
<td class="celda_normal "><?=$each['running_hours']?></td>
<td class="celda_normal "><?=$each['mileage']?></td>
<?php
}
}
?>
</tr>
</tbody>
</table>
</div>
<!-- this else condition work if groupeddieselStockDetails is empty and creating new records
with initial values 0 for entire month -->
<?php } else { ?>
@ -763,7 +900,7 @@ foreach ($period as $day) {
const readingsRowPart = [];
const allRow = [] ;
//this table to json is customized for bagstock not for all
//this table to json is customized for dieselStock not for all
table.find('tbody tr').each(function(index) {

View File

@ -166,6 +166,15 @@
color: #ffffff;
}
.celda_encabezado_total {
background-color:#ffffff;
border: 1px solid #ccc;
color: #ffffff;
font-weight: bold;
padding: 6px 10px;
text-align: center;
}
.modal {
padding-right: 30% ! important;
}
@ -279,9 +288,10 @@
</tr>
<?php
}
}
?>
}else{
<?php }else{
$date = DateTime::createFromFormat('M-Y', $month);

View File

@ -177,9 +177,29 @@
color: #ffffff;
}
.modal {
padding-right: 30% ! important;
#resinStockDetailsTableSummaryId th:nth-child(1),
#resinStockDetailsTableSummaryId td:nth-child(1) {
position: sticky;
left: 0;
background-color: #00a65a;
z-index: 2;
border-right: 2px solid #ddd;
color: #ffffff;
}
.table-responsive {
overflow-y: auto;
}
.fht-table thead th {
position: sticky;
top: 0;
z-index: 5!important;
}
</style>
@ -312,38 +332,7 @@ foreach ($period as $day) {
<?php if (!empty($groupedResinStockDetails)) {
function sumMaterialValues($groupedResinStockDetails) {
$summary = [];
foreach ($groupedResinStockDetails as $resinStockDetails) {
foreach ($resinStockDetails as $resinStock) {
$materialCode = $resinStock['materialCode']; // Unique identifier
// Initialize the material entry if it doesn't exist
if (!isset($summary[$materialCode])) {
$summary[$materialCode] = [
'opening' => "-" ,
'receipt' => 0,
'used' => 0,
'balanceStock' => 0,
];
}
// Sum values for the material
;
$summary[$materialCode]['opening'] = "-" ;
$summary[$materialCode]['receipt'] += $resinStock['receipt'] == '-' ? 0 :$resinStock['receipt'] ;
$summary[$materialCode]['used'] += $resinStock['used'] == '-' ? 0 :$resinStock['used'] ;
$summary[$materialCode]['balanceStock'] = $resinStock['balanceStock'] == '-' ? 0 :$resinStock['balanceStock'] ;
}
}
return $summary;
}
// Example usage:
$summary = sumMaterialValues($groupedResinStockDetails);
$summary = [];
foreach ($groupedResinStockDetails as $groupedResinStockDetailsIndex => $resinStockDetails) {
@ -412,7 +401,33 @@ foreach ($period as $day) {
<?= $resinStock['balanceStock'] ?>
</td>
<?php } ?>
<?php
//before closing inner loop we just adding the total values insidde it
$materialCode = $resinStock['materialCode']; // Unique identifier
// Initialize the material entry if it doesn't exist
if (!isset($summary[$materialCode])) {
$summary[$materialCode] = [
'opening' => "-" ,
'receipt' => 0,
'used' => 0,
'balanceStock' => 0,
];
}
// Sum values for the material
;
$summary[$materialCode]['opening'] = "-" ;
$summary[$materialCode]['receipt'] += $resinStock['receipt'] == '-' ? 0 :$resinStock['receipt'] ;
$summary[$materialCode]['used'] += $resinStock['used'] == '-' ? 0 :$resinStock['used'] ;
$summary[$materialCode]['balanceStock'] = $resinStock['balanceStock'] == '-' ? 0 :$resinStock['balanceStock'] ;
} ?>
</tr>
<?php } ?>

View File

@ -166,6 +166,15 @@
color: #ffffff;
}
.celda_encabezado_total {
background-color:#ffffff;
border: 1px solid #ccc;
color: #ffffff;
font-weight: bold;
padding: 6px 10px;
text-align: center;
}
.modal {
padding-right: 30% ! important;
}
@ -236,8 +245,8 @@
style="width: 100px;"
class="celda_encabezado_general" >Date </th>
<th class="celda_encabezado_general" >Rough Kgs </th>
<th class="celda_encabezado_general" >Fine kgs </th>
<th class="celda_encabezado_general" >Total kgs </th>
<th class="celda_encabezado_general" >Fine Kgs </th>
<th class="celda_encabezado_general" >Total Kgs </th>
<th class="celda_encabezado_general" >Customer Name</th>
</tr>
@ -247,7 +256,11 @@
<?php
if(!empty($trpSandUseStockDetails)){
$summary = [] ;
foreach($trpSandUseStockDetails as $trpSandUseStockDetailsIndex => $trpSandUseStockDetail){
?>
<tr
@ -280,7 +293,7 @@
data-id="<?= $trpSandUseStockDetail['date'] ?>"
><?= $trpSandUseStockDetail['total_kgs'] ?></td>
<td class="celda_normal total"
<td class="celda_normal customerName"
data-id="<?= $trpSandUseStockDetail['date'] ?>"
contenteditable="true"
><?= $trpSandUseStockDetail['customer_name'] ?></td>
@ -292,9 +305,54 @@
</tr>
<?php
}
}else{
//before closing inner loop
if (!isset($summary['rough_kgs'])) {
$summary['rough_kgs'] = 0 ;
$summary['fine_kgs'] = 0 ;
$summary['total_kgs'] = 0 ;
}
$summary['rough_kgs'] += $trpSandUseStockDetail['rough_kgs'] == "-" ? 0 : (float) $trpSandUseStockDetail['rough_kgs'] ;
$summary['fine_kgs'] += $trpSandUseStockDetail['fine_kgs'] == "-" ? 0 : (float) $trpSandUseStockDetail['fine_kgs'] ;
$summary['total_kgs'] += $trpSandUseStockDetail['total_kgs'] == "-" ? 0 :(float) $trpSandUseStockDetail['total_kgs'] ;
} ?>
<div class="table-responsive" style="width: 700px;">
<table id="trpSandUseStockDetailsTableSummaryId" class="fht-table table-striped">
<thead >
<th class="celda_encabezado_total" style="width: 100px;">Total </th>
<th class="celda_encabezado_total" style="width: 150px;">Rough Kgs </th>
<th class="celda_encabezado_total" style="width: 120px;">Fine Kgs </th>
<th class="celda_encabezado_total" style="width: 130px;">Total Kgs </th>
</thead>
<tbody>
<tr>
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
<b> Total </b>
</td>
<td class="celda_normal "><?=$summary['rough_kgs']?></td>
<td class="celda_normal "><?=$summary['fine_kgs']?></td>
<td class="celda_normal "><?=$summary['total_kgs']?></td>
</tr>
</tbody>
</table>
</div>
<?php }else{
$date = DateTime::createFromFormat('M-Y', $month);