
<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>

                    <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-4">
                        <div class="panel panel-default">
                            <!-- 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>
                                        </tr>
                                    </thead>
                                    <tbody>

                                        {foreach $clientShowData{$k} as $data}
                                        {if $data->clientdebt neq "0"}
                                        <tr>
                                            <td>{$data->clientdate}</td>
                                            <td>{$data->clientname}</td>
                                            <td>{$data->clientdebt}</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">

                                    <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>
