<?php /* Smarty version Smarty-3.1.11, created on 2024-07-15 16:48:41
         compiled from "..\views\default\buyBillview\add.html" */ ?>
<?php /*%%SmartyHeaderCode:9599669536c9cf5ff9-17847608%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '98ee0615b434bc7a455e2932dc89069c2281a8a3' => 
    array (
      0 => '..\\views\\default\\buyBillview\\add.html',
      1 => 1719869497,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '9599669536c9cf5ff9-17847608',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'printURL' => 0,
    'lang_code' => 0,
    'productsData' => 0,
    'product' => 0,
    'j' => 0,
    'billnameAddData' => 0,
    'billsettingsData' => 0,
    'usergroup' => 0,
    'Programsettingdata' => 0,
    'offerId' => 0,
    'billnameid' => 0,
    'userSaveData' => 0,
    'allCostcenter' => 0,
    'myallCostcenter' => 0,
    'nextId' => 0,
    'unique' => 0,
    'today' => 0,
    'billFromExcel_date' => 0,
    'mysupplierdata' => 0,
    'buyBillData' => 0,
    'myclientdata' => 0,
    'userdata' => 0,
    'storesData' => 0,
    'store' => 0,
    'sessionSave' => 0,
    'allSaves' => 0,
    'data' => 0,
    'manyParcodes' => 0,
    'mysellbilldata' => 0,
    'manyParcodesSaveid' => 0,
    'allCurrency' => 0,
    'currency' => 0,
    'countBillDetails' => 0,
    'buyBillDetails' => 0,
    'x' => 0,
    'mybuyBillDetails' => 0,
    'mymyunitdata' => 0,
    'ui' => 0,
    'piecesCount' => 0,
    'catDataReport' => 0,
    'roundNumbersStatus' => 0,
    'noOfDecimalPlaces' => 0,
    'storenegative' => 0,
    'categoriesData' => 0,
    'cat' => 0,
    'unitsData' => 0,
    'unit' => 0,
    'allSizeColor' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_669536caa1d4a0_01816175',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_669536caa1d4a0_01816175')) {function content_669536caa1d4a0_01816175($_smarty_tpl) {?><input type="hidden" name="printURL" id="printURL" value="<?php echo $_smarty_tpl->tpl_vars['printURL']->value;?>
" />
<script>
    var printURL = $('#printURL').val();
    if (printURL != "") {
        window.open(printURL);
    }
</script>
<style>
    .newoption {
        background-color: #CCCCCC !important;
        font-weight: bold !important;
    }
</style>

<div class="row">
    <div class="container <?php if ($_smarty_tpl->tpl_vars['lang_code']->value=='en'){?> gt4-ltr<?php }?>">
        <ol class="breadcrumb">
            <li><a href="#"><?php echo @BUY_BILL_BILLING_MANAGEMENT;?>
</a></li>
            <li><a href="#"><?php echo @BUY_BILL_PURCHASE_INVOICE;?>
</a></li>
            <li class="active"><?php echo @BUY_BILL_ADD_INVOICE;?>
</li>
        </ol>
        <!-- === start addrowcreated === -->
        <div id="addrowcreated" style="display:none">
            <option value="-1"><?php echo @BUY_BILL_SELECT;?>
</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;?>
" />
        <input type="hidden" id="canEditAddDiscountPercentage" value="<?php echo $_smarty_tpl->tpl_vars['usergroup']->value->canEditAddDiscountPercentage;?>
"/>
        
        <form class="form-horizontal" role="form" action="buyBillController.php?do=add" method="post" id="billform"
              enctype="multipart/form-data" 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="valueaddeddiscount" id="valueaddeddiscount"
                   value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->valueaddeddiscount;?>
" />
            <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" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->enablequantityfractions;?>
" id="enablequantityfractions" />

            <input type="hidden" name="productAndQuantityOnly" id="productAndQuantityOnly"
                   value="<?php echo $_smarty_tpl->tpl_vars['billnameAddData']->value->productAndQuantityOnly;?>
" />
            <input type="hidden" name="billtype2" id="billtype2" value="<?php echo $_smarty_tpl->tpl_vars['billnameAddData']->value->billtype2;?>
" />
            <input type="hidden" name="ordertype" id="ordertype" value="<?php echo $_smarty_tpl->tpl_vars['billnameAddData']->value->ordertype;?>
" />
            <input type="hidden" name="offerId" id="offerId" value="<?php echo $_smarty_tpl->tpl_vars['offerId']->value;?>
" />
            <input type="hidden" name="billnameid" id="billnameid" value="<?php echo $_smarty_tpl->tpl_vars['billnameid']->value;?>
" />
            <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[53]->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="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="saveBtnGoesTo" id="saveBtnGoesTo"
                   value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[75]->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="0" />
            <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;?>
" />
            <input type="hidden" id="proNumType" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[113]->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"><?php echo @BUY_BILL_COST_CENTER;?>
</label>
                        <div class="col-lg-4">

                            <select class="select2 wdt100" name="Costcenter" id="Costcenter">


                                <option value="-1"><?php echo @BUY_BILL_SELECT_COST_CENTER;?>
</option>
                                <?php  $_smarty_tpl->tpl_vars['myallCostcenter'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['myallCostcenter']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allCostcenter']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['myallCostcenter']->key => $_smarty_tpl->tpl_vars['myallCostcenter']->value){
$_smarty_tpl->tpl_vars['myallCostcenter']->_loop = true;
?>



                                <option value="<?php echo $_smarty_tpl->tpl_vars['myallCostcenter']->value->id;?>
"><?php echo $_smarty_tpl->tpl_vars['myallCostcenter']->value->name;?>
</option>

                                <?php } ?>


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

                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->clientserial==1){?>
                    <div class="form-group">
                        <label class="col-lg-4 control-label"><?php echo @BUY_BILL_SERIAL_NUMBER;?>
</label>
                        <div class="col-lg-4">
                            <input type="text" value="<?php echo $_smarty_tpl->tpl_vars['nextId']->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"><?php echo @BUY_BILL_INVOICE_NUMBER;?>
</label>
                        <div class="col-lg-4">
                            <input name="pay_num" id="pay_num" type="text" value="<?php echo $_smarty_tpl->tpl_vars['unique']->value;?>
" 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"><?php echo @BUY_BILL_PAYMENT_PROCESS;?>
</label>
                        <div class="col-lg-4">
                            <input name="pay_num_optional" id="pay_num_optional" class="form-control" type="text"
                                   tabindex="1" />
                        </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"><?php echo @BUY_BILL_INVOICE_DATE;?>
</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['today']->value;?>
" 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="<?php echo @BUY_BILL_INVOICE_DATE;?>
"
                                   readonly
                                   value="<?php if (isset($_smarty_tpl->tpl_vars['billFromExcel_date']->value)&&$_smarty_tpl->tpl_vars['billFromExcel_date']->value!=''){?><?php echo $_smarty_tpl->tpl_vars['billFromExcel_date']->value;?>
<?php }else{ ?><?php echo $_smarty_tpl->tpl_vars['today']->value;?>
<?php }?>"
                                   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 if (isset($_smarty_tpl->tpl_vars['billFromExcel_date']->value)&&$_smarty_tpl->tpl_vars['billFromExcel_date']->value!=''){?><?php echo $_smarty_tpl->tpl_vars['billFromExcel_date']->value;?>
<?php }else{ ?><?php echo $_smarty_tpl->tpl_vars['today']->value;?>
<?php }?>"
                                       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"><?php echo @BUY_BILL_SUPPLIER_NAME;?>
</label>
                        <div class="col-lg-8">
                            <span id="spryselect1">
                                <div id="supplierIdDiv">

                                    <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['buyBillData']->value->buybillsupplierid;?>
"
                                       name="buybillsupplierid" />
                                <span class="selectInvalidMsg"><?php echo @BUY_BILL_CHOOSE_SUPPLIER;?>
</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 $_tmp2=ob_get_clean();?><?php if ($_tmp2==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-4 control-label"><?php echo @BUY_BILL_DEBT_BALANCE;?>
</label>
                        <div class="col-lg-8">
                            <div id="debt" class="form-control-static"><?php echo $_smarty_tpl->tpl_vars['mysupplierdata']->value->suppliercurrentDebt;?>
 </div>
                            <input name="hidden_debt" id="hidden_debt" type="hidden"
                                   value="<?php echo $_smarty_tpl->tpl_vars['mysupplierdata']->value->suppliercurrentDebt;?>
" class="form-control" tabindex="4" />
                            <span class="aw_ras"><a id="editdebt" style="display:none;"
                                                    href="#"><?php echo @BUY_BILL_EDIT;?>
</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[115]->billsettingsvalue==0){?> style="display:none !important;" <?php }?>>
                        <label class="col-lg-4 control-label">العميل</label>
                        <div class="col-lg-8">
                            <input type="hidden" name="client" id="client" class="select2client" />
                            <input type="hidden" name="oldclientid" id="oldclientid" value="<?php echo $_smarty_tpl->tpl_vars['myclientdata']->value->clientid;?>
" />
                            <input type="hidden" name="oldclientname" id="oldclientname" value="<?php echo $_smarty_tpl->tpl_vars['myclientdata']->value->clientname;?>
" />
                        </div>
                    </div>
                    <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"><?php echo @BUY_BILL_STORE;?>
</label>
                        <div class="col-lg-8">
                            <select name="storeId" id="storeId" data-placeholder="<?php echo @BUY_BILL_SELECT;?>
"
                                    class="select2 wdt100 aw_m1" tabindex="5">
                                <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->dontChooseStore==1){?><option value="-1"></option><?php }?>
                                <?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 value="<?php echo $_smarty_tpl->tpl_vars['store']->value->storeId;?>
" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybillstoreid;?>
<?php $_tmp3=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['store']->value->storeId;?>
<?php $_tmp4=ob_get_clean();?><?php if ($_tmp3==$_tmp4||($_smarty_tpl->tpl_vars['userdata']->value->userstoreidDef==$_smarty_tpl->tpl_vars['store']->value->storeId&&$_smarty_tpl->tpl_vars['usergroup']->value->dontChooseStore==0)){?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['store']->value->storeName;?>
</option>



                                <?php } ?>



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

                        <input name="storeId" id="storeId" type="hidden"
                               value="<?php if (isset($_smarty_tpl->tpl_vars['buyBillData']->value->buybillstoreid)&&$_smarty_tpl->tpl_vars['buyBillData']->value->buybillstoreid>0){?><?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybillstoreid;?>
<?php }else{ ?><?php echo $_smarty_tpl->tpl_vars['userdata']->value->userstoreid;?>
<?php }?>" />

                        <?php if (isset($_smarty_tpl->tpl_vars['buyBillData']->value->buybillstoreid)&&$_smarty_tpl->tpl_vars['buyBillData']->value->buybillstoreid>0){?>

                        <?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;
?>
                        <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['store']->value->storeId;?>
<?php $_tmp5=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybillstoreid;?>
<?php $_tmp6=ob_get_clean();?><?php if ($_tmp5==$_tmp6){?>
                        <label class="col-lg-4 control-label"><?php echo @BUY_BILL_STORE;?>
</label>
                        <div class="col-lg-8"> <?php echo $_smarty_tpl->tpl_vars['store']->value->storeName;?>
</div>
                        <?php }?>
                        <?php } ?>

                        <?php }else{ ?>

                        <?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;
?>
                        <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['store']->value->storeId;?>
<?php $_tmp7=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['userdata']->value->userstoreid;?>
<?php $_tmp8=ob_get_clean();?><?php if ($_tmp7==$_tmp8){?>
                        <label class="col-lg-4 control-label"><?php echo @BUY_BILL_STORE;?>
</label>
                        <div class="col-lg-8"> <?php echo $_smarty_tpl->tpl_vars['store']->value->storeName;?>
</div>
                        <?php }?>
                        <?php } ?>

                        <?php }?>



                        <?php }?>
                    </div>

                    <!-- end of form-group-->
                    <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[87]->billsettingsvalue;?>
<?php $_tmp9=ob_get_clean();?><?php if ($_tmp9!=1){?>
                    <input type="hidden" name="saveid" value="<?php echo $_smarty_tpl->tpl_vars['sessionSave']->value;?>
" />
                    <?php }else{ ?>
                    <div <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[87]->billsettingsvalue;?>
<?php $_tmp10=ob_get_clean();?><?php if ($_tmp10==1){?> <?php }else{ ?> style="display:none" <?php }?> >
                        <div class="form-group mg-bt5">
                            <label class="col-lg-4 col-sm-4 control-label">الخزنة</label>
                            <div class="col-lg-8 col-sm-8">
                                <select class="select2 wdt100 autoSaveBillMainPart" 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['manyParcodes']->value==1&&($_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbillsaveid==$_smarty_tpl->tpl_vars['data']->value->saveid||$_smarty_tpl->tpl_vars['mysellbilldata']->value->returnsellbillsaveid==$_smarty_tpl->tpl_vars['data']->value->saveid||$_smarty_tpl->tpl_vars['manyParcodesSaveid']->value==$_smarty_tpl->tpl_vars['data']->value->saveid))||($_smarty_tpl->tpl_vars['manyParcodes']->value!=1&&$_smarty_tpl->tpl_vars['sessionSave']->value==$_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>
                    <?php }?>
                    <!--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 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"><?php echo @BUY_BILL_COMMENT;?>
</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;?>
</textarea>
                        </div>
                    </div>
                    <!-- end of form-group-->
                </div>
                <!-- end of client info-->

            </div>
            <!-- =========================== END GENERAL INFO PANEL ====================== -->
            <!-- التحكم فى استخدام نسب الخصم -->
            <input type="hidden" name="hide_discount" id="hide_discount"
                   value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[63]->billsettingsvalue;?>
" />
            <input type="hidden" name="realprice_precentage1" value="0" id='realprice_precentage1' />
            <input type="hidden" name="realprice_precentage_re1" value="0" id='realprice_precentage_re1' />

            <!-- =========================== START BUY BILL PANEL ======================= -->
            <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><?php echo @BUY_BILL_BUY;?>
</h4>
                    </div>
                    <div class="col-lg-6">
                        <button type="button" name="addpro" id="addpro"
                                class="btn btn-primary pull-left ft-nor"><?php echo @BUY_BILL_ADD_NEW;?>
 </button>
                        <button type="button" style="display:none;" name="addpro" id="addpro"
                                class="btn btn-primary pull-left ft-nor"><?php echo @BUY_BILL_ADD_NEW;?>
</button>
                        <button type="button" onclick="$('#billAsExcelFile').click();" name="billAsExcel"
                                id="billAsExcel" class="btn btn-success pull-left ft-nor"
                                style="margin-left:3px;"><?php echo @BUY_BILL_EXCEL;?>
</button>
                        <button type="button" class="btn btn-primary pull-left ft-nor addProSizeColor"
                                style="margin-left:3px;"><?php echo @BUY_BILL_ADD_PRO_SIZE_COLOR;?>
 </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 }?>><?php echo @BUY_BILL_NEW;?>
</th>
                                <th class="wdt20" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[40]->billsettingsvalue;?>
<?php $_tmp11=ob_get_clean();?><?php if ($_tmp11==0){?> <?php }else{ ?>
                                    style="display:none !important;" <?php }?>><?php echo @BUY_BILL_NUMBER;?>
</th>
                                <th
                                    class="wdt120 check_tr_parcode <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[4]->billsettingsvalue;?>
<?php $_tmp12=ob_get_clean();?><?php if ($_tmp12==1){?>  hidden <?php }?>">
                                    <?php echo @BUY_BILL_BARCODE;?>
</th>
                                <th class="wdt400"><?php echo @BUY_BILL_PRODUCT_NAME;?>
</th>
                                <th class="wdt240" <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[7]->billsettingsvalue==0){?> <?php }else{ ?>
                                    style="display:none !important;" <?php }?>><?php echo @BUY_BILL_NOTES;?>
</th>
                                <th
                                    class="wdt100n check_tr_unit <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[53]->billsettingsvalue;?>
<?php $_tmp13=ob_get_clean();?><?php if ($_tmp13==1){?>  hidden <?php }?>">
                                    <?php echo @BUY_BILL_UNIT;?>
</th>



                                <th
                                    class="wdt100n check_tr_quantity <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp14=ob_get_clean();?><?php if ($_tmp14==1){?>  hidden <?php }?>">
                                    <?php echo @BUY_BILL_QUANTITY;?>
</th>

                                <th class="wdt100n   <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
<?php $_tmp15=ob_get_clean();?><?php if ($_tmp15=='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 echo @BUY_BILL_PRICE;?>
</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 $_tmp16=ob_get_clean();?><?php if ($_tmp16==1){?>  hidden <?php }?>">
                                    <?php echo @BUY_BILL_DISCOUNT;?>
</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 $_tmp17=ob_get_clean();?><?php if ($_tmp17==1){?>  hidden <?php }?>">
                                    <?php echo @BUY_BILL_ROW_TAX;?>
</th>
                                <!--<th class="wdt100n" <?php if ($_smarty_tpl->tpl_vars['billnameAddData']->value->productAndQuantityOnly==1){?> style="display:none !important;" <?php }?>>الاجمالى-->
                                <th class="wdt100n buydiscountClass <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showbuydiscount!=1){?>hidden<?php }?>">النسبه</th>
                                <th class="wdt100n <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?>">
                                    <?php echo @BUY_BILL_TOTAL;?>

                                    <input name="hidden_itr" id="hidden_itr" type="hidden"
                                           value="<?php if ((isset($_smarty_tpl->tpl_vars['billFromExcel_date']->value)&&$_smarty_tpl->tpl_vars['billFromExcel_date']->value!='')||$_smarty_tpl->tpl_vars['offerId']->value>0){?><?php echo $_smarty_tpl->tpl_vars['countBillDetails']->value;?>
<?php }else{ ?>1<?php }?>" />
                                </th>
                                <th class="wdt80"><?php echo @BUY_BILL_DELETE;?>
</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $_smarty_tpl->tpl_vars['piecesCount'] = new Smarty_variable(0, null, 0);?>
                            <?php if ($_smarty_tpl->tpl_vars['countBillDetails']->value>0){?><!-- having products from excel -->

                            <?php $_smarty_tpl->tpl_vars['x'] = new Smarty_variable(1, 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"><?php echo @BUY_BILL_NEW;?>
</a></td>
                                <td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[40]->billsettingsvalue;?>
<?php $_tmp18=ob_get_clean();?><?php if ($_tmp18==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[4]->billsettingsvalue;?>
<?php $_tmp19=ob_get_clean();?><?php if ($_tmp19==0){?> <?php }else{ ?> style="display:none"
                                    <?php }?>>
                                    <input type="text" class="form-control txt-nonraduis"
                                           placeholder="<?php echo @BUY_BILL_BARCODE;?>
" 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="<?php echo @BUY_BILL_SELECT;?>
"
                                               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 $_tmp20=ob_get_clean();?><?php if ($_tmp20==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="<?php echo @BUY_BILL_SELECT;?>
"
                                                class="select2 aw_m1 wdt100 chosenproduct" tabindex="7">
                                            <option value="-1"></option>
                                            <?php $_smarty_tpl->tpl_vars['ui'] = new Smarty_variable(1, null, 0);?>
                                            <?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 $_tmp21=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mymyunitdata']->value->productunitid;?>
<?php $_tmp22=ob_get_clean();?><?php if ($_tmp21==$_tmp22){?> selected="selected"  <?php }?>   value="<?php echo $_smarty_tpl->tpl_vars['mymyunitdata']->value->productunitid;?>
" ><?php echo $_smarty_tpl->tpl_vars['mymyunitdata']->value->unitName;?>
</option>-->
                                            <option <?php if ($_smarty_tpl->tpl_vars['ui']->value==1){?> selected="selected" <?php }?>
                                                    value="<?php echo $_smarty_tpl->tpl_vars['mymyunitdata']->value->productunitid;?>
"><?php echo $_smarty_tpl->tpl_vars['mymyunitdata']->value->unitName;?>

                                            </option>
                                            <?php $_smarty_tpl->tpl_vars['ui'] = new Smarty_variable($_smarty_tpl->tpl_vars['ui']->value+1, null, 0);?>
                                            <?php } ?>

                                        </select>
                                    </div>
                                </td>
                                <td
                                    class="check_tr_quantity <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp23=ob_get_clean();?><?php if ($_tmp23==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 <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[113]->billsettingsvalue==1){?> positiveNo <?php }else{ ?> positivefloat <?php }?>"
                                           placeholder="<?php echo @BUY_BILL_QUANTITY;?>
" 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 $_tmp24=ob_get_clean();?><?php if ($_tmp24=='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="<?php echo @BUY_BILL_QUANTITY;?>
" 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="<?php echo @BUY_BILL_PRICE;?>
"
                                               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="<?php echo @BUY_BILL_DISCOUNT;?>
" tabindex="7" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[34]->billsettingsvalue;?>
<?php $_tmp25=ob_get_clean();?><?php if ($_tmp25==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 $_tmp26=ob_get_clean();?><?php if ($_tmp26==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="<?php echo @BUY_BILL_ROW_TAX;?>
" 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="buydiscountClass <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showbuydiscount!=1){?>hidden<?php }?>">
                                    <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->canEditAddDiscountPercentage!=1){?><span id="probuyDiscountPer_span<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"><?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->probuyDiscountPer;?>
</span><?php }?>
                                    <input name="probuyDiscountPer<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="probuyDiscountPer<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['mybuyBillDetails']->value->probuyDiscountPer;?>
"
                                           class="form-control txt-nonraduis positiveNo probuyDiscountPerClass getprototal" tabindex="7"
                                           <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->canEditAddDiscountPercentage==1){?>type="text"<?php }else{ ?>type="hidden"<?php }?> />
                                </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 } ?>

                            <?php }else{ ?>
                            <tr id="newProduct1">
                                <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"><?php echo @BUY_BILL_NEW;?>
</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 }?>>1</td>
                                <td
                                    class="check_tr_parcode <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[4]->billsettingsvalue;?>
<?php $_tmp28=ob_get_clean();?><?php if ($_tmp28==1){?>  hidden <?php }?>">
                                    <input type="text" class="form-control txt-nonraduis"
                                           placeholder="<?php echo @BUY_BILL_BARCODE;?>
" name="parcode1" id="parcode1"
                                           onKeyPress="getproductbyParcode(event, this.value, 1);" autocomplete="off"
                                           tabindex="7">
                                </td>
                                <td>
                                    <?php if ($_smarty_tpl->tpl_vars['billnameAddData']->value->billtype2=="1"){?>
                                    <div style="display: inline">
                                        <select class="select2 productCat productCat1" style="display: inline"
                                                data-level="0" data-itr="1" name="productCatId0_1" id="productCatId0_1">
                                            <option value="-1"><?php echo @BUY_BILL_CHOOSE_RATING;?>
</option>
                                            <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['catDataReport']->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->productCatId;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->productCatName;?>
</option>
                                            <?php } ?>
                                        </select>
                                    </div>
                                    <input type="hidden" id="level_1" data-itr="1" name="level_1" value="0">
                                    <div id="manyParents_1" data-itr="1" style="display: inline">

                                    </div>
                                    <?php }else{ ?>
                                    <!-- product -->
                                    <div id="productdiv1">
                                        <input type="hidden" id="product1" name="product1"
                                               data-placeholder="<?php echo @BUY_BILL_SELECT;?>
"
                                               class="select2product wdt100" tabindex="7" />
                                    </div>
                                    <?php }?>
                                </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="note1" id="note1"
                                              tabindex="7"></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==1){?>  hidden <?php }?>">
                                    <!-- unit -->
                                    <div id="unitDiv1">
                                        <select name="unitId1" id="unitId1" size="3" onchange="getUnitPrice(1);"
                                                data-placeholder="<?php echo @BUY_BILL_SELECT;?>
"
                                                class="select2 aw_m1 wdt100 chosenproduct" tabindex="7">
                                        </select>
                                    </div>
                                </td>


                                <td
                                    class="check_tr_quantity <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp30=ob_get_clean();?><?php if ($_tmp30==1){?>  hidden <?php }?>">
                                    <input name="pronum1" id="pronum1" value="1"
                                           class="form-control getprototal numberclic enteraction numberinput txt-nonraduis <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[113]->billsettingsvalue==1){?> positiveNo <?php }else{ ?> positivefloat <?php }?>"
                                           placeholder="<?php echo @BUY_BILL_DELETE;?>
" type="text" tabindex="7" />
                                </td>

                                <td class="  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
<?php $_tmp31=ob_get_clean();?><?php if ($_tmp31=='0'){?>  hidden <?php }?>">
                                    <input name="scunitname1" id="scunitname1" value="0"
                                           class="form-control txt-nonraduis positiveNo"
                                           placeholder="<?php echo @BUY_BILL_DELETE;?>
" type="text" tabindex="7" />
                                </td>
                                <td class="<?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?>">
                                    <!-- price -->
                                    <div id="propricechange1">
                                        <input name="proprice1" id="proprice1"
                                               placeholder="<?php echo @BUY_BILL_PRICE;?>
" value="0"
                                               class="form-control txt-nonraduis getprototal numberclic enteraction numberinput positivefloat"
                                               type="text" tabindex="7" />
                                    </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 $_tmp32=ob_get_clean();?><?php if ($_tmp32==1){?>  hidden <?php }?>">
                                    <input name="prodis1" id="prodis1" value="0"
                                           class="form-control getprototal numberonly enteraction numberinput txt-nonraduis positiveNo"
                                           placeholder="<?php echo @BUY_BILL_DISCOUNT;?>
" tabindex="7" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[34]->billsettingsvalue;?>
<?php $_tmp33=ob_get_clean();?><?php if ($_tmp33==0){?> type="text" <?php }else{ ?>
                                    type="hidden" <?php }?>/>
                                    <input name="discounttype1" id="discounttype1" value="0"
                                           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 $_tmp34=ob_get_clean();?><?php if ($_tmp34==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="rowtaxval1" id="rowtaxval1" value="0"
                                           class="form-control getprototal numberonly enteraction numberinput txt-nonraduis positiveNo"
                                           placeholder="<?php echo @BUY_BILL_ROW_TAX;?>
" type="hidden" />
                                    <input name="rowtaxper1" id="rowtaxper1" value="0"
                                           class="form-control getprototal numberonly enteraction numberinput txt-nonraduis positiveNo"
                                           tabindex="7" type="text" />
                                </td>
                                <td class="<?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showbuydiscount!=1){?>hidden<?php }?>">
                                    <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->canEditAddDiscountPercentage!=1){?><span id="probuyDiscountPer_span1">0</span><?php }?>
                                    <input name="probuyDiscountPer1" id="probuyDiscountPer1" value="0"
                                           class="form-control txt-nonraduis positiveNo probuyDiscountPerClass getprototal" tabindex="7"
                                           <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->canEditAddDiscountPercentage==1){?>type="text"<?php }else{ ?>type="hidden"<?php }?> />
                                </td>
                                <td class="aw_totalprice <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?>">
                                    <!--<td class="aw_totalprice" <?php if ($_smarty_tpl->tpl_vars['billnameAddData']->value->productAndQuantityOnly==1){?> style="display:none !important;" <?php }?>>-->
                                    <!--                                    <div id="prototal1" class="aw_mt form-control-static">0 <?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</div>
                                                                        <input name="hidden_prototal1" id="hidden_prototal1" type="hidden" value="0"  tabindex="7"/>-->

                                    <input name="hidden_prototal1" id="hidden_prototal1"
                                           class="editTotal form-control txt-nonraduis enteraction numberinput positiveNo"
                                           value="0" type="text" />

                                </td>
                                <td>
                                    <button type="button" id="remove1" class="removeproduct close flt-none"
                                            aria-hidden="true" onclick="removeproduct(1);">&times;</button>
                                </td>
                            </tr>
                            <?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 }?>"><?php echo @BUY_BILL_TOTAL_BUY;?>
<span
                        class="badge wht-clo">
                        <div id="buyBillTotal">0</div>
                        <input type="hidden" value="0" name="totalBuyBill" id="totalBuyBill" />
                    </span></button>
            </div>
            <!-- end of second row-->
            <!-- =========================== END BUY BILL PANEL ==================== -->

            <!-- =========================== START RETURN BUY BILL PANEL ====================== -->
            <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><?php echo @RETURN_BUY_BILL_BUY_RETURNS;?>
</h4>
                    </div>
                    <div class="col-lg-6">
                        <button type="button" name="addpro_re" id="addpro_re" class="btn btn-primary  pull-left ft-nor">
                            <?php echo @BUY_BILL_ADD_NEW;?>
</button>
                        <button type="button" style="display:none !important;" name="addpro_re" id="addpro_re"
                                class="btn btn-primary pull-left ft-nor"> <?php echo @BUY_BILL_ADD_NEW;?>
</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="wdt20" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[40]->billsettingsvalue;?>
<?php $_tmp35=ob_get_clean();?><?php if ($_tmp35==0){?> <?php }else{ ?>
                                    style="display:none !important;" <?php }?>><?php echo @BUY_BILL_NUMBER;?>
</th>
                                <th
                                    class="check_tr_parcode <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[4]->billsettingsvalue;?>
<?php $_tmp36=ob_get_clean();?><?php if ($_tmp36==1){?>  hidden <?php }?>">
                                    <?php echo @BUY_BILL_BARCODE;?>
</th>
                                <th class="wdt400"><?php echo @BUY_BILL_PRODUCT_NAME;?>
</th>
                                <th class="wdt240" <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[7]->billsettingsvalue==0){?> <?php }else{ ?>
                                    style="display:none !important;" <?php }?>><?php echo @BUY_BILL_NOTES;?>
</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 }?>">
                                    <?php echo @BUY_BILL_UNIT;?>
</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 }?>">
                                    <?php echo @BUY_BILL_QUANTITY;?>
</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 echo @BUY_BILL_PRICE;?>
</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 }?>">
                                    <?php echo @BUY_BILL_DISCOUNT;?>
</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 }?>">
                                    <?php echo @BUY_BILL_ROW_TAX;?>
</th>
                                <th class="wdt100n <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?>">
                                    <?php echo @BUY_BILL_TOTAL;?>

                                    <input name="hidden_itr_re" id="hidden_itr_re" type="hidden" value="1" />
                                </th>
                                <th class="wdt80"><?php echo @BUY_BILL_DELETE;?>
</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[40]->billsettingsvalue;?>
<?php $_tmp42=ob_get_clean();?><?php if ($_tmp42==0){?> <?php }else{ ?> style="display:none
                                    !important;" <?php }?>>1</td>
                                <td
                                    class="check_tr_parcode <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[4]->billsettingsvalue;?>
<?php $_tmp43=ob_get_clean();?><?php if ($_tmp43==1){?>  hidden <?php }?>">
                                    <input name="parcode_re1" type="text" id="parcode_re1"
                                           class="form-control  txt-nonraduis"
                                           placeholder="<?php echo @BUY_BILL_BARCODE;?>
"
                                           onkeypress="getreturnproductbyParcode(event, this.value, 1);" autocomplete="off"
                                           tabindex="301" />
                                </td>

                                <td><!-- اسم المنتج -->
                                    <?php if ($_smarty_tpl->tpl_vars['billnameAddData']->value->billtype2=="1"){?>
                                    <div style="display: inline">
                                        <select class="select2 productCat_re productCat_re1" style="display: inline"
                                                data-level="0" data-itr="1" name="productCatId_re0_1"
                                                id="productCatId_re0_1">
                                            <option value="-1"><?php echo @BUY_BILL_CHOOSE_RATING;?>
</option>
                                            <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['catDataReport']->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->productCatId;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->productCatName;?>
</option>
                                            <?php } ?>
                                        </select>
                                    </div>
                                    <input type="hidden" id="level_re_1" data-itr="1" name="level_re_1" value="0">
                                    <div id="manyParents_re_1" data-itr="1" style="display: inline">

                                    </div>
                                    <?php }else{ ?>
                                    <!-- product -->
                                    <div id="productdiv_re1">
                                        <input type="hidden" id="product_re1" name="product_re1"
                                               data-placeholder="<?php echo @BUY_BILL_SELECT;?>
"
                                               class="select2product_re wdt100" tabindex="301" />
                                    </div>
                                    <?php }?>
                                </td>

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

                                <!-- الوحدة -->
                                <td class="check_tr_unit <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[53]->billsettingsvalue;?>
<?php $_tmp44=ob_get_clean();?><?php if ($_tmp44==1){?>  hidden <?php }?>"">
                                    <div id="unitDiv_re1">
                                        <select name="unitId_re1" id="unitId_re1" onchange="return_getUnitPrice(1);"
                                                data-placeholder="<?php echo @BUY_BILL_SELECT;?>
"
                                                class="select2 aw_m1 wdt100 chosenproduct" tabindex="301">
                                        </select>
                                    </div>
                                </td>

                                <td class="check_tr_quantity <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp45=ob_get_clean();?><?php if ($_tmp45==1){?>  hidden <?php }?>">
                                    <input name="pronum_re1" id="pronum_re1" value="1"
                                           class="form-control return_getprototal numberclic txt-nonraduis enteraction numberinput <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[113]->billsettingsvalue==1){?> positiveNo <?php }else{ ?> positivefloat <?php }?>"
                                           placeholder="<?php echo @BUY_BILL_QUANTITY;?>
" type="text" tabindex="301" />
                                </td>

                                <td class="  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
<?php $_tmp46=ob_get_clean();?><?php if ($_tmp46=='0'){?>  hidden <?php }?>">
                                    <input name="scunitname_re1" id="scunitname_re1" value="0"
                                           class="form-control txt-nonraduis positivefloat" placeholder="<?php echo @BUY_BILL_QUANTITY;?>
"
                                           type="text" tabindex="7" />
                                </td>
                                <td class="<?php if ($_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>hidden<?php }?>">
                                    <div id="propricechange_re1">
                                        <input name="proprice_re1" id="proprice_re1" placeholder="<?php echo @BUY_BILL_PRICE;?>
"
                                               value="0"
                                               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 $_tmp47=ob_get_clean();?><?php if ($_tmp47==1){?>  hidden <?php }?>">
                                    <input name="prodis_re1" id="prodis_re1" value="0"
                                           class="form-control return_getprototal txt-nonraduis numberonly enteraction numberinput positiveNo"
                                           placeholder="<?php echo @BUY_BILL_DISCOUNT;?>
" tabindex="301" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[34]->billsettingsvalue;?>
<?php $_tmp48=ob_get_clean();?><?php if ($_tmp48==0){?> type="text" <?php }else{ ?> type="hidden" <?php }?>/>
                                    <input name="discounttype_re1" id="discounttype_re1" value="0"
                                           class="form-control return_getprototal numberonly enteraction numberinput txt-nonraduis positivefloat"
                                           tabindex="301" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[34]->billsettingsvalue;?>
<?php $_tmp49=ob_get_clean();?><?php if ($_tmp49==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_re1" id="rowtaxval_re1" value="0"
                                           class="form-control return_getprototal numberonly enteraction numberinput txt-nonraduis positiveNo"
                                           placeholder="<?php echo @BUY_BILL_ROW_TAX;?>
" type="hidden" />
                                    <input name="rowtaxper_re1" id="rowtaxper_re1" value="0"
                                           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 }?>">
                                    <!--                                    <div id="prototal_re1" class="aw_mt form-control-static">0 <?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</div>
                                                                                                        <input name="hidden_prototal_re1" id="hidden_prototal_re1" type="hidden" value="0"  tabindex="301"/>-->
                                    <input name="hidden_prototal_re1" id="hidden_prototal_re1"
                                           class="returnEditTotal form-control txt-nonraduis enteraction numberinput positiveNo" value="0"
                                           type="text" />

                                </td>
                                <td>
                                    <button type="button" id="remove_re1" class="removeproduct_re close flt-none" aria-hidden="true"
                                            onclick="removeproduct_re(1);">&times;</button>
                                </td>
                            </tr>
                        </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 }?>">
                    <?php echo @RETURN_BUY_BILL_TOTAL_BUY_RETURNS;?>
 <span class="badge wht-clo">
                        <div id="buyBillTotal_re">0</div>
                        <input type="hidden" value="0" name="returnBuyBillTotal" id="returnBuyBillTotal" />

                    </span>
                </button>
            </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"><?php echo @BUY_BILL_PAID;?>
</label>
                        <div class="col-lg-3">
                            <input type="text" class="form-control" placeholder="<?php echo @BUY_BILL_PAID;?>
" name="genpay2"
                                   id="genpay2">
                        </div>
                    </div>
                    <!-- end of form-group-->

                    <div class="form-group mg-bt5">
                        <label class="col-lg-1 control-label"><?php echo @BUY_BILL_REST;?>
</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 $_tmp50=ob_get_clean();?><?php if ($_tmp50==1){?>  hidden <?php }?>">
                        <label class="col-lg-1 control-label"><?php echo @BUY_BILL_TOTAL_INCLUSIVE_VAT;?>
</label>
                        <div class="col-lg-3">
                            <input type="text" class="form-control positivefloat" id="vatIncludedTotalIfRow" value="" />
                        </div>
                    </div>
                    <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="file" id="multiupload" name="files[]" multiple>
                        </div>
                    </div>

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

                <div class="col-lg-5">
                    <hr />
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[58]->billsettingsvalue;?>
<?php $_tmp52=ob_get_clean();?><?php if ($_tmp52==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label"><?php echo @BUY_BILL_NUMBER_PIECES;?>
</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="totalQty"><?php echo $_smarty_tpl->tpl_vars['piecesCount']->value;?>
</p>
                        </div>
                    </div>
                    <!-- 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"><?php echo @BUY_BILL_NUMBER_PIECES_RETURNED;?>
</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="returnTotalQty">0</p>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5 <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showbuydiscount!=1){?>hidden<?php }?>">
                        <label class="col-lg-5 control-label">اجمالى خصومات الشراء</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="totalBuyDiscountVal">0</p>
                            <input type="hidden" name="totalBuyDiscountVal_hidden" id="totalBuyDiscountVal_hidden" value="0"/>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5">
                        <label class="col-lg-5 control-label"><?php echo @BUY_BILL_TOTAL_AMOUNT;?>
</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 check_tr_discount <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[57]->billsettingsvalue;?>
<?php $_tmp53=ob_get_clean();?><?php if ($_tmp53==1){?>  hidden <?php }?>">
                        <label class="col-lg-5 control-label"><?php echo @BUY_BILL_DISCOUNT_TYPE;?>
</label>
                        <div class="col-lg-7">
                            <label> <?php echo @BUY_BILL_DIRECT_DISCOUNT;?>
</label>
                        </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 check_tr_discount <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[57]->billsettingsvalue;?>
<?php $_tmp54=ob_get_clean();?><?php if ($_tmp54==1){?>  hidden <?php }?>">
                        <label class="col-lg-5 control-label"><?php echo @BUY_BILL_DISCOUNT_TYPE;?>
</label>
                        <div class="col-lg-7">
                            <label> <?php echo @BUY_BILL_PERCENTAGE_DISCOUNT;?>
</label>
                        </div>
                    </div>
                    <?php }elseif($_smarty_tpl->tpl_vars['billsettingsData']->value[44]->billsettingsvalue==2){?>
                    <div
                        class="form-group mg-bt5 check_tr_discount <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[57]->billsettingsvalue;?>
<?php $_tmp55=ob_get_clean();?><?php if ($_tmp55==1){?>  hidden <?php }?>">
                        <label class="col-lg-5 control-label"><?php echo @BUY_BILL_DISCOUNT_TYPE;?>
</label>
                        <div class="col-lg-7">
                            <select name="discount_type" id="discount_type" class="select2 wdt100" dir="rtl">
                                <option value="0" <?php if (($_smarty_tpl->tpl_vars['offerId']->value>0&&$_smarty_tpl->tpl_vars['buyBillData']->value->buybilldiscountrype==0)){?>selected<?php }?>><?php echo @BUY_BILL_DIRECT_DISCOUNT;?>
</option>
                                <option value="1" <?php if (($_smarty_tpl->tpl_vars['offerId']->value>0&&$_smarty_tpl->tpl_vars['buyBillData']->value->buybilldiscountrype==1)){?>selected<?php }?>><?php echo @BUY_BILL_PERCENTAGE_DISCOUNT;?>
</option>
                            </select>
                        </div>
                    </div>
                    <?php }?>

                    <!-- end of form-group-->
                    <div
                        class="form-group mg-bt5 check_tr_discount <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[57]->billsettingsvalue;?>
<?php $_tmp56=ob_get_clean();?><?php if ($_tmp56==1){?>  hidden <?php }?>">
                        <label class="col-lg-5 control-label"> <?php echo @BUY_BILL_DISCOUNT_VALUE;?>
</label>
                        <div class="col-lg-7"><span id="sprytextfield3">
                                <input name="gendis" id="gendis" class="form-control numberclic numberinput positivefloat" <?php if (isset($_smarty_tpl->tpl_vars['buyBillData']->value->buybilldiscount)){?>value="<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybilldiscount;?>
"<?php }else{ ?> <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[57]->billsettingsvalue;?>
<?php $_tmp57=ob_get_clean();?><?php if ($_tmp57!="0"||$_smarty_tpl->tpl_vars['usergroup']->value->hideBillPrices==1){?>value="0"
                                <?php }?><?php }?> type="text" placeholder="<?php echo @BUY_BILL_DISCOUNT_VALUE;?>
" />
                                <span class="textfieldRequiredMsg">*</span></span></div>
                    </div>

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

                    <div <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[36]->billsettingsvalue;?>
<?php $_tmp59=ob_get_clean();?><?php if ($_tmp59=="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"><?php echo @BUY_BILL_VALUE_TAX;?>
</label>
                            <div class="col-lg-7">

                                <div class="input-group">
                                    <input type="text" name="payedtax" class="form-control numberinput positiveNo" id="payedtax"
                                           value="<?php if (isset($_smarty_tpl->tpl_vars['buyBillData']->value->payedtax)){?><?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->payedtax;?>
<?php }else{ ?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->vatValue;?>
<?php }?>"
                                           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 />
                                    <span class="input-group-addon"><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->currancy;?>
</span>
                                </div>
                            </div>
                        </div>


                    </div>

                    <!-- end of form-group-->
                    <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 $_tmp60=ob_get_clean();?><?php if ($_tmp60=="0"){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label"><?php echo @BUY_BILL_PURE;?>
</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="gen2total"><?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybillaftertotalbill;?>
</p>
                            <input type="hidden" name="totalafterdiscount" id="totalafterdiscount"
                                   value="<?php echo $_smarty_tpl->tpl_vars['buyBillData']->value->buybillaftertotalbill;?>
" />
                        </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 $_tmp61=ob_get_clean();?><?php if ($_tmp61=="0"){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label"><?php echo @BUY_BILL_PAID;?>
</label>
                        <div class="col-lg-7">
                            <input name="genpay" id="genpay" class="form-control numberclic numberinput positivefloat"
                                   type="text" placeholder="0" />
                        </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 $_tmp62=ob_get_clean();?><?php if ($_tmp62==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label"><?php echo @BUY_BILL_RESIDUAL;?>
</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="gen3total">0</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"><?php echo @BUY_BILL_REST_DEBT;?>
</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"><?php echo @BUY_BILL_SAVE;?>
</button>
                <button type="submit" id="saveAndNew" class="btn btn-success"
                        onclick="return changeFormAction(<?php echo $_smarty_tpl->tpl_vars['billnameid']->value;?>
);"><?php echo @BUY_BILL_SAVE_NEW;?>
</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" id="productModal2" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog" style="width: 910px;">
                <div classnew_cat_id="modal-content bg-modal" class="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 check_tr_parcode <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[4]->billsettingsvalue;?>
<?php $_tmp63=ob_get_clean();?><?php if ($_tmp63==1){?>  hidden <?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">
                                        <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   -------------------------->
                                <!---------------------------->
                                <div class="clearfix"></div>
                                <br />
                                <div class="form-group "
                                     style="padding: 8px; line-height: 1.428571429; vertical-align: top; border-top: 1px solid #ddd;">
                                    <label for="inputEmail1" class="col-lg-2 control-label">بمقاسات و الوان</label>
                                    <div class="col-lg-4">
                                        <label>
                                            <input value="1" class="radioR hasSizeAndColor" name="hasSizeAndColor"
                                                   type="radio" />
                                            نعم </label>
                                        <label>
                                            <input value="0" class="noradioR hasSizeAndColor" name="hasSizeAndColor"
                                                   type="radio" checked="checked" />
                                            لا </label>
                                    </div>
                                </div>
                                <!---------------------------->
                                <!-- size color ------------------------------->
                                <div class="panel panel-default panel-m" id="sizeColorDiv" style="display:none">
                                    <div class="panel-heading">
                                        <h3 class="panel-title">المقاسات و الالوان</h3>
                                    </div>
                                    <div class="panel-body">
                                        <div class="row">
                                            <div class="col-lg-5" id="rightpart" style="display: inline">
                                                <label for="sizes" class="col-lg-4 control-label">المقاسات</label>
                                                <select class="select2" name="sizes[]" id="sizes" multiple="multiple">
                                                    <option value="-1">كل المقاسات</option>
                                                    <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allSizeColor']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                                    <?php if ($_smarty_tpl->tpl_vars['data']->value->type==0){?>
                                                    <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->name;?>
</option>
                                                    <?php }?>
                                                    <?php } ?>
                                                </select>
                                            </div>
                                            <div class="col-lg-5" id="leftpart" style="display: inline">
                                                <label for="colors" class="col-lg-4 control-label">الالوان</label>
                                                <select class="select2" name="colors[]" id="colors" multiple="multiple">
                                                    <option value="-1">كل الالوان</option>
                                                    <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allSizeColor']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                                    <?php if ($_smarty_tpl->tpl_vars['data']->value->type==1){?>
                                                    <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->name;?>
</option>
                                                    <?php }?>
                                                    <?php } ?>
                                                </select>
                                            </div>
                                            <div class="col-lg-2" id="leftpart" style="display: inline">
                                                <button type="button" class="btn btn-success pull-left"
                                                        id="SizeColorQuantity">ادخال الكميات </button>
                                            </div>


                                        </div>
                                        <div class="clearfix"></div>
                                        <br />
                                        <div class="row" id="quantity_div" style="display:none">
                                            <table class="table">
                                                <thead>
                                                    <tr>
                                                        <th>الباركود</th>
                                                        <th>المقاس</th>
                                                        <th>اللون</th>
                                                        <th>الكمية</th>
                                                        <th>حذف</th>
                                                    </tr>
                                                </thead>
                                                <tbody id="SizeColorTB">

                                                </tbody>
                                            </table>
                                            <input type="hidden" id="sizeColorItr" name="sizeColorItr" value="0" />
                                        </div>

                                    </div>
                                </div>
                                <!-- END  size color ---------------------->
                                </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>

        <?php if ($_smarty_tpl->tpl_vars['billnameAddData']->value->billtype2=="1"){?>
        <div id="cats" style="display:none;">
            <option value="-1">اختر تصنيف</option>
            <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['catDataReport']->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->productCatId;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->productCatName;?>
</option>
            <?php } ?>
        </div>
        <?php }?>

        <!---================== 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 positivefloat 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 -->
        <!------------------------Products with size & color Model----------------------------->
        <!-- Modal -->
        <div class="modal fade" id="proSizeColorModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
             aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content bg-modal">
                    <div class="modal-header">
                        <button type="button" class="close pull-left savemodel2" data-dismiss="modal"
                                aria-hidden="true">&times;</button>
                        <h4 class="modal-title"><?php echo @BUY_BILL_ADD_PRO_SIZE_COLOR;?>
</h4>
                    </div>
                    <div class="modal-body">
                        <div class="form-group">
                            <label for="debtLimit"
                                   class="col-lg-3 control-label"><?php echo @BUY_BILL_PRODUCT_NAME;?>
</label>
                            <div class="col-lg-9">
                                <input type="hidden" id="productSC" name="productSC"
                                       data-placeholder="<?php echo @BUY_BILL_SELECT;?>
" class="select2productSC wdt100"
                                       data-getColorSizeOnly="1" />
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <br />
                        <div class="row" id="quantity_div">
                            <table class="table table-bordered">
                                <thead>
                                    <tr>
                                        <th>الباركود</th>
                                        <th>المقاس</th>
                                        <th>اللون</th>
                                        <th>الكمية</th>
                                        <th>سعر الشراء</th>
                                        <th>حذف</th>
                                    </tr>
                                </thead>
                                <tbody id="SizeColorTB_eman">

                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default savemodel2"
                                data-dismiss="modal"><?php echo @BUY_BILL_CANCEL;?>
</button>
                        <button type="button" class="btn btn-primary"
                                id="doAddProWithSC"><?php echo @BUY_BILL_SAVE;?>
</button>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
        </div>
        <!-- /.modal -->
        <!-- ============================================= -->

    </div>
</div>

<form action="buyBillController.php?do=excelToBill" method="post" enctype="multipart/form-data" id="billAsExcelForm">
    <input name="billAsExcelFile" id="billAsExcelFile" type="file"
           accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
           class="hidden" />
</form>

<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 }} ?>