<?php /* Smarty version Smarty-3.1.11, created on 2023-10-10 00:33:31
         compiled from "../views/default/buyBillview/edit.html" */ ?>
<?php /*%%SmartyHeaderCode:1169662705652471ab76ae75-38456534%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '797c259c476272873906364d874238e2ee78f4c8' => 
    array (
      0 => '../views/default/buyBillview/edit.html',
      1 => 1694894782,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '1169662705652471ab76ae75-38456534',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'billnameAddData' => 0,
    'productsData' => 0,
    'product' => 0,
    'j' => 0,
    'billsettingsData' => 0,
    'usergroup' => 0,
    'billnameid' => 0,
    'billidnor' => 0,
    'controlname' => 0,
    'Programsettingdata' => 0,
    'userSaveData' => 0,
    'billCurrData' => 0,
    'allCostcenter' => 0,
    'buyBillData' => 0,
    'myallCostcenter' => 0,
    'returnbuybillData' => 0,
    'billId' => 0,
    'suppliersData' => 0,
    'supplier' => 0,
    'mysupplierdata' => 0,
    'userdata' => 0,
    'storesData' => 0,
    'store' => 0,
    'allSaves' => 0,
    'data' => 0,
    'allCurrency' => 0,
    'currency' => 0,
    'countBillDetails' => 0,
    'buyBillDetails' => 0,
    'x' => 0,
    'mybuyBillDetails' => 0,
    'mymyunitdata' => 0,
    'piecesCount' => 0,
    'countreturnBillDetails' => 0,
    'returnbuybilldetailData' => 0,
    'y' => 0,
    'myreturnbuybillData' => 0,
    'mymyreunitdata' => 0,
    'returnPiecesCount' => 0,
    'file' => 0,
    'i' => 0,
    'buybilldiscount' => 0,
    'returnbuybilldiscount' => 0,
    'roundNumbersStatus' => 0,
    'noOfDecimalPlaces' => 0,
    'storenegative' => 0,
    'categoriesData' => 0,
    'cat' => 0,
    'today' => 0,
    'unitsData' => 0,
    'unit' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_652471abb75da5_68295263',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_652471abb75da5_68295263')) {function content_652471abb75da5_68295263($_smarty_tpl) {?><style>
    .newoption
    {
        background-color:#CCCCCC !important;
        font-weight:bold !important;
    }

</style>

<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">إدارة الفواتير</a></li>
            <li><a href="#"><?php echo $_smarty_tpl->tpl_vars['billnameAddData']->value->name;?>
</a></li>
            <li class="active">تعديل <?php echo $_smarty_tpl->tpl_vars['billnameAddData']->value->name;?>
</li>
        </ol>
        <!-- === start addrowcreated === -->
        <div id="addrowcreated" style="display:none">
            <option value="-1">اختر</option>
            <?php $_smarty_tpl->tpl_vars['j'] = new Smarty_variable(0, null, 0);?>
            <?php  $_smarty_tpl->tpl_vars['product'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['product']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['productsData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['product']->key => $_smarty_tpl->tpl_vars['product']->value){
$_smarty_tpl->tpl_vars['product']->_loop = true;
?>
            <option value="<?php echo $_smarty_tpl->tpl_vars['product']->value->productId;?>
"><?php echo $_smarty_tpl->tpl_vars['names'.($_smarty_tpl->tpl_vars['j']->value)]->value;?>
 <?php echo $_smarty_tpl->tpl_vars['product']->value->productName;?>
 </option>
            <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'j', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['j']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
            <?php } ?> </div>

        <!-- === end addrowcreated === -->
        <h3><?php echo $_smarty_tpl->tpl_vars['billnameAddData']->value->name;?>
</h3>
        <hr/>
        <input type="hidden" name="searchWithCatAndProductNameOnly" id="searchWithCatAndProductNameOnly" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[97]->billsettingsvalue;?>
"/>
        <input type="hidden" id="stopStoreSearch" value="1"/>
        <input type="hidden" id="supplierWithAddOption" value="<?php echo $_smarty_tpl->tpl_vars['usergroup']->value->addsupplierInBill;?>
"/>
        
        <form class="form-horizontal" role="form" action="buyBillController.php?do=update" method="post" enctype="multipart/form-data" id="billform" onsubmit="if (Spry.Widget.Form.validate(this)) {
                    $('#saveAndNew').css('display', 'none');
                    $('#saveBill').css('display', 'none');
                    return true;
                } else {
                    return false;
                }">
            
            <!-- =========================== START BUY BILL SETTINGS ================================== -->
            <input type="hidden" name="billnameid" id="billnameid" value="<?php echo $_smarty_tpl->tpl_vars['billnameid']->value;?>
"/>
            <input type="hidden" name="ordertype" id="ordertype" value="<?php echo $_smarty_tpl->tpl_vars['billnameAddData']->value->ordertype;?>
"/>
            <input type="hidden" name="billidnor" id="billidnor" value="<?php echo $_smarty_tpl->tpl_vars['billidnor']->value;?>
"/>
            <input type="hidden" name="controlname" id="controlname" value="<?php echo $_smarty_tpl->tpl_vars['controlname']->value;?>
"/>
            <input type="hidden" name="scunitnamevalue" id="scunitnamevalue" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
"/>
            <input type="hidden" name="usedParcode" id="usedParcode" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->usedParcode;?>
"/>
            <input type="hidden" name="valueaddedbuy" id="valueaddedbuy" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->valueaddedbuy;?>
"/>

            <input type="hidden" name="productAndQuantityOnly" id="productAndQuantityOnly" value="<?php echo $_smarty_tpl->tpl_vars['billnameAddData']->value->productAndQuantityOnly;?>
"/>
            <input type="hidden" name="returnBillSetting" id="returnBillSetting" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[0]->billsettingsvalue;?>
"/>
            <input type="hidden" name="storeSetting" id="storeSetting" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[2]->billsettingsvalue;?>
"/>
            <input type="hidden" name="parcodeSetting" id="parcodeSetting" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[4]->billsettingsvalue;?>
"/>
            <input type="hidden" name="dateSetting" id="dateSetting" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[5]->billsettingsvalue;?>
"/>
            <input type="hidden" name="newProductSetting" id="newProductSetting" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[6]->billsettingsvalue;?>
"/>
            <input type="hidden" name="noteSetting" id="noteSetting" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[7]->billsettingsvalue;?>
"/>
            <input type="hidden" name="productDiscountSetting" id="productDiscountSetting" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[8]->billsettingsvalue;?>
"/>
            <input type="hidden" name="productTaxSetting" id="productTaxSetting" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[96]->billsettingsvalue;?>
"/>
            <input type="hidden" name="quantityOrParcodeSetting" id="quantityOrParcodeSetting" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[9]->billsettingsvalue;?>
"/>
            <input type="hidden" name="payNumSetting" id="payNumSetting" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[11]->billsettingsvalue;?>
"/>
            <input type="hidden" name="unitSetting" id="unitSetting" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[10]->billsettingsvalue;?>
"/>
            <input type="hidden" name="commentSetting" id="commentSetting" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[12]->billsettingsvalue;?>
"/>
            <input type="hidden" name="searchvalue" id="searchvalue" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->searchvalue;?>
"/>
            <input type="hidden" name="settingQuantitiyFocus" id="settingQuantitiyFocus" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[9]->billsettingsvalue;?>
"/>
            <input type="hidden" name="discountrowtype" id="discountrowtype" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[34]->billsettingsvalue;?>
"/>
            <input type="hidden" name="payedSetting" id="payedSetting" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[71]->billsettingsvalue;?>
"/>
            <input type="hidden" name="userSaveCurrencyName" id="userSaveCurrencyName" value="<?php echo $_smarty_tpl->tpl_vars['userSaveData']->value->currencyName;?>
"/>
            <input type="hidden" name="userSaveconversionFactor" id="userSaveconversionFactor" value="<?php echo $_smarty_tpl->tpl_vars['userSaveData']->value->conversionFactor;?>
"/>
            <input type="hidden" name="oldCFactor" id="oldCFactor" value="1"/>
            <input type="hidden" name="oldCFactorVal" id="oldCFactorVal" value="<?php if (!empty($_smarty_tpl->tpl_vars['billCurrData']->value->conversionFactor)){?><?php echo $_smarty_tpl->tpl_vars['billCurrData']->value->conversionFactor;?>
<?php }else{ ?>1<?php }?>"/>
            <input type="hidden" name="hideBillPrices" id="hideBillPrices" value="<?php echo $_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices;?>
"/>
            <input type="hidden" name="withNakdi" id="withNakdi" value="<?php echo $_smarty_tpl->tpl_vars['usergroup']->value->showClientAndSupplierOne;?>
"/>

            <input type="hidden" name="shownumber" id="shownumber" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[40]->billsettingsvalue;?>
"/>
            <input type="hidden" id="checkRedundantProducts" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[107]->billsettingsvalue;?>
"/>
            <!-- ==========================  END BUY BILL SETTINGS ============================ -->

            <!-- =========================== START GENERAL INFO PANEL =====================-->
            <div class="row">
                <div class="col-lg-8">


                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[45]->billsettingsvalue;?>
<?php $_tmp1=ob_get_clean();?><?php if ($_tmp1==0){?>  <?php }else{ ?> style="display:none" <?php }?>>
                        <label class="col-lg-4 control-label">مركز التكلفة</label>
                        <div class="col-lg-4">
                            <select class="select2 wdt100" name="Costcenter" id="Costcenter" >


                                <option value="-1">اختر مركز التكلفه</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   <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->costcenterid;?>
<?php $_tmp2=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['myallCostcenter']->value->id;?>
<?php $_tmp3=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->costcenterid;?>
<?php $_tmp4=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['myallCostcenter']->value->id;?>
<?php $_tmp5=ob_get_clean();?><?php if ($_tmp2==$_tmp3||$_tmp4==$_tmp5){?>selected="selected"  <?php }?> value="<?php echo $_smarty_tpl->tpl_vars['myallCostcenter']->value->id;?>
"><?php echo $_smarty_tpl->tpl_vars['myallCostcenter']->value->name;?>
</option>

                                <?php } ?>


                            </select>

                        </div>
                        <!-- end of form-group-->

                    </div>
                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->clientserial==1){?>
                    <div class="form-group">
                        <label class="col-lg-4 control-label">الرقم التسلسلي</label>
                        <div class="col-lg-4">
                            <input type="text" value="<?php echo $_smarty_tpl->tpl_vars['billId']->value;?>
"  class="form-control" disabled readonly/>


                        </div>
                    </div>
                    <?php }?>

                    <div class="form-group" <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[61]->billsettingsvalue==0){?>  <?php }else{ ?> style="display:none !important;" <?php }?>>
                        <label class="col-lg-4 control-label">رقم  الفاتورة</label>
                        <div class="col-lg-4">
                            <input name="pay_num" id="pay_num" type="text" value="<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybillSerial;?>
<?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->returnbuybillSerial;?>
"  class="form-control"/>


                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div class="form-group"  <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[48]->billsettingsvalue==0){?>  <?php }else{ ?> style="display:none !important;" <?php }?>>
                        <label class="col-lg-4 control-label">رقم عملية السداد - اختياري</label>
                        <div class="col-lg-4">
                            <input name="pay_num_optional" id="pay_num_optional"  class="form-control" type="text"  tabindex="1"  value="<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybillSerial;?>
<?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->returnbuybillSerial;?>
" />
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div class="form-group" <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[5]->billsettingsvalue==0){?>  <?php }else{ ?> style="display:none !important;" <?php }?>>
                        <label class="col-lg-4 control-label">تاريخ الفاتورة</label>
                        <div class="col-lg-4">
                            <!--input name="bn" type="text" class=" form-control awdatepicker" autocomplete="off"  data-date-format="yyyy-mm-dd" id="bn" value="<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybillsysdate;?>
<?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->returnbuybilldate;?>
" placeholder="تاريخ الفاتورة" <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->allowdateedit==1){?>disabled="disabled"<?php }?> tabindex="2"/-->
                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->allowdateedit==1){?>
                            <input type="text" class="form-control" placeholder="تاريخ الفاتورة" readonly value="<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybillsysdate;?>
<?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->returnbuybilldate;?>
" name="bn" id="bn">
                            <?php }else{ ?>
                            <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="<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybilldate;?>
<?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->returnbuybilldate;?>
" name="bn" id="bn readonly="" >
                                <span class="input-group-addon "><span class=" glyphicon glyphicon-remove col-lg-4"></span></span>
                                <span class="input-group-addon"><span class="glyphicon glyphicon-th col-lg-4"></span></span>
                            </div><?php }?>
                        </div>
                    </div>
                    <!-- end of form-group-->
                </div>
                <!-- end of bill no-->
                <div class="col-lg-4">
                    <div class="form-group mg-bt5" <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[1]->billsettingsvalue==0){?>  <?php }else{ ?> style="display:none !important;" <?php }?>>
                        <label class="col-lg-4 control-label">اسم المورد</label>
                        <div class="col-lg-8">
                            <span id="spryselect1">
                                <div id="supplierIdDiv">
                                    <!--                                    <select id="supplier" name="supplier" onChange="supplierDebt(this.value);" data-placeholder="اختر المورد" class="select2 wdt100"  tabindex="3">
                                                                            <option value="-1">اختر مورد</option>
                                                                            <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->addsupplierInBill==0){?>
                                                                            <option value="-2" class="newoption"><a class="conformdel_supplier">إضافة مورد جديد</a></option>
                                                                            <?php }?>

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



                                                                            <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybillsupplierid;?>
<?php $_tmp6=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['supplier']->value->supplierid;?>
<?php $_tmp7=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->returnbuybillsupplierid;?>
<?php $_tmp8=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['supplier']->value->supplierid;?>
<?php $_tmp9=ob_get_clean();?><?php if ($_tmp6==$_tmp7||$_tmp8==$_tmp9){?>  selected="selected"  <?php }?> value="<?php echo $_smarty_tpl->tpl_vars['supplier']->value->supplierid;?>
"><?php echo $_smarty_tpl->tpl_vars['supplier']->value->suppliername;?>
</option>



                                                                            <?php } ?>


                                                                        </select>-->

                                    <input type="hidden" name="supplier" id="supplier" class="select2Supp"/>
                                    <input type="hidden" name="oldsupplierid" id="oldsupplierid" value="<?php echo $_smarty_tpl->tpl_vars['mysupplierdata']->value->supplierid;?>
"/>
                                    <input type="hidden" name="oldsuppliername" id="oldsuppliername" value="<?php echo $_smarty_tpl->tpl_vars['mysupplierdata']->value->suppliername;?>
"/>

                                </div>

                                <input type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->dailyentryid;?>
" name="returndailyEntryId"/>
                                <input type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->dailyentryid;?>
" name="dailyentryid"/>
                                <input type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybillsupplierid;?>
" name="buybillsupplierid"/>


                                <span class="selectInvalidMsg">اختر المورد</span></span>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[56]->billsettingsvalue;?>
<?php $_tmp10=ob_get_clean();?><?php if ($_tmp10==0){?> <?php }else{ ?>  style="display:none"    <?php }?>>
                        <label class="col-lg-4 control-label">رصيد الدين</label>
                        <div class="col-lg-8">
                            <div id="debt" class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['mysupplierdata']->value->suppliercurrentDebtInCurrency;?>
</div>
                            <input name="hidden_debt" id="hidden_debt" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['mysupplierdata']->value->suppliercurrentDebtInCurrency;?>
"/>
                            <input id="suppCurr" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['mysupplierdata']->value->sullpierCurrencyid;?>
"/>
                            <span class="aw_ras"><a id="editdebt" style="display:none;" href="#">تعديل</a></span> </div>
                    </div>
                    <!-- end of form-group-->
                    <hr class="mg-bt5 mg-tp5"/>
                    <div class="form-group mg-bt5" <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[2]->billsettingsvalue==0){?>  <?php }else{ ?> style="display:none !important;" <?php }?>>
                        <?php if ($_smarty_tpl->tpl_vars['userdata']->value->userstoreid==0){?>


                        <label class="col-lg-4 control-label">المخزن</label>
                        <div class="col-lg-8">
                            <select name="storeId" id="storeId" data-placeholder="اختر" class="select2 wdt100 aw_m1"  tabindex="5">
                                <!--<option value="-1"></option>-->
                                <?php  $_smarty_tpl->tpl_vars['store'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['store']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['storesData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['store']->key => $_smarty_tpl->tpl_vars['store']->value){
$_smarty_tpl->tpl_vars['store']->_loop = true;
?>



                                <option   <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybillstoreid;?>
<?php $_tmp11=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['store']->value->storeId;?>
<?php $_tmp12=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->returnbuybillstoreid;?>
<?php $_tmp13=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['store']->value->storeId;?>
<?php $_tmp14=ob_get_clean();?><?php if ($_tmp11==$_tmp12||$_tmp13==$_tmp14){?>  selected="selected"  <?php }?> value="<?php echo $_smarty_tpl->tpl_vars['store']->value->storeId;?>
"><?php echo $_smarty_tpl->tpl_vars['store']->value->storeName;?>
</option>



                                <?php } ?>



                            </select>
                        </div>
                        <?php }else{ ?>

                        <input name="storeId" id="storeId"  type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybillstoreid;?>
<?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->returnbuybillstoreid;?>
" />
                        <label class="col-lg-4 control-label">المخزن</label>
                        <?php  $_smarty_tpl->tpl_vars['store'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['store']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['storesData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['store']->key => $_smarty_tpl->tpl_vars['store']->value){
$_smarty_tpl->tpl_vars['store']->_loop = true;
?>


                        <div class="col-lg-8">  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['store']->value->storeId;?>
<?php $_tmp15=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybillstoreid;?>
<?php $_tmp16=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->returnbuybillstoreid;?>
<?php $_tmp17=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['store']->value->storeId;?>
<?php $_tmp18=ob_get_clean();?><?php if ($_tmp15==$_tmp16||$_tmp17==$_tmp18){?><?php echo $_smarty_tpl->tpl_vars['store']->value->storeName;?>
 <?php }?>
                        </div>

                        <?php } ?>
                        <?php }?>
                    </div>
                    <!-- end of form-group-->
                    <div <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[87]->billsettingsvalue;?>
<?php $_tmp19=ob_get_clean();?><?php if ($_tmp19==1){?>  <?php }else{ ?> style="display:none" <?php }?> >
                        <div class="form-group mg-bt5">
                            <label class="col-lg-4 control-label">الخزنة</label>
                            <div class="col-lg-8">
                                <select class="select2 wdt100" name="saveid" id="saveid">
                                    <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allSaves']->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;
?>
                                    <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->saveid;?>
" data-curr=<?php echo $_smarty_tpl->tpl_vars['data']->value->currencyId;?>
  <?php if ($_smarty_tpl->tpl_vars['buyBillData']->value->buybillsaveid==$_smarty_tpl->tpl_vars['data']->value->saveid||$_smarty_tpl->tpl_vars['returnbuybillData']->value->returnbuybillsaveid==$_smarty_tpl->tpl_vars['data']->value->saveid){?> selected="selected" <?php }?>><?php echo $_smarty_tpl->tpl_vars['data']->value->savename;?>
</option>

                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <!--only currency allowed now is supplier currency ,,, till we manage it in php-->
                    <div class="form-group mg-bt5 hidden" <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showCurrency!=1){?>style="display:none;"<?php }?>>
                        <label class="col-lg-4 control-label"><?php echo @BUY_BILL_CURRENCY;?>
</label>
                        <div class="col-lg-8">
                            <select class="select2" name="currencyId" id="currencyId">
                                <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allCurrency']->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;
?>
                                <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
" data-cfactor="<?php echo $_smarty_tpl->tpl_vars['data']->value->conversionFactor;?>
" data-othercfactor="<?php echo $_smarty_tpl->tpl_vars['data']->value->otherconversionFactor;?>
" <?php if ($_smarty_tpl->tpl_vars['buyBillData']->value->currencyId==$_smarty_tpl->tpl_vars['data']->value->id||$_smarty_tpl->tpl_vars['returnbuybillData']->value->currencyId==$_smarty_tpl->tpl_vars['data']->value->id){?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['data']->value->name;?>
</option>
                                <?php } ?>
                            </select>
                        </div>
                        <div class="clear"></div>
                        <label class="col-lg-4 control-label"><?php echo @BUY_BILL_CONVERSION_FACTOR;?>
</label>
                        <div class="col-lg-8">
                            <input type="text" name="cFactor" id="cFactor" class="form-control positivefloat calcOther" onkeyup="populateDebtAfter();" style="display: inline-block;width: 34%"/>
                            =
                            <div class="input-group" style="display: inline;">
                                <input type="text" name="otherCFactor" id="otherCFactor" class="form-control positivefloat calcOther" style="display: inline-block;width: 34%"/>
                                <span class="input-group-addon" style="display: inline-block;width: 23%"><?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</span>
                            </div>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5" <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[12]->billsettingsvalue==0){?>  <?php }else{ ?> style="display:none !important;" <?php }?>>
                        <label class="col-lg-4 control-label">التعليق</label>
                        <div class="col-lg-8">
                            <textarea name="comment" id="comment" cols="" rows="" class="form-control" tabindex="6"><?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->comment;?>
<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->returnbuybillData;?>
</textarea>
                        </div>
                    </div>
                    <!-- end of form-group-->
                </div>
                <!-- end of client info-->

            </div>
            <!-- =========================== END GENERAL INFO PANEL ====================== -->

            <!-- =========================== START BUY BILL PANEL ======================= -->

            <input name="hidden_itr" id="hidden_itr" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['countBillDetails']->value;?>
" />


            <div  <?php if ($_smarty_tpl->tpl_vars['controlname']->value=="buyBillController.php"||$_smarty_tpl->tpl_vars['controlname']->value=="buyAndReturnBillController.php"){?> <?php }else{ ?> style="display:none !important;" <?php }?>>

                <div class="row"  <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[14]->billsettingsvalue==0){?> <?php }else{ ?> style="display:none !important;" <?php }?>>
                    <div class="row">
                        <hr/>
                        <div class="col-lg-6">
                            <h4>المشتريات</h4>
                        </div>
                        <div class="col-lg-6">
                            <button type="button" name="addpro2" id="addpro2" class="btn btn-primary pull-left ft-nor"> اضافة جديد</button>
                            <!--button type="button" style="display:none;" name="addpro2" id="addpro2" class="btn btn-primary pull-left ft-nor"> اضافة جديد</button-->
                        </div>
                    </div>
                    <!-- end of title row-->
                    <div class="table-responsive bd-gr">
                        <table class="table billtable table-bordered table-black" id="containerpros">
                            <thead>
                                <tr>
                                    <th class="wdt60" <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[6]->billsettingsvalue==0){?>  <?php }else{ ?> style="display:none !important;" <?php }?>>جديد</th>
                                    <th class="wdt20" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[40]->billsettingsvalue;?>
<?php $_tmp20=ob_get_clean();?><?php if ($_tmp20==0){?>  <?php }else{ ?> style="display:none !important;" <?php }?>>رقم</th>
                                    <th class="wdt120 check_tr_parcode <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[59]->billsettingsvalue;?>
<?php $_tmp21=ob_get_clean();?><?php if ($_tmp21==1){?>  hidden <?php }?>">الباركود</th>
                                    <th class="wdt400">اسم المنتج</th>
                                    <th class="wdt240" <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[7]->billsettingsvalue==0){?> <?php }else{ ?> style="display:none !important;" <?php }?>>ملاحظات</th>
                                    <th class="wdt100n check_tr_unit <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[53]->billsettingsvalue;?>
<?php $_tmp22=ob_get_clean();?><?php if ($_tmp22==1){?>  hidden <?php }?>">الوحدة</th>
                                    <th class="wdt100n check_tr_quantity <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp23=ob_get_clean();?><?php if ($_tmp23==1){?>  hidden <?php }?>">العدد</th>
                                    <th class="wdt100n   <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
<?php $_tmp24=ob_get_clean();?><?php if ($_tmp24=='0'){?>  hidden <?php }?>" ><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
</th>

                                    <th class="wdt80" <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?> <?php if ($_smarty_tpl->tpl_vars['billnameAddData']->value->productAndQuantityOnly==1){?> style="display:none !important;" <?php }?>>السعر</th>
                                    <th class="wdt80 check_tr_discount <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?> <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[8]->billsettingsvalue;?>
<?php $_tmp25=ob_get_clean();?><?php if ($_tmp25==1){?>  hidden <?php }?>" <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[8]->billsettingsvalue==0&&$_smarty_tpl->tpl_vars['billnameAddData']->value->productAndQuantityOnly==0){?>  <?php }else{ ?> style="display:none !important;" <?php }?>>الخصم</th>
                                    <th class="wdt80 check_tr_tax <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?> <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[96]->billsettingsvalue;?>
<?php $_tmp26=ob_get_clean();?><?php if ($_tmp26==1){?>  hidden <?php }?>" >ضريبه</th>
                                    <th class="wdt100n <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?>" <?php if ($_smarty_tpl->tpl_vars['billnameAddData']->value->productAndQuantityOnly==1){?> style="display:none !important;" <?php }?>>الاجمالى

                                    </th>
                                    <th>حذف</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $_smarty_tpl->tpl_vars['x'] = new Smarty_variable(1, null, 0);?>
                                <?php $_smarty_tpl->tpl_vars['piecesCount'] = new Smarty_variable(0, null, 0);?>
                                <?php  $_smarty_tpl->tpl_vars['mybuyBillDetails'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['mybuyBillDetails']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['buyBillDetails']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
 $_smarty_tpl->tpl_vars['mybuyBillDetails']->iteration=0;
foreach ($_from as $_smarty_tpl->tpl_vars['mybuyBillDetails']->key => $_smarty_tpl->tpl_vars['mybuyBillDetails']->value){
$_smarty_tpl->tpl_vars['mybuyBillDetails']->_loop = true;
 $_smarty_tpl->tpl_vars['mybuyBillDetails']->iteration++;
?>
                                <tr id="newProduct<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
">
                                    <td <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[6]->billsettingsvalue==0){?>  <?php }else{ ?> style="display:none !important;" <?php }?>><a onClick="javascript:showModalBox(this.name);" class="newLink btn btn-primary  btn-xs conformdel"   id="new1" name="1">جديد</a></td>
                                    <td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[40]->billsettingsvalue;?>
<?php $_tmp27=ob_get_clean();?><?php if ($_tmp27==0){?>  <?php }else{ ?> style="display:none !important;" <?php }?>><?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->iteration;?>
</td>
                                    <td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[59]->billsettingsvalue;?>
<?php $_tmp28=ob_get_clean();?><?php if ($_tmp28==0){?> <?php }else{ ?>  style="display:none"    <?php }?>>
                                        <input type="text" class="form-control txt-nonraduis" placeholder="الباركود" name="parcode<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="parcode<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"  value="<?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->parcode;?>
" onKeyPress="getproductbyParcode(event, this.value, <?php echo $_smarty_tpl->tpl_vars['x']->value;?>
);" autocomplete="off" tabindex="7">
                                    </td>
                                    <td>
                                        <div id="productdiv<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
">
                                            <input type="hidden" id="product<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" name="product<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" data-placeholder="اختر" class="select2product wdt100"  tabindex="7"/>
                                            <input type="hidden" id="oldproduct<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" name="oldproduct<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"  value="<?php if ($_smarty_tpl->tpl_vars['mybuyBillDetails']->value->sizeid>0&&$_smarty_tpl->tpl_vars['mybuyBillDetails']->value->colorid>0){?>hasSizeColor<?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->buybilldetailproductid;?>
-<?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->sizeid;?>
-<?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->colorid;?>
<?php }else{ ?><?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->buybilldetailproductid;?>
<?php }?>"  />
                                            <input type="hidden" id="oldname<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" name="oldname<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"  value="<?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->productName;?>

                                                   <?php if ($_smarty_tpl->tpl_vars['mybuyBillDetails']->value->sizeName!=''){?>/ <?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->sizeName;?>
<?php }?>
                                                   <?php if ($_smarty_tpl->tpl_vars['mybuyBillDetails']->value->colorName!=''){?>/ <?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->colorName;?>
<?php }?>"  />
                                        </div>


                                    </td>
                                    <td <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[7]->billsettingsvalue==0){?>  <?php }else{ ?> style="display:none !important;" <?php }?>>
                                        <textarea class="form-control txt-nonraduis" rows="1" name="note<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="note<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"  tabindex="7"><?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->note;?>
</textarea>
                                    </td>
                                    <td class=" check_tr_unit <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[53]->billsettingsvalue;?>
<?php $_tmp29=ob_get_clean();?><?php if ($_tmp29==0){?>  <?php }else{ ?> hidden <?php }?>" >
                                        <div id="unitDiv<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
">
                                            <select name="unitId<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="unitId<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"  size="3"  onchange="getUnitPrice(<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
);"  data-placeholder="اختر" class="select2 aw_m1 wdt100 chosenproduct"  tabindex="7">
                                                <option value="-1"></option>
                                                <?php  $_smarty_tpl->tpl_vars['mymyunitdata'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['mymyunitdata']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['myunitdata'.($_smarty_tpl->tpl_vars['x']->value)]->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['mymyunitdata']->key => $_smarty_tpl->tpl_vars['mymyunitdata']->value){
$_smarty_tpl->tpl_vars['mymyunitdata']->_loop = true;
?>
                                                <option   <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->productunitid;?>
<?php $_tmp30=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mymyunitdata']->value->productunitid;?>
<?php $_tmp31=ob_get_clean();?><?php if ($_tmp30==$_tmp31){?> selected="selected"  <?php }?>   value="<?php echo $_smarty_tpl->tpl_vars['mymyunitdata']->value->productunitid;?>
" ><?php echo $_smarty_tpl->tpl_vars['mymyunitdata']->value->unitName;?>
</option>
                                                <?php } ?>

                                            </select>
                                        </div>
                                    </td>
                                    <td class="check_tr_quantity <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp32=ob_get_clean();?><?php if ($_tmp32==0){?> <?php }else{ ?>  hidden   <?php }?>" >
                                        <input name="pronum<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="pronum<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"   class="form-control getprototal numberclic enteraction numberinput txt-nonraduis positivefloat" placeholder="العدد" type="text" tabindex="7" value="<?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->buybilldetailquantity;?>
" />
                                        <?php $_smarty_tpl->tpl_vars['piecesCount'] = new Smarty_variable($_smarty_tpl->tpl_vars['piecesCount']->value+$_smarty_tpl->tpl_vars['mybuyBillDetails']->value->buybilldetailquantity, null, 0);?>
                                    </td>

                                    <td class="  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
<?php $_tmp33=ob_get_clean();?><?php if ($_tmp33=='0'){?>  hidden <?php }?>">
                                        <input name="scunitname<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="scunitname<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->otherdetailquantity;?>
"  class="form-control txt-nonraduis positiveNo" placeholder="العدد" type="text" tabindex="7" />
                                    </td>
                                    <td class="<?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?>" <?php if ($_smarty_tpl->tpl_vars['billnameAddData']->value->productAndQuantityOnly==1){?> style="display:none !important;" <?php }?>>
                                        <div id="propricechange<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
">
                                            <input name="proprice<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="proprice<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" placeholder="السعر" class="form-control txt-nonraduis getprototal numberclic enteraction numberinput positivefloat" type="text"   value="<?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->buybilldetailprice;?>
" tabindex="7"/>
                                        </div>
                                    </td>
                                    <td class="<?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?>" <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[8]->billsettingsvalue==0&&$_smarty_tpl->tpl_vars['billnameAddData']->value->productAndQuantityOnly==0){?>  <?php }else{ ?> style="display:none !important;" <?php }?>>
                                        <input name="prodis<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="prodis<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->discountvalue;?>
" class="form-control getprototal numberonly enteraction numberinput txt-nonraduis positiveNo" placeholder="الخصم"  tabindex="7" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[34]->billsettingsvalue;?>
<?php $_tmp34=ob_get_clean();?><?php if ($_tmp34==0){?> type="text" <?php }else{ ?>  type="hidden" <?php }?>/>
                                        <input name="discounttype<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="discounttype<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"  value="<?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->discounttype;?>
" class="form-control getprototal numberonly enteraction numberinput txt-nonraduis positivefloat" tabindex="7"   <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[34]->billsettingsvalue;?>
<?php $_tmp35=ob_get_clean();?><?php if ($_tmp35==1){?> type="text" <?php }else{ ?>  type="hidden" <?php }?>/>
                                    </td>
                                    <td class="<?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?>" <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[96]->billsettingsvalue==0&&$_smarty_tpl->tpl_vars['billnameAddData']->value->productAndQuantityOnly==0){?>  <?php }else{ ?> style="display:none !important;" <?php }?>>
                                        <input name="rowtaxval<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="rowtaxval<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->rowtaxval;?>
" class="form-control getprototal numberonly enteraction numberinput txt-nonraduis positiveNo" placeholder="ضريبة" type="hidden"/>
                                        <input name="rowtaxper<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="rowtaxper<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"  value="<?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->rowtaxper;?>
" class="form-control getprototal numberonly enteraction numberinput txt-nonraduis positiveNo" tabindex="7"  type="text" />
                                    </td>
                                    <td class="aw_totalprice <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?>" <?php if ($_smarty_tpl->tpl_vars['billnameAddData']->value->productAndQuantityOnly==1){?> style="display:none !important;" <?php }?>>
                                        <!--                                        <div id="prototal<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" class="aw_mt form-control-static"> <?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->buybilldetailtotalprice;?>
 <?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</div>
                                                                                <input name="hidden_prototal<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="hidden_prototal<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->buybilldetailtotalprice;?>
"  tabindex="7"/>-->

                                        <input  name="hidden_prototal<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="hidden_prototal<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" class="editTotal form-control txt-nonraduis enteraction numberinput positiveNo" value="<?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->buybilldetailtotalprice;?>
" type="text"/>
                                    </td>
                                    <td>
                                        <button type="button" id="remove<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" class="removeproduct close flt-none" aria-hidden="true" onclick="removeproduct(<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
);">&times;</button>
                                    </td>
                                </tr>

                                <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'x', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['x']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                <?php } ?>
                            </tbody>
                        </table>
                    </div>
                    <button type="button" class="btn btn-primary pull-left ft-nor <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?>"> إجمالي المشتريات <span class="badge wht-clo">
                            <input name="norbuyBillTotal"  id="norbuyBillTotal"  type="hidden"  value="" />
                            <div id="buyBillTotal">0</div>
                            <input type="hidden" value="0" name="totalBuyBill" id="totalBuyBill"/>
                        </span></button>
                </div>
            </div>
            <!-- end of second row-->
            <!-- =========================== END BUY BILL PANEL ==================== -->

            <!-- =========================== START RETURN BUY BILL PANEL ====================== -->
            <input name="hidden_itr_re" id="hidden_itr_re" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['countreturnBillDetails']->value;?>
" />


            <div  <?php if ($_smarty_tpl->tpl_vars['controlname']->value=="returnBuyBillController.php"||$_smarty_tpl->tpl_vars['controlname']->value=="buyAndReturnBillController.php"){?> <?php }else{ ?> style="display:none !important;" <?php }?>>



                <br />
                <div class="row"   <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[0]->billsettingsvalue==0){?> <?php }else{ ?> style="display:none !important;" <?php }?>>


                    <div class="row">
                        <hr/>
                        <div class="col-lg-6">
                            <h4>مردودات المشتريات</h4>
                        </div>
                        <div class="col-lg-6">
                            <button type="button" name="addpro_re" id="addpro_re" class="btn btn-primary  pull-left ft-nor"> اضافة جديد</button>
                            <button type="button" style="display:none !important;" name="addpro_re" id="addpro_re" class="btn btn-primary pull-left ft-nor"> اضافة جديد</button>
                        </div>
                    </div>
                    <!-- end of title row-->
                    <div class="table-responsive bd-rd">
                        <table class="table billtable table-bordered table-black" id="containerpros_re">
                            <thead>

                                <tr>
                                    <th class="wdt120 check_tr_parcode <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[59]->billsettingsvalue;?>
<?php $_tmp36=ob_get_clean();?><?php if ($_tmp36==1){?>  hidden <?php }?>">الباركود</th>
                                    <th class="wdt400">اسم المنتج</th>
                                    <th class="wdt240" <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[7]->billsettingsvalue==0){?>  <?php }else{ ?> style="display:none !important;" <?php }?>>ملاحظات</th>
                                    <th class="wdt100n check_tr_unit <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[53]->billsettingsvalue;?>
<?php $_tmp37=ob_get_clean();?><?php if ($_tmp37==1){?>  hidden <?php }?>">الوحدة</th>
                                    <th class="wdt100n check_tr_quantity <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp38=ob_get_clean();?><?php if ($_tmp38==1){?>  hidden <?php }?>" >العدد</th>
                                    <th class="wdt100n   <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
<?php $_tmp39=ob_get_clean();?><?php if ($_tmp39=='0'){?>  hidden <?php }?>" ><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
</th>

                                    <th class="wdt80" <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?> <?php if ($_smarty_tpl->tpl_vars['billnameAddData']->value->productAndQuantityOnly==1){?> style="display:none !important;" <?php }?>>السعر</th>
                                    <th class="wdt80 check_tr_discount <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?> <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[8]->billsettingsvalue;?>
<?php $_tmp40=ob_get_clean();?><?php if ($_tmp40==1){?>  hidden <?php }?>">الخصم</th>
                                    <th class="wdt80 check_tr_tax <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?> <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[96]->billsettingsvalue;?>
<?php $_tmp41=ob_get_clean();?><?php if ($_tmp41==1){?>  hidden <?php }?>" >ضريبة</th>
                                    <th class="wdt100n" <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?> <?php if ($_smarty_tpl->tpl_vars['billnameAddData']->value->productAndQuantityOnly==1){?> style="display:none !important;" <?php }?>>الاجمالى

                                    </th>
                                    <th>حذف</th>
                                </tr>
                            </thead>
                            <tbody>

                                <?php $_smarty_tpl->tpl_vars['y'] = new Smarty_variable(1, null, 0);?>
                                <?php $_smarty_tpl->tpl_vars['returnPiecesCount'] = new Smarty_variable(0, null, 0);?>
                                <?php  $_smarty_tpl->tpl_vars['myreturnbuybillData'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['myreturnbuybillData']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['returnbuybilldetailData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['myreturnbuybillData']->key => $_smarty_tpl->tpl_vars['myreturnbuybillData']->value){
$_smarty_tpl->tpl_vars['myreturnbuybillData']->_loop = true;
?>
                                <tr>
                                    <td class=" check_tr_parcode <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[59]->billsettingsvalue;?>
<?php $_tmp42=ob_get_clean();?><?php if ($_tmp42==1){?>  hidden <?php }?>">
                                        <input name="parcode_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" type="text" id="parcode_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" class="form-control  txt-nonraduis"  placeholder="الباركود" value="<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->parcode;?>
" onkeypress="getreturnproductbyParcode(event, this.value, <?php echo $_smarty_tpl->tpl_vars['y']->value;?>
);" autocomplete="off"  tabindex="301"/>

                                    </td>

                                    <td><!-- اسم المنتج -->
                                        <div id="productdiv_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
">
                                            <input type="hidden" id="product_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" name="product_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" data-placeholder="اختر" class="select2product_re wdt100"  tabindex="301"/>

                                            <input type="hidden" id="reoldproduct<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" name="reoldproduct<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
"  value="<?php if ($_smarty_tpl->tpl_vars['myreturnbuybillData']->value->sizeid>0&&$_smarty_tpl->tpl_vars['myreturnbuybillData']->value->colorid>0){?>hasSizeColor<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->buybilldetailproductid;?>
<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->returnbuybilldetailproductid;?>
-<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->sizeid;?>
-<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->colorid;?>
<?php }else{ ?><?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->buybilldetailproductid;?>
<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->returnbuybilldetailproductid;?>
<?php }?>"  />
                                            <!---->
                                            <input type="hidden" id="reoldname<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" name="reoldname<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
"  value="<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->productName;?>

                                                   <?php if ($_smarty_tpl->tpl_vars['myreturnbuybillData']->value->sizeName!=''){?>/ <?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->sizeName;?>
<?php }?>
                                                   <?php if ($_smarty_tpl->tpl_vars['myreturnbuybillData']->value->colorName!=''){?>/ <?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->colorName;?>
<?php }?>"  />
                                        </div>
                                    </td>

                                    <td <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[7]->billsettingsvalue==0){?>  <?php }else{ ?> style="display:none !important;" <?php }?>>
                                        <input name="note_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="note_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" type="text"  class="form-control  txt-nonraduis" tabindex="301"/ value="<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->note;?>
">
                                    </td>

                                    <!-- الوحدة -->
                                    <td class="check_tr_unit <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[53]->billsettingsvalue;?>
<?php $_tmp43=ob_get_clean();?><?php if ($_tmp43==1){?>  hidden <?php }?>">

                                        <div id="unitDiv_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
">
                                            <select name="unitId_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="unitId_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" onchange="return_getUnitPrice(<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
);"  data-placeholder="اختر" class="select2 aw_m1 wdt100 chosenproduct"  tabindex="301">
                                                <option value="-1"></option>
                                                <?php  $_smarty_tpl->tpl_vars['mymyreunitdata'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['mymyreunitdata']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['myreunitdata'.($_smarty_tpl->tpl_vars['y']->value)]->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['mymyreunitdata']->key => $_smarty_tpl->tpl_vars['mymyreunitdata']->value){
$_smarty_tpl->tpl_vars['mymyreunitdata']->_loop = true;
?>
                                                <option    value="<?php echo $_smarty_tpl->tpl_vars['mymyreunitdata']->value->productunitid;?>
"   <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->productunitid;?>
<?php $_tmp44=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mymyreunitdata']->value->productunitid;?>
<?php $_tmp45=ob_get_clean();?><?php if ($_tmp44==$_tmp45){?> selected="selected"<?php }?>><?php echo $_smarty_tpl->tpl_vars['mymyreunitdata']->value->unitName;?>

                                                </option>
                                                <?php } ?>
                                            </select>



                                        </div>
                                    </td>

                                    <td class=" check_tr_quantity <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp46=ob_get_clean();?><?php if ($_tmp46==1){?>  hidden <?php }?>">
                                        <input name="pronum_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="pronum_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->returnbuybilldetailquantity;?>
<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->buybilldetailquantity;?>
" class="form-control return_getprototal numberclic txt-nonraduis enteraction numberinput positiveNo" placeholder="العدد"  type="text"  tabindex="301"/>
                                        <?php $_smarty_tpl->tpl_vars['returnPiecesCount'] = new Smarty_variable($_smarty_tpl->tpl_vars['returnPiecesCount']->value+$_smarty_tpl->tpl_vars['myreturnbuybillData']->value->returnbuybilldetailquantity+$_smarty_tpl->tpl_vars['myreturnbuybillData']->value->buybilldetailquantity, null, 0);?>
                                    </td>
                                    <td class="  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
<?php $_tmp47=ob_get_clean();?><?php if ($_tmp47=='0'){?>  hidden <?php }?>">
                                        <input name="scunitname_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="scunitname_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->otherdetailquantity;?>
"  class="form-control txt-nonraduis positiveNo" placeholder="العدد" type="text" tabindex="7" />
                                    </td>
                                    <td class="<?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?>" <?php if ($_smarty_tpl->tpl_vars['billnameAddData']->value->productAndQuantityOnly==1){?> style="display:none !important;" <?php }?>>
                                        <div id="propricechange_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
">
                                            <input name="proprice_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="proprice_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" placeholder="السعر" value="<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->returnbuybilldetailprice;?>
<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->buybilldetailprice;?>
" class="form-control txt-nonraduis return_getprototal numberclic enteraction numberinput positivefloat" type="text"  tabindex="301"/>
                                        </div>
                                    </td>
                                    <td class="check_tr_discount <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?> <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[8]->billsettingsvalue;?>
<?php $_tmp48=ob_get_clean();?><?php if ($_tmp48==1){?>  hidden <?php }?>">
                                        <input name="prodis_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="prodis_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->discountvalue;?>
" class="form-control return_getprototal txt-nonraduis numberonly enteraction numberinput positiveNo" placeholder="الخصم"   tabindex="301" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[34]->billsettingsvalue;?>
<?php $_tmp49=ob_get_clean();?><?php if ($_tmp49==0){?> type="text" <?php }else{ ?>  type="hidden" <?php }?>/>
                                        <input name="discounttype_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="discounttype_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
"  value="<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->discounttype;?>
" class="form-control getprototal numberonly enteraction numberinput txt-nonraduis positivefloat" tabindex="301"   <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[34]->billsettingsvalue;?>
<?php $_tmp50=ob_get_clean();?><?php if ($_tmp50==1){?> type="text" <?php }else{ ?>  type="hidden" <?php }?>/>
                                    </td>
                                    <td class="<?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?>" <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[96]->billsettingsvalue==0&&$_smarty_tpl->tpl_vars['billnameAddData']->value->productAndQuantityOnly==0){?>  <?php }else{ ?> style="display:none !important;" <?php }?>>
                                        <input name="rowtaxval_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="rowtaxval_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->rowtaxval;?>
" class="form-control return_getprototal numberonly enteraction numberinput txt-nonraduis positiveNo" placeholder="ضريبة" type="hidden"/>
                                        <input name="rowtaxper_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="rowtaxper_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
"  value="<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->rowtaxper;?>
" class="form-control return_getprototal numberonly enteraction numberinput txt-nonraduis positiveNo" tabindex="7"  type="text" />
                                    </td>
                                    <td class="aw_totalprice_re <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?>" <?php if ($_smarty_tpl->tpl_vars['billnameAddData']->value->productAndQuantityOnly==1){?> style="display:none !important;" <?php }?>>
                                        <!--                                        <div id="prototal_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" class="aw_mt form-control-static"><?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->returnbuybilldetailtotalprice;?>
<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->buybilldetailtotalprice;?>
<?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</div>
                                                                                <input name="hidden_prototal_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="hidden_prototal_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->returnbuybilldetailtotalprice;?>
<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->buybilldetailtotalprice;?>
"  tabindex="301"/>-->

                                        <input  name="hidden_prototal_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="hidden_prototal_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" class="returnEditTotal form-control txt-nonraduis enteraction numberinput positiveNo" value="<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->returnbuybilldetailtotalprice;?>
<?php echo $_smarty_tpl->tpl_vars['myreturnbuybillData']->value->buybilldetailtotalprice;?>
" type="text"/>
                                    </td>
                                    <td>
                                        <button type="button" id="remove_re<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" class="removeproduct_re close flt-none" aria-hidden="true"  onclick="removeproduct_re(<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
);">&times;</button>
                                    </td>
                                </tr>
                                <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'y', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['y']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                <?php } ?>
                            </tbody>
                        </table>
                    </div>
                    <button type="button" class="btn btn-primary pull-left ft-nor <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?>"> إجمالي مردودات المشتريات <span class="badge wht-clo">
                            <div id="buyBillTotal_re">0</div>
                            <input name="norbuyBillTotal_re"  id="norbuyBillTotal_re"  type="hidden"  value="" />
                        </span></button>
                </div>
            </div>


            <!-- =========================== END RETURN BUY BILL PANEL ======================== -->

            <!-- =========================== START TOTAL VALUES PANEL ======================= -->
            <div class="row <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?>">
                <div class="col-lg-7">
                    <div class="form-group mg-bt5" >
                        <label class="col-lg-1 control-label">المدفوع</label>
                        <div class="col-lg-3">
                            <input type="text" class="form-control positivefloat"  value="0" placeholder="المدفوع" name="genpay2" id="genpay2">
                        </div>
                    </div>
                    <!-- end of form-group-->

                    <div class="form-group mg-bt5">
                        <label class="col-lg-1 control-label">الباقى</label>
                        <div class="col-lg-3">
                            <p class="form-control-static" id="gen3total2">0 <?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</p>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5 <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[91]->billsettingsvalue;?>
<?php $_tmp51=ob_get_clean();?><?php if ($_tmp51==1){?>  hidden <?php }?>">
                        <label class="col-lg-1 control-label">الاجمالي شامل ضريبة القيمة المضافة لمنتج واحد</label>
                        <div class="col-lg-3">
                            <input type="text" class="form-control positivefloat" id="vatIncludedTotalIfRow" value=""/>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5 "><!-- <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[91]->billsettingsvalue;?>
<?php $_tmp52=ob_get_clean();?><?php if ($_tmp52==1){?>  hidden <?php }?> -->
                        <label class="col-lg-1 control-label">المرفقات</label>
                        <div class="col-lg-3">
                            <input type="file" id="multiupload" name="files[]" style="display: inline-block" multiple >
                            <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);?>
                            <?php  $_smarty_tpl->tpl_vars['file'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['file']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['buyBillData']->value->filesArr; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['file']->key => $_smarty_tpl->tpl_vars['file']->value){
$_smarty_tpl->tpl_vars['file']->_loop = true;
?>
                            <?php if ($_smarty_tpl->tpl_vars['file']->value!=''&&$_smarty_tpl->tpl_vars['file']->value!="."&&$_smarty_tpl->tpl_vars['file']->value!="no image"){?>
                            <a href="../upload/buyBillFiles/<?php echo $_smarty_tpl->tpl_vars['file']->value;?>
" target="_blank" style="color: blue;"> (<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
) </a>
                            <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable($_smarty_tpl->tpl_vars['i']->value+1, null, 0);?>
                            <?php }?>
                            <?php } ?>
                            <input type="hidden" name="oldFiles" id="oldFiles" value="<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->files;?>
">
                        </div>
                    </div>
                </div>
                <!-- end of calucation center-->

                <div class="col-lg-5">
                    <hr/>
                    <?php if ($_smarty_tpl->tpl_vars['controlname']->value=="buyBillController.php"||$_smarty_tpl->tpl_vars['controlname']->value=="buyAndReturnBillController.php"){?>
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[58]->billsettingsvalue;?>
<?php $_tmp53=ob_get_clean();?><?php if ($_tmp53==0){?> <?php }else{ ?>  style="display:none"    <?php }?>>
                        <label class="col-lg-5 control-label">عدد القطع</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="totalQty"><?php echo $_smarty_tpl->tpl_vars['piecesCount']->value;?>
</p>
                        </div>
                    </div>
                    <?php }?>

                    <?php if ($_smarty_tpl->tpl_vars['controlname']->value=="returnBuyBillController.php"||$_smarty_tpl->tpl_vars['controlname']->value=="buyAndReturnBillController.php"){?>
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5" <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[0]->billsettingsvalue==0){?>  <?php }else{ ?> style="display:none !important;" <?php }?>>
                        <label class="col-lg-5 control-label">عدد القطع المرتجعة</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="returnTotalQty"><?php echo $_smarty_tpl->tpl_vars['returnPiecesCount']->value;?>
</p>
                        </div>
                    </div>
                    <?php }?>
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5">
                        <label class="col-lg-5 control-label">الاجمالى العام</label>
                        <div class="col-lg-7">
                            <input type="hidden" name="totalbeforediscount" id="totalbeforediscount" value="<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybilltotalbill;?>
"/>
                            <p class="form-control-static" id="gentotal">0</p>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[44]->billsettingsvalue=="0"){?>
                    <input type="hidden" name="discount_type" id="discount_type" value="0"/>
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[57]->billsettingsvalue;?>
<?php $_tmp54=ob_get_clean();?><?php if ($_tmp54==0){?> <?php }else{ ?>  style="display:none"    <?php }?>>
                        <label class="col-lg-5 control-label">نوع الخصم</label>
                        <div class="col-lg-7">
                            خصم مباشر
                        </div>
                    </div>
                    <?php }elseif($_smarty_tpl->tpl_vars['billsettingsData']->value[44]->billsettingsvalue==1){?>
                    <input type="hidden" name="discount_type" id="discount_type" value="1"/>
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[57]->billsettingsvalue;?>
<?php $_tmp55=ob_get_clean();?><?php if ($_tmp55==0){?> <?php }else{ ?>  style="display:none"    <?php }?>>
                        <label class="col-lg-5 control-label">نوع الخصم</label>
                        <div class="col-lg-7">
                            خصم بنسبه مئويه
                        </div>
                    </div>
                    <?php }elseif($_smarty_tpl->tpl_vars['billsettingsData']->value[44]->billsettingsvalue==2){?>
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[57]->billsettingsvalue;?>
<?php $_tmp56=ob_get_clean();?><?php if ($_tmp56==0){?> <?php }else{ ?>  style="display:none"    <?php }?>>
                        <label class="col-lg-5 control-label">نوع الخصم</label>
                        <div class="col-lg-7">
                            <select name="discount_type" id="discount_type" class="select2 wdt100" dir="rtl">
                                <option  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybilldiscountrype;?>
<?php $_tmp57=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->returnbuybilldiscountrype;?>
<?php $_tmp58=ob_get_clean();?><?php if ($_tmp57==0||$_tmp58==0){?> selected="selected" <?php }?> value="0">خصم مباشر</option>
                                <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybilldiscountrype;?>
<?php $_tmp59=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->returnbuybilldiscountrype;?>
<?php $_tmp60=ob_get_clean();?><?php if ($_tmp59==1||$_tmp60==1){?> selected="selected" <?php }?>  value="1">خصم بنسبه مئويه</option>
                            </select>
                        </div>
                    </div>
                    <?php }?>

                    <!-- end of form-group-->
                    <?php $_smarty_tpl->tpl_vars['buybilldiscount'] = new Smarty_variable($_smarty_tpl->tpl_vars['buyBillData']->value->buybilldiscount, null, 0);?>
                    <?php $_smarty_tpl->tpl_vars['returnbuybilldiscount'] = new Smarty_variable($_smarty_tpl->tpl_vars['returnbuybillData']->value->returnbuybilldiscount, null, 0);?>
                    <?php if (isset($_smarty_tpl->tpl_vars['billCurrData']->value)){?>
                    <?php if (isset($_smarty_tpl->tpl_vars['buyBillData']->value)){?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billCurrData']->value->conversionFactor*$_smarty_tpl->tpl_vars['buybilldiscount']->value;?>
<?php $_tmp61=ob_get_clean();?><?php $_smarty_tpl->tpl_vars['buybilldiscount'] = new Smarty_variable($_tmp61, null, 0);?><?php }?>
                    <?php if (isset($_smarty_tpl->tpl_vars['returnbuybillData']->value)){?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billCurrData']->value->conversionFactor*$_smarty_tpl->tpl_vars['returnbuybilldiscount']->value;?>
<?php $_tmp62=ob_get_clean();?><?php $_smarty_tpl->tpl_vars['returnbuybilldiscount'] = new Smarty_variable($_tmp62, null, 0);?><?php }?>
                    <?php }?>
                    <div class="form-group mg-bt5"<?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[57]->billsettingsvalue;?>
<?php $_tmp63=ob_get_clean();?><?php if ($_tmp63==0){?> <?php }else{ ?>  style="display:none"    <?php }?>>
                        <label class="col-lg-5 control-label">قيمة الخصم</label>
                        <div class="col-lg-7"><span id="sprytextfield3">
                                <input name="gendis" id="gendis" class="form-control numberclic numberinput positivefloat"  value="<?php echo $_smarty_tpl->tpl_vars['buybilldiscount']->value;?>
<?php echo $_smarty_tpl->tpl_vars['returnbuybilldiscount']->value;?>
" type="text" placeholder="قيمة الخصم" />
                                <span class="textfieldRequiredMsg">*</span></span></div>
                    </div>
                    <!-- end of form-group-->

                    <!-- end of form-group-->
                    <div <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[89]->billsettingsvalue;?>
<?php $_tmp64=ob_get_clean();?><?php if ($_tmp64==0){?> style="display:none"    <?php }?>>
                        <hr class="mg-tp5 mg-bt5"/>
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 control-label">ضريبه خصم  (<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->taxOfDiscountPer;?>
<?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->taxOfDiscountPer;?>
%)</label>
                            <div class="col-lg-7">
                                <div class="input-group">
                                    <input type="hidden" name="taxOfDiscountPercentage" id="taxOfDiscountPercentage" value="<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->taxOfDiscountPer;?>
<?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->taxOfDiscountPer;?>
"/>
                                    <input type="hidden" name="taxOfDiscountVal_h" id="taxOfDiscountVal_h" value="<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->taxOfDiscountVal;?>
<?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->taxOfDiscountVal;?>
"/>
                                    <input type="text" name="taxOfDiscountVal" class="form-control numberinput positiveNo"  id="taxOfDiscountVal" value="<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->taxOfDiscountVal;?>
<?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->taxOfDiscountVal;?>
" readonly/>
                                    <span class="input-group-addon"><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->currancy;?>
</span>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!------------------------------------------------------>
                    <div <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[36]->billsettingsvalue;?>
<?php $_tmp65=ob_get_clean();?><?php if ($_tmp65=="0"){?> <?php }else{ ?>  style="display:none"    <?php }?>>
                        <hr class="mg-tp5 mg-bt5"/>
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 control-label">ضريبه القيمة المضافة</label>
                            <div class="col-lg-7">

                                <div class="input-group">
                                    <input type="text" name="payedtax" id="payedtax" class="form-control numberinput"  value="<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->payedtax;?>
<?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->payedtax;?>
" onkeyup="checkdisValue();"/>
                                    <span class="input-group-addon">%</span>
                                </div>
                                <div class="input-group" style="padding-top: 1px;">
                                    <input type="text" name="taxVal" class="form-control numberinput positiveNo"  id="taxVal" value="0" readonly/><!-- value is calculated in js no need to write it -->
                                    <span class="input-group-addon"><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->currancy;?>
</span>
                                </div>
                            </div>
                        </div>


                    </div>
                    <!------------------------------------------------------->



                    <hr class="mg-tp5 mg-bt5"/>
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[51]->billsettingsvalue;?>
<?php $_tmp66=ob_get_clean();?><?php if ($_tmp66==0){?> <?php }else{ ?>  style="display:none"    <?php }?>>
                        <label class="col-lg-5 control-label">الصافى</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="gen2total"><?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybillaftertotalbill;?>
<?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->returnbuybillaftertotalbill;?>
</p>
                            <input type="hidden" name="totalafterdiscount" id="totalafterdiscount" value="<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybillaftertotalbill;?>
<?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->returnbuybillaftertotalbill;?>
"/>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[54]->billsettingsvalue;?>
<?php $_tmp67=ob_get_clean();?><?php if ($_tmp67==0){?> <?php }else{ ?>  style="display:none"    <?php }?>>
                        <label class="col-lg-5 control-label">المدفوع</label>
                        <div class="col-lg-7">
                            <input name="genpay" id="genpay"  class="form-control numberclic numberinput positivefloat" type="text"  value="<?php if (isset($_smarty_tpl->tpl_vars['billCurrData']->value->buybilltotalpayedC)||isset($_smarty_tpl->tpl_vars['billCurrData']->value->returnbuybilltotalpayedC)){?><?php echo $_smarty_tpl->tpl_vars['billCurrData']->value->buybilltotalpayedC;?>
<?php echo $_smarty_tpl->tpl_vars['billCurrData']->value->returnbuybilltotalpayedC;?>
<?php }else{ ?><?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybilltotalpayed;?>
<?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->returnbuybilltotalpayed;?>
<?php }?>"/>

                            <!--input name="oldpayed" id="oldpayed" type="text" value="<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybilltotalpayed;?>
<?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->returnbuybilltotalpayed;?>
" /-->
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <hr class="mg-tp5 mg-bt5"/>
                    <div class="form-group mg-bt5 bg-yel" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[55]->billsettingsvalue;?>
<?php $_tmp68=ob_get_clean();?><?php if ($_tmp68==0){?> <?php }else{ ?>  style="display:none"    <?php }?>>
                        <label class="col-lg-5 control-label">المتبقى</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="gen3total"><?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybillfinalbill;?>
<?php echo $_smarty_tpl->tpl_vars['returnbuybillData']->value->returnbuybillfinalbill;?>
</p>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5" <?php if ($_smarty_tpl->tpl_vars['billnameAddData']->value->productAndQuantityOnly==1){?> style="display:none !important;" <?php }?>>
                        <label class="col-lg-5 control-label">باقى الدين</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="gen4total">0</p>
                            <input type="hidden" name="supplierdebtafter" id="supplierdebtafter" value="0"/>
                        </div>
                    </div>
                    <!-- end of form-group-->
                </div>
                <!-- end of totals center-->
            </div>
            <!-- end of fourth row-->

            <input type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['roundNumbersStatus']->value;?>
" id="round_numbers" name="round_numbers"/>
            <input type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['noOfDecimalPlaces']->value;?>
" id="noOfDecimalPlaces" name="noOfDecimalPlaces"/>
            <div class="row">
                <button type="submit" id="saveBill" class="btn btn-primary">تعديل</button>
            </div>
            <br/>
            <div class="row">
                <style>
                    .unsufficient{
                        background-color: #f59a99 !important;
                    }
                    .note-warning{
                        background-color: #faeaa9;
                        border-color: #f3cc31;
                        color: #000;
                        border-right: 5px solid #f3cc31;
                        border-radius: 4px 0 0 4px;
                        margin: 0 0 20px;
                        padding: 15px 15px 15px 30px;
                    }
                </style>
                <input type="hidden" name="storenegative" id="storenegative" value="<?php echo $_smarty_tpl->tpl_vars['storenegative']->value;?>
"/>
                <div class="note-warning" style="display: none" id="check_store_div">
                    <h4 class="block" id="check_store_msg"></h4>
                </div>
            </div>
            <!-- end of fifth row-->

            <!-- =========================== END TOTAL VALUESPANEL ====================== -->
        </form>

        <!-- Modal -->
        <input type="hidden" name="productAddMultiCatLevel" id="productAddMultiCatLevel" value="1"/>
        <div class="modal fade in" id="productModal2"  role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog"style="width: 910px;">
                <div class="modal-content bg-modal">
                    <div class="modal-header">
                        <button type="button" class="close pull-left" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title"> إضافة منتج</h4>
                    </div>
                    <div class="productForm">
                        <div class="modal-body ">
                            <form id="productInfo" action="#" method="post" class="nameToBeChecked form-horizontal" onsubmit="if (Spry.Widget.Form.validate(this)) {
                                        checkName(event, 'product', 'new_productName');
                                        insertIntoTemp(event);
                                    } else {
                                        return false;
                                    }">
                                  <div class="form-group">
                                    <label for="inputEmail1" class="col-lg-2 control-label">المنتج الرئيسي</label>
                                    <div class="col-lg-4"> <span id="spryselect4">
                                            <select name="new_cat_id" id="new_cat_id" data-placeholder="اختر" class="select2 aw_m1 productCat" tabindex="12">
                                                <option>-- اختر المنتج الرئيسي</option>

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

                                                <option value="<?php echo $_smarty_tpl->tpl_vars['cat']->value->productCatId;?>
"><?php echo $_smarty_tpl->tpl_vars['cat']->value->productCatName;?>
</option>

                                                <?php } ?>

                                            </select>
                                            <span class="selectRequiredMsg">*</span></span> </div>
                                </div>
                                <!---------------------------->

                                <div class="form-group">
                                    <label for="inputEmail1" class="col-lg-2 control-label">الإسم </label>
                                    <div class="col-lg-4">
                                        <input name="new_productName" type="text" id="new_productName" size="50" class=" form-control " required   />
                                        <!----------- start nameError alert -------------->
                                        <div id="new_nameError" class="alert alert-block alert-danger fade in" style="display:none">
                                            <button type="button" class="close pull-left" data-dismiss="alert" aria-hidden="true">&times;</button>
                                            <h4>رسالة خطأ</h4>
                                            <p>هذا الإسم مستخدم من قبل</p>
                                            <div class="clearfix"></div>
                                        </div>
                                        <!----------- end nameError alert ------------->
                                    </div>


                                </div>



                                <!---------------------------->

                                <div class="form-group" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[59]->billsettingsvalue;?>
<?php $_tmp69=ob_get_clean();?><?php if ($_tmp69==0){?> <?php }else{ ?>  style="display:none"    <?php }?>>
                                    <label for="inputEmail1" class="col-lg-2 control-label">الباركود</label>
                                    <div class="col-lg-4">
                                        <input name="new_parcode" type="text" id="new_parcode"  class=" form-control" size="50"   />
                                    </div>
                                </div>
                                <!---------------------------->

                                <div class="form-group">
                                    <label for="inputEmail1" class="col-lg-2 control-label">سعر الشراء</label>
                                    <div class="col-lg-4">
                                        <input name="new_productBuyPrice" type="text" id="new_productBuyPrice" class="numberinput form-control" required size="50"   />
                                    </div>
                                </div>
                                <!---------------------------->

                                <div class="form-group">
                                    <label for="inputEmail1" class="col-lg-2 control-label">سعر بيع الجمله</label>
                                    <div class="col-lg-4">
                                        <input name="new_productSellAllPrice" type="text" id="new_productSellAllPrice" class="numberinput form-control" onKeyUp="populateSellPrice();" required size="50"   />
                                    </div>
                                </div>
                                <!---------------------------->

                                <div class="form-group">
                                    <label for="inputEmail1" class="col-lg-2 control-label">سعر بيع الجمله التجزئة</label>
                                    <div class="col-lg-4">
                                        <input name="new_productSellHalfPrice" type="text" id="new_productSellHalfPrice" class=" form-control numberinput" required size="50"   />
                                    </div>
                                </div>
                                <!---------------------------->

                                <div class="form-group">
                                    <label for="inputEmail1" class="col-lg-2 control-label">سعر بيع الوحده</label>
                                    <div class="col-lg-4">
                                        <input name="new_productSellUnitPrice" type="text" id="new_productSellUnitPrice" class=" form-control numberinput" required size="50"   />
                                    </div>
                                </div>
                                <!---------------------------->

                                <div class="form-group">
                                    <label for="inputEmail1" class="col-lg-2 control-label">الكمية</label>
                                    <div class="col-lg-4">
                                        <input name="new_productquantity" type="text" id="new_productquantity" class=" form-control numberinput"  required="required"   value="0" size="50"/>
                                    </div>
                                </div>
                                <!---------------------------->
                                <div class="form-group ">
                                    <label for="inputEmail1" class="col-lg-2 control-label">فى المنيو</label>
                                    <div class="col-lg-4">
                                        <label>
                                            <input value="0"  class="radioR" name="inMenu1"  checked="checked"  type="radio" />
                                            نعم </label>
                                        <label>
                                            <input value="1"  class="noradioR" name="inMenu1"     type="radio" />
                                            لا </label>
                                    </div>
                                </div>
                                <!---------------------------->

                                <div class="form-group">
                                    <label for="inputEmail1" class="col-lg-2 control-label">س</label>
                                    <div class="col-lg-4">



                                        <label>
                                            <input value="1"  class="radioR" name="type1"   type="radio" />

                                            نعم </label>

                                        <label>
                                            <input value="0"  class="noradioR" name="type1"   checked="checked"  type="radio" />
                                            لا </label>



                                    </div>
                                </div>
                                <!---------------------------->






                                <div class="form-group">
                                    <label for="inputEmail1" class="col-lg-2 control-label">التاريخ</label>
                                    <div class="col-lg-4">
                                        <input name="new_productDate" type="text" id="new_productDate" class=" form-control awdatepicker" autocomplete="off"   data-date-format="yyyy-mm-dd" size="50"  value="<?php echo $_smarty_tpl->tpl_vars['today']->value;?>
" required   />
                                    </div>
                                </div>
                                <!---------------------------->

                                <!--------------------------------  adding units   ----------------------------->

                                <div id="addUnitsDiv">
                                    <table id="unitsTable" class="table table-black">
                                        <tr id="unit_row1">
                                            <td>
                                                <div class="form-group">
                                                    <label for="inputEmail1" class="col-lg-4 control-label">اسم وحدة القياس</label>
                                                    <div class="col-lg-8">
                                                        <select name="productunit1" id="productunit1" data-placeholder="اختر" class="select2 aw_m1 chosenproduct"  tabindex="12">
                                                            <option value="-1">اختر وحدة القياس</option>







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







                                                            <option value="<?php echo $_smarty_tpl->tpl_vars['unit']->value->unitId;?>
"><?php echo $_smarty_tpl->tpl_vars['unit']->value->unitName;?>
</option>







                                                            <?php } ?>







                                                        </select>
                                                    </div>
                                                </div>
                                                <!---------------------------->
                                            </td>
                                            <td>
                                                <div class="form-group">
                                                    <label for="inputEmail1" class="col-lg-4 control-label">عدد الوحدات</label>
                                                    <div class="col-lg-8">
                                                        <input name="productnumber1" id="productnumber1" class="numberinput form-control" type="text" />
                                                    </div>
                                                </div>
                                                <!---------------------------->
                                            </td>
                                            <td><a id="remove1" onClick="removeUnits(1);" class="removeUnits">X</a></td>
                                        </tr>
                                    </table>
                                    <!--end unitsTable-->
                                </div>
                                <input class="addUnits btn btn-primary" onClick="addUnits();" type="button" value="إضافة وحدة قياس"/>
                                <input name="unitsItr" id="unitsItr" type="hidden" value="1" />

                                <!-------------------------------- end adding units   -------------------------->
                                </td>
                                <input name="newLinkCurrentId" id="newLinkCurrentId" type="hidden" value="" />
                                <!--        <input type="button" id="cancel" onClick="closeProductForm();" value="إلغاء" />
                          <input type="button" id="insert" onClick="insertIntoTemp();" value="إضافة" />
                                -->

                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" id="cancel" onClick="closeProductForm();">إلغاء</button>
                            <button type="submit" class="btn btn-primary" id="insert" >حفظ</button>
                        </div>
                        </form>
                    </div>
                    <!-- /.productForm -->
                </div>
                <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
        </div>
        <!-- /.modal -->

        <div id="productSelect" style="display:none;"> <?php  $_smarty_tpl->tpl_vars['cat'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['cat']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['categoriesData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['cat']->key => $_smarty_tpl->tpl_vars['cat']->value){
$_smarty_tpl->tpl_vars['cat']->_loop = true;
?>
            <option value="<?php echo $_smarty_tpl->tpl_vars['cat']->value->productCatId;?>
"><?php echo $_smarty_tpl->tpl_vars['cat']->value->productCatName;?>
</option>
            <?php } ?> </div>
        <div id="productUnitsDiv" style="display:none;">
            <option value="-1">اختر وحدة القياس</option>
            <?php  $_smarty_tpl->tpl_vars['unit'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['unit']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['unitsData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['unit']->key => $_smarty_tpl->tpl_vars['unit']->value){
$_smarty_tpl->tpl_vars['unit']->_loop = true;
?>
            <option value="<?php echo $_smarty_tpl->tpl_vars['unit']->value->unitId;?>
"><?php echo $_smarty_tpl->tpl_vars['unit']->value->unitName;?>
</option>
            <?php } ?> </div>
        <div id="productUnitsDiv_new" style="display:none;">
            <option value="-1">اختر وحدة القياس</option>
            <?php  $_smarty_tpl->tpl_vars['unit'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['unit']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['unitsData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['unit']->key => $_smarty_tpl->tpl_vars['unit']->value){
$_smarty_tpl->tpl_vars['unit']->_loop = true;
?>
            <option value="<?php echo $_smarty_tpl->tpl_vars['unit']->value->unitId;?>
"><?php echo $_smarty_tpl->tpl_vars['unit']->value->unitName;?>
</option>
            <?php } ?> </div>

        <!---================== END ADD PRODUCT MODAL BOX ==================--->

        <!---================== START NEW UNIT ROW  ==================--->
        <div id="unitsTableHidden" style="display:none !important;">
            <tr>
                <td>
                    <div class="form-group">
                        <label for="inputEmail1" class="col-lg-2 control-label">اسم وحدة القياس</label>
                        <div class="col-lg-4">
                            <select name="productunit1" id="productunit1" data-placeholder="اختر" class="select2 aw_m1 chosenproduct"  tabindex="12">
                                <option value="-1">اختر وحدة القياس</option>







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







                                <option value="<?php echo $_smarty_tpl->tpl_vars['unit']->value->unitId;?>
"><?php echo $_smarty_tpl->tpl_vars['unit']->value->unitName;?>
</option>







                                <?php } ?>







                            </select>
                        </div>
                    </div>
                    <!---------------------------->
                </td>
                <td>
                    <div class="form-group">
                        <label for="inputEmail1" class="col-lg-2 control-label">عدد الوحدات</label>
                        <div class="col-lg-4">
                            <input name="productnumber1" id="productnumber1" class="numberinput form-control" type="text" />
                        </div>
                    </div>
                    <!---------------------------->
                </td>
                <td><a id="remove1" onClick="removeUnits(1);" class="removeUnits">X</a></td>
            </tr>
        </div>
        <!---================== END NEW UNIT ROW  ==================--->

        <!-- ======================= Supplier Modal Box =========== -->
        <!-- Modal -->
        <div class="modal fade" id="supplierModal" tabindex="-1" role="dialog" aria-labelledby="supplierModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content bg-modal">
                    <div class="modal-header">
                        <button type="button" class="close pull-left" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">عنوان الرسالة</h4>
                    </div>
                    <div class="modal-body">
                        <form id="supplierInfo" action="#" method="post" class="form-horizontal">
                            <div class="form-group">
                                <label class="col-lg-2 control-label">اسم المورد</label>
                                <div class="col-lg-4"> <span id="sprytextfield1">
                                        <input name="txtName" type="text" id="sup_txtName"  class="form-control"/>
                                        <span class="textfieldRequiredMsg">*</span></span> </div>
                            </div>
                            <!------------------------------>

                            <div class="form-group">
                                <label class="col-lg-2 control-label">العنوان</label>
                                <div class="col-lg-4">
                                    <input name="txtAddress" type="text" id="sup_txtAddress"  class="form-control"/>
                                </div>
                            </div>
                            <!------------------------------>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">رقم التليفون</label>
                                <div class="col-lg-4">
                                    <input name="txtPhone" type="text" id="sup_txtPhone"  class="numberinput form-control"/>
                                </div>
                            </div>
                            <!------------------------------>

                            <div class="form-group">
                                <label class="col-lg-2 control-label">قيمة المديونية</label>
                                <div class="col-lg-4"> <span id="sprytextfield2">
                                        <input type="text" name="txtDebt" id="sup_txtDebt" class="numberinput  form-control" />
                                        <span class="textfieldRequiredMsg">يرجى إدخال رقم صحيح</span><span class="textfieldInvalidFormatMsg">*</span></span> </div>
                            </div>
                            <!------------------------------>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">تفاصيل أخرى</label>
                                <div class="col-lg-4">
                                    <textarea name="textDetails" cols="" rows="" id="sup_textDetails"  class="form-control"></textarea>
                                </div>
                            </div>
                            <!------------------------------>

                            <!--  <div class="form-group">
                                <div class="col-lg-offset-2 col-lg-4">
                                  <input type="button" id="cancel" onClick="closeSupplierForm();" class="btn btn-error pull-left" value="إلغاء" />
                                  <input type="button" id="insert" onClick="insertSupplier();" class="btn btn-primary pull-left" value="إضافة" />
                                </div>
                              </div>-->
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" id="cancel" onClick="closeSupplierForm();">اغلاق</button>
                        <button type="button" id="insert" class="btn btn-primary savemodel_supplier"  onClick="insertSupplier();" >حفظ</button>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
        </div>
        <!-- /.modal -->
        <!-- ============================================= -->
        <!-- ======================= Supplier Modal Box =========== -->
        <!-- Modal -->
        <div class="modal fade" id="proPriceUpdateModal" tabindex="-1" role="dialog" aria-labelledby="proPriceUpdateModalLabel" aria-hidden="true">
            <div class="modal-dialog modal-lg">
                <div class="modal-content bg-modal">
                    <div class="modal-header">
                        <button type="button" class="close pull-left" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">تم تعديل سعر شراء المنتج تحديث الاسعار؟</h4>
                    </div>
                    <div class="modal-body">
                        <form id="proPriceInfo" action="#" method="post" class="form-horizontal">

                        </form>
                        <input type="hidden" id="showProPriceUpdateModalIfBuyPriceChange" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[95]->billsettingsvalue;?>
"/>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">اغلاق</button>
                        <button type="button" class="btn btn-primary" data-rowItr="" id="saveProPricesBtn" >حفظ</button>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
        </div>
        <!-- /.modal -->
        <!-- ============================================= -->

    </div>
</div>

<script type="text/javascript">
    var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {isRequired: false, invalidValue: "-1"});
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    //var spryselect2 = new Spry.Widget.ValidationSelect("spryselect2", {isRequired:false, invalidValue:"-1"});
    //var spryselect3 = new Spry.Widget.ValidationSelect("spryselect3");
    var spryselect4 = new Spry.Widget.ValidationSelect("spryselect4");</script>
<script type="text/javascript">
    var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
</script>
<?php }} ?>