<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">{$smarty.const.EXPENSES_REVENUE}</a></li>
            <li><a href="#"> {$smarty.const.REVENUE}</a></li>
            <li class="active">{$smarty.const.REVENUE_SHOW}</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading" style="padding:5px 15px 15px">
                <h3 class="panel-title" style="display: inline-block;">{$smarty.const.REVENUE_SHOW}</h3>
                <a href="{$youtubes[102]->url}" target="_blank" class="hidden-print"><img src="../views/default/assets/img/youtube.png" class="pull-left" alt="Youtube" style="width: 2%;"></a>
                <a href="incomeController.php" class="hidden-print"><input type="button" style="margin-left: 12px" id="submit"  class="btn btn-primary pull-left " value="{$smarty.const.REVENUE_ADD_NEW}"/></a>
            </div>
            <div class="panel-body">

                <!---------- start outputString alert ----------->
                <div id="outputString" class="alert alert-block alert-success fade in" style="display:none">
                    <button type="button" class="close pull-left" data-dismiss="alert" aria-hidden="true">&times;</button>
                    <p id="outputStringValue">{$outputString}</p>
                    <div class="clearfix"></div>
                </div>
                <!---------  end outputString alert ------------>

                <form class="form-inline hidden-print" method="post" action="incomeController.php?do=show">
                    <div class="form-group">
                        <label class="sr-only">{$smarty.const.REVENUE_NAME_TYPE}</label>
                        <select data-placeholder="{$smarty.const.REVENUE_CHOOSE_TYPE}"  class="select2 wdt100"  name="incomeTypeId" id="incomeTypeId" >
                            <option value="-1">{$smarty.const.REVENUE_CHOOSE_TYPE}</option>


                            {foreach $alldata as $type}

                            <option value="{$type->incomeTypeId}">{$type->incomeTypeName}</option>

                            {/foreach}

                        </select>

                    </div>
                    <div class="form-group"   >
                        <label class="sr-only">{$smarty.const.REVENUE_COST_CENTER}</label>
                            <select class="select2 wdt100" name="Costcenterid" id="Costcenterid" >
                                <option value="-1" >{$smarty.const.REVENUE_CHOOSE_COST_CENTER}</option>
                                {foreach $allCostcenter as $myallCostcenter}
                                <option value="{$myallCostcenter->id}" {if $myallCostcenter->id eq $projectid}selected=""{/if}>{$myallCostcenter->name}</option>
                                {/foreach}
                            </select>
                    </div>
                    <div class="form-group"  {if $Programsettingdata->incomeclient eq 1} style="display:none" {/if} >
                        <label class="sr-only">{$smarty.const.REVENUE_CLIENTS}</label>
                            <select class="select2 wdt100" name="clientid" id="clientid" >
                               <option value="-1">{$smarty.const.REVENUE_CHOOSE_CLIENT}</option>
                                    {foreach $clientsData as $data }
                                    <option value="{$data->clientid}" >{$data->clientname}</option>
                                    {/foreach}
                            </select>
                    </div>
         

                    {if $searchinonesave == 1}
                    <input type="hidden" name="saveid" id="saveid" value="{$saves}" />
                    {else}
                    <div class="form-group">
                        <label class="sr-only">{$smarty.const.REVENUE_SAFE}</label>
                        <select name="saveid" id="saveid" class="select2 wdt100">
                                <option value="-1">{$smarty.const.REVENUE_CHOOSE_SAFE}</option>
                            {foreach $saves as $data}
                            <option value="{$data->saveid}" {if $saveid == $data->saveid}selected{/if}>{$data->savename}</option>
                            {/foreach}
                        </select>
                    </div>
                    {/if}


                    <br />
                    <div class="form-group">
                        <label class="sr-only">{$smarty.const.REVENUE_FROM_DATE}</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">{$smarty.const.REVENUE_TO_DATE}</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 hidden-print">{$smarty.const.REVENUE_SEARCH}</button>
                </form>


                <div class="panel panel-default panel-m">
                    <!-- Default panel contents -->
                    <div class="panel-heading">{$message}</div>
                    <div class="panel-body">
                        <div class="col-lg-offset-8 col-lg-4 ">
                            <div class="well well-sm">
                                <h4 class="text-center">{$smarty.const.REVENUE_TOTAL} :  {$sum}</h4>
                            </div>
                        </div>
                        {literal}
                        <br />        <br />
                        <br />
                        <br />

                        <form id="form1" name="form1" method="post" action="incomeController.php?do=show">
                            {/literal}
                            <!-- Table -->
                            <table class="table table-black">
                                <thead>
                                    <tr>

                                        <th >{$smarty.const.REVENUE_NAME}</th>
                                        <th>{$smarty.const.REVENUE_TYPE}</th>
                                        <th {if $Programsettingdata->incomeclient eq 1} style="display:none" {/if}>العميل</th>
                                         <th>{$smarty.const.REVENUE_SAFE}</th>
                                        <th>{$smarty.const.REVENUE_DATE}</th>
                                        <th>{$smarty.const.REVENUE_AMOUNT}</th>
                                        <th>{$smarty.const.REVENUE_COMMIT}</th>
                                        <th class="hidden-print">{$smarty.const.REVENUE_TEMPORARY_DELETE}/{$smarty.const.REVENUE_UNDELETE}</th>
                                        <th class="hidden-print">{$smarty.const.REVENUE_EDIT}</th>
                                        <th class="hidden-print">{$smarty.const.REVENUE_DELETE}</th>
                                    </tr>
                                </thead>
                                <tbody>

                                    {foreach $incomeData as $data}
                                    {if {$data->conditions} eq 1}
                                    <tr class="danger"> {elseif {$data->conditions} eq 0}

                                    <tr> {/if}

                                        <td> {$data->incomeName} </td>
                                        <td>{$data->incomeTypeName}</td>
                                        <td {if $Programsettingdata->incomeclient eq 1} style="display:none" {/if}> {$data->clientid} </td>
                                        <td>{$data->savename}</td>
                                        <td>{$data->incomeDate}</td>
                                        <td>{$data->incomeValue}</td>
                                        <td>{if {$data->incomeDetails} <> ""}
                                            {$data->incomeDetails}
                                            {else }{$smarty.const.REVENUE_NO_COMMENT}
                                            {/if} </td>
                                        <td  class="hidden-print">

                                            {if {$data->conditions} eq 0} <a href="incomeController.php?do=tempdelete&id={$data->incomeId}" type="button" class="btn btn-default btn-lg removeicon"> </a>
                                            {elseif {$data->conditions} eq 1 } <a  href="incomeController.php?do=returndelete&id={$data->incomeId}" type="button" class="btn btn-default btn-lg correcticon"> </a>
                                            {/if}
                                        </td>


                                        <td  class="hidden-print"> <a href="incomeController.php?do=edit&id={$data->incomeId}"  type="button" class="btn btn-default btn-lg editicon"></a></td>
                                        <td class="hidden-print" ><!--<a onclick="getValue({$data->expensesid})" name="dd" > حذف </a>-->
                                            <a href="incomeController.php?do=delete&id={$data->incomeId}&action={$data->dailyentryid}" name="dd"  type="button" class="btn btn-default btn-lg deleteicon"
                                               onclick="getValue({$data->incomeId});"> </a> </td>
                                    </tr>
                                    {/foreach}

                                </tbody>

                            </table>

                        </form>
                        <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">{$smarty.const.REVENUE_PRINT}</button>
                                    </div>
                                </div>
                            </div>
                            <div class="clearfix"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        {literal}
        <script type="text/javascript">

            function getValue(idval)
            {
                var confirmDel = window.confirm("هل تريد حذف العنصر؟");
                //alert(confirmDel);

                if (confirmDel == true)
                {
                    // x="You pressed OK!";
                    window.location.href = "incomeController.php?do=delete&id=" + idval;
                }
                else
                {
                    // x="You pressed Cancel!";
                    event.preventDefault();
                }


            }



        </script>
        {/literal}