
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">اداره الفولتير </a></li>
            <li><a href="userController.php?do=show">تقرير نسب {if $Programsettingdata->delegate_seller eq 0} البائعين {elseif $Programsettingdata->delegate_seller == 1}المندوبين {elseif $Programsettingdata->delegate_seller == 2}الاطباء {/if}</a></li>
            <li class="active"> تقرير نسب {if $Programsettingdata->delegate_seller eq 0} البائعين {elseif $Programsettingdata->delegate_seller == 1}المندوبين {elseif $Programsettingdata->delegate_seller == 2}الاطباء {/if}</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">تقرير نسب {if $Programsettingdata->delegate_seller eq 0} البائعين {elseif $Programsettingdata->delegate_seller == 1}المندوبين {elseif $Programsettingdata->delegate_seller == 2}الاطباء {/if}<br />
                {if $message != ""}
                {$message}
                {/if}
                <a href="{$youtubes[24]->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="userratereportController.php?do=show" method="post">
                    <div class="form-group">
                        <label class="sr-only">الموظف</label>
                        <select class="select2 wdt300"  name="sellerid" id="sellerid" >
                            <option value="-1">اختر {if $Programsettingdata->delegate_seller eq 0} بائع {elseif $Programsettingdata->delegate_seller == 1}مندوب {elseif $Programsettingdata->delegate_seller == 2}طبيب {/if}</option>
                            <option value="0">الكل </option>


                            {foreach $allsellier as $myallsellier}


                            <option value="{$myallsellier->userid}">{$myallsellier->employeename}</option>


                            {/foreach}


                        </select>
                    </div>
                    <div class="form-group">
                        <label class="sr-only">نوع السعر</label>
                        <select class="select2 wdt300"  name="priceType" id="priceType" >
                            <option value="-1">اختر </option>
                            <option value="0">جملة</option>
                            <option value="1">تجزئة</option>
                            <option value="2">نصف جملة</option>
                        </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="startDate" >
                    </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="endDate" >
                    </div>
                    <button type="submit" class="btn btn-primary">بحث</button>

                </form>
            </div>
            <hr/>

            {if !empty($selldata) || !empty($Returnselldata)  || !empty($Sellbillandruterndata) }

            <div class="row">

                <div class="well well-sm2">
                    <h4 class="text-center">إجمالي عدد الفواتير {count($selldata) + count($Returnselldata) + count($Sellbillandruterndata)}</h4>
                </div>

                <div class="well well-sm2">
                    <h4 class="text-center">إجمالي عدد القطع {$totalPiecesNo}</h4>
                </div>

                <div class="well well-sm2">
                    <h4 class="text-center">الاجمالى {$total} {$currency}</h4>
                </div>
                <div class="well well-sm2">
                    <h4 class="text-center">الاجمالى ببائع {$totalBillsWithSeller} {$currency}</h4>
                </div>


                <div class="well well-sm2">
                    <h4 class="text-center">نسبه {if $Programsettingdata->delegate_seller eq 0} بائع {elseif $Programsettingdata->delegate_seller == 1}مندوب {elseif $Programsettingdata->delegate_seller == 2}طبيب {/if} {$awardrate} %</h4>
                </div>


                <div class="well well-sm2">
                    <h4 class="text-center">المستحق لل{if $Programsettingdata->delegate_seller eq 0} بائع {elseif $Programsettingdata->delegate_seller == 1}مندوب {elseif $Programsettingdata->delegate_seller == 2}طبيب {/if} {$final} {$currency}</h4>
                </div>

            </div>



            <div class="clearfix"></div>

            <!-- Table -->
            <table class="table table-black dataTableClass">
                <thead>
                    <tr>
                        <th>الفاتوره</th>
                        <th>تاريخ الفاتوره</th>
                        <th>المجموع</th>
                        <th>عدد القطع</th>
                        <th>نوع السعر</th>
                        <th>البائع</th>
                        <th>العميل</th>
                        <th class="hidden-print">عرض </th>

                    </tr>
                </thead>
                <tbody>

                    {foreach $selldata as $myselldata}
                    <tr>
                        <td>فاتوره مبيعات</td>
                        <td>{$myselldata->sellbilldate}</td>
                        <td>{$myselldata->sellbillaftertotalbill}</td>
                        <td>{$myselldata->sellQuantity}</td>
                        <td>{if $myselldata->pricetype eq 0}جملة{elseif $myselldata->pricetype eq 1}تجزئة{elseif $myselldata->pricetype eq 2}نصف جملة{/if}</td>
                        <td>{$myselldata->username}</td>
                        <td>{$myselldata->clientname}</td>
                        <td class="hidden-print"> <a href="sellbillController.php?do=editprint&id={$myselldata->sellbillid}" type="button" class="btn btn-default btn-lg editicon"></a> </td>
                    </tr>
                    {/foreach}


                    {foreach $Returnselldata as $myReturnselldata}
                    <tr class="danger">
                        <td>فاتوره مردودات</td>
                        <td>{$myReturnselldata->returnsellbilldate}</td>
                        <td>{$myReturnselldata->returnsellbillaftertotalbill}</td>
                        <td>{$myReturnselldata->returnsellQuantity}</td>
                        <td>{if $myReturnselldata->pricetype eq 0}جملة{elseif $myReturnselldata->pricetype eq 1}تجزئة{elseif $myReturnselldata->pricetype eq 2}نصف جملة{/if}</td>
                        <td>{$myReturnselldata->username}</td>
                        <td>{$myReturnselldata->clientname}</td>
                        <td class="hidden-print"> <a href="returnsellbillController.php?do=editprint&id={$myReturnselldata->returnsellbillid}" type="button" class="btn btn-default btn-lg editicon"></a> </td>
                    </tr>
                    {/foreach}


                    {foreach $Sellbillandruterndata as $mySellbillandruterndata}
                    <tr>
                        <td>فاتوره  مبيعات ومردودات</td>
                        <td>{$mySellbillandruterndata->sellbilldate}</td>
                        <td>{$mySellbillandruterndata->sellbillaftertotalbill}</td>
                        <td>{$mySellbillandruterndata->sellQuantity - $mySellbillandruterndata->returnsellQuantity}</td>
                        <td>{if $mySellbillandruterndata->pricetype eq 0}جملة{elseif $mySellbillandruterndata->pricetype eq 1}تجزئة{elseif $mySellbillandruterndata->pricetype eq 2}نصف جملة{/if}</td>
                        <td>{$mySellbillandruterndata->username}</td>
                        <td>{$mySellbillandruterndata->clientname}</td>
                        <td class="hidden-print"> <a href="sellbillandruternController.php?do=editprint&id={$mySellbillandruterndata->sellbillid}" type="button" class="btn btn-default btn-lg editicon"></a> </td>
                    </tr>
                    {/foreach}


                </tbody>

            </table>
            {/if}
        </div>
    </div>
</div>



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