lundi 26 décembre 2016

get the subtotal in the blade view in laravel

I need to print the subtotal values of the following table using 2D array. I used the following way to print but the values wont show up. $a variable is used to calculate the subtotal of each row.

                     @foreach($reportData as $date => $array)
                        <?php $a = 0; ?>

                        <tr>

                            <td>
                            </td>

                            <td>
                                <?php $a = $array['Electrical'];?>
                                </td>
                            <td>
                                <?php $a = $a + $array['Electronics'];?>

                                
                            </td>

                            <td>
                                <?php $a = $a + $array['Lights'];?>

                                
                            </td>
                            <td>
                                <?php $a = $a + $array['Body'];?>

                                
                            </td>

                            <td>
                                <?php $a = $a + $array['Exhaustions'];?>

                                
                            </td>
                            <td>
                                <?php $a = $a + $array['Transmission'];?>

                                
                            </td>
                            <td>
                                <?php $a = $a + $array['Suspension'];?>

                                
                            </td>
                            <td>
                                <?php $a = $a + $array['Engine'];?>

                                
                            </td>
                            <td>
                                

                            </td>


                        </tr>

                    @endforeach

my array structure

enter image description here

my table that need to print the subtotal

enter image description here

Thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire