<?php /* Smarty version Smarty-3.1.11, created on 2025-08-30 19:15:29
         compiled from "..\views\default\sellbillview\billedit.html" */ ?>
<?php /*%%SmartyHeaderCode:753168b323a187ccc8-11641339%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '5e775a93af542568cb2c8fe04e7f5d55d8cc6c11' => 
    array (
      0 => '..\\views\\default\\sellbillview\\billedit.html',
      1 => 1720470825,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '753168b323a187ccc8-11641339',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'productData' => 0,
    'product' => 0,
    'returnproductData' => 0,
    'returnproduct' => 0,
    'categoriesData' => 0,
    'cat' => 0,
    'unitsData' => 0,
    'unit' => 0,
    'storeData' => 0,
    'store' => 0,
    'userdata' => 0,
    'Programsettingdata' => 0,
    'allDiscounts' => 0,
    'Usergroupdata' => 0,
    'billsettingsData' => 0,
    'billnameAddData' => 0,
    'mysellbilldata' => 0,
    'returnmysellbilldata' => 0,
    'billId' => 0,
    'billStatus' => 0,
    'myclientdata' => 0,
    'client' => 0,
    'allCostcenter' => 0,
    'myallCostcenter' => 0,
    'clientData' => 0,
    'y' => 0,
    'mysellbildetales' => 0,
    'returnmysellbildetales' => 0,
    'allSaves' => 0,
    'data' => 0,
    'allCurrency' => 0,
    'billCurrData' => 0,
    'currency' => 0,
    'sellerData' => 0,
    'seller' => 0,
    'billOperations' => 0,
    'knownWays' => 0,
    'way' => 0,
    'billnameid' => 0,
    'billnameData' => 0,
    'userSaveData' => 0,
    'controlname' => 0,
    'detalesitr' => 0,
    'x' => 0,
    'mymysellbildetales' => 0,
    'mymyunitdata' => 0,
    'ex' => 0,
    'sellbilldetailtax' => 0,
    'returndetalesitr' => 0,
    'myreturnmysellbildetales' => 0,
    'remymyunitdata' => 0,
    'sellbilldiscount' => 0,
    'returnsellbilldiscount' => 0,
    'sellbilltotalpayed' => 0,
    'bankAccounts' => 0,
    'acc' => 0,
    'roundNumbersStatus' => 0,
    'noOfDecimalPlaces' => 0,
    'previousPriceStatus' => 0,
    'storenegative' => 0,
    'today' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_68b323a3241146_59688239',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_68b323a3241146_59688239')) {function content_68b323a3241146_59688239($_smarty_tpl) {?><!-- === here the drop down list that fill the product list === -->
<style>
    .serial-success {
        background-color: #6ed96e !important;
    }

    .serial-error {
        background-color: #f47c7c !important;
    }

    .proDetails {
        cursor: pointer;
    }

    .proDetails:hover {
        text-decoration: underline;
        color: blue;
        font-weight: bold;
    }

    .newoption {
        background-color: #CCCCCC !important;
        font-weight: bold !important;
    }

    /*for select2-drop of product*/
    .largeWidthForDropDown {
        width: 500px !important;
    }



    /* -- progress bar ------------------------------------------------------ */
    #myProgress {
        width: 100%;
        background-color: #ddd;
    }

    #myBar {
        width: 0%;
        height: 20px;
        background-color: #04AA6D;
        text-align: center;
        color: white;
    }

    /* ---------------------------------------------------------------------- */
    .small-addon {
        border-right: 1px solid #ccc !important;
        padding: 4px 4px;
        width: 25px;
    }
</style>
<script type="application/javascript">
    //$(document).ready(function(e) {
    //
    //	$("#pronum1").keydown(function(e) {
    //   // test for the enter key
    //	   if (e.keyCode == 40) {
    //		   alert(this.name);
    //		  // Do your function
    //		  $("#pronum2").select();
    //	 //    alert("sfdsfds");
    //	   }
    //
    //
    //	});
    //
    //
    //
    //		$("#textfield2").keydown(function(e) {
    //			   // test for the enter key
    //			   if (e.keyCode == 38) {
    //				  // Do your function
    //				  $("#textfield").select();
    //			 //    alert("sfdsfds");
    //			   }
    //
    //		});
    //
    //});
</script>
<div id="addrowcreated" style="display:none">
    <option value="-1"> </option>
    <?php  $_smarty_tpl->tpl_vars['product'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['product']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['productData']->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['product']->value->productName;?>
 </option>
    <?php } ?>
</div>
<div id="addreturnproduct" style="display:none"> <?php  $_smarty_tpl->tpl_vars['returnproduct'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['returnproduct']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['returnproductData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['returnproduct']->key => $_smarty_tpl->tpl_vars['returnproduct']->value){
$_smarty_tpl->tpl_vars['returnproduct']->_loop = true;
?>
    <option value="-1"> </option>
    <option value="<?php echo $_smarty_tpl->tpl_vars['returnproduct']->value->productId;?>
"><?php echo $_smarty_tpl->tpl_vars['returnproduct']->value->productName;?>
 </option>
    <?php } ?>
</div>
<div id="addProductCat" 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="addNewUnit" style="display:none;"> <?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="addstore" style="display:none;" class="clientstore">
    <?php  $_smarty_tpl->tpl_vars['store'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['store']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['storeData']->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 echo $_smarty_tpl->tpl_vars['store']->value->storeName;?>
</option>
    <?php } ?>

</div>
<div id="addstore2" style="display:none;" class="clientstoretxt">
    <?php  $_smarty_tpl->tpl_vars['store'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['store']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['storeData']->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 $_tmp1=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['userdata']->value->userstoreid;?>
<?php $_tmp2=ob_get_clean();?><?php if ($_tmp1==$_tmp2){?><?php echo $_smarty_tpl->tpl_vars['store']->value->storeName;?>
 <?php }?>
    <?php } ?>
</div>
<!-- === end of drop down list === -->

<!-- === here the drop down list that fill the product list === -->

<div id="addunit" style="display:none"> </div>
<!-- === end of drop down list === -->
<input type="hidden" name="scunitnamevalue" id="scunitnamevalue" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
" />
<input type="hidden" name="clientPhoneReq" id="clientPhoneReq" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->clientPhoneReq;?>
" />
<input type="hidden" name="addServiceToBill" id="addServiceToBill" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->addServiceToBill;?>
" />
<input name="showPrevDiscount" id="showPrevDiscount" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->showPrevDiscount;?>
" />
<input type="hidden" name="usedParcode" id="usedParcode" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->usedParcode;?>
" />
<input type="hidden" name="valueadded" id="valueadded" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->valueadded;?>
" />
<input type="hidden" name="sendBillToRestaurant" id="sendBillToRestaurant"
       value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->sendBillToRestaurant;?>
" />
<input type="hidden" name="defaultUnitPriceAtBill" id="defaultUnitPriceAtBill"
       value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->defaultUnitPriceAtBill;?>
" />


<input type="hidden" name="showpriceall" id="showpriceall" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->showpriceall;?>
" />
<input type="hidden" name="showpricehalf" id="showpricehalf" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->showpricehalf;?>
" />
<input type="hidden" name="showpriceunit" id="showpriceunit" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->showpriceunit;?>
" />
<input type="hidden" name="showprice4" id="showprice4" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice4;?>
" />
<input type="hidden" name="showprice5" id="showprice5" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice5;?>
" />
<input type="hidden" name="showprice6" id="showprice6" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice6;?>
" />
<input type="hidden" name="showprice7" id="showprice7" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice7;?>
" />
<input type="hidden" name="showprice8" id="showprice8" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice8;?>
" />

<input type='hidden' name='allDiscounts' id='allDiscounts' value='<?php echo $_smarty_tpl->tpl_vars['allDiscounts']->value;?>
' />
<input type="hidden" name="stopDiscountOfTotalControl" id="stopDiscountOfTotalControl"
       value="<?php echo $_smarty_tpl->tpl_vars['Usergroupdata']->value->stopDiscountOfTotalControl;?>
" />
<input type="hidden" name="discountOfTotalControlEditable" id="discountOfTotalControlEditable"
       value="<?php echo $_smarty_tpl->tpl_vars['Usergroupdata']->value->discountOfTotalControlEditable;?>
" />
<input type="hidden" name="discountOfTotalControlMTGDA" id="discountOfTotalControlMTGDA"
       value="<?php echo $_smarty_tpl->tpl_vars['Usergroupdata']->value->discountOfTotalControlMTGDA;?>
" />
<input type="hidden" name="supplierWithAddOption" id="supplierWithAddOption"
       value="<?php echo $_smarty_tpl->tpl_vars['Usergroupdata']->value->addClientInBill;?>
" />
<input type="hidden" name="withNakdi" id="withNakdi" value="<?php echo $_smarty_tpl->tpl_vars['Usergroupdata']->value->showClientAndSupplierOne;?>
" />
<input type="hidden" name="hideBillPrices" id="hideBillPrices" value="<?php echo $_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices;?>
" />
<input type="hidden" name="searchWithCatAndProductNameOnly" id="searchWithCatAndProductNameOnly"
       value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[97]->billsettingsvalue;?>
" />
<input type="hidden" name="activateAutoSave" id="activateAutoSave" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[98]->billsettingsvalue;?>
" />

<input type="hidden" name="clientType" id="clientType" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[103]->billsettingsvalue;?>
" />
<input type="hidden" id="retOnlySoldProducts" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[105]->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;?>
" />
<input type="hidden" id="canEditAddDiscountPercentage" value="<?php echo $_smarty_tpl->tpl_vars['Usergroupdata']->value->canEditAddDiscountPercentage;?>
"/>
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">ادارة الفواتير</a></li>
            <li><a href="sellbillController.php?do=show"> <?php echo $_smarty_tpl->tpl_vars['billnameAddData']->value->name;?>
</a></li>
            <li class="active">تعديل <?php echo $_smarty_tpl->tpl_vars['billnameAddData']->value->name;?>
</li>
        </ol>
        <h3><?php echo $_smarty_tpl->tpl_vars['billnameAddData']->value->name;?>
</h3>
        <hr />



        
        <form class="form-horizontal " role="form" action="sellbillController.php?do=update" method="post"
              id="sellbillForm" onsubmit="
                      //check if muliple clients to make sure user is choosing one client at least then validate form
                      if ($('.multiSupp').is(':visible'))
                      {
                          var foo = [];
                          $('#supplier :selected').each(function (i, selected) {
                              foo[i] = $(selected).text();
                          });
                          if (foo.length === 0) {
                              alert('من فضلك اختر عميل واحد على الاقل');
                              return false;
                          } else
                          {
                              if (Spry.Widget.Form.validate(this)) {
                                  $('#saveAndNew').css('display', 'none');
                                  $('#saveBill').css('display', 'none');
                                  return true;
                              } else {
                                  return false;
                              }
                          }
                      } else
                      {
                          if (Spry.Widget.Form.validate(this)) {
                              $('#saveAndNew').css('display', 'none');
                              $('#saveBill').css('display', 'none');
                              return true;
                          } else {
                              return false;
                          }
                      }
              ">
            


            <input name="oldid" type="hidden"
                   value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbillid;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbillid;?>
" />
            <div class="row">




                <div class="col-lg-8">
                    <div class="form-group" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[61]->billsettingsvalue;?>
<?php $_tmp3=ob_get_clean();?><?php if ($_tmp3==0){?> style="display:block"
                        <?php }else{ ?> style="display:none" <?php }?>>
                        <label class="col-lg-2 control-label">رقم الفاتورة</label>
                        <div class="col-lg-4">
                            <input type="text" name="bns" id="bns"
                                   value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbillserial;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbillserial;?>
"
                                   class="form-control" placeholder="رقم الفاتورة">
                        </div>
                    </div>
                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->clientserial==1){?>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">الرقم التسلسلي</label>
                        <div class="col-lg-4">
                            <input type="text"
                                   value="<?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->taxBillNumber;?>
<?php $_tmp4=ob_get_clean();?><?php if ($_tmp4>0){?><?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->taxBillNumber;?>
<?php }else{ ?><?php echo $_smarty_tpl->tpl_vars['billId']->value;?>
<?php }?>"
                                   class="form-control" disabled readonly>
                        </div>
                    </div>
                    <?php }?>
                    <!-- end of form-group-->

                    <div class="form-group" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[5]->billsettingsvalue;?>
<?php $_tmp5=ob_get_clean();?><?php if ($_tmp5==0){?> style="display:block"
                        <?php }else{ ?> style="display:none" <?php }?> >
                        <label class="col-lg-2 control-label">تاريخ الفاتورة</label>
                        <div class="col-lg-4"> <span id="sprydate">
                                <!--input type="text" class="form-control awdatepicker" autocomplete="off"  data-date-format="yyyy-mm-dd" placeholder="تاريخ الفاتورة" <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->allowdateedit==1){?>disabled="disabled"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbilldate;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbilldate;?>
" name="bn" id="bn"-->
                                <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->allowdateedit==1){?>
                                <input type="text" class="form-control" placeholder="تاريخ الفاتورة" readonly
                                       value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbilldate;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbilldate;?>
"
                                       name="bn" id="bn">
                                <?php }else{ ?>
                                <div class="input-group date form_datetime col-md-5" data-date=""
                                     data-date-format="yyyy-mm-dd  h:i:s" data-link-field="dtp_input1">
                                    <input class="form-control" size="16" type="text"
                                           value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbilldate;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbilldate;?>
"
                                           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 }?>
                                <span class="textfieldRequiredMsg">*</span></span>
                        </div>
                    </div>

                    <div class="form-group" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[119]->billsettingsvalue;?>
<?php $_tmp6=ob_get_clean();?><?php if ($_tmp6!=1){?> style="display:none" <?php }?>>
                        <label class="col-lg-2 control-label"> <?php echo @SELL_BILL_SELL_INVOICE_NUMBER;?>
</label>
                        <div class="col-lg-4">
                            <input type="text" name="sellbillno" id="sellbillno" value="<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->sellbillno;?>
" class="form-control positiveNo"
                                   placeholder="<?php echo @SELL_BILL_SELL_INVOICE_NUMBER;?>
 ">
                        </div>
                    </div>
                    <!-- end of form-group-->

                    <div <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[35]->billsettingsvalue;?>
<?php $_tmp7=ob_get_clean();?><?php if ($_tmp7==0){?> <?php }else{ ?> style="display:none" <?php }?> >


                        <div class="form-group">
                            <label class="col-lg-2 control-label">رقم السيارة</label>
                            <div class="col-lg-4"> <span id="sprytempname">
                                    <input type="text" class="form-control" placeholder="رقم السيارة" name="carNumber"
                                           id="carNumber"
                                           value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->carnumber;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->carnumber;?>
" />
                                    <span class="textfieldRequiredMsg">*</span></span> </div>
                        </div>

                        <div class="form-group">
                            <label class="col-lg-3 control-label">نوع السيارة</label>
                            <div class="col-lg-4"> <span id="sprytempname">
                                    <input type="text" class="form-control" placeholder="نوع السيارة" name="carType"
                                           id="carType" value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->cartype;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->cartype;?>
" />
                                    <span class="textfieldRequiredMsg">*</span></span> </div>
                        </div>

                        <div class="form-group">
                            <label class="col-lg-3 control-label">شاسيه السيارة</label>
                            <div class="col-lg-4"> <span id="sprytempname">
                                    <input type="text" class="form-control" placeholder="شاسيه السيارة" name="carChase"
                                           id="carChase"
                                           value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->carchase;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->carchase;?>
" />
                                    <span class="textfieldRequiredMsg">*</span></span> </div>
                        </div>

                        <div class="form-group" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[40]->billsettingsvalue;?>
<?php $_tmp8=ob_get_clean();?><?php if ($_tmp8==0){?> <?php }else{ ?>
                            style="display:none" <?php }?> >
                            <label class="col-lg-3 control-label">موتور السيارة</label>
                            <div class="col-lg-4"> <span id="sprytempname">
                                    <input type="text" class="form-control" placeholder="موتور السيارة" name="carMotor"
                                           id="carMotor"
                                           value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->carmotor;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->carmotor;?>
" />
                                    <span class="textfieldRequiredMsg">*</span></span> </div>
                        </div>

                    </div>

                    <div class="form-group" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[50]->billsettingsvalue;?>
<?php $_tmp9=ob_get_clean();?><?php if ($_tmp9==0){?> <?php }else{ ?> style="display:none"
                        <?php }?>>
                        <label class="col-lg-2 control-label">اسم العميل المؤقت</label>
                        <div class="col-lg-4"> <span id="sprytempname">
                                <input type="text" class="form-control" placeholder="الاسم المؤقت" name="tempclientName"
                                       id="tempclientName"
                                       value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->tempclientName;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->tempclientName;?>
" />
                                <span class="textfieldRequiredMsg">*</span></span> </div>
                    </div>
                    <div class="form-group" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[102]->billsettingsvalue;?>
