<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">فرن عيش </a></li>
            <li class="active">تقرير بواقى</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">تقرير بواقى<br />
                {if $message != ""}
                {$message}
                {/if}
                <a href="{$youtubes[262]->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">

                <div id="outputString" class="alert alert-block alert-success fade in hidden-print" style="display:none">
                    <button type="button" class="close pull-left" data-dismiss="alert" aria-hidden="true">&times;</button>
                    <p id="outputStringValue">{$outputString}</p>
                    <div class="clearfix"></div>
                </div>
                <form class="form-inline hidden-print" action="tamweenreports.php?do=clientremain" 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" name="month" id="month">
                    </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="from" id="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" id="to">
                                        </div>-->
                    <button type="submit" class="btn btn-primary">بحث</button>
                </form>
            </div>

            <hr/>

            <form class="form-inline hidden-print" action="tamweenreports.php?do=clientremainsave" method="post">
                <table class="table table-black dataTableClassNoPaging">
                    <thead>
                        <tr>

                            <th>#</th>
                            <th>العميل</th>
                            <th>الحصة</th>
                            <th>المنصرف</th>
                            <th>الباقى</th>
                            <th>قبض الفرق</th>
                            <th>التاريخ</th>
                            <th>المستخدم</th>
                        </tr>
                    </thead>
                    <tbody>
                        {assign var=i value=1}
                        {assign var=totalShare value=0}
                        {assign var=totalQuantity value=0}
                        {assign var=totalRemain value=0}

                        {foreach $reportData as $data}
                        <!--{*assign var=share value=(5*$noOfDays*$data->noOfPersonsDa3m)*}-->
                        {assign var=share value=(5*$data->noOfDaysCalc*$data->noOfPersonsDa3m)}

                        {assign var=totalShare value=$totalShare+$share}
                        {assign var=totalQuantity value=$totalQuantity+$data->quantity}
                        {assign var=totalRemain value=$totalRemain+($share - $data->quantity)}
                        <tr>
                            <td>{$data->clientcode}<!--{*$i*}--></td>
                            <td>{$data->clientname}</td>
                            <td>{$share}</td>
                            <td>{$data->quantity}</td>
                            <td>{$share - $data->quantity}</td>
                            <td>
                                <input type="checkbox" name="remainstatus{$i}" id="remainstatus{$i}" {if $data->remainstatus == 1}checked{/if} value="1"/>
                                <input type="hidden" name="clientid{$i}" id="clientid{$i}" value="{$data->clientid}"/>
                                <input type="hidden" name="tamweenremainstatusid{$i}" id="tamweenremainstatusid{$i}" value="{$data->tamweenremainstatusid}"/>
                            </td>
                            <td>{if $data->remainstatus == 1}{$data->sysdate}{/if}</td>
                            <td>{if $data->remainstatus == 1}{$data->employeename}{/if}</td>
                        </tr>
                        {assign var=i value=$i+1}
                        {/foreach}
                    </tbody>
                    <tfoot>
                        <tr style="text-align: center;font-weight: bolder;">
                            <td colspan="2">الاجمالى</td>
                            <td>{$totalShare}</td>
                            <td>{$totalQuantity}</td>
                            <td>{$totalRemain}</td>
                            <td colspan="3"></td>
                        </tr>
                    </tfoot>
                </table>

                <input type="hidden" name="itr" id="itr" value="{$i}"/>
                <input type="hidden" name="firstDayOfMonthSelected" id="firstDayOfMonthSelected" value="{$firstDayOfMonthSelected}"/>

                <div class="clearfix"></div>
                <div class="row">
                    <button type="submit" class="btn btn-primary center-block" style="margin-right: 47%">حفظ</button>
                </div>
                <br/>
            </form>

        </div>

    </div>
</div>
