<style>
    .solidgraytop{
        border-top-style:solid;
        border-top-color:#ddd;
    }
    .solidgrayleft{
        border-left:solid;
        border-left-width:3px;
        border-color: #ddd;
    }
    .solidgrayright{
        border-right-style:solid;
        border-right-color:#ddd;
    }
    .solidgraybottom{
        border-top-style:solid;
        border-top-color:#ddd;
    }
    .hidetop{
        border-top:hidden !important;
    }
    .hidebottom{
        border-bottom:hidden !important;
    }
    .fromaccountstyle{
        font-weight:bold;
        font-size:17px;
        color:blue;
    }
    .toaccountstyle
    {
        font-weight:bold;
        font-size:17px;
        color:purple;
    }
    .fromaccountstylesmall{
        font-weight:bold;
        font-size:15px;
        color:blue;
    }
    .toaccountstylesmall
    {
        font-weight:bold;
        font-size:15px;
        color:purple;
    }
    .dangerstyle
    {
        font-weight:bold;
        font-size:15px;
        color:red;
    }
    .mytotal{
        background-color:#ddd;
        font-weight:bold;
    }
    .nodata{
        background-color: #72B4EC;
        color: white;
        border-radius: 13px;
        margin: 14px;
        font-size: 24px;
        text-align: center;
        padding: 5px;
    }

    @media print {
        .pree { display: block !important; }
        .hide_prin{ display: none;}
    }
