<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[123]->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="supplierReportsController.php?do=all" method="post">
                    <div class="form-group">
                        <label class="sr-only">اختر مورد</label>
                        <select data-placeholder="اختر مورد" class="select2 wdt300" name="supplierid" id="supplierid">
                            <option value="-1"></option>


                            {foreach $supplierData as $supplier}


                            <option value="{$supplier->supplierid}">{$supplier->suppliername}</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" id="datepicker_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="datepicker_to">
                    </div>
                    <button type="submit" class="btn btn-primary">بحث</button>
                </form>
            </div>
            <hr />
            <table class="table-black" width="200" border="1" align="center">
                <tr>
                    <td>رصيد المورد :</td>
                    <td>{$supplierDept->suppliercurrentDebt} {$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">
                            <thead>
                                <tr>
                                    <th>م</th>
                                    <!--                <th>رقم الفاتورة</th>
                                    -->
                                    <th>تاريخ الفاتورة</th>
                                    <th>عدد الوحدات</th>
                                    <th>إجمالي الفاتورة</th>
                                </tr>
                            </thead>
                            <tbody>

                                {foreach $buybillData as $data}
                                <tr>
                                    <td rowspan="2">{$data->buybillid}</td>
                                    <!--              <td>{$data->buybillSerial}</td>
                                    -->
                                    <td>{$data->buybilldate}</td>
                                    <td>{$data->totalQty}</td>
                                    <td>{$data->buybillaftertotalbill}</td>
                                </tr>

                                <tr>
                                    {if {$data->comment}}
                                    <td colspan="3" style="text-align: center;">التعليق: {$data->comment}</td>
                                    {/if}
                                </tr>
                                {/foreach}

                                <tr class="success">
                                    <td colspan="2">الإجمالي</td>
                                    <td>{$buytotalQTY} قطعة</td>
                                    <td>{$buytotalBills} {$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 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>
                                </tr>
                            </thead>
                            <tbody>

                                {foreach $SupplierShowData as $data}
                                {if $data->supplierdebtchangeamount neq "0"}
                                {if $data->del == 1}
                                <tr class="danger">
                                    {else}
                                <tr>
                                    {/if}
                                    <td>{$data->supplierdebtchangedate}</td>
                                    <td>{$data->supplierdebtchangeamount}</td>
                                    <td>{$data->processname}{if $data->processname == "دفع
                                        شيك"}({$data->bankname})/({$data->accountname}){/if}</td>
                                </tr>
                                {/if}
                                {/foreach}
                                {foreach $buybillData as $data}
                                {if $data->buybilltotalpayed !=0}
                                {*if $data->buybilltotalpayed > $data->buybillaftertotalbill*}
                                <tr>
                                    <td>{$data->buybilldate}</td>
                                    <!--td>{$data->sellbilltotalpayed - $data->sellbillaftertotalbill}</td-->
                                    <td>{$data->buybilltotalpayed}</td>
                                    <td>دفعة فى فاتورة مشتريات</td>
                                </tr>
                                {*/if*}
                                {/if}
                                {/foreach}
                                {foreach $returnbuybillData as $data}
                                {if $data->buybilltotalpayed !=0}
                                {*if $data->buybilltotalpayed > $data->buybilltotalpayed*}
                                <tr>
                                    <td>{$data->buybilldate}</td>
                                    <!--td>{$data->sellbilltotalpayed - $data->sellbillaftertotalbill}</td-->
                                    <td>{$data->buybilltotalpayed}</td>
                                    <td>دفعة فى فاتورة المشتريات والمرتجعات</td>
                                </tr>
                                {*/if*}
                                {/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 $returnbuybillData as $data}
                                <tr>
                                    <td rowspan="2">{$data->returnbuybillid}</td>
                                    <!--              <td>{$data->returnbuybillSerial}</td>
                                    -->
                                    <td>{$data->returnbuybilldate}</td>
                                    <td>{$data->totalQty}</td>
                                    <td>{$data->returnbuybillaftertotalbill}</td>
                                </tr>
                                <tr>
                                    {if $data->comment}
                                    <td colspan="3" style="text-align: center;"> التعليق: {$data->comment}</td>
                                    {/if}
                                </tr>
                                {/foreach}


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

                                </tr>
                            </tbody>

                        </table>
                    </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>
                        </div>
                    </div>
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="clearfix"></div>
        </div>
    </div>
</div>