
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">خصائص عامة</a></li>
            <li><a href="clientReportsController.php?do=clientShowByArea">العملاء</a></li>
            <li class="active">تقرير شامل العملاء</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">تقرير شامل للعملاء

                {if $message != ""}
                {$message}
                {/if}</div>

            <div class="panel-body">
                <form class="form-inline hidden-print" action="clientReportsController.php?do=clientShowByArea" method="post">
                    <div class="form-group">
                        <label class="sr-only">الشركة</label>
                        <select class="select2 wdt300"  name="id" id="id" >
                            <option value="-1">اختر الشركة</option>


                            {foreach $allclientareadrop as $myallclientareadrop}


                            <option value="{$myallclientareadrop->id}">{$myallclientareadrop->name}</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>
                    <button type="submit" class="btn btn-primary">بحث</button>
                </form>
            </div>
            <hr/>
            <table class="table billtable table-bordered table-black">
                <thead>
                    <tr>
                        <th>وصف العمليه</th>
                        <th>المبيعات</th>
                        <th>المدفوعات</th>




                        <th>الرصيد

                        </th>
                        <th>البيان</th>
                        <th>التاريخ</th>
                    </tr>
                </thead>
                <tbody>
                    {assign var=i value=1}

                    {foreach $shownData as $data}


                    {if {$data->clientdebtchangeid} > 0}


                    {if {$data->clientdebtchangetype} eq 1}
                    <tr class="danger">
                        {elseif {$data->clientdebtchangetype} eq 0}

                    <tr>
                        {/if}


                        <td>{$data->processname}</td>

                        <td>
                            {if ($data->tablename eq "sellbillandruternController.php" ||  $data->tablename eq "sellbillController.php" )}
                            {foreach  $myselldata{$i}  as  $mymyselldata{$i}}

                            {if $mymyselldata{$i}->selltype <> 1}
                            {$mymyselldata{$i}->sellbilldetailtotalprice}
                            {else}
                            ( {$mymyselldata{$i}->sellbilldetailtotalprice} -)
                            {/if}


                            <br />

                            {/foreach}



                            {else  $data->tablename eq "ruternsellbillController.php" }
                            {foreach  $myselldata{$i}  as  $mymyselldata{$i}}


                            ( {$mymyselldata{$i}->returnsellbilldetailtotalprice} -)



                            <br />

                            {/foreach}
                            {/if}



                        </td>


                        <td>{$data->sellbilltotalpayed}</td>

                        <td><div {if {$data->clientdebtchangetype} eq 1} style="float:left;  margin: 10px 10px 10px 10px;"  {else} style="float:right; margin: 10px 10px 10px 10px;"  {/if} >
                                {$data->sellbillfinalbill}
                            </div></td>
                        <td>  {foreach  $myselldata{$i}  as  $mymyselldata{$i}}
                            {$mymyselldata{$i}->sellbilldetailquantity} {$mymyselldata{$i}->returnsellbilldetailquantity}   {$mymyselldata{$i}->unitName}  {$mymyselldata{$i}->productName}
                            <br />

                            {/foreach}</td>

                        <td>{$data->clientdebtchangedate}</td>
                    </tr>


                    {/if}

                    {capture assign=i}{$i+1}{/capture}
                    {/foreach}
                    <!--<tr>
                   {if $burex <> 1}
                     <td></td>
                  <td></td>
                     <td></td>
                  <td></td>
                  <td></td>
                  {else}
                     <td></td>
                       <td></td>
                     <td></td>
                  <td></td>
                  {/if}
                  <td> <table border="1" width="100%"  style="text-align:center" >
                         <tr><td width="50%">  {$j}</td><td width="50%">{$k}</td></tr>

                      </table>
                    </td>


                  </tr>-->
                </tbody>

            </table>

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