<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;
    }
</style>

<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">التقارير</a></li>
            <li><a href="savedailyController.php?do=show2">تقرير يومية باليوم</a></li>
            <li class="active">عرض التقرير</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">تقرير يومية باليوم</div>
            <div class="panel-body">
                <form class="form-inline hidden-print " action="savedailyController.php?do=show3" method="post">

                    {if $searchinonesave eq 0}
                    <div class="form-group">
                        <label class="sr-only">الخزنة</label>
                        <select class="select2 wdt100"  name="saveId" id="saveid" >
                            <option value="-1">اختر خزنة</option>


                            {foreach $saveData as $save}


                            <option value="{$save->saveid}">{$save->savename}</option>


                            {/foreach}


                        </select>
                    </div>

                    {/if}

                    <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>
                    {/if}
                    <input type="hidden" name="showbyday" value="1"/>
                    <button type="submit" class="btn btn-primary">بحث</button>
                </form>
            </div>

            <div class="clearfix"></div>
            <hr/>
            <div class="panel panel-default panel-m">
                <!-- Default panel contents -->
                <div class="panel-heading">{$message}</div>
                {if count($savedailyData)>0}
                <div class="panel-body"> {if {count($savedailyData)} > 0}
                    <div class="col-lg-offset-8 col-lg-4">
                        {if $savedailydate eq 1}
                        <div class="well well-sm">
                            <h4 class="text-center">الاجمالى {$sumValue} {$currency}</h4>
                        </div>

                        {/if}
                    </div>

                    <div class="col-lg-offset-8 col-lg-4">
                        <div class="well well-sm">
                            <h4 class="text-center">قيمة التغير {$changeAmountSum} {$currency}</h4>
                        </div>
                    </div>
                    {/if}
                    <div class="clearfix"></div>
                    <table class="table table-black" style="width:100%">
                        <thead>
                            <tr>
                                <th>التاريخ</th>
                                <th> القيمة المتغيرة
                                </th>
                                <th class="hidden-print ">تفاصيل </th>
                            </tr>
                        </thead>
                        <tbody>
                            {foreach from=$savedailyData key=mykey item=myvalue}
                            {if $myvalue < 0}
                            <tr class="danger"> {else}

                            <tr> 
                                {/if}
                                <td nowrap="nowrap">{$mykey}</td>
                                <td> {$myvalue} </td>
                                <td class="hidden-print ">
                                    <a href="savedailyController.php?do=show2&saveId={$saveId}&from={$mykey}&to={$mykey}" target="_blank" type="button" class="btn btn-default btn-lg editicon"></a>
                                </td>
                            </tr>
                            {/foreach}
                        </tbody>



                    </table>
                    <div class="col-lg-offset-8 col-lg-4">
                        {if $savedailydate eq 1}
                        <div class="well well-sm">

                            <h4 class="text-center">الاجمالى {$sumValue} {$currency}</h4>

                        </div>
                        {/if}
                    </div>
                    <div class="col-lg-offset-8 col-lg-4">
                        <div class="well well-sm">
                            <h4 class="text-center">قيمة التغير {$changeAmountSum} {$currency}</h4>
                        </div>
                    </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>
            {else}
            <div class="nodata">عفوا لا توجد نتائج</div>
            {/if}
        </div>

        {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();
            }
        </script>
        {/literal}
