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

    @media print {
        #ResultTable th, #ResultTable td {
            padding: 20px !important;
        }
    }
</style>

<div class="row">
    <div class="container {if $lang_code == 'en'} gt4-ltr{/if}">
        <ol class="breadcrumb">
            <li><a href="#">التقارير</a></li>
            <li><a href="savedailyController.php?do=show">تقرير حركة للخزنه مجمع</a></li>
            <li class="active">عرض التقرير</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">تقرير حركة للخزنه مجمع
                <a href="{$youtubes[118]->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="savedailyController.php?do=joined" method="post">

                    <div class="form-group">
                        <label class="sr-only">الخزنة</label>
                        <select class="select2 wdt300"  name="saveId" id="saveid" >
                            <option value="-1">اختر خزنة</option>
                            {foreach $saveData as $save}
                            <a href="show_ltr.html"></a>
                            <option value="{$save['saveid']}">{$save['savename']}</option>
                            {/foreach}
                        </select>

                    </div>
                    <div class="form-group">
                        <label class="sr-only">المستخدم</label>
                        <select class="select2 wdt300"  name="userId" id="userId" >
                            <option value="-1">  اختر مستخدم </option>
                            {foreach $usersData as $data}
                            <option value="{$data->userid}">{$data->employeename}</option>
                            {/foreach}
                        </select>
                    </div>
                    <div class="form-group">
                        <label class="sr-only">خزن مجمعة </label>
                        <input type="checkbox" class="" name="mergeSaves" checked="checked" value="1">
                    </div>
                    <br/>

                    {if $savedailydate eq 1}
                    <div id="dateTimeDiv">
                        <div class="form-group">
                            <label class="sr-only">من التاريخ</label>
                            <div  class="input-group date form_datetime col-md-5" data-date="" data-date-format="yyyy-mm-dd  h:i:s" data-link-field="dtp_input1">
                                <input class="form-control" size="16" type="text" value="" name="from" id="from" readonly="" >
                                <span class="input-group-addon " style="width: 0%;"><span class=" glyphicon glyphicon-remove col-lg-4"></span></span>
                                <span class="input-group-addon"  style="width: 0%;"><span class="glyphicon glyphicon-th col-lg-4"></span></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="sr-only">إلى التاريخ</label>
                            <div  class="input-group date form_datetime col-md-5" data-date="" data-date-format="yyyy-mm-dd  h:i:s" data-link-field="dtp_input1">
                                <input class="form-control" size="16" type="text" value="" name="to" id="to" readonly="" >
                                <span class="input-group-addon " style="width: 0%;"><span class=" glyphicon glyphicon-remove col-lg-4"></span></span>
                                <span class="input-group-addon" style="width: 0%;"><span class="glyphicon glyphicon-th col-lg-4"></span></span>
                            </div>
                        </div>
                    </div>

                    <div id="dateOnlyDiv">
                        <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>
                    </div>

                    <div class="form-group">
                        <label class="sr-only">بحث بـ</label>
                        <div  class="input-group">
                            <label>  <input value="dateOnly" name="search" id="searchdateOnly" type="radio" checked onclick='localStorage.setItem("search", "dateOnly");
                                    window.location.reload();'>
                                تاريخ</label>
                            <label>
                                <input value="dateTime" name="search" id="searchdateTime" type="radio" onclick='localStorage.setItem("search", "dateTime");
                                        window.location.reload();'>
                                تاريخ ووقت</label>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                    <button type="submit" class="btn btn-primary">بحث</button>
                </form>
                {/if}
            </div>

            <div class="clearfix"></div>
            <hr/>
            <div class="panel panel-default panel-m">
                <div class="panel-heading">{$message}<br/>
                <span class="prntdat panel-heading" style="display: none;">تاريخ الطباعة:  <span class="panel-heading" id="printDate"></span></span>
                </div>

                <table class="table table-black" id="ResultTable">
                    <thead >
                        <tr style="text-align:center">
                            <th>البيان</th>
                            <th>وارد نقدا</th>
                            <th>منصرف نقدا</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>فواتير مبيعات نقديه </td>
                            <!--<td>{$payedLaterNakdiVal}</td>-->
                            <td>{$payedSellBillVal}</td>
                            <td> </td>
                        </tr>
                        <tr>
                            <td>مصروفات </td>
                            <td> </td>
                            <td>{$expensesVal}</td>
                        </tr>
                        <tr>
                            <td>مرتجع بيع </td>
                            <td> </td>
                            <td>{$payedRetSellBillVal}</td>
                            <!--<td>{$payedDeptRetSellBillVal}</td>-->
                        </tr>
                        <tr>
                            <td>دفعات سداد نقدا</td>
                            <td> </td>
                            <td>{$cashPayed}</td>
                            <!--<td>{$payedDeptSellBillVal}</td>-->
                        </tr>
                        <tr>
                            <td>دفعات تحصيل اجل</td>
                            <td>{$laterPayed}</td>
                            <!--<td>{$payedDeptVal}</td>-->
                            <td> </td>
                        </tr>
                        <tr>
                            <td>رصيد سابق بالخزينه</td>
                            <td>{$valueFirstOfPeriod}</td>
                            <td> </td>
                        </tr>
                        <!-- {foreach $saveArrData as $saveId => $save}
                        {if $save.totalChange}
                        <tr>
                            <th>{$save.savename}</th>
                            <th>{if $save.totalChange > 0}{$save.totalChange} {/if}</th>
                            <th>{if $save.totalChange < 0}{abs($save.totalChange)} {/if}</th>
                        </tr>
                        {/if}
                        {/foreach} -->
                    </tbody>
                     <tfoot style="background-color:rgb(225, 226, 227)!important;">
                        <tr class="foot">
                            <td>اجمالى الحركات</td>
                            <td>{$totalIncome}</td>
                            <td>{$totalexp}</td>
                        </tr>
                        <!-- <tr class="foot">
                            <td>باقى بالخزينة</td>
                            <td>{if $net >=0}{abs($net)}{/if}</td>
                            <td>{if $net <0}{abs($net)}{/if}</td>
                        </tr> -->
                    </tfoot>
                    <tbody>
                        <tr>
                            <th>أرصدة الخزن الحالية</th>
                            <th colspan="2">{$allCurrentVal}</th>
                        </tr>
                        {foreach $saveArrData as $saveId => $save}
                        {if $save.currentVal != 0} 
                        <tr>
                            <td>{$save.savename}</td>
                            <td>{if $save.currentVal >=0}{abs($save.currentVal)}{/if}</td>
                            <td>{if $save.currentVal <0}{abs($save.currentVal)}{/if}</td>
                        </tr>
                        {/if}
                        {/foreach}
                    </tbody>
                </table>
                <br/>
                <!--class="panel-heading"-->
                <div style="font-size: 14px;">{$allCurrentValWritten}{*$netWritten*}</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" id="printData" class="btn btn-success pull-right">طباعة</button>
                            </div>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>




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

            </div>
        </div>
        <!--<input id="ddrt" name="ddrt" value="">-->
        {literal}
        <script>
            var search = localStorage.getItem("search");
            if (search == "dateTime") {
                $('#searchdateTime').attr('checked', 'checked');
                $('#searchdateOnly').removeAttr('checked');
                //
                $('#dateTimeDiv').show();
                $('#dateOnlyDiv').remove();
            } else {
                $('#searchdateOnly').attr('checked', 'checked');
                $('#searchdateTime').removeAttr('checked');
                //
                $('#dateOnlyDiv').show();
                $('#dateTimeDiv').remove();
            }
            var db = Number(localStorage.getItem("db"));
            if (db == 1) {
                $('#db').attr('checked', 'checked');
            } else {
                $('#db').removeAttr('checked');
            }

            $('#printData').on('click',function(){
                var dt = new Date();
                var month =1;
                month += Number(dt.getMonth()) ;
                var time = dt.getDate() +"-"+ month +"-"+ dt.getFullYear() +" "+ dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds();
                $('#printDate').html(time);
                $('.prntdat').css('display','inline');
                print_Custom('mycustomheader');
                $('.prntdat').css('display','none');

            });
            /*
             //write number at input id=ddrt, mark it with sucess class @ value columns
             $('#ddrt').on('blur', function () {
             var val = $(this).val();
             $('.ddrt td').each(function () {
             if ($(this).text().trim() == val) {
             $(this).parent().parent().addClass('success');
             }
             })
             })
             $('.ddrt').on('click', function () {
             $(this).addClass('success');
             })
             */
        </script>
        {/literal}