<?php $_tmp10=ob_get_clean();?><?php if ($_tmp10==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-2 control-label"><?php echo @SELL_BILL_DATE_OF_STARTING;?>
 </label>
                        <div class="col-lg-4"> <span id="sprydate">
                                <input type="text" class="form-control awdatepicker" autocomplete="off"
                                       data-date-format="yyyy-mm-dd" placeholder="<?php echo @SELL_BILL_DATE_OF_STARTING;?>
"
                                       value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->datestarting;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->datestarting;?>
"
                                       name="datestarting">
                                <span class="textfieldRequiredMsg">*</span></span>
                        </div>
                    </div>
                    <div class="form-group" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[110]->billsettingsvalue;?>
<?php $_tmp11=ob_get_clean();?><?php if ($_tmp11==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-3 control-label"><?php echo @SELL_BILL_STATUS;?>
 </label>
                        <div class="col-lg-4">
                            <?php if ($_smarty_tpl->tpl_vars['billStatus']->value=="new"){?>
                            <?php echo @SELL_BILL_STATUS_NEW;?>

                            <?php }elseif($_smarty_tpl->tpl_vars['billStatus']->value=="prepare"){?>
                            <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[111]->billsettingsvalue==0){?>
                            <?php echo @SELL_BILL_STATUS_PREPARE;?>

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

                            <?php }?>
                            <?php }elseif($_smarty_tpl->tpl_vars['billStatus']->value=="shipped"){?>
                            <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[111]->billsettingsvalue==0){?>
                            <?php echo @SELL_BILL_STATUS_SHIPPED;?>

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

                            <?php }?>
                            <?php }elseif($_smarty_tpl->tpl_vars['billStatus']->value=="deliver"){?>
                            <?php echo @SELL_BILL_STATUS_DELIVERED;?>

                            <?php }elseif($_smarty_tpl->tpl_vars['billStatus']->value=="refused"){?>
                            <?php echo @SELL_BILL_STATUS_REFUSED;?>

                            <?php }?>
                        </div>
                    </div>
                    <!-- end of form-group-->

                    <div <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[39]->billsettingsvalue;?>
<?php $_tmp12=ob_get_clean();?><?php if ($_tmp12==0){?> <?php }else{ ?> style="display:none" <?php }?> >
                        <div id="divclientdata">
                            <div class="form-group">
                                <label class="col-lg-3 control-label">عنوان العميل : </label>
                                <div class="col-lg-4">
                                    <label> <?php echo $_smarty_tpl->tpl_vars['myclientdata']->value->clientaddress;?>
</label>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-lg-3 control-label">رقم التليفون:</label>
                                <div class="col-lg-4">
                                    <label><?php echo $_smarty_tpl->tpl_vars['myclientdata']->value->clientphone;?>
</label>
                                </div>


                            </div>


                            <div class="form-group">
                                <label class="col-lg-3 control-label">كود العميل:</label>
                                <div class="col-lg-4">
                                    <label><?php echo $_smarty_tpl->tpl_vars['myclientdata']->value->clientcode;?>
</label>
                                </div>


                            </div>

                        </div>

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


                                <option value="-1">اختر مركز التكلفه</option>
                                <?php  $_smarty_tpl->tpl_vars['myallCostcenter'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['myallCostcenter']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allCostcenter']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['myallCostcenter']->key => $_smarty_tpl->tpl_vars['myallCostcenter']->value){
$_smarty_tpl->tpl_vars['myallCostcenter']->_loop = true;
?>



                                <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->costcenterid;?>
<?php $_tmp14=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['myallCostcenter']->value->id;?>
<?php $_tmp15=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->costcenterid;?>
<?php $_tmp16=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['myallCostcenter']->value->id;?>
<?php $_tmp17=ob_get_clean();?><?php if ($_tmp14==$_tmp15||$_tmp16==$_tmp17){?>selected="selected"
                                    <?php }?> value="<?php echo $_smarty_tpl->tpl_vars['myallCostcenter']->value->id;?>
"><?php echo $_smarty_tpl->tpl_vars['myallCostcenter']->value->name;?>
</option>

                                <?php } ?>


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

                </div>
                <div class="col-lg-4">
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[1]->billsettingsvalue;?>
<?php $_tmp18=ob_get_clean();?><?php if ($_tmp18==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-4 control-label">اسم العميل</label>
                        <div class="col-lg-8"> <span id="spryclient">
                                <div id="clientDiv">

                                    <!--                                    <select class="select2Supp wdt100" name="supplier" id="supplier" >


                                                                                            <?php $_smarty_tpl->tpl_vars['y'] = new Smarty_variable(1, null, 0);?>
                                                                                            <?php  $_smarty_tpl->tpl_vars['client'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['client']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['clientData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['client']->key => $_smarty_tpl->tpl_vars['client']->value){
$_smarty_tpl->tpl_vars['client']->_loop = true;
?>

                                                                                            <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['y']->value;?>
<?php $_tmp19=ob_get_clean();?><?php if ($_tmp19==2){?>
                                                                                            <option  value="-2"  class="newoption">اضافة عميل جديد</option>
                                                                                            <?php }?>


                                                                                            <option value="<?php echo $_smarty_tpl->tpl_vars['client']->value->clientid;?>
" data-id="i<?php echo $_smarty_tpl->tpl_vars['client']->value->clientid;?>
" data-mobile="<?php echo $_smarty_tpl->tpl_vars['client']->value->clientmobile;?>
" data-phone="<?php echo $_smarty_tpl->tpl_vars['client']->value->clientphone;?>
" data-clientcode="<?php echo $_smarty_tpl->tpl_vars['client']->value->clientcode;?>
" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbillclientid;?>
<?php $_tmp20=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['client']->value->clientid;?>
<?php $_tmp21=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbillclientid;?>
<?php $_tmp22=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['client']->value->clientid;?>
<?php $_tmp23=ob_get_clean();?><?php if ($_tmp20==$_tmp21||$_tmp22==$_tmp23){?> selected="selected" <?php }?> > <?php echo $_smarty_tpl->tpl_vars['client']->value->clientname;?>
</option>

                                                                                            <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'y', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['y']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                                                            <?php } ?>


                                                                                        </select>-->
                                    <input type="hidden" name="supplier" id="supplier" class="select2Supp" />
                                    <input type="hidden" id="oldsupplierid" value="<?php echo $_smarty_tpl->tpl_vars['myclientdata']->value->clientid;?>
" />
                                    <input type="hidden" id="oldsuppliername" value="<?php echo $_smarty_tpl->tpl_vars['myclientdata']->value->clientname;?>
" />
                                    <input type="hidden" id="initialSupp_Debt" value="<?php echo $_smarty_tpl->tpl_vars['myclientdata']->value->clientdebt;?>
" />

                                </div>
                                <span class="selectInvalidMsg">*</span>
                            </span> </div>

                        <input type="hidden" id="specialDiscount_" value="<?php echo $_smarty_tpl->tpl_vars['myclientdata']->value->specialDiscount;?>
" />
                        <input type="hidden" id="specialDiscountVal_" value="<?php echo $_smarty_tpl->tpl_vars['myclientdata']->value->specialDiscountVal;?>
" />
                    </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 $_tmp24=ob_get_clean();?><?php if ($_tmp24==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-4 control-label">رصيد الدين</label>
                        <div class="col-lg-8">
                            <p class="form-control-static" id="debt"><?php echo $_smarty_tpl->tpl_vars['myclientdata']->value->clientdebt;?>
 </p>
                            <input name="hidden_debt" id="hidden_debt" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['myclientdata']->value->clientdebt;?>
" />
                            <input id="hidden_debt_main_curr" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['myclientdata']->value->clientdebt;?>
" />
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div id="commentAZ" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[78]->billsettingsvalue;?>
<?php $_tmp25=ob_get_clean();?><?php if ($_tmp25==0){?> <?php }else{ ?> style="display:none"
                        <?php }?>>
                        <div class="form-group">
                            <label class="col-lg-4 control-label">تفاصيل العميل</label>
                            <div class="col-lg-4">

                            </div>
                        </div>

                    </div>

                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[68]->billsettingsvalue;?>
<?php $_tmp26=ob_get_clean();?><?php if ($_tmp26==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-4 control-label">نوع السعر</label>
                        <div class="col-lg-8">
                            <select class="select2 wdt100" name="pricetype" id="pricetype">
                                <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showpriceall==1){?>
                                <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mysellbildetales']->value[0]->pricetype;?>
<?php $_tmp27=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnmysellbildetales']->value[0]->pricetype;?>
<?php $_tmp28=ob_get_clean();?><?php if ($_tmp27==0||$_tmp28==0){?> selected="selected" <?php }?> value="0">جملة
                                </option>
                                <?php }?>
                                <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showpriceunit==1){?>
                                <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mysellbildetales']->value[0]->pricetype;?>
<?php $_tmp29=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnmysellbildetales']->value[0]->pricetype;?>
<?php $_tmp30=ob_get_clean();?><?php if ($_tmp29==1||$_tmp30==1){?> selected="selected" <?php }?> value="1">تجزئة
                                </option>
                                <?php }?>
                                <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showpricehalf==1){?>
                                <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mysellbildetales']->value[0]->pricetype;?>
<?php $_tmp31=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnmysellbildetales']->value[0]->pricetype;?>
<?php $_tmp32=ob_get_clean();?><?php if ($_tmp31==2||$_tmp32==2){?> selected="selected" <?php }?> value="2">نصف
                                    جملة</option>
                                <?php }?>
                                <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice4==1){?>
                                <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mysellbildetales']->value[0]->pricetype;?>
<?php $_tmp33=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnmysellbildetales']->value[0]->pricetype;?>
<?php $_tmp34=ob_get_clean();?><?php if ($_tmp33==4||$_tmp34==4){?> selected="selected" <?php }?> value="4">سعر4
                                </option>
                                <?php }?>
                                <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice5==1){?>
                                <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mysellbildetales']->value[0]->pricetype;?>
<?php $_tmp35=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnmysellbildetales']->value[0]->pricetype;?>
<?php $_tmp36=ob_get_clean();?><?php if ($_tmp35==5||$_tmp36==5){?> selected="selected" <?php }?> value="5">سعر5
                                </option>
                                <?php }?>
                                <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice6==1){?>
                                <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mysellbildetales']->value[0]->pricetype;?>
<?php $_tmp37=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnmysellbildetales']->value[0]->pricetype;?>
<?php $_tmp38=ob_get_clean();?><?php if ($_tmp37==6||$_tmp38==6){?> selected="selected" <?php }?> value="6">سعر6
                                </option>
                                <?php }?>
                                <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice7==1){?>
                                <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mysellbildetales']->value[0]->pricetype;?>
<?php $_tmp39=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnmysellbildetales']->value[0]->pricetype;?>
<?php $_tmp40=ob_get_clean();?><?php if ($_tmp39==7||$_tmp40==7){?> selected="selected" <?php }?> value="7">سعر7
                                </option>
                                <?php }?>
                                <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice8==1){?>
                                <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mysellbildetales']->value[0]->pricetype;?>
<?php $_tmp41=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnmysellbildetales']->value[0]->pricetype;?>
<?php $_tmp42=ob_get_clean();?><?php if ($_tmp41==8||$_tmp42==8){?> selected="selected" <?php }?> value="8">سعر8
                                </option>
                                <?php }?>
                            </select>
                            <input type="hidden" name="hiddenpricetype" id="hiddenpricetype" value="0" />
                        </div>
                        <!----------------------------------------------------->
                        <div id="progressBarContainer" style="display: none;">
                            <div class="clearfix"></div>
                            <label class="col-lg-4 col-sm-4 control-label"></label>
                            <div class="col-lg-8 col-sm-8">
                                <div id="myProgress">
                                    <div id="myBar"></div>
                                </div>
                            </div>
                        </div>
                        <!----------------------------------------------------->
                    </div>
                    <!-- end of form-group-->

                    <hr class="mg-bt5 mg-tp5" />
                    <input type="hidden" id="userstoreid" value="<?php echo $_smarty_tpl->tpl_vars['userdata']->value->userstoreid;?>
" />
                    <input type="hidden" id="userstoreidForClient" value="<?php echo $_smarty_tpl->tpl_vars['userdata']->value->userstoreid;?>
" />

                    <div <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[2]->billsettingsvalue;?>
<?php $_tmp43=ob_get_clean();?><?php if ($_tmp43==0){?> <?php }else{ ?> style="display:none" <?php }?> >
                        <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[26]->billsettingsvalue;?>
<?php $_tmp44=ob_get_clean();?><?php if ($_tmp44==1){?>
                        <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[2]->billsettingsvalue;?>
<?php $_tmp45=ob_get_clean();?><?php if ($_tmp45==0){?> <?php }else{ ?>
                            style="display:none" <?php }?>>


                            <?php if ($_smarty_tpl->tpl_vars['userdata']->value->userstoreid==0){?>
                            <label class="col-lg-4 control-label">المخزن</label>
                            <div class="col-lg-8">
                                <select class="select2 wdt100 clientstore" name="storeid" id="storeid">


                                    <?php  $_smarty_tpl->tpl_vars['store'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['store']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['storeData']->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['mysellbilldata']->value->sellbillstoreid;?>
<?php $_tmp46=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['store']->value->storeId;?>
<?php $_tmp47=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbillstoreid;?>
<?php $_tmp48=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['store']->value->storeId;?>
<?php $_tmp49=ob_get_clean();?><?php if ($_tmp46==$_tmp47||$_tmp48==$_tmp49){?> selected="selected" <?php }?>><?php echo $_smarty_tpl->tpl_vars['store']->value->storeName;?>
</option>


                                    <?php } ?>


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



                            <div style="display:none">

                                <select class="select2 wdt100 clientstore" name="storeid" id="storeid">
                                    <option value="-1">اختر مخزن</option>
                                    
                                    <?php  $_smarty_tpl->tpl_vars['store'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['store']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['storeData']->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['mysellbilldata']->value->sellbillstoreid;?>
<?php $_tmp50=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['store']->value->storeId;?>
<?php $_tmp51=ob_get_clean();?><?php if ($_tmp50==$_tmp51){?>|| <?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbillstoreid;?>
 eq
                                        <?php echo $_smarty_tpl->tpl_vars['store']->value->storeId;?>

                                        selected="selected" <?php }?>><?php echo $_smarty_tpl->tpl_vars['store']->value->storeName;?>
</option>


                                    <?php } ?>


                                </select>
                            </div>

                            <label class="col-lg-4 control-label">المخزن</label>
                            <div class="col-lg-8 clientstoretxt">

                                <?php  $_smarty_tpl->tpl_vars['store'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['store']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['storeData']->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 $_tmp52=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['userdata']->value->userstoreid;?>
<?php $_tmp53=ob_get_clean();?><?php if ($_tmp52==$_tmp53){?><?php echo $_smarty_tpl->tpl_vars['store']->value->storeName;?>
 <?php }?>


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

                        </div>
                        <?php }else{ ?>
                        <div style="display:none">
                            <select class="select2 wdt100 clientstore autoSaveBillMainPart" name="storeid" id="storeid">
                                <?php  $_smarty_tpl->tpl_vars['store'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['store']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['storeData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['store']->key => $_smarty_tpl->tpl_vars['store']->value){
$_smarty_tpl->tpl_vars['store']->_loop = true;
?>
                                <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['store']->value->storeId;?>
<?php $_tmp54=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['userdata']->value->userstoreid;?>
<?php $_tmp55=ob_get_clean();?><?php if ($_tmp54==$_tmp55){?> selected="selected"
                                    <?php }?>value="<?php echo $_smarty_tpl->tpl_vars['store']->value->storeId;?>
"><?php echo $_smarty_tpl->tpl_vars['store']->value->storeName;?>
</option>
                                <?php } ?>
                            </select>
                        </div>
                        <?php }?>
                    </div>
                    <!-- end of form-group-->
                    <div <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[87]->billsettingsvalue;?>
<?php $_tmp56=ob_get_clean();?><?php if ($_tmp56==1){?> <?php }else{ ?> style="display:none" <?php }?> >
                        <div class="form-group mg-bt5">
                            <label class="col-lg-4 control-label">الخزنة</label>
                            <div class="col-lg-8">
                                <select class="select2 wdt100" name="saveid" id="saveid">
                                    <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allSaves']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                    <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->saveid;?>
" data-curr=<?php echo $_smarty_tpl->tpl_vars['data']->value->currencyId;?>
 <?php if ($_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbillsaveid==$_smarty_tpl->tpl_vars['data']->value->saveid||$_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbillsaveid==$_smarty_tpl->tpl_vars['data']->value->saveid){?> selected="selected"
                                        <?php }?>><?php echo $_smarty_tpl->tpl_vars['data']->value->savename;?>
</option>

                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5" <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showCurrency!=1){?>style="display:none;"<?php }?>>
                        <label class="col-lg-4 control-label">العملة</label>
                        <div class="col-lg-8">
                            <select class="select2" name="currencyId" id="currencyId">
                                <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allCurrency']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
" data-cfactor="<?php echo $_smarty_tpl->tpl_vars['data']->value->conversionFactor;?>
"
                                        data-othercfactor="<?php echo $_smarty_tpl->tpl_vars['data']->value->otherconversionFactor;?>
" <?php if ($_smarty_tpl->tpl_vars['mysellbilldata']->value->currencyId==$_smarty_tpl->tpl_vars['data']->value->id||$_smarty_tpl->tpl_vars['returnmysellbilldata']->value->currencyId==$_smarty_tpl->tpl_vars['data']->value->id){?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['data']->value->name;?>

                                </option>
                                <?php } ?>
                            </select>
                        </div>
                        <div class="clear"></div>
                        <label class="col-lg-4 control-label">معامل التحويل
                        </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%"
                                   value="<?php echo $_smarty_tpl->tpl_vars['billCurrData']->value->conversionFactor;?>
" />
                            =
                            <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%"
                                       value="<?php echo $_smarty_tpl->tpl_vars['billCurrData']->value->otherconversionFactor;?>
" />
                                <span class="input-group-addon" style="display: inline-block;width: 23%"><?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</span>
                            </div>
                        </div>
                    </div>

                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[3]->billsettingsvalue;?>
<?php $_tmp57=ob_get_clean();?><?php if ($_tmp57==0){?> style="display:block"
                        <?php }else{ ?> style="display:none" <?php }?>>
                        <label class="col-lg-4 control-label">اسم <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==0){?> بائع
                            <?php }elseif($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==1){?>مندوب <?php }elseif($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==2){?>طبيب <?php }?></label>
                        <div class="col-lg-8">
                            <select class="select2 wdt100" name="sellerid" id="sellerid">

                                <option value="-1">اختر</option>
                                <?php  $_smarty_tpl->tpl_vars['seller'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['seller']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['sellerData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['seller']->key => $_smarty_tpl->tpl_vars['seller']->value){
$_smarty_tpl->tpl_vars['seller']->_loop = true;
?>


                                <option <?php if ($_smarty_tpl->tpl_vars['mysellbilldata']->value->sellerid==$_smarty_tpl->tpl_vars['seller']->value->userid||$_smarty_tpl->tpl_vars['returnmysellbilldata']->value->sellerid==$_smarty_tpl->tpl_vars['seller']->value->userid){?> selected="selected" <?php }?>
                                    value="<?php echo $_smarty_tpl->tpl_vars['seller']->value->userid;?>
"><?php echo $_smarty_tpl->tpl_vars['seller']->value->employeename;?>
</option>


                                <?php } ?>


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

                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[101]->billsettingsvalue;?>
<?php $_tmp58=ob_get_clean();?><?php if ($_tmp58==0){?>
                        style="display:block" <?php }else{ ?> style="display:none" <?php }?>>
                        <label class="col-lg-4 control-label">عملية الفاتورة</label>
                        <div class="col-lg-8">
                            <select class="select2 wdt100" name="billoperationid" id="billoperationid">
                                <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['billOperations']->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 <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->billoperationid;?>
<?php $_tmp59=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
<?php $_tmp60=ob_get_clean();?><?php if ($_tmp59==$_tmp60){?> selected="selected" <?php }?>
                                    value="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->name;?>
</option>
                                <?php } ?>
                            </select>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5" <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[101]->billsettingsvalue==0){?> <?php }else{ ?>
                        style="display:none !important;" <?php }?>>
                        <label class="col-lg-4 control-label">نوع الفاتورة</label>
                        <div class="col-lg-8">
                            <div class="radio-inline">
                                <label>
                                    <input value="1" class="radioR" name="obgyBillType" type="radio" <?php if ($_smarty_tpl->tpl_vars['mysellbilldata']->value->obgyBillType==1||$_smarty_tpl->tpl_vars['returnmysellbilldata']->value->obgyBillType==1){?>checked<?php }?>>
                                    مباشر</label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input value="2" class="radioR" name="obgyBillType" type="radio" <?php if ($_smarty_tpl->tpl_vars['mysellbilldata']->value->obgyBillType==2||$_smarty_tpl->tpl_vars['returnmysellbilldata']->value->obgyBillType==2){?>checked<?php }?>>
                                    مستهلك</label>
                            </div>
                        </div>
                    </div>
                    <!-- end of form-group-->

                    <!-- end of form-group-->
                    <div class="form-group mg-bt5" <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[12]->billsettingsvalue==0){?> <?php }else{ ?>
                        style="display:none !important;" <?php }?>>
                        <label class="col-lg-4 control-label">التعليق</label>
                        <div class="col-lg-8">
                            <textarea name="comment" id="comment" cols="" rows="" class="form-control"
                                      tabindex="6"><?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->comment;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->comment;?>
