
<style>

    @media print {
        table ,tbody,thead,th,tr,td{

        }
        .col-lg-4
        {

            padding-top:50px !important;
        }

    }

</style>
<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 />
                بتاريخ: {$today}
                {if $message != ""}
                {$message}
                {/if}</div>
            <div class="panel-body">
                <form class="form-inline hidden-print" action="clientReportsbyareaController.php?do=allbyclientarea" method="post">
                    <div class="form-group">
                        <label class="sr-only">المنطقه</label>
                        <select class="select2 wdt300"  name="clientareaid" id="clientareaid" >
                            <option value="-1">اختر منطقه</option>


                            {foreach $allclientareadrop as $myallclientareadrop}


                            <option value="{$myallclientareadrop->id}">{$myallclientareadrop->name}</option>


                            {/foreach}


                        </select>
                    </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="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>
                <hr/>
                <div  id="tableWrap">

                    {assign var=k value=1}
                    {foreach $allclientarea as $myallclientarea}

                    <div class="col-lg-12">
                        <div class="panel panel-default panel-m">
                            <!-- Default panel contents -->
                            <div class="panel-heading"> عملاء منطقه {$myallclientarea->name}</div>
                            <div class="panel-body">
                                <table class="table table-black">
                                    <thead>
                                        <tr>

                                            <th>اسم العميل</th>
                                            <th> مديونية العميل</th>
                                            <th>صافى المبيعات</th>

                                            <th>المدفوعات</th>
                                            <th>الرصيد</th>
                                        </tr>
                                    </thead>
                                    <tbody>

                                        {foreach $clientShowData{$k} as $data}
                                        {if $data->clientdebt neq "0"}
                                        <tr>

                                            <td>{$data->clientname}</td>
                                            <td>{$data->clientdebt}</td>

                                            <td> {$data->myGenSum} </td>

                                            <td>{$data->myPaySum}</td>
                                            <td>{$data->rondomtxt}</td>

                                        </tr>
                                        {/if}
                                        {/foreach}
                                        <tr class="success">
                                            <td>الإجمالي</td>
                                            <td>{$sum{$k}} {$currency}</td>
                                            <td></td>
                                        </tr>
                                    </tbody>

                                </table>
                            </div>
                            <!--panel-body-->
                        </div>
                        <!--panel panel-default-->
                    </div>
                    {capture assign=k}{$k+1}{/capture}



                    {/foreach}




                    <div class="col-lg-4">
                        <div class="panel panel-default panel-m">
                            <!-- Default panel contents -->
                            <div class="panel-heading"> الاجمالى العام</div>
                            <div class="panel-body">
                                <table class="table table-black">

                                    <tr class="success">
                                        <td>الإجمالي</td>
                                        <td>{$totalsum} {$currency}</td>
                                        <td></td>
                                    </tr>
                                    </tbody>

                                </table>
                            </div>
                            <!--panel-body-->
                        </div>
                        <!--panel panel-default-->
                    </div>
                    <!--col-lg-4-->
                    <!--**********************************************************************-->

                </div><!--col-lg-4-->
                <div class="clearfix"></div>
                <hr />
                <div  class="hidden-print">
                    <div class="col-lg-12">
                        <div class="form-group">
                            <div class="col-lg-4">
                                <button type="button" onClick="print_Custom('mycustomheader');" class="btn btn-success pull-right">طباعة</button>

                                <script type="text/javascript">
                                    var x = document.getElementById("tableWrap").innerHTML;
                                    $(document).ready(function (e) {

                                        document.getElementById("data").value = x;

                                    });
                                </script>
                                <form name="jazx" id="excel" action="http://localhost/newexcel/untitled.php" method="post">
                                    <input type="hidden" name="data" id="data"/>
                                    <!--<br /> <input type="submit" name="button" id="button" class="btn btn-success pull-right" value="ملف اكسل" /></form>-->
                            </div>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>
                <div class="clearfix"></div>
            </div>
        </div>
    </div>
</div>