</style>
<div class="row">
    <div class="container">
        <!--show-------------------------------------------------------------------------------------------->
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">
                <h3 class="panel-title"><strong>دفتر الأستاذ المساعد </strong></h3>
                <a href="{$youtubes[221]->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="assistantledger.php" method="post">
                    <div class="form-group" style="width: 19%">
                        <label class="sr-only col-lg-12">شكل الدفتر</label>
                        <select class="select2" name="shape" style="margin-right: 0px">
                            <option value="0" selected="selected">رصيد متحرك</option>
                            <option value="1"> حرف T</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label class="sr-only col-lg-3">اختر القيد</label>
                        <input type="hidden"  class="assistantledger wdt600" name="assistantledgerid" id="assistantledgerid" data-placeholder="اختر"  />
                    </div>
                    <br/>
                    <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="datefrom" >
                    </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="dateto" >
                    </div>
                    <button type="submit" class="btn btn-primary">بحث</button>
                </form>
                <input type="hidden" id="searchvalue" name="searchvalue" value="0"/>
                <div>
                    {if $allDailyEnteryCount>0}
                    <br />
                    <hr/>
                    <br/>
                    {if $shape == 0}
                    <table class="table table-black">
                        <thead>
                            <tr class="mytotal">
                                <th class="solidgrayright" style="text-align: center;border-bottom-color: white !important"></th>
                                <th colspan="6" style="text-align: center;border-bottom-color: white !important">حـــــــــ/{$entry->customName}</th>
                                <th class="solidgrayleft" style="text-align: center;border-bottom-color: white !important"></th>
                            </tr>
                            <tr class="mytotal">
                                <th class="solidgrayright" style="border-top-color: white !important">التاريخ</th>
                                <th style="border-top-color: white !important">بيان القيد</th>
                                <th style="border-top-color: white !important">البيان</th>
                                <th style="border-top-color: white !important">رقم القيد</th>
                                <th style="border-top-color: white !important">مدين</th>
                                <th style="border-top-color: white !important">دائن</th>
                                <th style="border-top-color: white !important">اسم الحساب</th>
                                <th class="solidgrayleft" width="8%" style="border-top-color: white !important">الرصيد</th>
                            </tr>
                        </thead>
                        <tbody>
                            {assign var=debtorByNature value=0}
                            {assign var=cerditorByNature value=0}
                            {foreach $allDailyEntery as $dailyEntery}
                            {if $dailyEntery->id !=""}

                            <!--عكس القيد-->
                            {if $dailyEntery->reverseofid != 0 && $dailyEntery->reverseofid != -10}
                            <tr class="solidgraytop bg-open-report" >
                                {else}
                            <tr class="solidgraytop">
                                {/if}




                                {else}

                                <!--عكس القيد-->
                                {if $dailyEntery->reverseofid != 0}
                            <tr style="background-color: #FCE4EC">
                                {else}
                            <tr>
                                {/if}



                                {/if}

                                <td class="solidgrayleft solidgrayright">{$dailyEntery->dDateTime}</td>
                                <td class="solidgrayleft solidgrayright">{$dailyEntery->entryComment}</td>
                                <td class="solidgrayleft solidgrayright">{$dailyEntery->dComment}</td>
                                <td class="solidgrayleft solidgrayright "><a class="hide_prin"  href="dailyentry.php?id={$dailyEntery->id}" target="_blank"><u class="color-blue">{$dailyEntery->id}</u></a><span style="display: none" class="pree">{$dailyEntery->id}</span></td>




                                {if $dailyEntery->type eq 0}
                                <td class="solidgrayleft solidgrayright">{$dailyEntery->value}</td>
                                <td class="solidgrayleft solidgrayright"></td>
                                <td class="solidgrayleft solidgrayright">{$dailyEntery->accountstreeName}</td>

                                {assign var=debtorByNature value=$debtorByNature + $dailyEntery->value}
                                {assign var=cerditorByNature value=$cerditorByNature - $dailyEntery->value}
                                {else}
                                <td class="solidgrayleft solidgrayright"></td>
                                <td class="solidgrayleft solidgrayright">{$dailyEntery->value}</td>
                                <td class="solidgrayleft solidgrayright">{$dailyEntery->accountstreeName}</td>
                                {assign var=debtorByNature value=$debtorByNature - $dailyEntery->value}
                                {assign var=cerditorByNature value=$cerditorByNature + $dailyEntery->value}
                                {/if}
                                <td class="solidgrayleft">{if $entry->itemtype == "0"||$entry->itemtype == "3"}{$debtorByNature}{else}{$cerditorByNature}{/if}</td>

                            </tr>
                            {/foreach}
                            <tr class="mytotal">
                                <td class="solidgrayright"></td>
                                <td class="solidgrayright"></td>
                                <td colspan="6" class="solidgrayleft" style="text-align:center;"></td>

                            </tr>
                            <!--tr class="mytotal">
                                <td class="solidgrayright"></td>
                                <td class="solidgrayright"></td>
                                <td>{$debtorTotal}</td>
                                <td>{$creditorTotal}</td>
                                <td colspan="3" class="solidgrayleft" style="text-align:center;">الاجــــــــــمــــــــــالــــــى</td>

                            </tr-->

                        </tbody>
                    </table>
                    {else if $shape == 1}
                    <table class="table table-black">
                        <thead>
                            <tr class="mytotal">
                                <th class="solidgrayright" style="text-align: right;border-bottom-color: white !important">مــن</th>
                                <th colspan="6" style="text-align: center;border-bottom-color: white !important">حـــــــــ/{$entry->name}</th>
                                <th class="solidgrayleft" style="text-align: left;border-bottom-color: white !important">الــى</th>
                            </tr>
                            <tr class="mytotal">
                                <th class="solidgrayright" style="border-top-color: white !important" width="9%">القيمة</th>
                                <th style="border-top-color: white !important" width="23%">اسم الحساب</th>
                                <th style="border-top-color: white !important" width="13%">التاريخ</th>
                                <th style="border-top-color: white !important" width="5%">رقم القيد</th>
                                <th style="border-top-color: white !important" width="9%">القيمة</th>
                                <th style="border-top-color: white !important" width="23%">اسم الحساب</th>
                                <th style="border-top-color: white !important" width="13%">التاريخ</th>
                                <th class="solidgrayleft" style="border-top-color: white !important" width="5%">رقم القيد</th>
                            </tr>
                        </thead>
                        <tbody>
                            {assign var=debtorTotal value=0}
                            {assign var=cerditorTotal value=0}
                            {for $foo = 0 to $realCount step=2}
                            {if $allDailyEntery[$foo]->accountstreeName =="" && $allDailyEntery[$foo+1]->accountstreeName ==""}
                            {else}
                            <tr>
                                <td class="solidgrayright">{$allDailyEntery[$foo]->value}</td>
                                <th>{if $allDailyEntery[$foo]->accountstreeName != ""}<span class="toaccountstylesmall">الى حــ/ </span>{/if}{$allDailyEntery[$foo]->accountstreeName}</th>
                                <td >{$allDailyEntery[$foo]->dDateTime}</td>
                                <td class="solidgrayleft "><a class="hide_prin "  href="dailyentry.php?id={$allDailyEntery[$foo]->id}" target="_blank" style="color:blue;"><u>{$allDailyEntery[$foo]->id}</u></a><span style="display: none" class="pree">{$allDailyEntery[$foo]->id}</span></td>
                                <td class="solidgrayright">{$allDailyEntery[$foo+1]->value}</td>
                                <th>{if $allDailyEntery[$foo+1]->accountstreeName != ""}<span class="fromaccountstylesmall">من حــ/ </span>{/if}{$allDailyEntery[$foo+1]->accountstreeName}</th>
                                <td>{$allDailyEntery[$foo+1]->dDateTime}</td>
                                <td class="solidgrayleft "><a class="hide_prin "  href="dailyentry.php?id={$allDailyEntery[$foo+1]->id}" target="_blank" style="color:blue;"><u>{$allDailyEntery[$foo+1]->id}</u></a><span style="display: none" class="pree">{$allDailyEntery[$foo+1]->id}</span></td>
                            </tr>
                            {assign var=debtorTotal value=$debtorTotal + $allDailyEntery[$foo]->value}
                            {assign var=cerditorTotal value=$cerditorTotal + $allDailyEntery[$foo+1]->value}
                            {/if}
                            {/for}
                            {if $cerditorTotal-$debtorTotal != 0}
                            <tr>
                                <td class="solidgrayright">{if $cerditorTotal-$debtorTotal>0}<span class="dangerstyle">{$cerditorTotal-$debtorTotal}</span>{/if}</td>
                                <th colspan="2">{if $cerditorTotal-$debtorTotal>0}<span class="dangerstyle">رصيد دائن</span>{/if}</th>
                                <td class="solidgrayleft"></td>
                                <td class="solidgrayright">{if $debtorTotal-$cerditorTotal>0}<span class="dangerstyle">{$debtorTotal-$cerditorTotal}</span>{/if}</td>
                                <th colspan="2">{if $debtorTotal-$cerditorTotal>0}<span class="dangerstyle">رصيد مدين</span>{/if}</th>
                                <td class="solidgrayleft"></td>
                            </tr>
                            {/if}
                            <tr class="mytotal">
                                <td class="solidgrayright">{if $cerditorTotal-$debtorTotal>0}{$cerditorTotal}{else}{$debtorTotal}{/if}</td>
                                <th colspan="2"></th>
                                <td class="solidgrayleft"></td>
                                <td class="solidgrayright">{if $cerditorTotal-$debtorTotal>0}{$cerditorTotal}{else}{$debtorTotal}{/if}</td>
                                <th colspan="2"></th>
                                <td class="solidgrayleft"></td>

                            </tr>

                        </tbody>
                    </table>
                    {/if}
                    {else}
                    <div class="nodata">عفوا لا توجد نتائج</div>
                    {/if}
                </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>