</textarea>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[109]->billsettingsvalue;?>
<?php $_tmp61=ob_get_clean();?><?php if ($_tmp61==0){?>
                    <div class="form-group mg-bt5">
                        <label class="col-lg-4 col-sm-4 control-label"><?php echo @SELL_BILL_KNOW_WAY;?>
</label>
                        <div class="col-lg-8 col-sm-8">
                            <select class=" wdt100" name="knownwayId" id="know_way">
                                <option value=""><?php echo @SELL_BILL_SELECT;?>
</option>
                                <?php  $_smarty_tpl->tpl_vars['way'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['way']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['knownWays']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['way']->key => $_smarty_tpl->tpl_vars['way']->value){
$_smarty_tpl->tpl_vars['way']->_loop = true;
?>
                                <option value="<?php echo $_smarty_tpl->tpl_vars['way']->value->id;?>
" <?php if ($_smarty_tpl->tpl_vars['mysellbilldata']->value->knownwayId==$_smarty_tpl->tpl_vars['way']->value->id){?>selected<?php }?>>
                                    <?php echo $_smarty_tpl->tpl_vars['way']->value->name;?>
</option>
                                <?php } ?>
                            </select>
                        </div>
                    </div>
                    <?php }?>
                    <!-- end of form-group-->
                </div>
                <!-- end of client info-->

            </div>
            <!-- end of frist row-->
            <!-- hidden ===============================-->
            <input type="hidden" id="newproductItr" />
            <input type="hidden" id="newproductTabIndex" />
            <input type="hidden" name="billnameid" id="billnameid" value="<?php echo $_smarty_tpl->tpl_vars['billnameid']->value;?>
" />
            <input type="hidden" id="settingreturn" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[0]->billsettingsvalue;?>
" />
            <input type="hidden" name="settingclient" id="settingclient" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[1]->billsettingsvalue;?>
" />
            <input type="hidden" name="settingstore" id="settingstore" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[2]->billsettingsvalue;?>
" />
            <input type="hidden" name="settingseller" id="settingseller" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[3]->billsettingsvalue;?>
" />
            <input type="hidden" id="settingparcode" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[4]->billsettingsvalue;?>
" />
            <input type="hidden" name="settingdate" id="settingdate" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[5]->billsettingsvalue;?>
" />
            <input type="hidden" id="settingnewproduct" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[6]->billsettingsvalue;?>
" />
            <input type="hidden" id="settingcomment" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[7]->billsettingsvalue;?>
" />
            <input type="hidden" id="settingdiscount" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[8]->billsettingsvalue;?>
" />
            <input type="hidden" id="settingQuantitiyFocus" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[9]->billsettingsvalue;?>
" />
            <input type="hidden" id="settingUnit" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[10]->billsettingsvalue;?>
" />
            <input type="hidden" name="settingQuantityAlert" id="settingQuantityAlert"
                   value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[13]->billsettingsvalue;?>
" />


            <input type="hidden" id="morestore" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[26]->billsettingsvalue;?>
" />
            <input type="hidden" id="sumSameProductForStore" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[73]->billsettingsvalue;?>
" />
            <input type="hidden" id="usePriceTypeOfClient" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[74]->billsettingsvalue;?>
" />
            <input type="hidden" id="sellerIsRequired" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[76]->billsettingsvalue;?>
" />

            <input type="hidden" id="searchvalue" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->searchvalue;?>
" />
            <input type="hidden" id="directDiscount" value="<?php echo $_smarty_tpl->tpl_vars['Usergroupdata']->value->directDiscount;?>
" />
            <input type="hidden" id="percentageDiscount" value="<?php echo $_smarty_tpl->tpl_vars['Usergroupdata']->value->percentageDiscount;?>
" />
            <input type="hidden" id="priceupdate" value="<?php echo $_smarty_tpl->tpl_vars['Usergroupdata']->value->priceupdate;?>
" />

            <input type="hidden" name="ordertype" id="ordertype" value="<?php echo $_smarty_tpl->tpl_vars['billnameData']->value->ordertype;?>
" />
            <input type="hidden" id="extraDiscountPlace" value="<?php echo $_smarty_tpl->tpl_vars['billnameData']->value->extraDiscountPlace;?>
" />
            <input type="hidden" id="useExtraDiscount" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[90]->billsettingsvalue;?>
" />
            <input type="hidden" id="saveeffect" value="<?php echo $_smarty_tpl->tpl_vars['billnameData']->value->saveeffect;?>
" />
            <input type="hidden" id="discountrowtype" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[34]->billsettingsvalue;?>
" />
            <input type="hidden" id="multiclient" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[37]->billsettingsvalue;?>
" />
            <input type="hidden" name="taxBillNumber" id="taxBillNumber" value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->taxBillNumber;?>
" />
            <input type="hidden" id="showdiscountrow" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[8]->billsettingsvalue;?>
" />
            <input type="hidden" id="showbouns" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[38]->billsettingsvalue;?>
" />
            <input type="hidden" id="showclientdetail" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[39]->billsettingsvalue;?>
" />
            <input type="hidden" id="showCommentAZ" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[78]->billsettingsvalue;?>
" />
            <input type="hidden" id="showtotal" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[41]->billsettingsvalue;?>
" />
            <input type="hidden" id="shownumber" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[40]->billsettingsvalue;?>
" />
            <input type="hidden" id="payedSetting" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[71]->billsettingsvalue;?>
" />
            <input type="hidden" id="userSaveCurrencyName" value="<?php echo $_smarty_tpl->tpl_vars['userSaveData']->value->currencyName;?>
" />
            <input type="hidden" id="userSaveconversionFactor" value="<?php echo $_smarty_tpl->tpl_vars['userSaveData']->value->conversionFactor;?>
" />
            <input type="hidden" id="oldCFactor" value="1" />
            <input type="hidden" id="showrowPriceType" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[83]->billsettingsvalue;?>
" />
            <input type="hidden" id="showCatDiscount" value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[116]->billsettingsvalue;?>
" />


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

            <!-- end of hidden ===============================-->

            <!-- ---------------------check if data get from  sellbill table------------------->


            <div <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['controlname']->value;?>
<?php $_tmp62=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['controlname']->value;?>
<?php $_tmp63=ob_get_clean();?><?php if ($_tmp62=='sellbillController'||$_tmp63=='sellbillandruternController'){?>
                 style="display:block" <?php }else{ ?> style="display:none" <?php }?>>
                <div class="row" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[14]->billsettingsvalue;?>
<?php $_tmp64=ob_get_clean();?><?php if ($_tmp64==0){?> <?php }else{ ?> style="display:none !important"
                    <?php }?>>
                    <div class="row">
                        <hr />
                        <div class="col-lg-6">
                            <h4 id="header4Sell">المبيعات</h4>
                        </div>
                        <div class="col-lg-6">
                            <button type="button" name="addpro" id="addpro" class="btn btn-primary pull-left ft-nor"> اضافة
                                جديد</button>
                        </div>
                    </div>
                    <!-- end of title row-->
                    <div class="table-responsive bd-gr" id="taxesitr">
                        <table class="table billtable table-bordered table-black" id="containerpros">
                            <thead>
                                <tr>
                                    <th class="wdt60" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[6]->billsettingsvalue;?>
<?php $_tmp65=ob_get_clean();?><?php if ($_tmp65==0){?> <?php }else{ ?>
                                        style="display:none !important;" <?php }?>>جديد</th>
                                    <th class="wdt20" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[40]->billsettingsvalue;?>
<?php $_tmp66=ob_get_clean();?><?php if ($_tmp66==0){?> <?php }else{ ?>
                                        style="display:none !important;" <?php }?>>رقم</th>
                                    <th
                                        class="wdt20 <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[104]->billsettingsvalue;?>
<?php $_tmp67=ob_get_clean();?><?php if ($_tmp67==0){?> proSellTrackingSerialClass <?php }else{ ?> hidden <?php }?>">
                                        Serial</th><!--السيريال الثانوى-->
                                    <th <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[59]->billsettingsvalue;?>
<?php $_tmp68=ob_get_clean();?><?php if ($_tmp68==0){?> <?php }else{ ?> style="display:none" <?php }?>
                                        class="wdt120">الباركود</th>
                                    <th <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[26]->billsettingsvalue;?>
