<?php /* Smarty version Smarty-3.1.11, created on 2023-12-07 23:10:14
         compiled from "../views/default/expensesview/show.html" */ ?>
<?php /*%%SmartyHeaderCode:576260667657234b6b71b36-35859501%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '594ef7739304b4c1928a44bfc6c79c9c57837482' => 
    array (
      0 => '../views/default/expensesview/show.html',
      1 => 1693253992,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '576260667657234b6b71b36-35859501',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'lang_code' => 0,
    'youtubes' => 0,
    'outputString' => 0,
    'alldata' => 0,
    'type' => 0,
    'Programsettingdata' => 0,
    'allCostcenter' => 0,
    'myallCostcenter' => 0,
    'projectid' => 0,
    'message' => 0,
    'sum' => 0,
    'expenseData' => 0,
    'usergroupid' => 0,
    'data' => 0,
    'i' => 0,
    'sumUser' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_657234b75df5c6_73930242',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_657234b75df5c6_73930242')) {function content_657234b75df5c6_73930242($_smarty_tpl) {?><div class="row">
    <div class="container <?php if ($_smarty_tpl->tpl_vars['lang_code']->value=='en'){?> gt4-ltr<?php }?>">
        <ol class="breadcrumb">
            <li><a href="#"><?php echo @EXPENSES_REVENUE;?>
</a></li>
            <li><a href="#"><?php echo @EXPENSES;?>
</a></li>
            <li class="active"><?php echo @EXPENSES_SHOW;?>
</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading" style="padding:5px 15px 5px">
                <h3 class="panel-title" style="display: inline-block;"><?php echo @EXPENSES_SHOW;?>
 </h3>
                <h3 class="panel-title" id="gexpensestypename" style="display: none;"></h3>
                <a href="<?php echo $_smarty_tpl->tpl_vars['youtubes']->value[99]->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="expensesController.php" class="hidden-print"><input type="button" style="margin-left: 12px" id="submit"  class="btn btn-primary pull-left " value="<?php echo @EXPENSES_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"><?php echo $_smarty_tpl->tpl_vars['outputString']->value;?>
</p>
                    <div class="clearfix"></div>
                </div>
                <!---------  end outputString alert ------------>

                <form class="form-inline hidden-print" method="post" action="expensesController.php?do=show">
                    <div class="form-group">
                        <label class="sr-only"><?php echo @EXPENSES_TYPE_NAME;?>
</label>
                        <select data-placeholder="<?php echo @EXPENSES_CHOOSE_TYPE;?>
"  class="select2 wdt100"  name="expensestypeid" id="expensestypeid" >
                            <option value="-1"><?php echo @EXPENSES_CHOOSE_TYPE;?>
</option>


                            <?php  $_smarty_tpl->tpl_vars['type'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['type']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['alldata']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['type']->key => $_smarty_tpl->tpl_vars['type']->value){
$_smarty_tpl->tpl_vars['type']->_loop = true;
?>

                            <option value="<?php echo $_smarty_tpl->tpl_vars['type']->value->expensestypeid;?>
"><?php echo $_smarty_tpl->tpl_vars['type']->value->expensestypename;?>
</option>

                            <?php } ?>

                        </select>
                    </div>
                    <div class="form-group" <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->costcenter==0){?> <?php }else{ ?> style="display:none" <?php }?>  >
                        <label class="sr-only"><?php echo @EXPENSES_COST_CENTER;?>
</label>
                        <select class="select2 wdt100" name="Costcenterid" id="Costcenterid" >
                            <option value="-1" ><?php echo @EXPENSES_CHOOSE_COST_CENTER;?>
</option>
                            <?php  $_smarty_tpl->tpl_vars['myallCostcenter'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['myallCostcenter']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allCostcenter']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['myallCostcenter']->key => $_smarty_tpl->tpl_vars['myallCostcenter']->value){
$_smarty_tpl->tpl_vars['myallCostcenter']->_loop = true;
?>
                            <option value="<?php echo $_smarty_tpl->tpl_vars['myallCostcenter']->value->id;?>
" <?php if ($_smarty_tpl->tpl_vars['myallCostcenter']->value->id==$_smarty_tpl->tpl_vars['projectid']->value){?>selected=""<?php }?>><?php echo $_smarty_tpl->tpl_vars['myallCostcenter']->value->name;?>
</option>
                            <?php } ?>
                        </select>
                    </div>
                    <div class="form-group"   <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->expensesproduct==0){?> <?php }else{ ?> style="display:none" <?php }?>>
                        <label class="sr-only"><?php echo @EXPENSES_PRODUCTS;?>
</label>
                        <input type="hidden" name="searchvalue" id="searchvalue" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->searchvalue;?>
"/>
                        <input type="text" name="productid" id="productid"    class="select2product wdt100 clas_offerproduct" data-itr='1'  data-placeholder="<?php echo @EXPENSES_CHOOSE_PRODUCT;?>
" tabindex="301"/>
                    </div>

                    <br />
                    <div class="form-group">
                        <label class="sr-only"><?php echo @EXPENSES_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"><?php echo @EXPENSES_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"><?php echo @EXPENSES_SEARCH;?>
</button>
                </form>
                <div class="panel panel-default">
                    <!-- Default panel contents -->
                    <div class="panel-heading"><?php echo $_smarty_tpl->tpl_vars['message']->value;?>
</div>
                    <div class="panel-body">
                        <!--div class="col-lg-offset-8 col-lg-4 ">
                            <div class="well well-sm">
                                <h4 class="text-center">إجمالي المصروفات:  <?php echo $_smarty_tpl->tpl_vars['sum']->value;?>
</h4>
                            </div>
                        </div-->
                        

                        <form id="form1" name="form1" method="post" action="expensesController.php?do=executeOperation" onsubmit="if (Spry.Widget.Form.validate(this)) {
                                    return countChoosenProducts('expensesController');
                                } else {
                                    return false;
                                }
                              " enctype="multipart/form-data">
                            
                            <!-- Table -->
                            <table class="table table-black">
                                <thead>
                                    <tr>
                                        <th class="hidden-print">
                                            <label>
                                                <input type="checkbox" name="checkAll" id="checkAll"/>
                                            </label>
                                        </th>
                                        <th><?php echo @EXPENSES_DATE;?>
</th>
                                        <th><?php echo @EXPENSES_SAVEN;?>
</th>
                                        <th><?php echo @EXPENSES_NAME;?>
</th>
                                        <th class="expensestypename " ><?php echo @EXPENSES_TYPE;?>
</th>
                                        <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->expensesupplier==1){?>
                                        <th>المورد</th>
                                        <th>المتبقى على المورد</th>
                                        <?php }?>

                                        <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->clientsell==1){?>
                                        <th>العميل</th>
                                        <?php }?>


                                        <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->realestateunits==1){?>
                                        <th>العقار</th>
                                        <th>الوحده</th>
                                        <?php }?>


                                        <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->expensesproduct==0){?>
                                        <th><?php echo @EXPENSES_PRODUCTS;?>
</th>
                                        <?php }?>
                                        <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->costcenter==0){?>
                                        <th><?php echo @EXPENSES_COST_CENTER;?>
</th>
                                        <?php }?>

                                        <th><?php echo @EXPENSES_AMOUNT;?>
</th>
                                        <th>القيمة المضافة</th>
                                        <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->specialexpenses==0){?>
                                        <th><?php echo @EXPENSES_NUMBER;?>
</th>
                                        <th><?php echo @EXPENSES_PRICE;?>
</th>
                                        <th><?php echo @EXPENSES_TOTALN;?>
</th>
                                        <th><?php echo @EXPENSES_SHORTFALLS;?>
</th>
                                        <?php }?>
                                        <th><?php echo @EXPENSES_COMMENT;?>
</th>
                                        <th class="hidden-print"><?php echo @EXPENSES_TEMPORARY_DELETE;?>
/<?php echo @EXPENSES_UNDELETE;?>
</th>
                                        <th class="hidden-print"><?php echo @EDIT;?>
</th>
                                        <th class="hidden-print"><?php echo @EXPENSES_DELETE;?>
</th>
                                        <th class="hidden-print">قيد اليومية</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php $_smarty_tpl->tpl_vars['sumUser'] = new Smarty_variable(0, null, 0);?>
                                    <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['expenseData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                    <?php if (!in_array($_smarty_tpl->tpl_vars['usergroupid']->value,$_smarty_tpl->tpl_vars['data']->value->addOnlyGroupIds)){?>
                                    <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['data']->value->conditions;?>
<?php $_tmp1=ob_get_clean();?><?php if ($_tmp1==1){?>
                                    <tr class="danger"> <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['data']->value->conditions;?>
<?php $_tmp2=ob_get_clean();?><?php if ($_tmp2==0){?>

                                    <tr> <?php }}?>
                                        <td class="hidden-print">
                                            <label>
                                                <input type="checkbox" name="choosedItem[]" id="checked<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" class="choosenItem" value="<?php echo $_smarty_tpl->tpl_vars['data']->value->expensesid;?>
" />
                                                <input type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['data']->value->expensesid;?>
" name="expensestype"/>
                                            </label>
                                        </td>

                                        <td><?php echo $_smarty_tpl->tpl_vars['data']->value->expensesdate;?>
</td>
                                        <td><?php echo $_smarty_tpl->tpl_vars['data']->value->savename;?>
</td>
                                        <td><?php echo $_smarty_tpl->tpl_vars['data']->value->expensesname;?>
 </td>

                                        <td class="expensestypename "><?php echo $_smarty_tpl->tpl_vars['data']->value->expensestypename;?>
</td>

                                        <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->expensesupplier==1){?>
                                        <td><?php echo $_smarty_tpl->tpl_vars['data']->value->supplier;?>
</td>
                                        <td><?php echo $_smarty_tpl->tpl_vars['data']->value->suppRemainingVal;?>
</td>
                                        <?php }?>

                                        <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->clientsell==1){?>
                                        <td><?php echo $_smarty_tpl->tpl_vars['data']->value->clientid;?>
</td>
                                        <?php }?>
                                        <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->realestateunits==1){?>
                                        <td><?php echo $_smarty_tpl->tpl_vars['data']->value->realestatename;?>
</td>
                                        <td><?php echo $_smarty_tpl->tpl_vars['data']->value->unitdata;?>
</td>
                                        <?php }?>


                                        <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->expensesproduct==0){?>
                                        <td><?php echo $_smarty_tpl->tpl_vars['data']->value->productName;?>
</td>
                                        <?php }?>
                                        <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->costcenter==0){?>
                                        <td><?php echo $_smarty_tpl->tpl_vars['data']->value->name;?>
</td>
                                        <?php }?>

                                        <td><?php echo $_smarty_tpl->tpl_vars['data']->value->expensesValue;?>
<?php $_smarty_tpl->tpl_vars['sumUser'] = new Smarty_variable($_smarty_tpl->tpl_vars['sumUser']->value+$_smarty_tpl->tpl_vars['data']->value->expensesValue, null, 0);?></td>
                                        <td><?php echo $_smarty_tpl->tpl_vars['data']->value->taxVal;?>
</td>

                                        <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->specialexpenses==0){?>
                                        <td><?php echo $_smarty_tpl->tpl_vars['data']->value->expensenumbrt;?>
 </td>
                                        <td><?php echo $_smarty_tpl->tpl_vars['data']->value->expenseprice;?>
 </td>
                                        <td><?php echo $_smarty_tpl->tpl_vars['data']->value->expensetotaln;?>
 </td>
                                        <td><?php echo $_smarty_tpl->tpl_vars['data']->value->expenseshortfalls;?>
 </td>
                                        <?php }?>
                                        <td><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['data']->value->expensesdetails;?>
<?php $_tmp3=ob_get_clean();?><?php if ($_tmp3!=''){?>
                                            <?php echo $_smarty_tpl->tpl_vars['data']->value->expensesdetails;?>

                                            <?php }else{ ?> <?php echo @EXPENSES_NO_COMMENT;?>

                                            <?php }?> </td>
                                        <td  class="hidden-print"> <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['data']->value->conditions;?>
<?php $_tmp4=ob_get_clean();?><?php if ($_tmp4==0){?> <a href="expensesController.php?do=tempdelete&id=<?php echo $_smarty_tpl->tpl_vars['data']->value->expensesid;?>
" type="button" class="btn btn-default btn-lg removeicon"> </a> <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['data']->value->conditions;?>
<?php $_tmp5=ob_get_clean();?><?php if ($_tmp5==1){?> <a  href="expensesController.php?do=returndelete&id=<?php echo $_smarty_tpl->tpl_vars['data']->value->expensesid;?>
" type="button" class="btn btn-default btn-lg correcticon"> </a> </td>
                                        <?php }}?>
                                        <td  class="hidden-print"> <a href="expensesController.php?do=edit&id=<?php echo $_smarty_tpl->tpl_vars['data']->value->expensesid;?>
"  type="button" class="btn btn-default btn-lg editicon"></a></td>
                                        <td class="hidden-print" ><!--<a onclick="getValue(<?php echo $_smarty_tpl->tpl_vars['data']->value->expensesid;?>
)" name="dd" > حذف </a>-->
                                            <a href="#"  name="dd" id="delbtn" data-id="<?php echo $_smarty_tpl->tpl_vars['data']->value->expensesid;?>
" data-entryId="<?php echo $_smarty_tpl->tpl_vars['data']->value->dailyentryid;?>
"  type="button" class="btn btn-default btn-lg deleteicon"> </a> </td>
                                        <td class="hidden-print"><a href="dailyentry.php?id=<?php echo $_smarty_tpl->tpl_vars['data']->value->dailyentryid;?>
" target="_blank" type="button" class="btn btn-default btn-lg editicon"> </a></td>
                                    </tr>
                                    <?php }?>
                                    <?php } ?>

                                </tbody>

                            </table>
                            <div class="clearfix hidden-print"></div>
                            <hr />
                            <div  class="">
                                <div class="col-lg-12 hidden-print">
                                    <div class="well well-sm">
                                        <div class="form-group " >
                                            <div class="col-lg-4 hidden-print">
                                                <label for="operation"></label>
                                                <span id="spryselect1">
                                                    <select name="operation" id="operation"  data-placeholder="<?php echo @EXPENSES_CHOOSE_PROCESS;?>
"  class="select2 wdt100">
                                                        <option value="-1"></option>
                                                        <option value="1"><?php echo @EXPENSES_TEMPORARY_DELETE;?>
</option>
                                                        <option value="2"><?php echo @EXPENSES_UNDELETE;?>
</option>
                                                        <option value="3"><?php echo @EXPENSES_PERMANENT_DELETE;?>
</option>
                                                    </select>
                                                    <span class="selectInvalidMsg"><?php echo @EXPENSES_CHOOSE_PROCESS;?>
</span></span></div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-lg-4">
                                                <input name=""  class="hidden-print btn btn-primary" type="submit" value="<?php echo @EXPENSES_EXECUTION;?>
"/>
                                            </div>
                                        </div>

                                        <!-----------  start noElementsError alert ------------->
                                        <div class="clearfix"></div>
                                        <div id="noElementsError" class="alert alert-danger fade in" style="display:none;">
                                            <button type="button" class="close pull-left" data-dismiss="alert" aria-hidden="true">×</button>
                                            <p><?php echo @EXPENSES_SELECTED_FIRST;?>
</p>
                                            <div class="clearfix"></div>
                                        </div>
                                        <!----------  end noElementsError alert -------------->

                                        <div class="clearfix"></div>
                                    </div>
                                </div>
                                <!--div class="col-lg-offset-8 col-lg-4 ">
                                    <div class="well well-sm">
                                        <h4 class="text-center">إجمالي المصروفات:  <?php echo $_smarty_tpl->tpl_vars['sum']->value;?>
</h4>
                                    </div>
                                </div-->
                                <div class="col-lg-offset-8 col-lg-4 ">
                                    <div class="well well-sm">
                                        <h4 class="text-center"><?php echo @EXPENSES_TOTAL;?>
:  <?php echo $_smarty_tpl->tpl_vars['sumUser']->value;?>
</h4>
                                    </div>
                                </div>

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


                        <!-- Modal -->
                        <div class="modal fade hidden-print" id="myModal155" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                            <div class="modal-dialog">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <button type="button" class="close pull-left savemodel2" data-dismiss="modal" aria-hidden="true">&times;</button>
                                    </div>
                                    <div class="modal-body">
                                        <h4 class="modal-title"><?php echo @EXPENSES_WANT_DELETE;?>
</h4>

                                        <form id="expDel" action="expensesController.php?do=delete&id=<?php echo $_smarty_tpl->tpl_vars['data']->value->expensesid;?>
&dailyentryid=<?php echo $_smarty_tpl->tpl_vars['data']->value->dailyentryid;?>
" method="post" class="form-horizontal">
                                        </form>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" id="ddbtn" class="btn btn-default" > <?php echo @EXPENSES_DELETE;?>
</button>

                                        <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo @EXPENSES_CLOSE;?>
 </button>
                                    </div>
                                </div>
                                <!-- /.modal-content -->
                            </div>
                            <!-- /.modal-dialog -->
                        </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"><?php echo @EXPENSES_PRINT;?>
</button>
                                    </div>
                                </div>
                            </div>
                            <div class="clearfix"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <script type="text/javascript">
            var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {invalidValue: "-1", isRequired: false});
        </script>
        <script type="text/javascript">

            $(document).ready(function () {

                $("#expensestypeid").live('change', function () {
                    var expensestypeid = $(this).val();
                    if (expensestypeid > 0) {
                        var expensestypename = $('#expensestypeid').find('option:selected').text();
                        $("#gexpensestypename").show();
                        $("#gexpensestypename").text(expensestypename);
                        $(".expensestypename").addClass('hidden-print');
                    } else {
                        $("#gexpensestypename").show();
                        $("#gexpensestypename").text('');
                        $(".expensestypename").removeClass('hidden-print');
                    }
                });

                $(".positiveNo").forcepositiveNum();
                var formatResult;
                formatResult = function (data) {

                    return  data.text;
                }
                $("#productid").select2({
                    placeholder: "إسم المنتج",
                    width: '100%',
                    minimumInputLength: document.getElementById("searchvalue").value,
                    multiple: false,
                    quietMillis: 100,
                    ajax: {
                        url: "sellbillAjaxController.php?do=getProductsexpenses",
                        dataType: 'json',
                        data: function (term, page) {
                            return {
                                term: term, //search term
                                page_limit: 10,

                            };
                        },
                        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>
        <?php }} ?>