

<div class="row">
    <div class="container">
         <ol class="breadcrumb">
            <li><a href="#"> التقارير </a></li>
            <li><a href="clientsexpensereport.php">  تقرير عملاء و مصروفات  </a></li>
            <li class="active">عرض   </li>
        </ol>

        <div class="panel panel-default panel-m">
            <form class="form-inline hidden-print" id="searchdata"  method="post" action="realestateunits.php?do=show">
                    
                   
                    <div class="form-group"  style="width: 180px;">
                        <label class="sr-only">من التاريخ</label>
                        <input type="text" class="form-control awdatepicker searchdata" autocomplete="off"   data-date-format="yyyy-mm-dd" name="start_date" id="start_date" value="{$date}">
                    </div>
                    <div class="form-group" style="width: 180px;">
                        <label class="sr-only">إلى التاريخ</label>
                        <input type="text" class="form-control awdatepicker searchdata" autocomplete="off"   data-date-format="yyyy-mm-dd" name="end_date" id="end_date" value="{$date}">
                    </div>
                    <!-- <div class="form-group"  >
                        <label class="sr-only">المالك</label>
                        <div style="width: 180px;">
                             <input type="text" name="supplierid" class="searchdata wdt100" id="select2supplier" data-placeholder="اختر " />
                        </div> 
                    </div> -->
                     

                    <div class="form-group"  >
                        <label class="sr-only">العملاء</label>
                        <div style="width: 180px;">
                            <input type="text" name="clientid" class="searchdata wdt100" id="select2client" data-placeholder="اختر " />
                        </div> 
                    </div>

                  <!--    <div class="form-group"  >
                        <label class="sr-only">العقارات</label>
                        <div style="width: 180px;">
                            <input id="select2realestates" type="text" name="realestateid" class="searchdata "  data-placeholder="اختر  العقار"   /> 
                        </div> 
                    </div>
                     <div class="form-group"  >
                        <label class="sr-only">الوحدات</label>
                        <div style="width: 180px;">
                            <input id="select2realestatesunits" type="text" name="realestateunitid" class="searchdata "  data-placeholder="اختر  الوحده"  /> 
                        </div> 
                    </div> -->
                </form>
            <hr/>
            <div id="getdata">
                
            </div>
            <div class="clearfix"></div>
        </div>
    </div>
</div>


{literal}
<script type="text/javascript">
$(document).ready(function () {
        var formatResult;
        formatResult = function (data) {return  data.text;}
           dssd();
          function dssd() {
            var start_date = $("#start_date").val();
             var end_date = $("#end_date").val();
             var clientid = $("#select2client").val();
              $.post('clientsexpensereport.php?do=getdata', {start_date: start_date, end_date: end_date, clientid: clientid}, function (result) {
                $("#getdata").html(result);
                $("#tspaids").html($("#gtspaids").text());
                $("#tepaids").html($("#gtepaids").text());
                $("#tcpaids").html($("#gtcpaids").text());
                $("#tcspaids").html($("#gtcspaids").text());
              });
          }

          $('body').on('change', '.searchdata', function () {
            var start_date = $("#start_date").val();
             var end_date = $("#end_date").val();
             var clientid = $("#select2client").val();
              $.post('clientsexpensereport.php?do=getdata', {start_date: start_date, end_date: end_date, clientid: clientid}, function (result) {
                $("#getdata").html(result);

               $("#tspaids").html($("#gtspaids").text());
                $("#tepaids").html($("#gtepaids").text());
                $("#tcpaids").html($("#gtcpaids").text());
                $("#tcspaids").html($("#gtcspaids").text());

              });
            });



         $("#select2client").select2({
            placeholder: "إسم  المشروع",
            multiple: false,
            quietMillis: 100,
            ajax: {
                url: "realestateunits.php?do=select2client",
                type: "post",
                dataType: 'json',
                data: function (term, page) {
                    return {
                        searchTerm: term,
                    };
                },
                results: function (data) {
                    return {results: data};
                }
            },
            formatResult: formatResult,
            initSelection: function (element, callback) {
                var item = element.val().split(':');
                var data = {id: item[0], text: item[1]};
                callback(data);
            }
        });




    
});  
</script>
{/literal}