<?php $_tmp69=ob_get_clean();?><?php if ($_tmp69==0){?> <?php }else{ ?> style="display:none
                                        !important" <?php }?> class="wdt240 check_tr_store">المخزن</th>
                                    <th class="wdt400">اسم المنتج</th>
                                    <th <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[7]->billsettingsvalue;?>
<?php $_tmp70=ob_get_clean();?><?php if ($_tmp70==0){?> <?php }else{ ?> style="display:none
                                        !important" <?php }?> class="wdt240">ملاحظات</th>
                                    <th <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[53]->billsettingsvalue;?>
<?php $_tmp71=ob_get_clean();?><?php if ($_tmp71==0){?> <?php }else{ ?> style="display:none
                                        !important" <?php }?> class="wdt100n">الوحدة</th>
                                    <th
                                        class="wdt100n check_tr_Height <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp72=ob_get_clean();?><?php if ($_tmp72==1||$_smarty_tpl->tpl_vars['billsettingsData']->value[100]->billsettingsvalue==0){?>  hidden <?php }?>">
                                        الطول</th>
                                    <th
                                        class="wdt100n check_tr_Width <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp73=ob_get_clean();?><?php if ($_tmp73==1||$_smarty_tpl->tpl_vars['billsettingsData']->value[100]->billsettingsvalue==0){?>  hidden <?php }?>">
                                        العرض</th>
                                    <th class="wdt100n" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp74=ob_get_clean();?><?php if ($_tmp74==0){?> <?php }else{ ?>
                                        style="display:none" <?php }?>>العدد</th>
                                    <th class="wdt100n   <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
<?php $_tmp75=ob_get_clean();?><?php if ($_tmp75=='0'){?>  hidden <?php }?>">
                                        <?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
</th>

                                    <th class="wdt20" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[38]->billsettingsvalue;?>
<?php $_tmp76=ob_get_clean();?><?php if ($_tmp76==0){?> <?php }else{ ?>
                                        style="display:none !important;" <?php }?>>Bouns</th>
                                    <th
                                        class="wdt80 showrowPriceType <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[83]->billsettingsvalue;?>
<?php $_tmp77=ob_get_clean();?><?php if ($_tmp77==1){?>  <?php }else{ ?> hidden <?php }?>">
                                        نوع السعر</th>
                                    <th
                                        class="wdt80 <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1||$_smarty_tpl->tpl_vars['billsettingsData']->value[116]->billsettingsvalue==0){?> hidden<?php }?>">
                                        السعر قبل الخصم</th>
                                    <th class="wdt100n <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[116]->billsettingsvalue;?>
<?php $_tmp78=ob_get_clean();?><?php if ($_tmp78==0){?>  hidden <?php }?>">
                                        <?php echo @SELL_BILL_CAT_DISCOUNT;?>
</th>

                                    <th class="wdt80 <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?> hidden<?php }?>">
                                        السعر</th>

                                    <th <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[8]->billsettingsvalue;?>
<?php $_tmp79=ob_get_clean();?><?php if ($_tmp79==0){?> <?php }else{ ?> style="display:none" <?php }?>
                                        class="wdt80 <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">قيمة الخصم</th>
                                    <th class="wdt100n selldiscountClass <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showsellpercentage!=1){?>hidden<?php }?>">النسبه</th>
                                    <!-------------------------------------discountvalue by hazem---------------------------------------------->
                                    <!--th <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[8]->billsettingsvalue;?>
<?php $_tmp80=ob_get_clean();?><?php if ($_tmp80==0){?>  <?php }else{ ?> style="display:none !important" <?php }?> class="wdt80"> نسبة الخصم</th-->
                                    <!-------------------------------------discountvalue by hazem---------------------------------------------->
                                    <th class="wdt100n <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">
                                        <input name="hidden_itr" id="hidden_itr" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['detalesitr']->value;?>
" />
                                        الاجمالى
                                    </th>
                                    <th class="check_tr_soldSerials <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->expiredate;?>
<?php $_tmp81=ob_get_clean();?><?php if ($_tmp81==1){?>  hidden <?php }?>">
                                        سريل</th>
                                    <th class="<?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->ebillclient==0){?>  hidden <?php }?>">
                                        ض
                                    </th>
                                    <th>حذف</th>
                                </tr>
                            </thead>
                            <tbody>

                                <?php $_smarty_tpl->tpl_vars['x'] = new Smarty_variable(1, null, 0);?>
                                <?php  $_smarty_tpl->tpl_vars['mymysellbildetales'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['mymysellbildetales']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['mysellbildetales']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['mymysellbildetales']->key => $_smarty_tpl->tpl_vars['mymysellbildetales']->value){
$_smarty_tpl->tpl_vars['mymysellbildetales']->_loop = true;
?>

                                <tr id="productraw1">
                                    <td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[6]->billsettingsvalue;?>
<?php $_tmp82=ob_get_clean();?><?php if ($_tmp82==0){?> <?php }else{ ?> style="display:none
                                        !important;" <?php }?>><a onClick="javascript:showProductModal(<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
, 7);"
                                                              class="newLink btn btn-primary btn-xs conformdelProduct">جديد</a></td>

                                    <td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[40]->billsettingsvalue;?>
<?php $_tmp83=ob_get_clean();?><?php if ($_tmp83==0){?> <?php }else{ ?> style="display:none
                                        !important;" <?php }?>><span class="proDetails" data-pro="product<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"><?php echo $_smarty_tpl->tpl_vars['x']->value;?>
</span></td>

                                    <td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[104]->billsettingsvalue;?>
<?php $_tmp84=ob_get_clean();?><?php if ($_tmp84==0){?> <?php }else{ ?> style="display:none
                                        !important;" <?php }?>>
                                        <input type="text" name="proSellTrackingSerial<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="proSellTrackingSerial<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                               class="form-control txt-nonraduis autoSaveBillRow" tabindex="7" size="3"
                                               value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->proSellTrackingSerial;?>
" />
                                    </td>
                                    <td
                                        class="wdt120 check_tr_parcode <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[59]->billsettingsvalue;?>
<?php $_tmp85=ob_get_clean();?><?php if ($_tmp85==1){?>  hidden <?php }?>">
                                        <div id="productparcode<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
">
                                            <input type="text" 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['mymysellbildetales']->value->parcode;?>
" class="form-control txt-nonraduis"
                                                   tabindex="7" onkeypress="getproductbyParcode(event, this.value, <?php echo $_smarty_tpl->tpl_vars['x']->value;?>
);" size="3"
                                                   placeholder="الباركود" />
                                            <input name="parcodeType<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="parcodeType<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" type="hidden"
                                                   value="<?php if ($_smarty_tpl->tpl_vars['mymysellbildetales']->value->productserailid>0){?>serialnumber<?php }?>" />
                                            <input name="productserailid<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="productserailid<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" type="hidden"
                                                   value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->productserailid;?>
" />
                                            <input name="productQty<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="productQty<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" type="hidden"
                                                   value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->don;?>
" />
                                        </div>
                                    </td>

                                    <td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[26]->billsettingsvalue;?>
<?php $_tmp86=ob_get_clean();?><?php if ($_tmp86==0){?> <?php }else{ ?> style="display:none
                                        !important" <?php }?>>
                                        <div id="prstoridsiv<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
">

                                            <?php if ($_smarty_tpl->tpl_vars['userdata']->value->userstoreid==0){?>
                                            <select class="select2 clientstore wdt100" name="prstorid<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="prstorid<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
">
                                                <option value="-1">اختر مخزن</option>
                                                <?php  $_smarty_tpl->tpl_vars['store'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['store']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['storeData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['store']->key => $_smarty_tpl->tpl_vars['store']->value){
$_smarty_tpl->tpl_vars['store']->_loop = true;
?>
                                                <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->storeid;?>
<?php $_tmp87=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['store']->value->storeId;?>
<?php $_tmp88=ob_get_clean();?><?php if ($_tmp87==$_tmp88){?>
                                                    selected="selected" <?php }?>value="<?php echo $_smarty_tpl->tpl_vars['store']->value->storeId;?>
"><?php echo $_smarty_tpl->tpl_vars['store']->value->storeName;?>

                                                </option>
                                                <?php } ?>
                                            </select>
                                            <?php }else{ ?>
                                            <?php  $_smarty_tpl->tpl_vars['store'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['store']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['storeData']->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 $_tmp89=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['userdata']->value->userstoreid;?>
<?php $_tmp90=ob_get_clean();?><?php if ($_tmp89==$_tmp90){?><?php echo $_smarty_tpl->tpl_vars['store']->value->storeName;?>
 <?php }?>
                                            <?php } ?>
                                            <input name="prstorid<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="prstorid<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" class="selectstore" type="hidden"
                                                   value="<?php echo $_smarty_tpl->tpl_vars['userdata']->value->userstoreid;?>
" />
                                            <?php }?>
                                        </div>
                                    </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;?>
"
                                                   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['mymysellbildetales']->value->sizeid>0&&$_smarty_tpl->tpl_vars['mymysellbildetales']->value->colorid>0){?>hasSizeColor<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->sellbilldetailproductid;?>
-<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->sizeid;?>
-<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->colorid;?>
<?php }else{ ?><?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->sellbilldetailproductid;?>
<?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['mymysellbildetales']->value->productName;?>

                                                   <?php if ($_smarty_tpl->tpl_vars['mymysellbildetales']->value->sizeName!=''){?>/ <?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->sizeName;?>
<?php }?>
                                                   <?php if ($_smarty_tpl->tpl_vars['mymysellbildetales']->value->colorName!=''){?>/ <?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->colorName;?>
<?php }?>" />
                                            <input type="hidden" id="isService<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->isService;?>
" />

                                        </div>
                                    </td>
                                    <td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[7]->billsettingsvalue;?>
<?php $_tmp91=ob_get_clean();?><?php if ($_tmp91==0){?> <?php }else{ ?> style="display:none
                                        !important" <?php }?>>
                                        <textarea class="form-control txt-nonraduis enteraction" name="comment<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                                  id="comment<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" rows="1" tabindex="7"><?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->note;?>
</textarea>
                                    </td>
                                    <td
                                        class="wdt100n check_tr_unit <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[53]->billsettingsvalue;?>
<?php $_tmp92=ob_get_clean();?><?php if ($_tmp92==1){?>  hidden <?php }?>">
                                        <div id="productunitdiv<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
">
                                            <input type="hidden" name="proNum<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="proNum<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" value="" />
                                            <select id="productunit<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" name="productunit<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" class="select2 wdt100"
                                                    tabindex="7" onChange="getunitprice(<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
);">
                                                <option value="-1"></option>
                                                <?php  $_smarty_tpl->tpl_vars['mymyunitdata'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['mymyunitdata']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['myunitdata'.($_smarty_tpl->tpl_vars['x']->value)]->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['mymyunitdata']->key => $_smarty_tpl->tpl_vars['mymyunitdata']->value){
$_smarty_tpl->tpl_vars['mymyunitdata']->_loop = true;
?>
                                                <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->productunitid;?>
<?php $_tmp93=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mymyunitdata']->value->productunitid;?>
<?php $_tmp94=ob_get_clean();?><?php if ($_tmp93==$_tmp94){?> selected="selected" <?php }?>
                                                    data-pu-num="<?php echo $_smarty_tpl->tpl_vars['mymyunitdata']->value->productnumber;?>
"
                                                    value="<?php echo $_smarty_tpl->tpl_vars['mymyunitdata']->value->productunitid;?>
" ><?php echo $_smarty_tpl->tpl_vars['mymyunitdata']->value->unitName;?>
</option>
                                                <?php } ?>
                                            </select>
                                        </div>
                                    </td>
                                    <td
                                        class="wdt100n check_tr_Height <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp95=ob_get_clean();?><?php if ($_tmp95==1||$_smarty_tpl->tpl_vars['billsettingsData']->value[100]->billsettingsvalue==0){?>  hidden <?php }?>">
                                        <input type="text" name="proHeight<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="proHeight<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                               value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->proHeight;?>
"
                                               class="form-control txt-nonraduis enteraction numberinput positivefloat autoSaveBillRow"
                                               onKeyUp="calcQuantity(<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
, event);" tabindex="7" />
                                    </td>
                                    <td
                                        class="wdt100n check_tr_Width <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp96=ob_get_clean();?><?php if ($_tmp96==1||$_smarty_tpl->tpl_vars['billsettingsData']->value[100]->billsettingsvalue==0){?>  hidden <?php }?>">
                                        <input type="text" name="proWidth<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="proWidth<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                               value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->proWidth;?>
"
                                               class="form-control txt-nonraduis enteraction numberinput positivefloat autoSaveBillRow"
                                               onKeyUp="calcQuantity(<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
, event);" tabindex="7" />
                                    </td>
                                    <td
                                        class="wdt100n check_tr_quantity <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp97=ob_get_clean();?><?php if ($_tmp97==1){?>  hidden <?php }?>">
                                        <input type="text" name="pronum<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="pronum<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                               value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->sellbilldetailquantity;?>
"
                                               class="form-control txt-nonraduis getprototal enteraction numberinput <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[113]->billsettingsvalue==1){?> positiveNo <?php }else{ ?> positivefloat <?php }?>"
                                               onKeyUp="checkquantity(<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
, event);" value="1" tabindex="7" />
                                        <input type="hidden" id="oldpronum<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                               value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->sellbilldetailquantity;?>
" />
                                    </td>
                                    <td class="  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
<?php $_tmp98=ob_get_clean();?><?php if ($_tmp98=='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['mymysellbildetales']->value->otherdetailquantity;?>
"
                                               class="form-control txt-nonraduis positiveNo" placeholder="العدد" type="text"
                                               tabindex="7" />
                                    </td>

                                    <td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[38]->billsettingsvalue;?>
<?php $_tmp99=ob_get_clean();?><?php if ($_tmp99==0){?> <?php }else{ ?> style="display:none
                                        !important" <?php }?>>
                                        <input type="text" name="bouns<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="bouns<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                               class="form-control txt-nonraduis getprototal enteraction numberinput"
                                               value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->bouns;?>
" tabindex="7" />
                                    </td>
                                    <td
                                        class="showrowPriceType <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[83]->billsettingsvalue;?>
<?php $_tmp100=ob_get_clean();?><?php if ($_tmp100==1){?>  <?php }else{ ?> hidden <?php }?>">
                                        <select class="select2 wdt100" name="pricetypepro<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="pricetypepro<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
">
                                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showpriceall==1){?>
                                            <option value="0" <?php if ($_smarty_tpl->tpl_vars['mymysellbildetales']->value->pricetypepro==0){?> selected="selected"
                                                <?php }?> >جملة</option>
                                            <?php }?>
                                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showpriceunit==1){?>
                                            <option value="1" <?php if ($_smarty_tpl->tpl_vars['mymysellbildetales']->value->pricetypepro==1){?> selected="selected"
                                                <?php }?> >تجزئة</option>
                                            <?php }?>
                                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showpricehalf==1){?>
                                            <option value="2" <?php if ($_smarty_tpl->tpl_vars['mymysellbildetales']->value->pricetypepro==2){?> selected="selected"
                                                <?php }?>>نصف جملة</option>
                                            <?php }?>
                                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice4==1){?>
                                            <option value="4" <?php if ($_smarty_tpl->tpl_vars['mymysellbildetales']->value->pricetypepro==4){?> selected="selected"
                                                <?php }?>>سعر4</option>
                                            <?php }?>
                                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice5==1){?>
                                            <option value="5" <?php if ($_smarty_tpl->tpl_vars['mymysellbildetales']->value->pricetypepro==5){?> selected="selected"
                                                <?php }?>>سعر5</option>
                                            <?php }?>
                                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice6==1){?>
                                            <option value="6" <?php if ($_smarty_tpl->tpl_vars['mymysellbildetales']->value->pricetypepro==6){?> selected="selected"
                                                <?php }?>>سعر6</option>
                                            <?php }?>
                                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice7==1){?>
                                            <option value="7" <?php if ($_smarty_tpl->tpl_vars['mymysellbildetales']->value->pricetypepro==7){?> selected="selected"
                                                <?php }?>>سعر7</option>
                                            <?php }?>
                                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice8==1){?>
                                            <option value="8" <?php if ($_smarty_tpl->tpl_vars['mymysellbildetales']->value->pricetypepro==8){?> selected="selected"
                                                <?php }?>>سعر8</option>
                                            <?php }?>
                                        </select>
                                    </td>
                                    <td
                                        class=" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[116]->billsettingsvalue;?>
<?php $_tmp101=ob_get_clean();?><?php if ($_tmp101==0||$_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>  hidden <?php }?>">
                                        <input type="text" name="pricebeforcatdis<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="pricebeforcatdis<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                               class="form-control txt-nonraduis"
                                               value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->categorydiscount+$_smarty_tpl->tpl_vars['mymysellbildetales']->value->sellbilldetailprice;?>
"
                                               tabindex="7" />
                                    </td>

                                    <td class=" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[116]->billsettingsvalue;?>
<?php $_tmp102=ob_get_clean();?><?php if ($_tmp102==0){?>  hidden <?php }?>">
                                        <input type="text" name="catdis<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="catdis<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                               class="form-control txt-nonraduis sumProDis  positiveNo autoSaveBillRow"
                                               value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->categorydiscount;?>
" tabindex="7" />
                                        <input type="hidden" id="selldiscount<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                               value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->categorydiscount;?>
" />
                                    </td>
                                    <td class="<?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">
                                        <div id="propricechange<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
">
                                            <input type="text" name="proprice<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="proprice<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                                   value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->sellbilldetailprice;?>
"
                                                   class="form-control getprototal enteraction numberinput txt-nonraduis positivefloat"
                                                   value="0" tabindex="7" />
                                        </div>
                                    </td>


                                    <td
                                        class="check_tr_discount <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[8]->billsettingsvalue;?>
<?php $_tmp103=ob_get_clean();?><?php if ($_tmp103==1){?>  hidden <?php }?> <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">
                                        <!--input type="text" name="prodis<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="prodis<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"   class="form-control txt-nonraduis getprototal enteraction numberinput" value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->discountvalue;?>
" tabindex="7"  /-->

                                        <div class="input-group">
                                            <input name="prodis<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="prodis<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" class="form-control txt-nonraduis getprototal enteraction numberinput positiveNo
                                                   <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[34]->billsettingsvalue==1){?> hidden <?php }?>"
                                                   value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->discountvalue;?>
" tabindex="7" type="text" />
                                            <input name="discounttype<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="discounttype<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" class="form-control txt-nonraduis getprototal enteraction numberinput positivefloat
                                                   <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[34]->billsettingsvalue==0){?> hidden <?php }?>"
                                                   value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->discounttype;?>
" tabindex="7" type="text" />

                                            <span class="input-group-addon small-addon discountSpan" data-itr="<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
">
                                                <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[34]->billsettingsvalue;?>
<?php $_tmp104=ob_get_clean();?><?php if ($_tmp104==0){?>C
                                                <?php }else{ ?>
                                                %
                                                <?php }?>
                                            </span>
                                        </div>
                                    </td>
                                    <td class="selldiscountClass <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showsellpercentage!=1){?>hidden<?php }?>">
                                        <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->canEditAddDiscountPercentage!=1){?>
                                        <span id="prosellDiscountPer_span<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"><?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->prosellDiscountPer;?>
</span>
                                        <input name="prosellDiscountPer<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="prosellDiscountPer<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->prosellDiscountPer;?>
"
                                               class="prosellDiscountPerClass getprototal" tabindex="7"
                                               type="hidden"/>
                                        <?php }else{ ?>
                                        <div class="input-group">
                                            <input name="prosellDiscountPer<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="prosellDiscountPer<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->prosellDiscountPer;?>
"
                                                   class="form-control txt-nonraduis positiveNo prosellDiscountPerClass getprototal" tabindex="7"
                                                   type="text" />

                                            <span class="input-group-addon small-addon prosellDiscountPerTypeSpan" id="prosellDiscountPerTypeSpan<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" data-itr="<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
">
                                                <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->prosellDiscountPerType;?>
<?php $_tmp105=ob_get_clean();?><?php if ($_tmp105==0){?>ض
                                                <?php }else{ ?>
                                                خ
                                                <?php }?>
                                            </span>
                                        </div>
                                        <?php }?>
                                        <input name="prosellDiscountPerType<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="prosellDiscountPerType<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" class="getprototal" value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->prosellDiscountPerType;?>
" type="hidden"/>
                                        <input name="prosellDiscountVal<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="prosellDiscountVal<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"  value="" type="hidden"/>
                                    </td>
                                    <!-------------------------------------discountvalue by hazem---------------------------------------------->
                                    <!--td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[8]->billsettingsvalue;?>
<?php $_tmp106=ob_get_clean();?><?php if ($_tmp106==0){?>  <?php }else{ ?> style="display:none !important" <?php }?>>
                                                                      <input type="text" name="prodisper<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="prodisper<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"  onkeyup="getdiscount(<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
);"  class="form-control txt-nonraduis  enteraction numberinput " value="0" tabindex="7"  />
                                                                    </td-->
                                    <!-------------------------------------discountvalue by hazem---------------------------------------------->



                                    <td class="<?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">
                                        <div id="prototal<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" class="form-control-static">
                                            <?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->sellbilldetailtotalprice;?>
</div>
                                        <input name="hidden_prototal<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="hidden_prototal<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                               value="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->sellbilldetailtotalprice;?>
" type="hidden" value="0" />
                                    </td>
                                    <td class="<?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->expiredate;?>
<?php $_tmp107=ob_get_clean();?><?php if ($_tmp107==1){?>  hidden <?php }?>">
                                        <input type="hidden" name="proSerials<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="proSerials<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" data-itr="<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                               class="autoSaveBillRow" value="">
                                        <input type='hidden' id='oldproSerials<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
'
                                               value='<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->soldSerialsInDetails;?>
' />
                                    </td>

                                    <td class="<?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->ebillclient==0){?>  hidden <?php }?>">

                                        <button type="button" class="btn btn-primary Taxes" data-mitr="<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" data-toggle="modal"
                                                data-target="#ebillclient<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" data-whatever="@mdo"></button>

                                    </td>
                            <div class="modal fade" id="ebillclient<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" role="dialog"
                                 aria-labelledby="exampleModalLabel" aria-hidden="true">
                                <div class="modal-dialog modal-lg" role="document">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close pull-left" data-dismiss="modal"
                                                    aria-hidden="true">×</button>
                                        </div>
                                        <div class="modal-body">
                                            <div style="display: none">
                                                <button type="button"
                                                        class="btn green-meadow btn-sm pull-right addtaxes"
                                                        id="addtaxes<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" data-mitr="<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" style="background: #55ff55">
                                                    اضافه ضريبه </button>
                                                <button type="button" style="background: #f34141"
                                                        class="btn green-meadow btn-sm pull-right removetaxes" data-edit='1'
                                                        data-id="<?php echo $_smarty_tpl->tpl_vars['mymysellbildetales']->value->sellbilldetailid;?>
" data-itr="<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
">
                                                    حذف </button>
                                                <input type="hidden" id="taxesitr_<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" name="taxesitr_<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                                       value="<?php echo count($_smarty_tpl->tpl_vars['mymysellbildetales']->value->sellbilldetailtax);?>
">
                                            </div>
                                            <div style="clear: both;"></div>

                                            <ul id="taxes<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
