
<style>
    .nodata{
        background-color: #72B4EC;
        color: white;
        border-radius: 13px;
        margin: 14px;
        font-size: 24px;
        text-align: center;
        padding: 5px;
    }

</style>
{if $allDataArrCount>0}
<form class="form-horizontal" role="form" action="clientreceiptController.php?do=payed" id="paynetwork-form" method="post" >
    <input type="hidden" id="currentitr" name="currentitr" value="1"/>
    <div class="form-group">
        <label for="clientpayed" class="col-lg-2 control-label"> المبلغ المدفوع</label>
        <div class="col-lg-4">
            <div class="input-group">
                <input type="text" name="clientpayed" id="clientpayed"  class="form-control positiveNo" />
                <span class="input-group-addon">جنية</span>
            </div>
        </div>
    </div>


    <div class="form-group">
        <label for="payedtype" class="col-lg-2 control-label">  نوع الدفع</label>
        <div class="col-lg-4">
            <label><input type="radio" name="payedtype" id="payedtypecash" class="payedtypeck" value="0" checked /> نقدى</label>
            <label>
                <input type="radio" name="payedtype" id="payedtypeshapk" class="payedtypeck" value="1" /> شبكة</label>
            <label>
                <input type="radio" name="payedtype" id="payedtypeshapk" class="payedtypeck" value="2" /> بنك</label>

        </div>
    </div>
    <!-- =================================================   -->

    <div id="check-div" style="display:none;">
        <div class="form-group">
            <label for="paynetwork" class="col-lg-2 control-label"> الشبكة</label>
            <div class="col-lg-4">
                <select class="select2 wdt100" name="paynetwork" id="paynetwork">
                    <option value="-1">اختر الشبكة</option>
                    {foreach $paymentmethod as $data}
                    <option value="{$data->id}">{$data->name}</option>
                    {/foreach}
                </select>
            </div>
        </div>
    </div>

    <div id="bank-div" style="display: none">
        <div class="form-group">
            <label class="col-lg-2 control-label">البنك</label>
            <div class="col-lg-4">
                <select class="select2 wdt100" name="bankid" id="bankid" required>
                    <option value=""></option>
                    {foreach $banks as $data}
                    <option value="{$data->bankid}">{$data->bankname}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="form-group mg-bt5">
            <label class="col-lg-2 control-label">الحساب</label>
            <div class="col-lg-4">
                <select class="select2 wdt100" name="bankaccountid" id="bankaccountid" required>
                    <option value=""></option>
                </select>
            </div>
        </div>
    </div>

    <!-- =================================================   -->

    <input type="hidden" name="billid" id="billid"   />
    <input type="hidden" name="billtype" id="billtype"  />
    <input type="hidden" name="billclientid" id="billclientid"  />
    <input type="hidden" name="debtbefore" id="debtbefore"  />
    <input type="hidden" name="searchClientId" value="{$searchClientId}"/>
    <input type="hidden" name="searchDate" value="{$searchDate}"/>
    <input type="hidden" name="mypaymethod" id="mypaymethod" value="{$paymethod}"/>
    <!-- =================================================   -->
    <br/>
    <br/>
    <br/>


    <div id="mydivToPay">

        <table class="table table-black">
            <thead>
                <tr>
                    <th style="width:50px;">م</th>
                    <th>رقم الفاتورة</th>
                    <th>تفاصيل الفاتورة</th>
                    <th> باقى المديونية على الفاتورة</th>
                    <th>تاريخ الفاتورة</th>
                    <th> المدفوع</th>
                    <th> المتبقى</th>

                </tr>
            </thead>
            {assign var=i value=1}
            {foreach $allDataArr as $data}
            {if $data->userid=="0"}
            <tr>
                <th style="width:50px;">{$i}</th>

                <th><a target="_blank" href="sellbillController.php?do=showDetail&sellbillid={$data->sellbillid}" style="color: blue;"><u>{$data->sellbillid}</u></a></th>
                <th><a target="_blank" href="sellbillController.php?do=showDetail&sellbillid={$data->sellbillid}" style="color: blue;"><u>التفاصيل</u></a></th>
                <th><span id="sellbillremain{$i}"> {$data->sellbillfinalbill}</span></th>
                <th>{$data->theDate}</th>
                <th><input type="text" class="payedVal positiveNo" data-itr="{$i}" data-id="{$data->sellbillid}" data-type="0" data-clientid ="{$data->sellbillclientid}"  data-debtbefore ="{$data->sellbillfinalbill}" value="" /> </th>
                <th><span id="remain{$i}"> {$data->sellbillfinalbill}</span></th>
            </tr>
            {else $data->userid==1}
            <tr>
                <th style="width:50px;">{$i}</th>
                <th><a target="_blank" href="bills.php?do=details&id={$data->id}" style="color: blue;"><u>{$data->id}</u></a></th>
                <th><a target="_blank" href="bills.php?do=details&id={$data->id}" style="color: blue;"><u>التفاصيل</u></a></th>
                <th><span id="sellbillremain{$i}">  {$data->waitvalue}</span></th>
                <th>{$data->theDate}</th>
                <th> <input type="text" class="payedVal positiveNo" data-itr="{$i}" data-id="{$data->id}" data-type="1" data-clientid="{$data->clientid}" data-debtbefore ="{$data->waitvalue}"  value="" /></th>
                <th><span id="remain{$i}"> {$data->waitvalue}</span></th>

            </tr>
            {/if}
            {assign var=i value=$i+1}
            {/foreach}

        </table>

    </div>
    <div class="col-lg-offset-8 col-lg-4">
        <div class="well well-sm">
            <h4 class="text-center">إجمالي مديونية العميل بعد <br>
                <span id="totalDebtAfter"></span>  </h4>
        </div>
    </div>





    <div style="clear: both"></div>
    <div class="form-group noprint">
        <label for="payedtype" class="col-lg-4 control-label"></label>
        <div class="col-lg-8">
            <button type="button" id="submit_paynetwork" class="btn btn-primary">حفظ الامر</button>
        </div>
    </div>

</form>
{else}
<div style="clear: both"></div>
<div class="nodata">عفوا لا توجد نتائج</div>
{/if}

{literal}
<script>
    $(document).ready(function () {
        $(".positiveNo").forcepositiveNum();
    });

</script>
{/literal}