<style>
    .myresult {
        -webkit-print-color-adjust: exact;
    }
</style>
<script src="{$path}/SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script>

    function getname()
    {

        document.getElementById("nameopration").value = ($("#operationname option:selected").text());

    }
</script>
<link href="{$path}/SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />

<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"> تقرير الشبكة
                <a href="{$youtubes[248]->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="networkreport.php?do=show" method="post">
                    <div class="form-group">
                        <label class="sr-only">الشبكة</label>
                        <select class="select2 wdt100"  name="network" id="network" >
                            <option value="-1">اختر شبكة</option>
                            {foreach $allNetworks as $network}
                            <option value="{$network->id}">{$network->name}</option>
                            {/foreach}
                        </select>
                    </div>
                    <div class="form-group">
                        <label class="sr-only">الفرع</label>
                        <select class="select2 wdt100"  name="branch" id="branch" >
                            <option value="-1">اختر فرع</option>
                            {foreach $allbranches as $branch}
                            <option value="{$branch->branchId}">{$branch->branchName}</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>
                    <br/>
                    <div class="form-group">

                        <input type="checkbox" name="reportType"  value="1"/>
                        <label class="sr-only">    مجمل اليوم</label>

                    </div>
                    <input type="submit" class="btn btn-primary" value="بحث"/>
                </form>
            </div>
            <div class="panel panel-default panel-m">
                <!-- Default panel contents -->
                <div class="panel-heading">{$message}</div>
                <div class="panel-body">
                    <hr/>
                    <table class="table table-black">
                        <thead>
                            <tr>
                                {if $type neq 1}
                                <th>رقم الفاتورة </th>
                                <th>تاريخ الفاتورة</th>
                                <th>اسم العميل</th>
                                {/if}
                                <th>الشبكة</th>
                                {if $type eq 1}
                                <th>التاريخ </th>
                                <th>إجمالي المدفوع بالشبكة</th>
                                <th>إجمالي المستحق للشبكة</th>
                                {else}
                                <th>قيمة الفاتورة</th>
                                <th>قيمة المدفوع بالشبكة</th>
                                <th>قيمة المستحق للشبكة</th>
                                {/if}
                            </tr>
                        </thead>
                        <tbody>
                            {assign var=i value=1}
                            {foreach $allData as $data}
                            <tr>
                                {if $type neq 1}
                                <td>{$data->billno}</td>
                                <td>{$data->billdate}</td>
                                <td>{$data->clientname}</td>
                                {/if}
                                <td>{$data->networkname}</td>

                                {if $type eq 1}
                                <td>{$data->billdate}</td>
                                <td>{$data->totalNet}</td>
                                <td>{$data->totalCarry}</td>
                                {else}
                                <td>{$data->netbillvalue}</td>
                                <td>{$data->cardvalue}</td>
                                <td>{if $data->paymentnetworkid eq 4}---{else}{($data->cardvalue * $data->netdiscountpercent)/100}{/if}</td>
                                {/if}
                            </tr>
                            {capture assign=i}{$i+1}{/capture}
                            {/foreach}
                            {if $madaData->totalCarry > 0}
                            <tr>
                                <td>مدا</td>
                                <td>{$data->billdate}</td>
                                <td>{$madaData->totalNet}</td>
                                <td>{$madaData->totalCarry}</td>
                            </tr>
                            {/if}
                            <tr  class="black" style="background-color: #f1e4e4; font-size: large;">
                                <td {if $type neq 1}colspan="4"{else}colspan="2"{/if}>الإجمالي </td>
                                {if $type eq 1}
                                <td>{$payedTotal}</td>
                                <td>{$netTotal}</td>
                                {else}
                                <td>{$billTotal}</td>
                                <td>{$payedTotal}</td>
                                <td>{$netTotal}</td>
                                {/if}
                            </tr>
                        </tbody>

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

            </div>
        </div>
        {literal}
        <script type="text/javascript">

        </script>
        {/literal}
        <script type="text/javascript">
            var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
            var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
        </script>