">
                                                <?php $_smarty_tpl->tpl_vars['ex'] = new Smarty_variable(1, null, 0);?>
                                                <?php  $_smarty_tpl->tpl_vars['sellbilldetailtax'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['sellbilldetailtax']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['mymysellbildetales']->value->sellbilldetailtax; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['sellbilldetailtax']->key => $_smarty_tpl->tpl_vars['sellbilldetailtax']->value){
$_smarty_tpl->tpl_vars['sellbilldetailtax']->_loop = true;
?>
                                                <li id="litaxes_<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
_<?php echo $_smarty_tpl->tpl_vars['ex']->value;?>
">
                                                    <input type="hidden" name="sellbilldetailtaxid_<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
_<?php echo $_smarty_tpl->tpl_vars['ex']->value;?>
"
                                                           value="<?php echo $_smarty_tpl->tpl_vars['sellbilldetailtax']->value->id;?>
">

                                                    <div style="    width: 20% !important;float: right;">
                                                        <input type="hidden" name="type_<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
_<?php echo $_smarty_tpl->tpl_vars['ex']->value;?>
" class="eTaxType"
                                                               id="eTaxType_<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
_<?php echo $_smarty_tpl->tpl_vars['ex']->value;?>
" data-mitr="<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" data-itr="<?php echo $_smarty_tpl->tpl_vars['ex']->value;?>
"
                                                               value="<?php echo $_smarty_tpl->tpl_vars['sellbilldetailtax']->value->type;?>
">
                                                        <input type="hidden" class="oldtype<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
_<?php echo $_smarty_tpl->tpl_vars['ex']->value;?>
"
                                                               data-text="<?php echo $_smarty_tpl->tpl_vars['sellbilldetailtax']->value->type;?>
"
                                                               data-id="<?php echo $_smarty_tpl->tpl_vars['sellbilldetailtax']->value->type;?>
"
                                                               data-stext="<?php echo $_smarty_tpl->tpl_vars['sellbilldetailtax']->value->subtype;?>
"
                                                               data-sid="<?php echo $_smarty_tpl->tpl_vars['sellbilldetailtax']->value->subtype;?>
">
                                                    </div>

                                                    <div style="    width: 20% !important;float: right;">
                                                        <input type="hidden" name="subtype_<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
_<?php echo $_smarty_tpl->tpl_vars['ex']->value;?>
"
                                                               class="eTaxsubtype" id="eTaxsubtype_<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
_<?php echo $_smarty_tpl->tpl_vars['ex']->value;?>
"
                                                               data-mitr="<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" data-itr="<?php echo $_smarty_tpl->tpl_vars['ex']->value;?>
"
                                                               value="<?php echo $_smarty_tpl->tpl_vars['sellbilldetailtax']->value->subtype;?>
">
                                                    </div>

                                                    <div style="    width: 20% !important;float: right;">
                                                        <input type="text" name="rate_<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
_<?php echo $_smarty_tpl->tpl_vars['ex']->value;?>
"
                                                               class="form-control must_go_req ncloseebill rates rate_<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                                               data-itrolddddddddddddddddddddddddd="<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
_<?php echo $_smarty_tpl->tpl_vars['ex']->value;?>
"
                                                               id="rate_<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
_<?php echo $_smarty_tpl->tpl_vars['ex']->value;?>
" data-mitr="<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" data-itr="<?php echo $_smarty_tpl->tpl_vars['ex']->value;?>
"
                                                               placeholder="نسبه" value="<?php echo $_smarty_tpl->tpl_vars['sellbilldetailtax']->value->rate;?>
">
                                                    </div>

                                                    <div style="    width: 20% !important;float: right;">
                                                        <input type="text" name="amount_<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
_<?php echo $_smarty_tpl->tpl_vars['ex']->value;?>
" class="form-control must_go_req ncloseebill
                                                               amounts  amount_<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                                               data-itrolddddddddddddddddddddddddddd="<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
_<?php echo $_smarty_tpl->tpl_vars['ex']->value;?>
"
                                                               data-mitr="<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" data-itr="<?php echo $_smarty_tpl->tpl_vars['ex']->value;?>
" id="amount_<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
_<?php echo $_smarty_tpl->tpl_vars['ex']->value;?>
"
                                                               placeholder="المبلغ" value="<?php echo $_smarty_tpl->tpl_vars['sellbilldetailtax']->value->amount;?>
">
                                                    </div>

                                                    <div style="    width: 20% !important;float: right;">
                                                        <!--<button type="button"  style="background: #f34141" class="btn green-meadow btn-sm pull-right removeellbilldetailtax" id="removetaxes" data-edit='1' data-id="<?php echo $_smarty_tpl->tpl_vars['sellbilldetailtax']->value->id;?>
" data-itroldddddddddddddddd="<?php echo $_smarty_tpl->tpl_vars['sellbilldetailtax']->value->id;?>
" data-itr="<?php echo $_smarty_tpl->tpl_vars['ex']->value;?>
" data-mitr="<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"> x </button>-->
                                                    </div>
                                                </li>
                                                <div style="clear: both;"></div>
                                                <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'ex', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['ex']->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 } ?>

                                            </ul>
                                        </div>
                                        <div style="clear: both;"></div>
                                        <div class="modal-footer" style="text-align: center !important">
                                            <button type="button" data-mitr="<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" style="opacity: 1;background: blue"
                                                    class="close closeebill" data-dismiss="modal"
                                                    aria-hidden="true">اعتماد</button>
                                        </div>
                                    </div>

                                </div>
                            </div>
                            <td>
                                <button id="remove<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" type="button" class="close flt-none removeicon removeproduct"
                                        aria-hidden="true">&times;</button>
                            </td>
                            </tr>
                            <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'x', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['x']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                            <?php } ?>

                            </tbody>
                        </table>
                    </div>
                    <button type="button"
                            class="btn btn-primary pull-left ft-nor <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">
                        اجمالى المبيعات <span class="badge wht-clo">
                            <div id="sellbilltotal"><?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbilltotalbill;?>
</div>
                        </span>
                        <input type="hidden" name="sellbillprice" id="sellbillprice"
                               value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbilltotalbill;?>
" />
                    </button>
                </div>

            </div>

            <!-- end of second row-->
            <input name="controlname" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['controlname']->value;?>
" />

            <div <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['controlname']->value;?>
<?php $_tmp108=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['controlname']->value;?>
<?php $_tmp109=ob_get_clean();?><?php if ($_tmp108=='returnsellbillController'||$_tmp109=='sellbillandruternController'){?>
                 style="display:block" <?php }else{ ?> style="display:none" <?php }?>>
                <div class="row" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[0]->billsettingsvalue;?>
<?php $_tmp110=ob_get_clean();?><?php if ($_tmp110==0){?> <?php }else{ ?> style="display:none !important"
                    <?php }?>>
                    <div class="row">
                        <hr />
                        <div class="col-lg-6">
                            <h4 id="header4retSell">مردودات المبيعات</h4>
                        </div>
                        <div class="col-lg-6">
                            <button type="button" name="addreturn" id="addreturn" class="btn btn-primary pull-left ft-nor">
                                اضافة جديد</button>
                        </div>
                    </div>
                    <!-- end of title row-->
                    <div class="table-responsive bd-rd">
                        <table class="table billtable table-bordered table-black" id="containerReturn" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[0]->billsettingsvalue;?>
<?php $_tmp111=ob_get_clean();?><?php if ($_tmp111==0){?> <?php }else{ ?> style="display:none !important" <?php }?>>
                            <thead>
                                <tr>
                                    <th class="wdt20" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[40]->billsettingsvalue;?>
<?php $_tmp112=ob_get_clean();?><?php if ($_tmp112==0){?> <?php }else{ ?>
                                        style="display:none !important;" <?php }?>>رقم</th>
                                    <th
                                        class="wdt20 <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[104]->billsettingsvalue;?>
<?php $_tmp113=ob_get_clean();?><?php if ($_tmp113==0){?> proSellTrackingSerialClass <?php }else{ ?> hidden <?php }?>">
                                        Serial</th><!--السيريال الثانوى-->
                                    <th
                                        class="wdt120 check_tr_parcode <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[59]->billsettingsvalue;?>
<?php $_tmp114=ob_get_clean();?><?php if ($_tmp114==1){?> hidden <?php }?>">
                                        الباركود</th>
                                    <!--<th class="wdt240">المخزن</th>-->
                                    <th class="wdt300 " <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[26]->billsettingsvalue;?>
<?php $_tmp115=ob_get_clean();?><?php if ($_tmp115==0){?> <?php }else{ ?>
                                        style="display:none !important" <?php }?>><?php echo @SELL_BILL_STORE;?>
</th>
                                    <th class="wdt400">اسم المنتج</th>

                                    <th class="wdt240" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[7]->billsettingsvalue;?>
<?php $_tmp116=ob_get_clean();?><?php if ($_tmp116==0){?> <?php }else{ ?>
                                        style="display:none !important" <?php }?>>ملاحظات</th>
                                    <th class="wdt100n" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[53]->billsettingsvalue;?>
<?php $_tmp117=ob_get_clean();?><?php if ($_tmp117==0){?> <?php }else{ ?>
                                        style="display:none !important" <?php }?>>الوحدة</th>
                                    <th
                                        class="wdt100n check_tr_Height <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp118=ob_get_clean();?><?php if ($_tmp118==1||$_smarty_tpl->tpl_vars['billsettingsData']->value[100]->billsettingsvalue==0){?>  hidden <?php }?>">
                                        الطول</th>
                                    <th
                                        class="wdt100n check_tr_Width <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp119=ob_get_clean();?><?php if ($_tmp119==1||$_smarty_tpl->tpl_vars['billsettingsData']->value[100]->billsettingsvalue==0){?>  hidden <?php }?>">
                                        العرض</th>
                                    <th class="wdt100n" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp120=ob_get_clean();?><?php if ($_tmp120==0){?> <?php }else{ ?>
                                        style="display:none" <?php }?>>العدد</th>
                                    <th class="wdt100n   <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
<?php $_tmp121=ob_get_clean();?><?php if ($_tmp121=='0'){?>  hidden <?php }?>">
                                        <?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
</th>
                                    <th
                                        class="wdt80 showrowPriceType <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[83]->billsettingsvalue;?>
<?php $_tmp122=ob_get_clean();?><?php if ($_tmp122==1){?>  <?php }else{ ?> hidden <?php }?>">
                                        نوع السعر</th>
                                    <th class="wdt80 <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">السعر</th>
                                    <th class="wdt80 <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[8]->billsettingsvalue;?>
<?php $_tmp123=ob_get_clean();?><?php if ($_tmp123==0){?> <?php }else{ ?> style="display:none" <?php }?>>الخصم
                                    </th>
                                    <th class="wdt100n <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">الاجمالى
                                        <input name="returnhidden_itr" id="returnhidden_itr" type="hidden"
                                               value="<?php echo $_smarty_tpl->tpl_vars['returndetalesitr']->value;?>
" />
                                    </th>
                                    <th class="check_tr_soldSerials <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->expiredate;?>
<?php $_tmp124=ob_get_clean();?><?php if ($_tmp124==1){?>  hidden <?php }?>">
                                        سريل</th>
                                    <th>حذف</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $_smarty_tpl->tpl_vars['y'] = new Smarty_variable(1, null, 0);?>
                                <?php  $_smarty_tpl->tpl_vars['myreturnmysellbildetales'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['returnmysellbildetales']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->key => $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value){
$_smarty_tpl->tpl_vars['myreturnmysellbildetales']->_loop = true;
?>
                                <tr>
                                    <td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[40]->billsettingsvalue;?>
<?php $_tmp125=ob_get_clean();?><?php if ($_tmp125==0){?> <?php }else{ ?> style="display:none
                                        !important;" <?php }?>><span class="proDetails" data-pro="returnproduct<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
"><?php echo $_smarty_tpl->tpl_vars['y']->value;?>
</span>
                                    </td>
                                    <td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[104]->billsettingsvalue;?>
<?php $_tmp126=ob_get_clean();?><?php if ($_tmp126==0){?> <?php }else{ ?> style="display:none
                                        !important;" <?php }?>>
                                        <input type="text" name="retproSellTrackingSerial<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="retproSellTrackingSerial<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
"
                                               class="form-control txt-nonraduis autoSaveBillRowRet" tabindex="7" size="3"
                                               value="<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->proSellTrackingSerial;?>
" />
                                    </td>
                                    <td
                                        class="check_tr_parcode <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[59]->billsettingsvalue;?>
<?php $_tmp127=ob_get_clean();?><?php if ($_tmp127==1){?> hidden <?php }?>">
                                        <div id="returnproductparcode<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
">
                                            <input type="text" name="returnparcode<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="returnparcode<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
"
                                                   class="form-control txt-nonraduis" placeholder="الباركود"
                                                   onkeypress="getreturnproductbyParcode(event, this.value, <?php echo $_smarty_tpl->tpl_vars['y']->value;?>
);" tabindex="301"
                                                   value="<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->parcode;?>
">
                                            <input name="returnparcodeType<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="returnparcodeType<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" type="hidden"
                                                   value="<?php if ($_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->productserailid>0){?>serialnumber<?php }?>" />
                                            <input name="returnproductserailid<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="returnproductserailid<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" type="hidden"
                                                   value="<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->productserailid;?>
" />
                                            <input name="returnproductQty<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="returnproductQty<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" type="hidden"
                                                   value="<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->don;?>
" />
                                        </div>
                                    </td>

                                    <td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[26]->billsettingsvalue;?>
<?php $_tmp128=ob_get_clean();?><?php if ($_tmp128==0){?> <?php }else{ ?> style="display:none
                                        !important" <?php }?>>
                                        <div id="prstoridsiv<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
">

                                            <?php if ($_smarty_tpl->tpl_vars['userdata']->value->userstoreid==0){?>
                                            <select class="select2 clientstore wdt100" name="reprstorid<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
"
                                                    id="reprstorid<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
">
                                                <option value="-1">اختر مخزن</option>
                                                <?php  $_smarty_tpl->tpl_vars['store'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['store']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['storeData']->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['store']->value->storeId;?>
<?php $_tmp129=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->storeid;?>
<?php $_tmp130=ob_get_clean();?><?php if ($_tmp129==$_tmp130){?> selected="selected"
                                                    <?php }?>><?php echo $_smarty_tpl->tpl_vars['store']->value->storeName;?>
</option>
                                                <?php } ?>
                                            </select>
                                            <?php }else{ ?>
                                            <?php  $_smarty_tpl->tpl_vars['store'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['store']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['storeData']->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 $_tmp131=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->storeid;?>
<?php $_tmp132=ob_get_clean();?><?php if ($_tmp131==$_tmp132){?><?php echo $_smarty_tpl->tpl_vars['store']->value->storeName;?>

                                            <?php }?>
                                            <?php } ?>
                                            <input name="reprstorid<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="reprstorid<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" class="selectstore" type="hidden"
                                                   value="<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->storeid;?>
" />
                                            <?php }?>
                                        </div>
                                    </td>

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

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

                                                   <?php if ($_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->sizeName!=''){?>/ <?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->sizeName;?>
<?php }?>
                                                   <?php if ($_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->colorName!=''){?>/ <?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->colorName;?>
<?php }?>" />
                                            <input type="hidden" id="reisService<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
"
                                                   value="<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->isService;?>
" />

                                        </div>
                                    </td>




                                    <td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[7]->billsettingsvalue;?>
<?php $_tmp133=ob_get_clean();?><?php if ($_tmp133==0){?> <?php }else{ ?> style="display:none
                                        !important" <?php }?>>
                                        <textarea class="form-control txt-nonraduis returnenteraction" name="returncomment<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
"
                                                  id="returncomment<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" rows="1"
                                                  tabindex="301"><?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->note;?>
</textarea>
                                    </td>
                                    <td
                                        class="check_tr_unit <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[53]->billsettingsvalue;?>
<?php $_tmp134=ob_get_clean();?><?php if ($_tmp134==1){?>  hidden <?php }?>">
                                        <div id="returnproductunitdiv<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
">

                                            <input type="hidden" name="retProNum<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="retProNum<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" value="" />
                                            <select class="select2 wdt100" id="returnproductunit<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
"
                                                    name="returnproductunit<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" onChange="getreturnunitprice(<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
);">
                                                <option value="-1"></option>
                                                <?php  $_smarty_tpl->tpl_vars['remymyunitdata'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['remymyunitdata']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['myreunitdata'.($_smarty_tpl->tpl_vars['y']->value)]->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['remymyunitdata']->key => $_smarty_tpl->tpl_vars['remymyunitdata']->value){
$_smarty_tpl->tpl_vars['remymyunitdata']->_loop = true;
?>
                                                <option data-pu-num="<?php echo $_smarty_tpl->tpl_vars['remymyunitdata']->value->productnumber;?>
"
                                                        value="<?php echo $_smarty_tpl->tpl_vars['remymyunitdata']->value->productunitid;?>
" <?php if ($_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->productunitid==$_smarty_tpl->tpl_vars['remymyunitdata']->value->productunitid||$_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->productunitid==$_smarty_tpl->tpl_vars['remymyunitdata']->value->productunitid){?>
                                                    selected="selected" <?php }?>><?php echo $_smarty_tpl->tpl_vars['remymyunitdata']->value->unitName;?>
 </option>
                                                <?php } ?>
                                            </select>
                                            <input name="oldunit<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="oldunit<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" type="hidden"
                                                   value="<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->productunitid;?>
" />
                                            <input name="oldunitname<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="oldunitname<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" type="hidden"
                                                   value="<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->unitName;?>
" />
                                        </div>
                                    </td>
                                    <td
                                        class="wdt100n check_tr_Height <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp135=ob_get_clean();?><?php if ($_tmp135==1||$_smarty_tpl->tpl_vars['billsettingsData']->value[100]->billsettingsvalue==0){?>  hidden <?php }?>">
                                        <input type="text" name="returnproHeight<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="returnproHeight<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
"
                                               value="<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->proHeight;?>
"
                                               class="form-control txt-nonraduis enteraction numberinput positivefloat autoSaveBillRowRet"
                                               onKeyUp="calcQuantityReturn(<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
, event);" tabindex="301" />
                                    </td>
                                    <td
                                        class="wdt100n check_tr_Width <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp136=ob_get_clean();?><?php if ($_tmp136==1||$_smarty_tpl->tpl_vars['billsettingsData']->value[100]->billsettingsvalue==0){?>  hidden <?php }?>">
                                        <input type="text" name="returnproWidth<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="returnproWidth<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
"
                                               value="<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->proWidth;?>
"
                                               class="form-control txt-nonraduis enteraction numberinput positivefloat autoSaveBillRowRet"
                                               onKeyUp="calcQuantityReturn(<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
, event);" tabindex="301" />
                                    </td>
                                    <td
                                        class="check_tr_quantity <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp137=ob_get_clean();?><?php if ($_tmp137==1){?>  hidden <?php }?>">
                                        <input type="text" name="returnpronum<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="returnpronum<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
