
<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}</div>
            <div class="panel-body">
                <form class="form-inline hidden-print" action="clientReportsController.php?do=all" method="post">
                    <div class="form-group">
                        <label class="sr-only">العميل</label>
                        <select class="select2 wdt300"  name="clientid" id="clientid" >
                            <option value="-1">اختر عميل</option>


                            {foreach $clientData as $client}


                            <option value="{$client->clientid}">{$client->clientname}</option>


                            {/foreach}


                        </select>
                    </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" >
                    </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">
                    <table width="200" border="1" align="center">
                        <tr>
                            <td>رصيد العميل :</td>
                            <td>{$clinetdept->clientdebt} {$currency}</td>
                        </tr>
                    </table>

                    <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" style="width:100% !important; height:100% !important;">
                                    <thead>
                                        <tr>
                                            <th>م</th>
                                            <!--                  <th>رقم الفاتورة</th>
                                            -->                  <th>تاريخ الفاتورة</th>
                                            <th>عدد الوحدات</th>
                                            <th>إجمالي الفاتورة</th>
                                        </tr>
                                    </thead>
                                    <tbody>

                                        {foreach $sellbillData as $data}
                                        <tr>
                                            <td>{$data->sellbillid}</td>
                                            <!--                <td>{$data->sellbillserial}</td>
                                            -->                <td>{$data->sellbilldate}</td>
                                            <td>{$data->sellQuantity}</td>
                                            <td>
                                                {if {$data->userid} eq -1}

                                                {$data->sellbillprice}
                                                {else}
                                                {$data->sellbillaftertotalbill}
                                                {/if}</td>
                                        </tr>
                                        {/foreach}
                                        <tr class="success">
                                            <td colspan="2">الإجمالي</td>
                                            <td>{$selltotalQTY} قطعة</td>
                                            <td>{$selltotalBills} {$currency}</td>

                                        </tr>
                                    </tbody>

                                </table>
                            </div>
                            <!--panel-body-->
                        </div>
                        <!--panel panel-default-->
                    </div><!--col-lg-4-->
                    <!--**********************************************************************-->
                    <div class="col-lg-4">
                        <div class="panel panel-default">
                            <!-- Default panel contents -->
                            <div class="panel-heading">الدفعات</div>
                            <div class="panel-body">
                                <table class="table">
                                    <thead>
                                        <tr>
                                            <th>التاريخ</th>
                                            <th>القيمة</th>
                                            <th>النوع</th>
                                        </tr>
                                    </thead>
                                    <tbody>

                                        {foreach $clientShowData as $data}
                                        {if $data->clientdebtchangeamount neq "0"}
                                        <tr>
                                            <td>{$data->clientdebtchangedate}</td>
                                            <td>{$data->clientdebtchangeamount}</td>
                                            <td>{$data->processname}</td>
                                        </tr>
                                        {/if}
                                        {/foreach}
                                        <tr class="success">
                                            <td>الإجمالي</td>
                                            <td>{$totalPrice} {$currency}</td>
                                            <td></td>
                                        </tr>
                                    </tbody>

                                </table>
                            </div>
                            <!--panel-body-->
                        </div>
                        <!--panel panel-default-->
                    </div><!--col-lg-4-->
                    <!--**********************************************************************-->
                    <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">
                                    <thead>
                                        <tr>
                                            <th>م</th>
                                            <!--                  <th>رقم الفاتورة</th>
                                            -->                  <th>تاريخ الفاتورة</th>
                                            <th>عدد الوحدات</th>
                                            <th>إجمالي الفاتورة</th>
                                        </tr>
                                    </thead>
                                    <tbody>

                                        {foreach $returnsellbillData as $data}
                                        <tr>
                                            <td>{$data->returnsellbillid}</td>
                                            <!--                <td>{$data->returnsellbillserial}</td>
                                            -->                <td>{$data->returnsellbilldate}</td>
                                            <td>{$data->returnsellQuantity}</td>
                                            <td>
                                                {if {$data->userid} eq -1}

                                                {$data->returnsellbillprice}
                                                {else}
                                                {$data->returnsellbillaftertotalbill}
                                                {/if}</td>
                                        </tr>
                                        {/foreach}

                                        <tr class="success">
                                            <td colspan="2">الإجمالي</td>
                                            <td>{$returntotalQTY} قطعة</td>
                                            <td>{$returntotalBills} {$currency}</td>

                                        </tr>
                                    </tbody>

                                </table>
                            </div>
                        </div>
                        <!--panel-body-->
                    </div>
                    <!--panel panel-default-->
                </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>
