<style>
    .borderleft{
        border-left: 2px solid #ddd;
    }
</style>
<div class="row">
    <div class="container">
        <!--show-------------------------------------------------------------------------------------------->
        <div class="panel panel-default">
            <!-- Default panel contents -->
            <div class="panel-heading">
                <h3 class="panel-title"><strong> ميزان المراجعة الشهرى</strong></h3>
                <a href="{$youtubes[222]->url}" target="_blank" class="hidden-print"><img src="../views/default/assets/img/youtube.png" class="pull-left" alt="Youtube" style="width: 2%;"></a>
            </div>
            <div class="panel-body">
                ,
                <form class="form-inline hidden-print" action="monthlytrialbalance.php" method="post">
                    <div class="form-group">
                        <label class="sr-only">من التاريخ</label>
                        <input type="text" class="form-control awdatepicker" autocomplete="off" data-date-format="yyyy-mm-dd" name="from">
                    </div>
                    <div class="form-group">
                        <label class="sr-only">إلى التاريخ</label>
                        <input type="text" class="form-control awdatepicker" autocomplete="off" data-date-format="yyyy-mm-dd" name="to">
                    </div>

                    <button type="submit" class="btn btn-primary">بحث</button>

                </form>
                <p>{$msg}</p>
                <hr/>
                <div id="dailyEntryTable" style="overflow-x: scroll">

                    <table class="table table-black">
                        <thead>
                            <tr class="mytotal">
                                <th rowspan="2" class="solidgrayright">#</th>
                                <th rowspan="2">الكود</th>
                                <th rowspan="2" style="min-width: 250px">الحساب</th>

                                <th colspan="2" style="min-width:150px;text-align: center" class="borderleft">رصيد اول المدة</th>
                                {foreach $months as $month}
                                <th colspan="2" style="min-width:150px;text-align: center" class="borderleft">{$month}</th>
                                {/foreach}
                                <th colspan="2" style="min-width:150px;text-align: center" class="borderleft">الاجمالى</th>
                                <th colspan="2" style="min-width:150px;text-align: center" class="borderleft">رصيد</th>
                            </tr>
                            <tr class="mytotal">
                                <th>مدين</th>
                                <th class="borderleft">دائن</th>
                                {foreach $months as $month}
                                <th>مدين</th>
                                <th class="borderleft">دائن</th>
                                {/foreach}
                                <th>مدين</th>
                                <th class="borderleft">دائن</th>
                                <th>مدين</th>
                                <th class="borderleft">دائن</th>
                            </tr>
                        </thead>
                        <tbody>
                            {assign var=i value=1}
                            {foreach $balanceArray as $data}
                            <tr>
                                <td>{$i}</td>
                                <td>{$data->layingOrder}</td>
                                <td>{$data->customName}</td>

                                <th>{$data->firstPeriodDebtor}</th>
                                <th class="borderleft">{$data->firstPeriodCreditor}</th>

                                {assign var=totMonthsDebt value=$data->firstPeriodDebtor}
                                {assign var=totMonthsCredit value=$data->firstPeriodCreditor}
                                {assign var=m value=1}
                                {foreach $months as $month}
                                <th>{$data->theValue[$month]['debt']}</th>
                                <th class="borderleft">{$data->theValue[$month]['credit']}</th>
                                {assign var=m value=$m+1}
                                {assign var=totMonthsDebt value=$totMonthsDebt+$data->theValue[$month]['debt']}
                                {assign var=totMonthsCredit value=$totMonthsCredit+$data->theValue[$month]['credit']}
                                {/foreach}

                                <th>{$totMonthsDebt}</th>
                                <th class="borderleft">{$totMonthsCredit}</th>

                                <th>{if $totMonthsDebt > $totMonthsCredit} {$totMonthsDebt-$totMonthsCredit} {/if}</th>
                                <th class="borderleft">{if $totMonthsCredit > $totMonthsDebt} {$totMonthsCredit-$totMonthsDebt} {/if}</th>

                            </tr>
                            {assign var=i value=$i+1}
                            {/foreach}
                            <tr style="background-color: gray">
                                <td colspan="3" style="text-align: center">الاجــمــالــى</td>

                                {assign var=m value=1}
                                {foreach $months as $month}
                                <td></td>
                                <td></td>
                                <td>{$totalsArr[{$month}]['debt']}</td>
                                <td>{$totalsArr[{$month}]['credit']}</td>
                                {assign var=m value=$m+1}
                                {/foreach}

                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>


                            </tr>
                        </tbody>
                    </table>

                </div>
                </br>
            </div>
        </div>
    </div>
</div>








<div id="accountsTree" style="display:none">
    <option value=""></option>
    {foreach $accountsTree as $element}
    <option value="{$element->id}">{$element->id}-{$element->name}</option>
    {/foreach}
</div>