"
                                               value="<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->returnsellbilldetailquantity;?>
<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->sellbilldetailquantity;?>
"
                                               class="form-control txt-nonraduis getreurnprototal returnenteraction <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[113]->billsettingsvalue==1){?> positiveNo <?php }else{ ?> positivefloat <?php }?>"
                                               onKeyUp="returncheckquantity(<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
, event);" value="1" tabindex="301" />
                                    </td>

                                    <td class="  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
<?php $_tmp138=ob_get_clean();?><?php if ($_tmp138=='0'){?>  hidden <?php }?>">
                                        <input name="returnscunitname<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="returnscunitname<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
"
                                               value="<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->otherdetailquantity;?>
"
                                               class="form-control txt-nonraduis positiveNo" placeholder="العدد" type="text"
                                               tabindex="7" />
                                    </td>
                                    <td
                                        class="showrowPriceType <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[83]->billsettingsvalue;?>
<?php $_tmp139=ob_get_clean();?><?php if ($_tmp139==1){?>  <?php }else{ ?> hidden <?php }?>">
                                        <select class="select2 wdt100" name="retpricetypepro<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="retpricetypepro<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
">
                                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showpriceall==1){?>
                                            <option value="0" <?php if ($_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->pricetypepro==0){?>
                                                selected="selected" <?php }?> >جملة</option>
                                            <?php }?>
                                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showpriceunit==1){?>
                                            <option value="1" <?php if ($_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->pricetypepro==1){?>
                                                selected="selected" <?php }?> >تجزئة</option>
                                            <?php }?>
                                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showpricehalf==1){?>
                                            <option value="2" <?php if ($_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->pricetypepro==2){?>
                                                selected="selected" <?php }?>>نصف جملة</option>
                                            <?php }?>
                                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice4==1){?>
                                            <option value="4" <?php if ($_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->pricetypepro==4){?>
                                                selected="selected" <?php }?>>سعر4</option>
                                            <?php }?>
                                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice5==1){?>
                                            <option value="5" <?php if ($_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->pricetypepro==5){?>
                                                selected="selected" <?php }?>>سعر5</option>
                                            <?php }?>
                                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice6==1){?>
                                            <option value="6" <?php if ($_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->pricetypepro==6){?>
                                                selected="selected" <?php }?>>سعر6</option>
                                            <?php }?>
                                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice7==1){?>
                                            <option value="7" <?php if ($_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->pricetypepro==7){?>
                                                selected="selected" <?php }?>>سعر7</option>
                                            <?php }?>
                                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice8==1){?>
                                            <option value="8" <?php if ($_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->pricetypepro==8){?>
                                                selected="selected" <?php }?>>سعر8</option>
                                            <?php }?>
                                        </select>
                                    </td>
                                    <td class="<?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">
                                        <div id="returnpropricechange<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
">
                                            <input type="text" name="returnproprice<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="returnproprice<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
"
                                                   class="form-control getreurnprototal txt-nonraduis returnenteraction numberinput"
                                                   value="<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->returnsellbilldetailprice;?>
<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->sellbilldetailprice;?>
"
                                                   tabindex="301" />
                                        </div>
                                    </td>
                                    <td
                                        class="check_tr_discount <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[8]->billsettingsvalue;?>
<?php $_tmp140=ob_get_clean();?><?php if ($_tmp140==1){?>  hidden <?php }?> <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">
                                        <!--input type="text" name="returnprodis<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="returnprodis<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
"  class="form-control getreurnprototal  txt-nonraduis returnenteraction numberinput" value="<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->discountvalue;?>
" tabindex="301" /-->

                                        <div class="input-group">
                                            <input name="returnprodis<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="returnprodis<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" class="form-control getreurnprototal  txt-nonraduis returnenteraction numberinput
                                                   <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[34]->billsettingsvalue==1){?> hidden <?php }?>"
                                                   value="<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->discountvalue;?>
" tabindex="301" type="text" />

                                            <input name="returndiscounttype<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="returndiscounttype<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" class="form-control getreurnprototal  txt-nonraduis returnenteraction numberinput
                                                   <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[34]->billsettingsvalue==0){?> hidden <?php }?>"
                                                   tabindex="301" value="<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->discounttype;?>
" type="text" />



                                            <span class="input-group-addon small-addon retdiscountSpan" data-itr="<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
">
                                                <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[34]->billsettingsvalue;?>
<?php $_tmp141=ob_get_clean();?><?php if ($_tmp141==0){?>C
                                                <?php }else{ ?>
                                                %
                                                <?php }?>
                                            </span>
                                        </div>

                                    </td>
                                    <td class="<?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">
                                        <p class="form-control-static" id="reurnprototal<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
">
                                            <?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->returnsellbilldetailtotalprice;?>
<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->sellbilldetailtotalprice;?>

                                        </p>
                                        <input name="returnhidden_prototal<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="returnhidden_prototal<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" type="hidden"
                                               value="<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->returnsellbilldetailtotalprice;?>
<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->sellbilldetailtotalprice;?>
" />
                                    </td>
                                    <td class="<?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->expiredate;?>
<?php $_tmp142=ob_get_clean();?><?php if ($_tmp142==1){?>  hidden <?php }?>">
                                        <input type="hidden" name="proSerialsRet<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" id="proSerialsRet<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" data-itr="<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
"
                                               class="autoSaveBillRowRet" value="">
                                        <input type='hidden' id='oldproSerialsRet<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
'
                                               value='<?php echo $_smarty_tpl->tpl_vars['myreturnmysellbildetales']->value->soldSerialsInDetails;?>
' />

                                    </td>
                                    <td>
                                        <button type="button" id="returnremove<?php echo $_smarty_tpl->tpl_vars['y']->value;?>
" class="close flt-none returnremoveproduct"
                                                aria-hidden="true">&times;</button>
                                    </td>
                                </tr>

                                <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'y', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['y']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                <?php } ?>

                            </tbody>
                        </table>
                    </div>
                    <button type="button"
                            class="btn btn-primary pull-left ft-nor <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[0]->billsettingsvalue;?>
<?php $_tmp143=ob_get_clean();?><?php if ($_tmp143==0){?> <?php }else{ ?> style="display:none !important" <?php }?>> اجمالى مردودات المبيعات<span
                            class="badge wht-clo"
                            id="returnsellbilltotal"><?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbilltotalbill;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbillprice;?>
</span>
                        <input type="hidden" name="returnsellbillprice" id="returnsellbillprice"
                               value="<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbilltotalbill;?>
" />
                        <input type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->dailyentryid;?>
" name="returndailyentryid" />
                    </button>
                </div>
            </div>

            <!-- end of third row-->

            <div class="row <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">
                <div class="col-lg-7">
                    <div id="closeebill">

                    </div>
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[54]->billsettingsvalue;?>
<?php $_tmp144=ob_get_clean();?><?php if ($_tmp144==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-3 control-label">المدفوع</label>
                        <div class="col-lg-3">
                            <input type="text" class="form-control" placeholder="المدفوع" id="genpay2" value="0"
                                   onkeyup="calculateremain(this.value);">
                        </div>
                    </div>
                    <!-- end of form-group-->

                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[49]->billsettingsvalue;?>
<?php $_tmp145=ob_get_clean();?><?php if ($_tmp145==0){?> <?php }else{ ?>
                        style="display:none !important" <?php }?>>
                        <label class="col-lg-3 control-label">الباقى</label>
                        <div class="col-lg-3">
                            <p class="form-control-static" id="gen3total2">0 <?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</p>
                        </div>
                    </div>
                    <!-- end of form-group-->


                    <div class="form-group" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[80]->billsettingsvalue;?>
<?php $_tmp146=ob_get_clean();?><?php if ($_tmp146==0){?> <?php }else{ ?> style="display:none"
                        <?php }?>>
                        <label class="col-lg-3 control-label"><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->delivery;?>
<?php $_tmp147=ob_get_clean();?><?php if ($_tmp147==0){?>شحن<?php }else{ ?> توصيل
                            <?php }?></label>
                        <div class="col-lg-3">
                            <span id="sprytextfield4">
                                <input type="text" class="form-control"
                                       value="<?php if (isset($_smarty_tpl->tpl_vars['mysellbilldata']->value->delivery)){?><?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->delivery;?>
<?php }else{ ?>0<?php }?>"
                                       placeholder="<?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->delivery;?>
<?php $_tmp148=ob_get_clean();?><?php if ($_tmp148==0){?>شحن<?php }else{ ?> توصيل <?php }?>" name="delivery"
                                       id="delivery" />
                                <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">ادخل القيمة
                                    صحيحة</span>
                            </span>
                        </div>
                    </div>

                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[80]->billsettingsvalue;?>
<?php $_tmp149=ob_get_clean();?><?php if ($_tmp149==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-3 control-label">الاجمالي العام</label>
                        <div class="col-lg-3">
                            <p class="form-control-static mg-tp10" id="valdelivery"><?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->totalafterdelivery;?>
</p>
                            <input type="hidden" name="valdeliveryhidden" id="valdeliveryhidden"
                                   value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->totalafterdelivery;?>
 " />

                        </div>
                    </div>

                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[84]->billsettingsvalue;?>
<?php $_tmp150=ob_get_clean();?><?php if ($_tmp150==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-3 control-label">حجز الفاتورة</label>
                        <div class="col-lg-3">
                            <?php if ($_smarty_tpl->tpl_vars['mysellbilldata']->value->billReservation==3||$_smarty_tpl->tpl_vars['returnmysellbilldata']->value->billReservation==3){?>
                            تم التسليم
                            <input type="hidden" name="billReservation" value="3" />
                            <?php }else{ ?>
                            <input type="checkbox" name="billReservation" id="billReservation" value="1" <?php if ($_smarty_tpl->tpl_vars['mysellbilldata']->value->billReservation==1||$_smarty_tpl->tpl_vars['returnmysellbilldata']->value->billReservation==1){?>checked<?php }?>/>
                            <?php }?>
                        </div>
                    </div>
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[84]->billsettingsvalue;?>
<?php $_tmp151=ob_get_clean();?><?php if ($_tmp151==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-3 control-label">تاريخ انتهاء الحجز</label>
                        <div class="col-lg-3">
                            <?php if ($_smarty_tpl->tpl_vars['mysellbilldata']->value->billReservation==3||$_smarty_tpl->tpl_vars['returnmysellbilldata']->value->billReservation==3){?>
                            <?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->billReservationDate;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->billReservationDate;?>

                            <input type="hidden" name="billReservationDate"
                                   value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->billReservationDate;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->billReservationDate;?>
" />
                            <?php }else{ ?>
                            <span id="billReservationDatesp">
                                <input type="text" class="form-control awdatepicker" autocomplete="off" id="billReservationDate"
                                       data-date-format="yyyy-mm-dd" name="billReservationDate" required=""
                                       value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->billReservationDate;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->billReservationDate;?>
">
                                <span class="textfieldRequiredMsg">*</span></span>
                            <?php }?>
                        </div>
                    </div>
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[93]->billsettingsvalue;?>
<?php $_tmp152=ob_get_clean();?><?php if ($_tmp152==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-3 control-label">طريقة التحصيل</label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input value="0" class="radioR" name="collectionType" type="radio" <?php if ($_smarty_tpl->tpl_vars['mysellbilldata']->value->collectionType==0){?> checked <?php }?>>
                                    بدون </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input value="1" class="radioR" name="collectionType" type="radio" <?php if ($_smarty_tpl->tpl_vars['mysellbilldata']->value->collectionType==1){?> checked <?php }?>>
                                    شيك </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input value="2" class="radioR" name="collectionType" type="radio" <?php if ($_smarty_tpl->tpl_vars['mysellbilldata']->value->collectionType==2){?> checked <?php }?>>
                                    مفتوح </label>
                            </div>

                        </div>
                    </div>
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[93]->billsettingsvalue;?>
<?php $_tmp153=ob_get_clean();?><?php if ($_tmp153==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-3 control-label">تاريخ الاستحقاق</label>
                        <div class="col-lg-3">
                            <input type="text" class="form-control awdatepicker" autocomplete="off" id="collectionDate"
                                   data-date-format="yyyy-mm-dd" name="collectionDate" value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->collectionDate;?>
">
                        </div>
                    </div>
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[91]->billsettingsvalue;?>
<?php $_tmp154=ob_get_clean();?><?php if ($_tmp154==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-3 control-label">الاجمالي شامل ضريبة القيمة المضافة لمنتج واحد</label>
                        <div class="col-lg-3">
                            <input type="text" class="form-control positivefloat" id="vatIncludedTotalIfRow" value="" />
                        </div>
                    </div>


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

                <div class="col-lg-5">
                    <hr />
                    <div <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[58]->billsettingsvalue;?>
<?php $_tmp155=ob_get_clean();?><?php if ($_tmp155==0){?> <?php }else{ ?> style="display:none !important" <?php }?>>

                        <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[58]->billsettingsvalue;?>
<?php $_tmp156=ob_get_clean();?><?php if ($_tmp156==0){?> <?php }else{ ?>
                            style="display:none" <?php }?>>
                            <label class="col-lg-5 control-label">عدد القطع المباعة</label>
                            <div class="col-lg-7">
                                <p class="form-control-static" id="totalQty"><?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->sellQuantity;?>
</p>
                                <input type="hidden" name="sellQuantity" id="sellQuantity"
                                       value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->sellQuantity;?>
" />
                            </div>
                        </div>


                        <!-- end of form-group-->
                        
                        <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[0]->billsettingsvalue;?>
<?php $_tmp157=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[58]->billsettingsvalue;?>
<?php $_tmp158=ob_get_clean();?><?php if ($_tmp157==0&&$_tmp158==0){?> <?php }else{ ?> style="display:none !important" <?php }?>>
                            <label class="col-lg-5 control-label">عدد القطع المرتجعة</label>
                            <div class="col-lg-7">
                                <p class="form-control-static" id="returnTotalQty">
                                    <?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellQuantity;?>
<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->returnsellQuantity;?>
</p>
                                <input type="hidden" name="returnsellQuantity" id="returnsellQuantity"
                                       value="<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellQuantity;?>
<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->returnsellQuantity;?>
" />
                            </div>
                        </div>
                        

                    </div>
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5">
                        <label class="col-lg-5 control-label">اجمالى النسبه</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="totalprosellDiscountVal">0</p>
                            <input type="hidden" name="totalprosellDiscountVal_hidden" id="totalprosellDiscountVal_hidden" value="0"/>
                        </div>
                    </div>
                    <!-- end of form-group-->

                    <div class="form-group mg-bt5">
                        <label class="col-lg-5 control-label">قيمة الفاتورة</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="gentotal">
                                <?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbilltotalbill;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbilltotalbill;?>
</p>
                            <input type="hidden" name="sellbilltotalbill" id="sellbilltotalbill"
                                   value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbilltotalbill;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbilltotalbill;?>
" />
                            <input type="hidden" name="etotal" id="etotal" value="0" />
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[90]->billsettingsvalue;?>
<?php $_tmp159=ob_get_clean();?><?php if ($_tmp159==1&&$_smarty_tpl->tpl_vars['billnameAddData']->value->extraDiscountPlace==1){?>
                    <div>
                        <!--<hr class="mg-tp5 mg-bt5"/>-->
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 control-label">خصم اضافى<?php if ($_smarty_tpl->tpl_vars['billnameAddData']->value->extraDiscountFixed==1){?>
                                (<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->extraDiscountPer;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->extraDiscountPer;?>
%) <?php }?></label>
                            <div class="col-lg-7">
                                <?php if ($_smarty_tpl->tpl_vars['billnameAddData']->value->extraDiscountFixed==0){?>
                                <div class="input-group">
                                    <input type="text" name="extraDiscountPer" class="form-control numberinput positiveNo"
                                           id="extraDiscountPer"
                                           value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->extraDiscountPer;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->extraDiscountPer;?>
" />
                                    <span class="input-group-addon">%</span>
                                </div>
                                <?php }else{ ?>
                                <input type="hidden" name="extraDiscountPer" id="extraDiscountPer"
                                       value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->extraDiscountPer;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->extraDiscountPer;?>
" />
                                <?php }?>
                                <div class="input-group" style="padding-top: 1px;">
                                    <input type="text" name="extraDiscountVal" class="form-control numberinput positiveNo"
                                           id="extraDiscountVal"
                                           value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->extraDiscountVal;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->extraDiscountVal;?>
"
                                           readonly />
                                    <input type="hidden" name="extraDiscountVal_h" id="extraDiscountVal_h"
                                           value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->extraDiscountVal;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->extraDiscountVal;?>
" />
                                    <span class="input-group-addon"><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->currancy;?>
</span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <?php }?>
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[42]->billsettingsvalue;?>
<?php $_tmp160=ob_get_clean();?><?php if ($_tmp160==0){?> <?php }else{ ?>
                        style="display:none !important" <?php }?>>
                        <label class="col-lg-5 control-label">نوع الخصم</label>
                        <div class="col-lg-7">
                            <select id="distype" name="distype" class="select2 wdt100" onchange="checkdisValue();">
                                <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbilldiscounttype;?>
<?php $_tmp161=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbilldiscounttype;?>
<?php $_tmp162=ob_get_clean();?><?php if ($_tmp161==1||$_tmp162==1){?> selected="selected" <?php }?>
                                    value="1">مباشر</option>
                                <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbilldiscounttype;?>
<?php $_tmp163=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbilldiscounttype;?>
<?php $_tmp164=ob_get_clean();?><?php if ($_tmp163==2||$_tmp164==2){?> selected="selected" <?php }?>
                                    value="2">نسبة</option>
                            </select>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[42]->billsettingsvalue;?>
<?php $_tmp165=ob_get_clean();?><?php if ($_tmp165==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label">قيمة الخصم</label>
                        <div class="col-lg-7"> <span id="sprytextfield4">

                                <?php $_smarty_tpl->tpl_vars['sellbilldiscount'] = new Smarty_variable($_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbilldiscount, null, 0);?>
                                <?php $_smarty_tpl->tpl_vars['returnsellbilldiscount'] = new Smarty_variable($_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbilldiscount, null, 0);?>
                                <?php if (isset($_smarty_tpl->tpl_vars['billCurrData']->value)){?>
                                <?php if (isset($_smarty_tpl->tpl_vars['mysellbilldata']->value)){?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billCurrData']->value->conversionFactor*$_smarty_tpl->tpl_vars['sellbilldiscount']->value;?>
<?php $_tmp166=ob_get_clean();?><?php $_smarty_tpl->tpl_vars['sellbilldiscount'] = new Smarty_variable($_tmp166, null, 0);?><?php }?>
                                <?php if (isset($_smarty_tpl->tpl_vars['returnmysellbilldata']->value)){?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billCurrData']->value->conversionFactor*$_smarty_tpl->tpl_vars['returnsellbilldiscount']->value;?>
<?php $_tmp167=ob_get_clean();?><?php $_smarty_tpl->tpl_vars['returnsellbilldiscount'] = new Smarty_variable($_tmp167, null, 0);?><?php }?>
                                <?php }?>

                                <div class="input-group" id="percentageSignDiv">
                                    <input type="text" name="gendis" id="gendis"
                                           value="<?php echo $_smarty_tpl->tpl_vars['sellbilldiscount']->value;?>
<?php echo $_smarty_tpl->tpl_vars['returnsellbilldiscount']->value;?>
"
                                           class="form-control numberinput positivefloat" placeholder="قيمة الخصم" />
                                    <span class="input-group-addon <?php if ($_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbilldiscounttype!=1){?> hide <?php }?>"
                                          id="percentageValSpan"><?php echo rtrim(rtrim(sprintf("%.2f",($_smarty_tpl->tpl_vars['sellbilldiscount']->value*100/$_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbilltotalbill)),'0'),'.');?>

                                        %</span>
                                    <span class="input-group-addon <?php if ($_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbilldiscounttype!=2){?> hide <?php }?>"
                                          id="percentageSignSpan">%</span>
                                </div>

                                <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">ادخل القيمة
                                    صحيحة</span>
                            </span> </div>
                    </div>
                    <!-- end of form-group-->
                    <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[90]->billsettingsvalue;?>
<?php $_tmp168=ob_get_clean();?><?php if ($_tmp168==1&&$_smarty_tpl->tpl_vars['billnameAddData']->value->extraDiscountPlace==0){?>
                    <div>
                        <!--<hr class="mg-tp5 mg-bt5"/>-->
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 control-label">خصم اضافى<?php if ($_smarty_tpl->tpl_vars['billnameAddData']->value->extraDiscountFixed==1){?>
                                (<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->extraDiscountPer;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->extraDiscountPer;?>
%) <?php }?></label>
                            <div class="col-lg-7">
                                <?php if ($_smarty_tpl->tpl_vars['billnameAddData']->value->extraDiscountFixed==0){?>
                                <div class="input-group">
                                    <input type="text" name="extraDiscountPer" class="form-control numberinput positiveNo"
                                           id="extraDiscountPer"
                                           value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->extraDiscountPer;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->extraDiscountPer;?>
" />
                                    <span class="input-group-addon">%</span>
                                </div>
                                <?php }else{ ?>
                                <input type="hidden" name="extraDiscountPer" id="extraDiscountPer"
                                       value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->extraDiscountPer;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->extraDiscountPer;?>
" />
                                <?php }?>
                                <div class="input-group" style="padding-top: 1px;">
                                    <input type="text" name="extraDiscountVal" class="form-control numberinput positiveNo"
                                           id="extraDiscountVal"
                                           value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->extraDiscountVal;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->extraDiscountVal;?>
"
                                           readonly />
                                    <input type="hidden" name="extraDiscountVal_h" id="extraDiscountVal_h"
                                           value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->extraDiscountVal;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->extraDiscountVal;?>
" />
                                    <span class="input-group-addon"><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->currancy;?>
</span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <?php }?>

                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[117]->billsettingsvalue;?>
<?php $_tmp169=ob_get_clean();?><?php if ($_tmp169==0){?> style="display:none"
                        <?php }?>>
                        <label class="col-lg-5 col-sm-7 control-label"> <?php echo @SELL_BILL_PRO_DISCOUNT;?>
</label>
                        <div class="col-lg-7 col-sm-5">
                            <p class="form-control-static mg-tp10" id="productDis"><?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->totalprodiscount;?>
</p>
                            <input type="hidden" name="totalProDis" id="totalProDis"
                                   value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->totalprodiscount;?>
" />
                        </div>
                    </div>

                    <!-- end of form-group-->
                    <div <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[89]->billsettingsvalue;?>
<?php $_tmp170=ob_get_clean();?><?php if ($_tmp170==0){?> style="display:none" <?php }?>>
                        <hr class="mg-tp5 mg-bt5" />
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 control-label">ضريبه خصم
                                (<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->taxOfDiscountPer;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->taxOfDiscountPer;?>
%)</label>
                            <div class="col-lg-7">
                                <div class="input-group">
                                    <input type="hidden" name="taxOfDiscountPercentage" id="taxOfDiscountPercentage"
                                           value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->taxOfDiscountPer;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->taxOfDiscountPer;?>
" />
                                    <input type="hidden" name="taxOfDiscountVal_h" id="taxOfDiscountVal_h"
                                           value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->taxOfDiscountVal;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->taxOfDiscountVal;?>
" />
                                    <input type="text" name="taxOfDiscountVal" class="form-control numberinput positiveNo"
                                           id="taxOfDiscountVal"
                                           value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->taxOfDiscountVal;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->taxOfDiscountVal;?>
"
                                           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[31]->billsettingsvalue;?>
<?php $_tmp171=ob_get_clean();?><?php if ($_tmp171==0){?> <?php }else{ ?> style="display:none" <?php }?>>
                        <hr class="mg-tp5 mg-bt5" />
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 control-label">ضريبه القيمة المضافة</label>
                            <div class="col-lg-7">
                                <div class="input-group">
                                    <input type="text" name="tax" id="tax" class="form-control numberinput"
                                           value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->tax;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->tax;?>
" onkeyup="checkdisValue();" />
                                    <span class="input-group-addon">%</span>
                                </div>
                                <div class="input-group" style="padding-top: 1px;">
                                    <input type="text" name="taxVal" class="form-control numberinput positiveNo" id="taxVal"
                                           value="0" readonly /><!-- value is calculated in js no need to write it -->
                                    <span class="input-group-addon"><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->currancy;?>
</span>
                                </div>

                            </div>
                        </div>


                    </div>

                    <!-- 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 $_tmp172=ob_get_clean();?><?php if ($_tmp172==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label">الصافى</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="gen2total">
                                <?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbillaftertotalbill;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbillaftertotalbill;?>

                            </p>
                            <input type="hidden" name="sellbillaftertotalbill" id="sellbillaftertotalbill"
                                   value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbillaftertotalbill;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbillaftertotalbill;?>
" />
                            <input type="hidden" name="dailyID"
                                   value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->dailyentryid;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->dailyentryid;?>
" />
                        </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 $_tmp173=ob_get_clean();?><?php if ($_tmp173==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label">المدفوع</label>
                        <?php if (isset($_smarty_tpl->tpl_vars['mysellbilldata']->value)){?>
                        <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbilltotalpayed-$_smarty_tpl->tpl_vars['mysellbilldata']->value->visaPayed;?>
<?php $_tmp174=ob_get_clean();?><?php $_smarty_tpl->tpl_vars['sellbilltotalpayed'] = new Smarty_variable($_tmp174, null, 0);?>
                        <?php }else{ ?>
                        <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbilltotalpayed-$_smarty_tpl->tpl_vars['returnmysellbilldata']->value->visaPayed;?>
<?php $_tmp175=ob_get_clean();?><?php $_smarty_tpl->tpl_vars['sellbilltotalpayed'] = new Smarty_variable($_tmp175, null, 0);?>
                        <?php }?>
                        <?php if (isset($_smarty_tpl->tpl_vars['billCurrData']->value)){?>
                        <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billCurrData']->value->conversionFactor*$_smarty_tpl->tpl_vars['sellbilltotalpayed']->value;?>
<?php $_tmp176=ob_get_clean();?><?php $_smarty_tpl->tpl_vars['sellbilltotalpayed'] = new Smarty_variable($_tmp176, null, 0);?>
                        <?php }?>
                        <div class="col-lg-7">
                            <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[86]->billsettingsvalue;?>
<?php $_tmp177=ob_get_clean();?><?php if ($_tmp177==0){?>
                            <input type="text" name="genpay" id="genpay" value="<?php echo $_smarty_tpl->tpl_vars['sellbilltotalpayed']->value;?>
"
                                   class="form-control positivefloat" placeholder="0" />
                            <input type="hidden" name="genpayvisa" id="genpayvisa"
                                   value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->visaPayed;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->visaPayed;?>
" />
                            <input type="hidden" name="visaAccount" id="visaAccount"
                                   value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->visaAccountId;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->visaAccountId;?>
" />
                            <input type="hidden" name="isBankAccountTransfer" id="isBankAccountTransfer"
                                   value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->isBankAccountTransfer;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->isBankAccountTransfer;?>
" />
                            <?php }else{ ?>
                            <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[54]->billsettingsvalue;?>
<?php $_tmp178=ob_get_clean();?><?php if ($_tmp178==0){?> <?php }else{ ?>
                                style="display:none" <?php }?>>
                                <label class="col-lg-5 control-label">كاش</label>
                                <div class="col-lg-7">
                                    <input type="text" name="genpay" id="genpay" value="<?php echo $_smarty_tpl->tpl_vars['sellbilltotalpayed']->value;?>
"
                                           class="form-control positivefloat" placeholder="0" />
                                </div>
                            </div>
                            <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[54]->billsettingsvalue;?>
<?php $_tmp179=ob_get_clean();?><?php if ($_tmp179==0){?> <?php }else{ ?>
                                style="display:none" <?php }?>>
                                <label class="col-lg-5 control-label">دفع الكترونى</label>
                                <div class="col-lg-7">
                                    <input type="text" name="genpayvisa" id="genpayvisa" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[37]->billsettingsvalue;?>
<?php $_tmp180=ob_get_clean();?><?php if ($_tmp180==1){?> " <?php }?> class="form-control numberinput
                                    positivefloat" placeholder="0"
                                    value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->visaPayed;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->visaPayed;?>
"/>
                                </div>
                            </div>
                            <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billnameData']->value->defVisaAccountSelect;?>
<?php $_tmp181=ob_get_clean();?><?php if ($_tmp181==0){?>
                            <input type="hidden" name="visaAccount" id="visaAccount"
                                   value="<?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->visaAccountId;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->visaAccountId;?>
" />
                            <?php }else{ ?>
                            <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[54]->billsettingsvalue;?>
<?php $_tmp182=ob_get_clean();?><?php if ($_tmp182==0){?> <?php }else{ ?>
                                style="display:none" <?php }?>>
                                <label class="col-lg-5 control-label">حساب الدفع</label>
                                <div class="col-lg-7">
                                    <select class="select2 wds100" name="visaAccount" id="visaAccount">
                                        <option value="0"></option>
                                        <?php  $_smarty_tpl->tpl_vars['acc'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['acc']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['bankAccounts']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['acc']->key => $_smarty_tpl->tpl_vars['acc']->value){
$_smarty_tpl->tpl_vars['acc']->_loop = true;
?>
                                        <option value="<?php echo $_smarty_tpl->tpl_vars['acc']->value->accountid;?>
" <?php if ($_smarty_tpl->tpl_vars['mysellbilldata']->value->visaAccountId==$_smarty_tpl->tpl_vars['acc']->value->accountid||$_smarty_tpl->tpl_vars['returnmysellbilldata']->value->visaAccountId==$_smarty_tpl->tpl_vars['acc']->value->accountid){?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['acc']->value->accountname;?>
/<?php echo $_smarty_tpl->tpl_vars['acc']->value->bankname;?>
</option>
                                        <?php } ?>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billnameData']->value->isBankAccountTransfer;?>
<?php $_tmp183=ob_get_clean();?><?php if ($_tmp183==1){?> <?php }else{ ?>
                                style="display:none" <?php }?>>
                                <label class="col-lg-5 control-label">تحويل بنكى</label>
                                <div class="col-lg-7">
                                    <input type="checkbox" name="isBankAccountTransfer" id="isBankAccountTransfer" value="1" <?php if ($_smarty_tpl->tpl_vars['mysellbilldata']->value->isBankAccountTransfer==1||$_smarty_tpl->tpl_vars['returnmysellbilldata']->value->isBankAccountTransfer==1){?> checked <?php }?>/>
                                </div>
                            </div>

                            <?php }?>
                            <?php }?>
                        </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 $_tmp184=ob_get_clean();?><?php if ($_tmp184==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label">المتبقى</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="gen3total">
                                <?php echo $_smarty_tpl->tpl_vars['mysellbilldata']->value->sellbillfinalbill;?>
<?php echo $_smarty_tpl->tpl_vars['returnmysellbilldata']->value->returnsellbillfinalbill;?>
</p>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <!-------------<?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[1]->billsettingsvalue;?>
<?php $_tmp185=ob_get_clean();?><?php if ($_tmp185==0){?> style="display:block" <?php }else{ ?> style="display:none !important" <?php }?>--------->
                    <div class="form-group mg-bt5" style="display:none">
                        <label class="col-lg-5 control-label">باقى الدين</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="gen4total"><?php echo $_smarty_tpl->tpl_vars['myclientdata']->value->clientdebt;?>
</p>
                            <input type="hidden" id="clientdebtafter" value="<?php echo $_smarty_tpl->tpl_vars['myclientdata']->value->clientdebt;?>
" />
                        </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" />
            <input type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['noOfDecimalPlaces']->value;?>
" id="noOfDecimalPlaces" />
            <input type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['previousPriceStatus']->value;?>
" id="previousPriceStatus" />
            <input type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->roundnumbersbilltotal;?>
" id="roundnumbersbilltotal" />
            <input type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->enablequantityfractions;?>
" id="enablequantityfractions" />
            <input type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->noOfDecimalPlacesBillTotal;?>
" id="noOfDecimalPlacesBillTotal" />
            <div class="row">
                <button type="button" id="saveBill" class="btn btn-primary">تعديل</button>
                <!--button type="button" id="saveAndNew" onclick="return addDataAndReturn();" class="btn btn-success">حفظ وجديد</button-->

                <!-- <button type="button" onclick="printData();" class="btn btn-info">طباعة</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" 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-->

        </form>


    </div>
    <!-- end of container-->
</div>
<!-- end of main row-->

<!------------------------Client Model----------------------------->
<!-- Modal -->
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close pull-left savemodel2" data-dismiss="modal"
                        aria-hidden="true">&times;</button>
                <h4 class="modal-title">اضافة عميل</h4>
            </div>
            <div class="modal-body">
                <form id="clientInfo" action="#" method="post" class="form-horizontal">
                    <input type="hidden" name="returnToselect2Ajax" value="1" />
                    <div class="form-group">
                        <label for="newclientName" class="col-lg-2 control-label">اسم العميل</label>
                        <div class="col-lg-4"> <span id="sprytextfield2">
                                <input class="form-control" placeholder="اسم العميل" id="newclientName"
                                       name="newclientName" type="text" required="required" />
                                <span class="textfieldRequiredMsg">*</span></span>
                            <div id="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>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="newclientdebt" class="col-lg-2 control-label">المديونية</label>
                        <div class="col-lg-4"> <!--<span id="sprytextfield3">-->
                            <input class="form-control numberinput" placeholder="المديونية" id="newclientdebt"
                                   name="newclientdebt" type="text" required="required" />
                            <!--<span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">ادخل المديونية صحيحة</span></span>-->
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="clientaddress" class="col-lg-2 control-label">العنوان</label>
                        <div class="col-lg-4">
                            <input class="form-control" placeholder="العنوان" id="clientaddress" name="clientaddress"
                                   type="text" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="clientphone" class="col-lg-2 control-label">رقم التليفون</label>
                        <div class="col-lg-4">
                            <input class="form-control numberinput" placeholder="رقم التليفون" id="clientphone"
                                   name="clientphone" type="text" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="clientmobile" class="col-lg-2 control-label">رقم الموبايل</label>
                        <div class="col-lg-4">
                            <input class="form-control numberinput" placeholder="رقم الموبايل" id="clientmobile"
                                   name="clientmobile" type="text" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="clientdetails" class="col-lg-2 control-label">التعليق</label>
                        <div class="col-lg-4">
                            <textarea class="form-control" rows="3" name="clientdetails" id="clientdetails"></textarea>
                        </div>
                    </div>
                    <!-- =================================================   -->
                    <div class="form-group" <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->simpleAddClientInBill!=1){?>style="display:none"<?php }?>>
                        <label for="textDetails" class="col-lg-2 control-label">المخزن</label>
                        <div class="col-lg-3">
                            <label>
                                <input type="checkbox" class="ckstore" name="store_all" id="store_all" checked="checked"
                                       value="1" />
                                كل المخازن
                            </label>
                        </div>
                        <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['storeData']->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;
?>
                        <div class="col-lg-3">
                            <label>
                                <input type="checkbox" class="clientStore ckstore" name="store<?php echo $_smarty_tpl->tpl_vars['data']->value->storeId;?>
"
                                       id="store<?php echo $_smarty_tpl->tpl_vars['data']->value->storeId;?>
" checked="checked" disabled="disabled" value="1" />
                                <?php echo $_smarty_tpl->tpl_vars['data']->value->storeName;?>

                            </label>
                        </div>
                        <?php } ?>
                    </div>
                    <!-- =================================================   -->
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default savemodel2" data-dismiss="modal">لا</button>
                <button type="button" class="btn btn-primary savemodel1">نعم</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<!------------------------Client Model----------------------------->
<!-- Modal -->
<div class="modal fade" id="productDetailsModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-dialog" style="width: 800px;">
        <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="productDetailsForm" class="form-horizontal">

                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">اغلاق</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<!------------------------Product Model----------------------------->

<!-- Modal -->
<div class="modal fade" id="productModal" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog"><!-- style="width: 910px;" -->
        <div class="modal-content bg-modal">
            <div class="modal-header">
                <button type="button" class="close pull-left savemodel3" 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', 'productName');
                                insertProduct(event);
                            } else {
                                return false;
                            }">
                        
                        <div class="form-group">
                            <label for="productCatId" class="col-lg-2 control-label">التصنيف الرئيسيى</label>
                            <div class="col-lg-4"><span id="spryselect1">
                                    <select name="productCatId" id="productCatId0" data-level="0"
                                            class="select2 wdt100 productCat">
                                        <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['categoriesData']->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>
                                    <input type="hidden" id="level" name="level" value="0">
                                    <span class="selectInvalidMsg">*</span></span></div>
                            <div id="manyParents" class="col-lg-12"> </div>
                            <span class="selectInvalidMsg">*</span>

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

                        <div class="form-group">
                            <label for="productName" class="col-lg-2 control-label">الإسم</label>
                            <div class="col-lg-4"> <span id="sprytextfield1">
                                    <input type="hidden" name="productAddMultiCatLevel" id="productAddMultiCatLevel"
                                           value="1" />
                                    <input name="productName" type="text" id="productName" size="50"
                                           class=" form-control " />
                                    <span class="textfieldRequiredMsg">*</span></span>
                                <div id="productnameError" 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>
                            </div>
                        </div>
                        <!---------------------------->

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

                        <div class="form-group">
                            <label for="productBuyPrice" class="col-lg-2 control-label">سعر الشراء</label>
                            <div class="col-lg-4"> <span id="sprytextfield5">
                                    <input name="productBuyPrice" type="text" id="productBuyPrice"
                                           class="numberinput form-control" size="50" />
                                    <span class="textfieldRequiredMsg">*</span><span
                                        class="textfieldInvalidFormatMsg">ادخل السعر صحيح</span></span></div>
                        </div>
                        <!---------------------------->

                        <div class="form-group">
                            <label for="productSellAllPrice" class="col-lg-2 control-label">سعر بيع الجمله</label>
                            <div class="col-lg-4"> <span id="sprytextfield6">
                                    <input name="productSellAllPrice" type="text" id="productSellAllPrice"
                                           class="numberinput form-control" onkeyup="populateSellPrice();" size="50" />
                                    <span class="textfieldRequiredMsg">*</span><span
                                        class="textfieldInvalidFormatMsg">ادخل السعر صحيح</span></span></div>
                        </div>
                        <!---------------------------->

                        <div class="form-group">
                            <label for="productSellHalfPrice" class="col-lg-2 control-label">سعر بيع الجمله
                                التجزئة</label>
                            <div class="col-lg-4"> <span id="sprytextfield7">
                                    <input name="productSellHalfPrice" type="text" id="productSellHalfPrice"
                                           class=" form-control numberinput" size="50" />
                                    <span class="textfieldRequiredMsg">*</span><span
                                        class="textfieldInvalidFormatMsg">ادخل السعر صحيح</span></span></div>
                        </div>
                        <!---------------------------->

                        <div class="form-group">
                            <label for="productSellUnitPrice" class="col-lg-2 control-label">سعر بيع الوحده</label>
                            <div class="col-lg-4"> <span id="sprytextfield8">
                                    <input name="productSellUnitPrice" type="text" id="productSellUnitPrice"
                                           class=" form-control numberinput" size="50" />
                                    <span class="textfieldRequiredMsg">*</span><span
                                        class="textfieldInvalidFormatMsg">ادخل السعر صحيح</span></span></div>
                        </div>
                        <!---------------------------->

                        <div class="form-group">
                            <label for="inputEmail1" class="col-lg-2 control-label">الكمية</label>
                            <div class="col-lg-4"> <span id="sprytextfield9">
                                    <input name="new_productquantity" type="text" id="new_productquantity"
                                           class=" form-control numberinput" value="0" size="50" />
                                    <span class="textfieldRequiredMsg">*</span><span
                                        class="textfieldInvalidFormatMsg">ادخل الكمية صحيحة</span></span></div>
                        </div>

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

                        <div class="form-group">
                            <label for="limitamount" class="col-lg-2 control-label">الحد الاقصى</label>
                            <div class="col-lg-4"> <span id="sprytextfield10">
                                    <input name="limitamount" type="text" id="limitamount"
                                           class=" form-control numberinput" size="50" />
                                    <span class="textfieldRequiredMsg">*</span><span
                                        class="textfieldInvalidFormatMsg">ادخل الكمية صحيحة</span></span></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="productDate" class="col-lg-2 control-label">التاريخ</label>
                            <div class="col-lg-4"> <span id="sprytextfield11">
                                    <input name="productDate" type="text" id="productDate" value="<?php echo $_smarty_tpl->tpl_vars['today']->value;?>
"
                                           class=" form-control awdatepicker" autocomplete="off"
                                           data-date-format="yyyy-mm-dd" size="50" />
                                    <span class="textfieldRequiredMsg">*</span></span></div>
                        </div>

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

                        <div class="row">
                            <div class="row">
                                <hr />
                                <div class="col-lg-6">
                                    <h4>وحدات القياس</h4>
                                </div>
                                <div class="col-lg-6">
                                    <button type="button" name="addrawUnit" id="addrawUnit"
                                            class="btn btn-primary pull-left ft-nor"> اضافة وحدة </button>
                                </div>
                            </div>
                            <!-- end of title row-->
                            <div class="table-responsive">
                                <table class="table billtable table-bordered" id="containerUnit">
                                    <thead>
                                        <tr>
                                            <th class="wdt120">وحدة القياس</th>
                                            <th class="wdt120">عدد الوحدات</th>
                                            <!--                                            <th class="wdt120">الباركود</th>
                                                                                        <th class="wdt120">سعر الجملة</th>
                                                                                        <th class="wdt120">سعر نص جملة</th>
                                                                                        <th class="wdt120">سعر قطاعى</th>-->
                                            <th>حذف
                                                <input name="unitsItr" id="unitsItr" type="hidden" value="1" />
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>
                                                <select name="newunitid1" id="newunitid1" class="select2 wdt100">




                                                    <?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>
                                            </td>
                                            <td>
                                                <input type="text" name="newproductnumber1" id="newproductnumber1"
                                                       class="form-control txt-nonraduis numberinput" value="1" />
                                            </td>
                                            <!--                                            <td>
                                                                                            <input type="text" name="proUnitParcode1" id="proUnitParcode1"  class="form-control txt-nonraduis numberinput positiveNo" onblur="checkUnitbarcode(this.value, 1);" value="" />
                                                                                        </td>
                                                                                        <td>
                                                                                            <input type="text" name="proUnitSellAllPrice1" id="proUnitSellAllPrice1"  class="form-control txt-nonraduis numberinput positivefloat" value="" />
                                                                                        </td>
                                                                                        <td>
                                                                                            <input type="text" name="proUnitSellHalfPrice1" id="proUnitSellHalfPrice1"  class="form-control txt-nonraduis numberinput positivefloat" value="" />
                                                                                        </td>
                                                                                        <td>
                                                                                            <input type="text" name="proUnitSellUnitPrice1" id="proUnitSellUnitPrice1"  class="form-control txt-nonraduis numberinput positivefloat" value="" />
                                                                                        </td>-->
                                            <td>
                                                <button type="button" id="removeUnit1" class="close flt-none removeUnit"
                                                        aria-hidden="true">&times;</button>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default savemodel3" data-dismiss="modal">لا</button>
                    <button type="submit" class="btn btn-primary">نعم</button>
                </div>
                </form>
            </div>
            <!-- /.productForm -->
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->

<!-- /////////////////////////Store Model/////////////////////////////////-->

<!-- Modal -->
<div class="modal fade" id="storemodel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close pull-left" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">الكمية المتاحة بالمخازن</h4>
            </div>
            <div class="modal-body"> لا يوجد كمية بالمخزن كافية <br />
                الكمية بالمخزن <span id="errorquantity"></span> </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">غلق</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<input type="hidden" id="allowBillDelete" value="<?php echo $_smarty_tpl->tpl_vars['Usergroupdata']->value->allowBillDelete;?>
" />
<!------------------------Client Model----------------------------->
<!-- Modal -->
<div class="modal fade" id="ckPassModal" 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">عفوا ليس لديك صلاحية الحذف</h4>
            </div>
            <div class="modal-body">
                <form id="clientInfo" action="#" method="post" class="form-horizontal">
                    <div class="form-group">
                        <label for="newclientName" class="col-lg-4 control-label">هل لديك كلمة مرور للمتابعة</label>
                        <div class="col-lg-4">
                            <input class="form-control" id="pass" name="pass" type="password" required="required" />
                        </div>
                    </div>
                    <!-- =================================================   -->
                    <input type="hidden" id="delBtnId" value="" />
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">الغاء</button>
                <button type="button" class="btn btn-primary" id="ckPassDel">متابعة</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->



<script type="text/javascript">



    $(document).ready(function () {
        $('.addtaxes').live('click', function (e) {
            var mitr = Number($(this).attr('data-mitr'));
            var itr = Number($('#taxesitr_' + mitr).val()) + 1;
            $.ajax({
                type: 'POST',
                url: 'sellbillAjaxController.php?do=addtaxes',
                data: {itr: mitr, itr2: itr},
                async: false,
                success: function (data) {
                    $('#taxes' + mitr).append(data);
                    $('#taxesitr_' + mitr).val(itr);
                    //Taxes();
                    Taxes(mitr, itr);

                }
            });
        });


        /* -----------------------------------------------------------------------*/
        $('.removetaxes').live('click', function (e) {
            var itr = Number($(this).attr('data-itr'));
            var edit = Number($(this).attr('data-edit'));
            var id = Number($(this).attr('data-id'));
            if (edit == 1) {
                $.ajax({
                    type: 'POST',
                    url: 'sellbillAjaxController.php?do=removetaxes',
                    data: {id: id, ordertype: $('#ordertype').val()},
                    async: false,
                    success: function (data) {
                        $('#taxes' + itr).remove();
                    }
                });
            } else {
                $('#taxes' + itr).remove();
            }

        });

        $('.removeellbilldetailtax').live('click', function (e) {
            var itr = $(this).attr('data-itr');
            var mitr = $(this).attr('data-mitr');
            var edit = Number($(this).attr('data-edit'));
            var id = Number($(this).attr('data-id'));
            if (edit == 1) {
                $.ajax({
                    type: 'POST',
                    url: 'sellbillAjaxController.php?do=removeellbilldetailtax',
                    data: {id: id},
                    async: false,
                    success: function (data) {
                        $('#litaxes_' + mitr + '_' + itr).remove();
                    }
                });
            } else {
                $('#litaxes_' + mitr + '_' + itr).remove();
            }

        });

        $('.Taxes').live('click', function (e) {
            var mitr = Number($(this).attr('data-mitr'));
            var itr = mitr;
            var itr2 = Number($('#taxesitr_' + itr).val());
            Taxes(itr, itr2);
            var citr2 = 1;
            $('.oldtype' + itr).each(function () {
                var id = $(this).attr('id');
                var sid = $(this).attr('data-id');
                var stext = $(this).attr('data-text');
                var sid2 = $(this).attr('data-sid');
                var stext2 = $(this).attr('data-stext');
                Taxes(itr, citr2);
                citr2++;
                $('#eTaxType_' + id).select2('data', {id: sid, text: stext});
                $('#eTaxsubtype_' + id).select2('data', {id: sid2, text: stext2});
            });

            $rowsneeded = 3 - $('.rate_' + mitr).length;
            for ($i = 0; $i < $rowsneeded; $i++) {
                $('#addtaxes' + mitr).click();
            }
        });


        function Taxes(itr, itr2) {
            $("#eTaxsubtype_" + itr + '_' + itr2).select2({
                placeholder: "اختر",
                minimumInputLength: 0, // document.getElementById("searchvalue").value,
                multiple: false,
                quietMillis: 100,
                ajax: {
                    type: 'POST',
                    url: "eBillRequests.php?do=tax-subtypes",
                    dataType: 'json',
                    data: function (term, page) {
                        var typeid = $('#eTaxType_' + itr + '_' + itr2).val();
                        return {
                            term: term,
                            typeid: typeid, //search term
                        };
                    },
                    results: function (data) {
                        return {results: data};
                    }
                },
                formatResult: function (data) {
                    return data.text;
                },
                initSelection: function (element, callback) {
                    var item = element.val().split(':');
                    //  var data = {id: item[0], text: item[1]};
                    var data = {id: item[0], text: item[1]};
                    callback(data);
                },
                //dropdownCssClass: "bigdrop", // apply css that makes the dropdown taller
            });



            $("#eTaxType_" + itr + '_' + itr2).select2({
                placeholder: "اختر",
                minimumInputLength: 0, // document.getElementById("searchvalue").value,
                multiple: false,
                quietMillis: 100,
                ajax: {
                    url: "eBillRequests.php?do=tax-types",
                    dataType: 'json',
                    data: function (term, page) {
                        return {
                            term: term, //search term
                        };
                    },
                    results: function (data) {
                        return {results: data};
                    }
                },
                formatResult: function (data) {
                    return data.text;
                },
                initSelection: function (element, callback) {
                    var item = element.val().split(':');
                    //  var data = {id: item[0], text: item[1]};
                    var data = {id: item[0], text: item[1]};
                    callback(data);
                },
                //dropdownCssClass: "bigdrop", // apply css that makes the dropdown taller
            });
            //this is needed for ajax =>to obtain id from it  and use in ajax
            // $('#eTaxType').select2('data', {id: $('#oldeTaxType').val(), text: $('#oldeTaxType').val()});
        }
        ;

    });
    $('.ncloseebill').live('change', function (e) {
        var mitr = $(this).attr('data-mitr');
        var itr = $(this).attr('data-itr');
        //closeebill(mitr, itr);//would be called inside totalprice
        totalprice();
        thegeneraldiscount();//to calc sellbillaftertotalbill value
    });

    $('.closeebill').live('click', function (e) {
        var mitr = $(this).attr('data-mitr');
        var itr = $(this).attr('data-itr');
        //closeebill(mitr, itr);//would be called inside totalprice
        totalprice();
        thegeneraldiscount();//to calc sellbillaftertotalbill value
    });
    function closeebill(mitr = 1, itr = 1) {


        var myarray = {};
        $('.amounts').each(function () {
            var mitr = $(this).attr('data-mitr');
            var itr = $(this).attr('data-itr');
            var proprice = $('#hidden_prototal' + mitr).val();
            var eTaxsubtype = $("#eTaxsubtype_" + mitr + '_' + itr).val();
            if (eTaxsubtype) {
                var eTaxType = $("#eTaxType_" + mitr + '_' + itr).val();
                var rate = $("#rate_" + mitr + '_' + itr).val();
                // alert(proprice + ' / ' + rate);
                if (rate) {
                    var amount = (proprice * rate) / 100;
                    $("#amount_" + mitr + '_' + itr).val(amount);
                } else {
                    var amount = Number($(this).val());
                }

                var intext = eTaxsubtype + ' - ' + eTaxType;
                if (intext in myarray) {
                    myarray[intext] = Number(myarray[intext]) + amount;
                } else {
                    myarray[intext] = amount;
                }
            }

        });
        $("#closeebill").html('');
        var etotal = 0;
        jQuery.each(myarray, function (index, item) {
            $("#closeebill").append('<div class="form-group mg-bt5">'
                    + '<label class="col-lg-3 control-label">' + index + '</label>'
                    + '<div class="col-lg-3">' + item + '</div>'
                    + '</div>');
            etotal += Number(item);
        });
        $("#etotal").val(etotal);

    }
    ;
</script>
<script type="text/javascript">
    $('#store_all').live('click', function () {
        if ($(this).attr('checked') == 'checked') {
            $('.clientStore').attr('checked', 'checked');
            $('.clientStore').attr('disabled', 'disabled');
        } else {
            $('.clientStore').removeAttr('checked');
            $('.clientStore').removeAttr('disabled');
        }
    });
    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
    var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "real");
    var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {isRequired: false, invalidValue: "-1"});
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "real");
    var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6", "real");
    var sprytextfield7 = new Spry.Widget.ValidationTextField("sprytextfield7", "real");
    var sprytextfield8 = new Spry.Widget.ValidationTextField("sprytextfield8", "real");
    var sprytextfield9 = new Spry.Widget.ValidationTextField("sprytextfield9", "integer");
    var sprytextfield10 = new Spry.Widget.ValidationTextField("sprytextfield10", "integer");
    var sprytextfield11 = new Spry.Widget.ValidationTextField("sprytextfield11");
    var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "real");
    var billReservationDatesp = null;
    $('#billReservation').live('change', function () {
        if ($('#billReservation').is(':checked')) {
            billReservationDatesp = new Spry.Widget.ValidationTextField("billReservationDatesp");
        } else if (billReservationDatesp != null) {
            billReservationDatesp.resetClasses(); //.reset();   //Resets any validation css on the form
            billReservationDatesp.destroy();
            billReservationDatesp = null;
        }
    });
    $('#billReservation').change();



</script>
<?php }} ?>