<input type="hidden" name="printURL" id="printURL" value="{$printURL}" />
<script>
    var printURL = $('#printURL').val();
    if (printURL != "") {
        window.open(printURL);
    }
</script>
<!-- === 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;
    }

    #manyParents .form-group label {
        margin-left: 11px;
        margin-right: 16px;
    }

    #manyParents .form-group div {
        width: 155px;
    }


    /* -- 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>
    {foreach $productData as $product}
    <option value="{$product->productId}">{$product->productName} </option>
    {/foreach}
</div>
<div id="addreturnproduct" style="display:none"> {foreach $returnproductData as $returnproduct}
    <option value="-1"> </option>
    <option value="{$returnproduct->productId}">{$returnproduct->productName} </option>
    {/foreach}
</div>
<div id="addProductCat" style="display:none;"> {foreach $categoriesData as $cat}
    <option value="{$cat->productCatId}">{$cat->productCatName}</option>
    {/foreach}
</div>
<div id="addNewUnit" style="display:none;"> {foreach $unitsData as $unit}
    <option value="{$unit->unitId}">{$unit->unitName}</option>
    {/foreach}
</div>


<div id="addstore" class="clientstore" style="display:none;">
    {foreach $storeData as $store}
    <option value="{$store->storeId}">{$store->storeName}</option>
    {/foreach}

</div>
<div id="addstore2" class="clientstoretxt" style="display:none;">
    {foreach $storeData as $store}
    {if {$store->storeId} eq {$userdata->userstoreid}}{$store->storeName} {/if}
    {/foreach}
</div>
<!-- === end of drop down list === -->
<input name="valueaddeddiscount" id="valueaddeddiscount" type="hidden"
       value="{$Programsettingdata->valueaddeddiscount}" />
<input name="clientPhoneReq" id="clientPhoneReq" type="hidden" value="{$Programsettingdata->clientPhoneReq}" />
<input name="addServiceToBill" id="addServiceToBill" type="hidden" value="{$Programsettingdata->addServiceToBill}" />
<input name="showPrevDiscount" id="showPrevDiscount" type="hidden" value="{$Programsettingdata->showPrevDiscount}" />
<input type="hidden" name="scunitnamevalue" id="scunitnamevalue" value="{$Programsettingdata->scunitname}" />
<input type="hidden" name="usedParcode" id="usedParcode" value="{$Programsettingdata->usedParcode}" />
<input type="hidden" name="valueadded" id="valueadded" value="{$Programsettingdata->valueadded}" />
<input type="hidden" name="sendBillToRestaurant" id="sendBillToRestaurant"
       value="{$Programsettingdata->sendBillToRestaurant}" />
<input type="hidden" name="defaultUnitPriceAtBill" id="defaultUnitPriceAtBill"
       value="{$Programsettingdata->defaultUnitPriceAtBill}" />
<input type="hidden" name="showpriceall" id="showpriceall" value="{$Programsettingdata->showpriceall}" />
<input type="hidden" name="showpricehalf" id="showpricehalf" value="{$Programsettingdata->showpricehalf}" />
<input type="hidden" name="showpriceunit" id="showpriceunit" value="{$Programsettingdata->showpriceunit}" />
<input type="hidden" name="showprice4" id="showprice4" value="{$Programsettingdata->showprice4}" />
<input type="hidden" name="showprice5" id="showprice5" value="{$Programsettingdata->showprice5}" />
<input type="hidden" name="showprice6" id="showprice6" value="{$Programsettingdata->showprice6}" />
<input type="hidden" name="showprice7" id="showprice7" value="{$Programsettingdata->showprice7}" />
<input type="hidden" name="showprice8" id="showprice8" value="{$Programsettingdata->showprice8}" />
<input type="hidden" name="showprice9" id="showprice9" value="{$Programsettingdata->showprice9}" />
<input type="hidden" name="showprice10" id="showprice10" value="{$Programsettingdata->showprice10}" />
<input type="hidden" name="showprice11" id="showprice11" value="{$Programsettingdata->showprice11}" />
<input type="hidden" name="showprice12" id="showprice12" value="{$Programsettingdata->showprice12}" />
<input type="hidden" name="showprice13" id="showprice13" value="{$Programsettingdata->showprice13}" />
<input type="hidden" name="medExCat" id="medExCat" value="{$Programsettingdata->medExCat}" />
<input type="hidden" name="checkretsellclient" id="checkretsellclient"
       value="{$Programsettingdata->checkretsellclient}" />

<input type='hidden' name='allDiscounts' id='allDiscounts' value='{$allDiscounts}' />
<input type="hidden" name="stopDiscountOfTotalControl" id="stopDiscountOfTotalControl"
       value="{$Usergroupdata->stopDiscountOfTotalControl}" />
<input type="hidden" name="discountOfTotalControlEditable" id="discountOfTotalControlEditable"
       value="{$Usergroupdata->discountOfTotalControlEditable}" />
<input type="hidden" name="discountOfTotalControlMTGDA" id="discountOfTotalControlMTGDA"
       value="{$Usergroupdata->discountOfTotalControlMTGDA}" />
<input type="hidden" name="supplierWithAddOption" id="supplierWithAddOption"
       value="{$Usergroupdata->addClientInBill}" />
<input type="hidden" name="withNakdi" id="withNakdi" value="{$Usergroupdata->showClientAndSupplierOne}" />
<input type="hidden" name="hideBillPrices" id="hideBillPrices" value="{$Usergroupdata->hideBillPrices}" />
<input type="hidden" name="clientidFromGET" id="clientidFromGET" value="{$clientidFromGET}" />
<input type="hidden" name="searchWithCatAndProductNameOnly" id="searchWithCatAndProductNameOnly"
       value="{$billsettingsData[97]->billsettingsvalue}" />
<input type="hidden" name="activateAutoSave" id="activateAutoSave" value="{$billsettingsData[98]->billsettingsvalue}" />
<input type="hidden" name="clientType" id="clientType" value="{$billsettingsData[103]->billsettingsvalue}" />
<input type="hidden" name="manyParcodesFlag" id="manyParcodesFlag" value="{$manyParcodes}" />
<input type="hidden" name="supplieridBeforeChange" id="supplieridBeforeChange" value="{$myclientdata->clientid}" />
<input type="hidden" name="suppliernameBeforeChange" id="suppliernameBeforeChange"
       value="{$myclientdata->clientname}" />
<input type="hidden" id="retOnlySoldProducts" value="{$billsettingsData[105]->billsettingsvalue}" />
<input type="hidden" id="checkRedundantProducts" value="{$billsettingsData[107]->billsettingsvalue}" />
<input type="hidden" id="proNumType" value="{$billsettingsData[113]->billsettingsvalue}" />
<input type="hidden" id="compareToBuyPriceAlert" value="{$billsettingsData[118]->billsettingsvalue}" />

<input type="hidden" id="hideBuyPrice" value="{$Usergroupdata->showstoredetailprice}" />
<input type="hidden" id="canEditAddDiscountPercentage" value="{$Usergroupdata->canEditAddDiscountPercentage}" />
<input type="hidden" id="isMedicalBill" value="{$billsettingsData[120]->billsettingsvalue}" />
<!-- === here the drop down list that fill the product list === -->

<div id="addunit" style="display:none"> </div>
<!-- === end of drop down list === -->

<div class="container {if $lang_code == 'en'} gt4-ltr{/if}">
    <div class="bill-mobile ">
        <ol class="breadcrumb">
            <li><a href="#">{$smarty.const.SELL_BILL_BILLING_MANAGEMENT}</a></li>
            <li><a href="sellbillController.php?do=addsellBill&billnameid=3">{$smarty.const.SELL_BILL_SALES_INVOICE}</a>
            </li>
            <li class="active">{$smarty.const.SELL_BILL_ADD_INVOICE}</li>


        </ol>



        <h3>{$smarty.const.SELL_BILL_BILLING_MANAGEMENT}</h3>
        {if $mylastbill->sellbillid>0}
        <h3><a class="color-white"
               href="sellbillController.php?do=showDetail&sellbillid={$mylastbill->sellbillid}">{$smarty.const.SELL_BILL_PREVIOUS_INVOICE}
            </a> </h3>
        {/if}
        <hr />
        {literal}
        <form class="form-horizontal " role="form" action="sellbillController.php?do=add" 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');
                                  if ($('#saveAndPrint').length > 0)
                                      $('#saveAndPrint').css('display', 'none');
                                  if ($('#saveAndNewOrder').length > 0)
                                      $('#saveAndNewOrder').css('display', 'none');
                                  if ($('#saveAndSend').length > 0)
                                      $('#saveAndSend').css('display', 'none');
                                  return true;
                              } else {
                                  return false;
                              }
                          }
                      } else
                      {
                          if (Spry.Widget.Form.validate(this)) {
                              $('#saveAndNew').css('display', 'none');
                              $('#saveBill').css('display', 'none');
                              if ($('#saveAndPrint').length > 0)
                                  $('#saveAndPrint').css('display', 'none');
                              if ($('#saveAndNewOrder').length > 0)
                                  $('#saveAndNewOrder').css('display', 'none');
                              if ($('#saveAndSend').length > 0)
                                  $('#saveAndSend').css('display', 'none');
                              return true;
                          } else {
                              return false;
                          }
                      }

              ">
            {/literal}
            <input type="hidden" name="tempSaveBillId" id="tempSaveBillId" value="{$tempSaveBillId}">
            <div class="row">
                <div class="col-lg-8">
                    <div class="form-group" {if {$billsettingsData[61]->billsettingsvalue} eq 0} style="display:block"
                        {else} style="display:none" {/if}>
                        <label class="col-lg-3 col-sm-5 control-label"> {$smarty.const.SELL_BILL_INVOICE_NUMBER}</label>
                        <div class="col-lg-4 col-sm-7">
                            <input type="text" name="bns" id="bns" value="{$unique}" class="form-control"
                                   placeholder="{$smarty.const.SELL_BILL_INVOICE_NUMBER} ">
                        </div>
                    </div>
                    <!-- end of form-group-->
                    {if $Programsettingdata->clientserial eq 1}
                    <div class="form-group">
                        <label class="col-lg-3 col-sm-5 control-label">{$smarty.const.SELL_BILL_SERIAL_NUMBER} </label>
                        <div class="col-lg-4 col-sm-7">
                            <input type="text" class="form-control" disabled readonly value="{$nextId}">
                        </div>
                    </div>
                    <!-- end of form-group-->
                    {/if}
                    <div class="form-group" {if {$billsettingsData[5]->billsettingsvalue} eq 0} style="display:block"
                        {else} style="display:none" {/if} >
                        <label class="col-lg-3 col-sm-5 control-label">{$smarty.const.SELL_BILL_INVOICE_DATE}</label>
                        <div class="col-lg-4 col-sm-7"> <span id="sprydate">
                                <!--input type="text" class="form-control awdatepicker" autocomplete="off"  data-date-format="yyyy-mm-dd" placeholder="تاريخ الفاتورة" {if $Programsettingdata->allowdateedit == 1}disabled="disabled"{/if} value="{$today}" name="bn" id="bn"-->
                                {if $Programsettingdata->allowdateedit == 1}
                                <input type="text" class="form-control"
                                       placeholder=" {$smarty.const.SELL_BILL_INVOICE_DATE}" readonly value="{$today}"
                                       name="bn" id="bn">
                                {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 autoSaveBillMainPart" size="16" type="text"
                                           value="{if $tempSaveBillId > 0}{$mysellbilldata->sellbilldate}{$mysellbilldata->returnsellbilldate}{else}{$today}{/if}"
                                           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>{/if}
                                <span class="textfieldRequiredMsg">*</span>
                            </span> </div>
                    </div>
                    <!-- end of form-group-->

                    <div class="form-group" {if {$billsettingsData[50]->billsettingsvalue} eq 0} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-3 col-sm-4 control-label">{$smarty.const.SELL_BILL_TEMPORARY_CLIENT_NAME}
                        </label>
                        <div class="col-lg-4 col-sm-8"> <span id="sprytempname">
                                <input type="text" class="form-control autoSaveBillMainPart"
                                       placeholder="{$smarty.const.SELL_BILL_TEMPORARY_CLIENT_NAME} " name="tempclientName"
                                       id="tempclientName"
                                       value="{if $manyParcodes == 1}{$mysellbilldata->tempclientName}{else}نقدى{/if}" />
                                <span class="textfieldRequiredMsg">*</span></span> </div>
                    </div>

                    <div class="form-group" {if {$billsettingsData[102]->billsettingsvalue} eq 0} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-3 control-label">{$smarty.const.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="{$smarty.const.SELL_BILL_DATE_OF_STARTING}" value="{$date}"
                                       name="datestarting">
                                <span class="textfieldRequiredMsg">*</span></span>
                        </div>
                    </div>
                    <div class="form-group" {if {$billsettingsData[110]->billsettingsvalue} eq 0} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-3 control-label">{$smarty.const.SELL_BILL_STATUS} </label>
                        <div class="col-lg-4">
                            {$smarty.const.SELL_BILL_STATUS_NEW}
                        </div>
                    </div>

                    <div class="form-group" {if {$billsettingsData[119]->billsettingsvalue} neq 1} style="display:none"
                        {/if}>
                        <label class="col-lg-3 col-sm-5 control-label"> {$smarty.const.SELL_BILL_INVOICE_NUMBER}</label>
                        <div class="col-lg-4 col-sm-7">
                            <input type="text" name="sellbillno" id="sellbillno" value=""
                                   class="form-control positiveNo"
                                   placeholder="{$smarty.const.SELL_BILL_SELL_INVOICE_NUMBER} ">
                        </div>
                    </div>
                    <!-- end of form-group-->

                    <!-- ahmed -->

                    <div {if {$billsettingsData[35]->billsettingsvalue} eq 0} {else} style="display:none" {/if} >

                        <div class="form-group">
                            <label class="col-lg-3  col-sm-4 control-label">{$smarty.const.SELL_BILL_CAR_NUMBER}
                            </label>
                            <div class="col-lg-4  col-sm-8"> <span id="sprytempname">
                                    <input type="text" class="form-control"
                                           placeholder="{$smarty.const.SELL_BILL_CAR_NUMBER}" name="carNumber"
                                           id="carNumber" />
                                    <span class="textfieldRequiredMsg">*</span></span> </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-3  col-sm-4 control-label">{$smarty.const.SELL_BILL_CAR_TYPE}</label>
                            <div class="col-lg-4  col-sm-8"> <span id="sprytempname">
                                    <input type="text" class="form-control"
                                           placeholder="{$smarty.const.SELL_BILL_CAR_TYPE} " name="carType" id="carType" />
                                    <span class="textfieldRequiredMsg">*</span></span> </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-3  col-sm-4 control-label">{$smarty.const.SELL_BILL_CAR_CHASSIS}
                            </label>
                            <div class="col-lg-4  col-sm-8"> <span id="sprytempname">
                                    <input type="text" class="form-control"
                                           placeholder="{$smarty.const.SELL_BILL_CAR_CHASSIS}  " name="carChase"
                                           id="carChase" />
                                    <span class="textfieldRequiredMsg">*</span></span> </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-3  col-sm-4 control-label">{$smarty.const.SELL_BILL_CAR_MOTOR} </label>
                            <div class="col-lg-4  col-sm-8"> <span id="sprytempname">
                                    <input type="text" class="form-control"
                                           placeholder=" {$smarty.const.SELL_BILL_CAR_MOTOR}" name="carMotor"
                                           id="carMotor" />
                                    <span class="textfieldRequiredMsg">*</span></span> </div>
                        </div>

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

                    </div>


                    <div {if {$billsettingsData[39]->billsettingsvalue} eq 0} {else} style="display:none" {/if} >
                        <div id="divclientdata">
                            <div class="form-group">
                                <label
                                    class="col-lg-3 col-sm-6 control-label">{$smarty.const.SELL_BILL_CUSTOMER_ADDRESS}</label>
                                <div class="col-lg-4 col-sm-6">

                                </div>
                            </div>

                            <div class="form-group">
                                <label
                                    class="col-lg-3 col-sm-6 control-label">{$smarty.const.SELL_BILL_PHONE_NUMBER}</label>
                                <div class="col-lg-4 col-sm-6">

                                </div>


                            </div>


                            <div class="form-group">
                                <label
                                    class="col-lg-3 col-sm-6 control-label">{$smarty.const.SELL_BILL_CLIENT_CODE}</label>
                                <div class="col-lg-4 col-sm-6">

                                </div>


                            </div>

                        </div>

                    </div>
                </div>

                <!-- end of bill no-->
                <div class="col-lg-4">
                    <div class="form-group mg-bt5" {if {$billsettingsData[45]->billsettingsvalue} eq 0} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-4 col-sm-4 control-label">{$smarty.const.SELL_BILL_COST_CENTER}</label>
                        <div class="col-lg-8 col-sm-8">

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


                                <option value="-1">{$smarty.const.SELL_BILL_SELECT_COST_CENTER}</option>
                                {foreach $allCostcenter as $myallCostcenter}



                                <option value="{$myallCostcenter->id}">{$myallCostcenter->name}</option>

                                {/foreach}


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

                </div>
                {if $billtoret < 1 && $billsettingsData[0]->billsettingsvalue != 1}
                <div class="col-lg-4">
                    <div class="form-group mg-bt5">
                        <label class="col-lg-4 col-sm-4 control-label">رد على فاتورة بيع</label>
                        <div class="col-lg-8 col-sm-8">
                            <input type="hidden" id="sellbillidToRet" value=""/>
                        </div>
                    </div>
                </div>
                {/if}
                <div class="col-lg-4">

                    {if {$billsettingsData[37]->billsettingsvalue} eq 1}
                    <div class="form-group mg-bt5" {if {$billsettingsData[1]->billsettingsvalue} eq 0} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-4 col-sm-4 control-label">{$smarty.const.SELL_BILL_CLIENT_NAME}</label>
                        <div class="col-lg-8 col-sm-8"> <span id="spryclient">
                                <div id="clientDiv">
                                    <!--                                    <select class="select2Supp wdt100" name="supplier" id="supplier" >


                                                                            {foreach $clientData as $client}
                                                                            <option  value="{$client->clientid}" data-id="i{$client->clientid}" data-mobile="{$client->clientmobile}" data-phone="{$client->clientphone}" data-clientcode="{$client->clientcode}" {if $manyParcodes == 1 && $manyParcodesSupplier == $client->clientid} selected="selected" {/if}>{$client->clientname}</option>
                                                                            {if $client->clientid == 1}
                                                                            <option  value="-2"  class="newoption">اضافة عميل جديد</option>
                                                                            {/if}

                                                                            {capture assign=y}{$y+1}{/capture}
                                                                            {/foreach}


                                                                        </select>-->
                                    <input type="hidden" name="supplier" id="supplier"
                                           class="select2Supp autoSaveBillMainPart" />
                                    <input type="hidden" id="oldsupplierid" value="{$myclientdata->clientid}" />
                                    <input type="hidden" id="oldsuppliername" value="{$myclientdata->clientname}" />
                                    <input type="hidden" id="initialSupp_PriceType"
                                           value="{$myclientdata->priceTypeId}" />
                                    <input type="hidden" id="initialSupp_Debt" value="{$myclientdata->clientdebt}" />

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

                        <input type="hidden" id="specialDiscount_" value="{$myclientdata->specialDiscount}" />
                        <input type="hidden" id="specialDiscountVal_" value="{$myclientdata->specialDiscountVal}" />
                    </div>


                    <div class="form-group mg-bt5" {if {$billsettingsData[1]->billsettingsvalue} eq 0} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-4 col-sm-4 control-label">نوع العميل</label>
                        <div class="col-lg-8 col-sm-8">
                            <span id="spryclient">
                                <div id="clientDiv">
                                    <input type="hidden" name="sellbilltypeclientid" id="typeclient" class="typeclientid"  />
                                </div>
                                <span class="selectInvalidMsg">*</span>
                            </span>
                        </div>
                    </div>
                    <!-- end of form-group-->

                    <div class="form-group mg-bt5" {if {$billsettingsData[56]->billsettingsvalue} eq 0} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-4 col-sm-4 control-label">{$smarty.const.SELL_BILL_DEBT_BALANCE}</label>
                        <div class="col-lg-8 col-sm-8">
                            <p class="form-control-static" id="debt">0 </p>
                            <input name="hidden_debt" id="hidden_debt" type="hidden" value="0" />
                            <input id="hidden_debt_main_curr" type="hidden" value="0" />
                        </div>
                    </div>
                    <!-------------------------->
                    {else}

                    <div class="form-group">
                        <label class="col-lg-4 col-sm-4 control-label">{$smarty.const.SELL_BILL_CLIENT_NAME} </label>
                        <div class="col-lg-8 col-sm-8">
                            <span id="spryselect12">
                                <select multiple name="supplierX[]" id="supplier" class="select2 wdt100 multiSupp">


                                    {foreach $clientData as $client}



                                    <option value="{$client->clientid}">{$client->clientname}</option>


                                    {/foreach}
                                </select>
                                <span class="selectInvalidMsg">****.</span><span
                                    class="selectRequiredMsg">****.</span></span>
                        </div>
                    </div>

                    <input type="hidden" name="oldsupplierid" id="oldsupplierid" value="{$myclientdata->clientid}" />
                    <input type="hidden" name="oldsuppliername" id="oldsuppliername"
                           value="{$myclientdata->clientname}" />
                    <input type="hidden" id="initialSupp_PriceType" value="{$myclientdata->priceTypeId}" />
                    <input type="hidden" id="initialSupp_Debt" value="{$myclientdata->clientdebt}" />
                    <div class="form-group mg-bt5" style="display:none">
                        <label class="col-lg-4  col-sm-4 control-label"> {$smarty.const.SELL_BILL_DEBT_BALANCE}</label>
                        <div class="col-lg-8 col-sm-8">
                            <p class="form-control-static" id="debt">0 </p>
                            <input name="hidden_debt" id="hidden_debt" type="hidden" value="0" />
                        </div>
                    </div>

                    {/if}

                    <div id="commentAZ" {if {$billsettingsData[78]->billsettingsvalue} eq 0} {else} style="display:none"
                        {/if}>
                        <div class="form-group">
                            <label
                                class="col-lg-4 col-sm-4 control-label">{$smarty.const.SELL_BILL_CLIENT_DETAILS}</label>
                            <div class="col-lg-4 col-sm-8">

                            </div>
                        </div>

                    </div>

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

                    <div class="form-group mg-bt5" {if {$billsettingsData[68]->billsettingsvalue} eq 0} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-4 col-sm-4 control-label">{$smarty.const.SELL_BILL_PRICE_TYPE}</label>
                        <div class="col-lg-8 col-sm-8">
                            <select class="select2 wdt100 autoSaveBillMainPart" name="pricetype" id="pricetype">
                                {if $Programsettingdata->showpriceall eq 1}
                                <option value="0" {if ($manyParcodes !=1 && $billsettingsData[32]->billsettingsvalue eq 0) || ($manyParcodes == 1 && $manyParcodesPriceType eq 0)} selected="selected"
                                    {/if}>{$smarty.const.SELL_BILL_WHOLESALE}</option>
                                {/if}
                                {if $Programsettingdata->showpriceunit eq 1}
                                <option value="1" {if ($manyParcodes !=1 && $billsettingsData[32]->billsettingsvalue eq 1) || ($manyParcodes == 1 && $manyParcodesPriceType eq 1)} selected="selected"
                                    {/if}>{$smarty.const.SELL_BILL_RETAIL}</option>
                                {/if}
                                {if $Programsettingdata->showpricehalf eq 1}
                                <option value="2" {if ($manyParcodes !=1 && $billsettingsData[32]->billsettingsvalue eq 2) || ($manyParcodes == 1 && $manyParcodesPriceType eq 2)} selected="selected"
                                    {/if}>{$smarty.const.SELL_BILL_HALF_WHOLESALE}</option>
                                {/if}
                                {if $Programsettingdata->showprice4 eq 1}
                                <option value="4" {if ($manyParcodes !=1 && $billsettingsData[32]->billsettingsvalue eq 4) || ($manyParcodes == 1 && $manyParcodesPriceType eq 4)} selected="selected"
                                    {/if}>{$smarty.const.SELL_BILL_PRICE4}</option>
                                {/if}
                                {if $Programsettingdata->showprice5 eq 1}
                                <option value="5" {if ($manyParcodes !=1 && $billsettingsData[32]->billsettingsvalue eq 5) || ($manyParcodes == 1 && $manyParcodesPriceType eq 5)} selected="selected"
                                    {/if}>{$smarty.const.SELL_BILL_PRICE5}</option>
                                {/if}
                                {if $Programsettingdata->showprice6 eq 1}
                                <option value="6" {if ($manyParcodes !=1 && $billsettingsData[32]->billsettingsvalue eq 6) || ($manyParcodes == 1 && $manyParcodesPriceType eq 6)} selected="selected"
                                    {/if}>{$smarty.const.SELL_BILL_PRICE6}</option>
                                {/if}
                                {if $Programsettingdata->showprice7 eq 1}
                                <option value="7" {if ($manyParcodes !=1 && $billsettingsData[32]->billsettingsvalue eq 7) || ($manyParcodes == 1 && $manyParcodesPriceType eq 7)} selected="selected"
                                    {/if}>{$smarty.const.SELL_BILL_PRICE7}</option>
                                {/if}
                                {if $Programsettingdata->showprice8 eq 1}
                                <option value="8" {if ($manyParcodes !=1 && $billsettingsData[32]->billsettingsvalue eq 8) || ($manyParcodes == 1 && $manyParcodesPriceType eq 8)} selected="selected"
                                    {/if}>{$smarty.const.SELL_BILL_PRICE8}</option>
                                {/if}
                                {if $Programsettingdata->showprice9 eq 1}
                                <option value="9" {if ($manyParcodes !=1 && $billsettingsData[32]->billsettingsvalue eq 9) || ($manyParcodes == 1 && $manyParcodesPriceType eq 9)} selected="selected"
                                    {/if}>{$smarty.const.SELL_BILL_PRICE9}</option>
                                {/if}
                                {if $Programsettingdata->showprice10 eq 1}
                                <option value="10" {if ($manyParcodes !=1 && $billsettingsData[32]->billsettingsvalue eq 10) || ($manyParcodes == 1 && $manyParcodesPriceType eq 10)} selected="selected"
                                    {/if}>{$smarty.const.SELL_BILL_PRICE10}</option>
                                {/if}
                                {if $Programsettingdata->showprice11 eq 1}
                                <option value="11" {if ($manyParcodes !=1 && $billsettingsData[32]->billsettingsvalue eq 11) || ($manyParcodes == 1 && $manyParcodesPriceType eq 11)} selected="selected"
                                    {/if}>{$smarty.const.SELL_BILL_PRICE11}</option>
                                {/if}
                                {if $Programsettingdata->showprice12 eq 1}
                                <option value="12" {if ($manyParcodes !=1 && $billsettingsData[32]->billsettingsvalue eq 12) || ($manyParcodes == 1 && $manyParcodesPriceType eq 12)} selected="selected"
                                    {/if}>{$smarty.const.SELL_BILL_PRICE12}</option>
                                {/if}
                                {if $Programsettingdata->showprice13 eq 1}
                                <option value="13" {if ($manyParcodes !=1 && $billsettingsData[32]->billsettingsvalue eq 13) || ($manyParcodes == 1 && $manyParcodesPriceType eq 13)} selected="selected"
                                    {/if}>{$smarty.const.SELL_BILL_PRICE13}</option>
                                {/if}
                            </select>
                            <input type="hidden" name="hiddenpricetype" id="hiddenpricetype" value="0" />
                            {if $manyParcodes != 1}
                            <input type="hidden" id="hiddenpritype"
                                   value="{$billsettingsData[32]->billsettingsvalue}" />
                            {else}
                            <input type="hidden" id="hiddenpritype" value="{$manyParcodesPriceType}" />
                            {/if}
                        </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="{$userdata->userstoreid}" />
                    <input type="hidden" id="userstoreidForClient" value="{$userdata->userstoreid}" />
                    <div {if {$billsettingsData[2]->billsettingsvalue} eq 0} {else} style="display:none" {/if} >
                        {if {$billsettingsData[26]->billsettingsvalue} eq 1}

                        <!------ {if {$billsettingsData[2]->billsettingsvalue} eq 0}  {else} style="display:none" {/if}---------------------->
                        <div class="form-group mg-bt5">


                            {if $userdata->userstoreid eq 0}
                            <label class="col-lg-4 col-sm-4 control-label">{$smarty.const.SELL_BILL_STORE}</label>
                            <div class="col-lg-8 col-sm-8">
                                <select class="select2 wdt100 clientstore autoSaveBillMainPart" name="storeid"
                                        id="storeid">
                                    {foreach $storeData as $store}
                                    <option value="{$store->storeId}" {if $manyParcodes==1 && $manyParcodesStoreid eq
                                            $store->storeId} selected="selected" {/if}>{$store->storeName}</option>

                                    {/foreach}
                                </select>
                            </div>
                            {else}

                            <div style="display:none">

                                <select class="select2 wdt100 clientstore autoSaveBillMainPart" name="storeid"
                                        id="storeid">
                                    <option value="-1">{$smarty.const.SELL_BILL_SELECT_STORE}</option>

                                    {foreach $storeData as $store}


                                    <option {if {$store->storeId} eq {$userdata->userstoreid}} selected="selected"
                                        {/if}value="{$store->storeId}">{$store->storeName}</option>


                                    {/foreach}


                                </select>
                            </div>
                            <!--input name="storeid" id="storeid"  type="hidden" value="{$userdata->userstoreid}" /-->
                            <label class="col-lg-4 col-sm-4 control-label">{$smarty.const.SELL_BILL_STORE}</label>
                            <div class="col-lg-8 col-sm-8 clientstoretxt">
                                {foreach $storeData as $store}
                                {if {$store->storeId} eq {$userdata->userstoreid}}{$store->storeName} {/if}
                                {/foreach}
                            </div>
                            {/if}

                        </div>
                        {else}


                        <div style="display:none">
                            <select class="select2 wdt100 clientstore autoSaveBillMainPart" name="storeid" id="storeid">


                                {foreach $storeData as $store}



                                <option {if {$store->storeId} eq {$userdata->userstoreid}} selected="selected"
                                    {/if}value="{$store->storeId}">{$store->storeName}</option>


                                {/foreach}


                            </select>
                        </div>
                        {/if}

                    </div>
                    <!-- end of form-group-->
                    <div {if {$billsettingsData[87]->billsettingsvalue} eq 1} {else} style="display:none" {/if} >
                        <div class="form-group mg-bt5">
                            <label class="col-lg-4 col-sm-4 control-label">{$smarty.const.SELL_BILL_SAFE}</label>
                            <div class="col-lg-8 col-sm-8">
                                <select class="select2 wdt100 autoSaveBillMainPart" name="saveid" id="saveid">
                                    {foreach $allSaves as $data}
                                    <option value="{$data->saveid}" data-curr={$data->currencyId}
                                        {if $billtoret  > 0}

                                        {if $sessionSave eq $data->saveid} selected="selected"{/if}



                                        {else}

                                        {if ($manyParcodes ==1 && ($mysellbilldata->sellbillsaveid == $data->saveid||$mysellbilldata->returnsellbillsaveid == $data->saveid||$manyParcodesSaveid == $data->saveid))
                                        ||( $manyParcodes != 1 &&$sessionSave eq $data->saveid)} selected="selected" {/if}

                                        {/if}

                                        >{$data->savename}
                                    </option>

                                    {/foreach}
                                </select>
                            </div>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5" {if $Programsettingdata->showCurrency !=
                        1}style="display:none;"{/if}>
                        <label class="col-lg-4 control-label">العملة</label>
                        <div class="col-lg-8">
                            <select class="select2" name="currencyId" id="currencyId">
                                {foreach $allCurrency as $data}
                                <option value="{$data->id}" data-cfactor="{$data->conversionFactor}"
                                        data-othercfactor="{$data->otherconversionFactor}" {if $manyParcodes==1 &&
                                        $billCurrData->currencyId > 0} selected {/if}>{$data->name}</option>
                                {/foreach}
                            </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="{if $manyParcodes==1 && $billCurrData->currencyId > 0}{$billCurrData->conversionFactor}{/if}" />
                            =
                            <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="{if $manyParcodes==1 && $billCurrData->currencyId > 0}{$billCurrData->otherconversionFactor}{/if}" />
                                <span class="input-group-addon"
                                      style="display: inline-block;width: 23%">{$currency}</span>
                            </div>
                        </div>
                    </div>

                    <div class="form-group mg-bt5" {if {$billsettingsData[3]->billsettingsvalue} eq 0}
                        style="display:block" {else} style="display:none" {/if}>
                        <label class="col-lg-4 col-sm-4 control-label"> اسم {if $Programsettingdata->delegate_seller eq
                            0} بائع {elseif $Programsettingdata->delegate_seller == 1}مندوب {elseif
                            $Programsettingdata->delegate_seller == 2}طبيب {/if}</label>
                        <div class="col-lg-8 col-sm-8">
                            <select class="select2 wdt100 autoSaveBillMainPart" name="sellerid" id="sellerid">

                                <option value="-1">{$smarty.const.SELL_BILL_SELECT}</option>
                                {foreach $sellerData as $seller}


                                <option value="{$seller->userid}" {if $manyParcodes==1 && $manyParcodesSellerid eq
                                        $seller->userid} selected="selected" {/if}>{$seller->employeename}</option>


                                {/foreach}


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

                    <div class="form-group mg-bt5" {if {$billsettingsData[101]->billsettingsvalue} eq 0}
                        style="display:block" {else} style="display:none" {/if}>
                        <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>
                                {foreach $billOperations as $data}
                                <option value="{$data->id}" {if $manyParcodes==1 &&
                                        $addManyParcodebilloperationid==$data->id}selected{/if}>{$data->name}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <!-- end of form-group-->

                    <div class="form-group mg-bt5" {if $billsettingsData[101]->billsettingsvalue eq 0} {else}
                        style="display:none !important;" {/if}>
                        <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" {if
                                           $manyParcodes==1 && $addManyParcodeobgyBillType==1}checked{/if}>
                                    مباشر</label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input value="2" class="radioR" name="obgyBillType" type="radio" {if
                                           $manyParcodes==1 && $addManyParcodeobgyBillType==2}checked{/if}>
                                    مستهلك</label>
                            </div>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5" {if $billsettingsData[12]->billsettingsvalue eq 0} {else}
                        style="display:none !important;" {/if}>
                        <label class="col-lg-4 control-label">{$smarty.const.SELL_BILL_COMMENT}</label>
                        <div class="col-lg-8">
                            <textarea name="comment" id="comment" cols="" rows=""
                                      class="form-control autoSaveBillMainPart" tabindex="6"></textarea>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    {if {$billsettingsData[109]->billsettingsvalue} eq 0}
                    <div class="form-group mg-bt5">
                        <label class="col-lg-4 col-sm-4 control-label">{$smarty.const.SELL_BILL_KNOW_WAY}</label>
                        <div class="col-lg-8 col-sm-8">
                            <select class=" wdt100" name="knownwayId" id="know_way">
                                <option value="">{$smarty.const.SELL_BILL_SELECT}</option>
                                {foreach $knownWays as $way}
                                <option value="{$way->id}" {if $manyParcodes==1 && $addManyParcodeknownwayId==$way->
                                    id}selected{/if}>{$way->name}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    {/if}

                    <div class="form-group mg-bt5" {if {$billsettingsData[123]->billsettingsvalue} eq 1} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-4 col-sm-4 control-label">بيع للمورد</label>
                        <div class="col-lg-8 col-sm-8">
                            <input type="hidden" name="sellToSupplier" id="sellToSupplier"
                                   class="select2sellToSupplier" />
                            <input type="hidden" id="oldsellToSupplierid" value="" />
                            <input type="hidden" id="oldsellToSuppliername" value="" />
                        </div>
                    </div>
                    <div class="form-group mg-bt5" {if {$billsettingsData[123]->billsettingsvalue} eq 1} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-4 col-sm-4 control-label">تكلفة المورد</label>
                        <div class="col-lg-8 col-sm-8">
                            <select class=" wdt100" name="whatShippingCost" id="whatShippingCost">
                                <option value="0" selected>نسبه المورد من سعر البيع</option>
                                <option value="1">نسبه المورد من سعر المنتج</option>
                            </select>
                        </div>
                    </div>
                    <!-- 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="{$billnameid}" />
            <input type="hidden" id="settingreturn" value="{$billsettingsData[0]->billsettingsvalue}" />
            <input type="hidden" name="settingclient" id="settingclient"
                   value="{$billsettingsData[1]->billsettingsvalue}" />
            <input type="hidden" name="settingstore" id="settingstore"
                   value="{$billsettingsData[2]->billsettingsvalue}" />
            <input type="hidden" name="settingseller" id="settingseller"
                   value="{$billsettingsData[3]->billsettingsvalue}" />
            <input type="hidden" id="settingparcode" value="{$billsettingsData[4]->billsettingsvalue}" />
            <input type="hidden" name="settingdate" id="settingdate"
                   value="{$billsettingsData[5]->billsettingsvalue}" />
            <input type="hidden" id="settingnewproduct" value="{$billsettingsData[6]->billsettingsvalue}" />
            <input type="hidden" id="settingcomment" value="{$billsettingsData[7]->billsettingsvalue}" />
            <input type="hidden" id="settingdiscount" value="{$billsettingsData[8]->billsettingsvalue}" />
            <input type="hidden" id="settingQuantitiyFocus" value="{$billsettingsData[9]->billsettingsvalue}" />
            <input type="hidden" id="settingUnit" value="{$billsettingsData[10]->billsettingsvalue}" />
            <input type="hidden" name="settingQuantityAlert" id="settingQuantityAlert"
                   value="{$billsettingsData[13]->billsettingsvalue}" />


            <input type="hidden" id="morestore" value="{$billsettingsData[26]->billsettingsvalue}" />
            <input type="hidden" id="sumSameProductForStore" value="{$billsettingsData[73]->billsettingsvalue}" />
            <input type="hidden" id="usePriceTypeOfClient" value="{$billsettingsData[74]->billsettingsvalue}" />
            <input type="hidden" name="saveBtnGoesTo" id="saveBtnGoesTo"
                   value="{$billsettingsData[75]->billsettingsvalue}" />
            <input type="hidden" id="userSaveCurrencyName" value="{$userSaveData->currencyName}" />
            <input type="hidden" id="userSaveconversionFactor" value="{$userSaveData->conversionFactor}" />

            <!-- this condition is to use cfactor that user writes if he changed it not default of currency -->
            <input type="hidden" id="oldCFactor"
                   value="{if $manyParcodes==1 && $billCurrData->currencyId > 0}1{else}0{/if}" />
            <input type="hidden" id="sellerIsRequired" value="{$billsettingsData[76]->billsettingsvalue}" />

            <input type="hidden" id="searchvalue" value="{$Programsettingdata->searchvalue}" />
            <input type="hidden" id="clientsearchvalue" value="{$Programsettingdata->clientsearchvalue}" />
            <input type="hidden" id="directDiscount" value="{$Usergroupdata->directDiscount}" />
            <input type="hidden" id="percentageDiscount" value="{$Usergroupdata->percentageDiscount}" />
            <input type="hidden" id="priceupdate" value="{$Usergroupdata->priceupdate}" />

            <input type="hidden" name="ordertype" id="ordertype" value="{$billnameData->ordertype}" />
            <input type="hidden" name="offerId" id="offerId" value="{$offerId}" />
            <input type="hidden" name="sellbilldiscount" id="sellbilldiscount"
                   value="{$mysellbilldata->sellbilldiscount}" />
            <input type="hidden" id="extraDiscountPlace" value="{$billnameData->extraDiscountPlace}" />
            <input type="hidden" id="useExtraDiscount" value="{$billsettingsData[90]->billsettingsvalue}" />
            <input type="hidden" id="saveeffect" value="{$billnameData->saveeffect}" />
            <input type="hidden" id="discountrowtype" value="{$billsettingsData[34]->billsettingsvalue}" />
            <input type="hidden" id="multiclient" value="{$billsettingsData[37]->billsettingsvalue}" />
            <input type="hidden" name="isTaxBill" id="isTaxBill" value="{$billsettingsData[92]->billsettingsvalue}" />
            <input type="hidden" name="taxBillNumber" id="taxBillNumber" value="{$nextId}" />


            <input type="hidden" id="showdiscountrow" value="{$billsettingsData[8]->billsettingsvalue}" />

            <input type="hidden" id="showbouns" value="{$billsettingsData[38]->billsettingsvalue}" />
            <input type="hidden" id="showclientdetail" value="{$billsettingsData[39]->billsettingsvalue}" />
            <input type="hidden" id="showCommentAZ" value="{$billsettingsData[78]->billsettingsvalue}" />
            <input type="hidden" id="showtotal" value="{$billsettingsData[41]->billsettingsvalue}" />
            <input type="hidden" id="shownumber" value="{$billsettingsData[40]->billsettingsvalue}" />
            <input type="hidden" id="payedSetting" value="{$billsettingsData[71]->billsettingsvalue}" />
            <input type="hidden" id="manyParcodesVal_h" value="{$manyParcodes}" />
            {if $Programsettingdata->halfPriceStart > 0 || $Programsettingdata->allPriceStart > 0}
            <input type="hidden" id="showrowPriceType" value="1" />
            <input type="hidden" id="halfPriceStart" value="{$Programsettingdata->halfPriceStart}" />
            <input type="hidden" id="allPriceStart" value="{$Programsettingdata->allPriceStart}" />
            {else}
            <input type="hidden" id="showrowPriceType" value="{$billsettingsData[83]->billsettingsvalue}" />
            {/if}
            <input type="hidden" id="ebillclient" value="{$Programsettingdata->ebillclient}" />

            <input type="hidden" id="showCatDiscount" value="{$billsettingsData[116]->billsettingsvalue}" />

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


            <div class="" {if {$billsettingsData[14]->billsettingsvalue} eq 0} {else} style="display:none !important"
                {/if}>
                <div class="row mobile-p">
                    <hr />
                    <div class="col-lg-6 col-sm-4">
                        <h4 id="header4Sell">{$smarty.const.SELL_BILL_SALES_INVOICE}</h4>
                    </div>
                    <div class="col-lg-6 col-sm-8">
                        <button type="button" name="addpro" id="addpro"
                                class="btn btn-primary pull-left ft-nor">{$smarty.const.SELL_BILL_ADD_NEW} </button>



                        {if $manyParcodes != 1}
                        <button type="button" class="btn btn-success pull-left ft-nor addManyParcodes" data-type="sell"
                                style="margin-left:3px;">{$smarty.const.SELL_BILL_COMBINED_BARCODE} </button>
                        <span
                            class="col-lg-4 pull-left {if $billsettingsData[99]->billsettingsvalue != 1} hidden {/if} ">
                            <select class="select2 wdt100" id="billTemplatesId" data-placeholder="الفواتير المحفوظة">
                                <option value=""></option>
                                {foreach $allBillTemplates as $item}
                                <option value="{$item->id}">{$item->name}</option>
                                {/foreach}
                            </select>
                            {/if}
                        </span>

                        <button type="button" class="btn btn-info pull-left ft-nor addFromPriceOffer" data-type="sell"
                                style="margin-left:3px;">{$smarty.const.SELL_BILL_OFFER_FILL} </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="wdt20" {if {$billsettingsData[6]->billsettingsvalue} eq 0} {else}
                                    style="display:none !important;" {/if}>{$smarty.const.SELL_BILL_NEW}</th>

                                <th class="wdt20" {if {$billsettingsData[40]->billsettingsvalue} eq 0} {else}
                                    style="display:none !important;" {/if}>{$smarty.const.SELL_BILL_NUMBER}</th>
                                <th
                                    class="wdt20 {if {$billsettingsData[104]->billsettingsvalue} eq 0} proSellTrackingSerialClass {else} hidden {/if}">
                                    Serial</th><!--السيريال الثانوى-->

                                <th
                                    class="wdt120 check_tr_parcode {if {$billsettingsData[59]->billsettingsvalue} eq 1} hidden {/if}">
                                    {$smarty.const.SELL_BILL_BARCODE}</th>
                                <th {if {$billsettingsData[26]->billsettingsvalue} eq 0} {else} style="display:none
                                    !important;" {/if} class="wdt300" >{$smarty.const.SELL_BILL_STORE}</th>
                                <th class="wdt500">{$smarty.const.SELL_BILL_PRODUCT_NAME}</th>
                                <th {if {$billsettingsData[7]->billsettingsvalue} eq 0} {else} style="display:none
                                    !important" {/if} class="wdt240">{$smarty.const.SELL_BILL_NOTES}</th>
                                <th
                                    class="wdt100n check_tr_unit {if {$billsettingsData[53]->billsettingsvalue} eq 1}  hidden {/if}">
                                    {$smarty.const.SELL_BILL_UNIT}</th>
                                <th
                                    class="wdt100n check_tr_Height {if {$billsettingsData[64]->billsettingsvalue} eq 1|| $billsettingsData[100]->billsettingsvalue == 0}  hidden {/if}">
                                    الطول</th>
                                <th
                                    class="wdt100n check_tr_Width {if {$billsettingsData[64]->billsettingsvalue} eq 1|| $billsettingsData[100]->billsettingsvalue == 0}  hidden {/if}">
                                    العرض</th>
                                <th
                                    class="wdt100n check_tr_quantity {if {$billsettingsData[64]->billsettingsvalue} eq 1}  hidden {/if}">
                                    {$smarty.const.SELL_BILL_QUANTITY}</th>
                                <th class="wdt100n   {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}">
                                    {$Programsettingdata->scunitname}</th>

                                <th class="wdt20" {if {$billsettingsData[38]->billsettingsvalue} eq 0} {else}
                                    style="display:none !important;" {/if}>Bouns</th>
                                <th
                                    class="wdt80 showrowPriceType {if {$billsettingsData[83]->billsettingsvalue} eq 1 || $Programsettingdata->halfPriceStart > 0 || $Programsettingdata->allPriceStart > 0}  {else} hidden {/if}">
                                    {$smarty.const.SELL_BILL_PRICE_TYPE}</th>

                                <th
                                    class="wdt100n {if {$billsettingsData[116]->billsettingsvalue} eq 0 || $Usergroupdata->hideBillPrices == 1}  hidden {/if}">
                                    {$smarty.const.SELL_BILL_PRICE_BEFORE_DISCOUNT}</th>
                                <th class="wdt100n {if {$billsettingsData[116]->billsettingsvalue} eq 0}  hidden {/if}">
                                    {$smarty.const.SELL_BILL_CAT_DISCOUNT}</th>
                                <th class="wdt80 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                    {$smarty.const.SELL_BILL_PRICE}</th>

                                <th
                                    class="wdt100n check_tr_discount {if $Usergroupdata->hideBillPrices == 1}hidden{/if} {if {$billsettingsData[8]->billsettingsvalue} eq 1}  hidden {/if}">
                                    {$smarty.const.SELL_BILL_DISCOUNT}</th>



                                <th
                                    class="wdt100n selldiscountClass {if $Programsettingdata->showsellpercentage != 1}hidden{/if}">
                                    النسبه</th>
                                <!-------------------------------------discountvalue by hazem---------------------------------------------->
                                <!--th {if {$billsettingsData[8]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} class="wdt80"> نسبة الخصم</th-->
                                <!-------------------------------------discountvalue by hazem---------------------------------------------->
                                <th class="wdt100n {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                    <input name="hidden_itr" id="hidden_itr" type="hidden"
                                           value="{if $manyParcodes == 1 && $detalesitr > 0}{$detalesitr}{else}1{/if}" />
                                    {$smarty.const.SELL_BILL_TOTAL}
                                </th>
                                <th
                                    class="check_tr_soldSerials {if {$Programsettingdata->expiredate} eq 1}  hidden {/if}">
                                    سريل</th>


                                <th class="{if $Programsettingdata->ebillclient eq 0}  hidden {/if}">
                                    ض
                                </th>

                                <th class="wdt20">{$smarty.const.SELL_BILL_DELETE}</th>
                            </tr>
                        </thead>
                        <tbody>
                            {if $manyParcodes == 1 && $detalesitr > 0}


                            {assign var=x value=1}
                            {foreach $mysellbildetales as $mymysellbildetales}

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

                                <td {if {$billsettingsData[40]->billsettingsvalue} eq 0} {else} style="display:none
                                    !important;" {/if}><span class="proDetails" data-pro="product{$x}">{$x}</span></td>

                                <td {if {$billsettingsData[104]->billsettingsvalue} eq 0} {else} style="display:none
                                    !important;" {/if}>
                                    <input type="text" name="proSellTrackingSerial{$x}" id="proSellTrackingSerial{$x}"
                                           class="form-control txt-nonraduis autoSaveBillRow" tabindex="7" size="3" />
                                </td>
                                <td
                                    class="wdt120 check_tr_parcode {if {$billsettingsData[59]->billsettingsvalue} eq 1}  hidden {/if}">
                                    <div id="productparcode{$x}">
                                        <input type="text" name="parcode{$x}" id="parcode{$x}"
                                               value="{$mymysellbildetales->parcode}"
                                               class="form-control txt-nonraduis autoSaveBillRow" tabindex="7"
                                               onkeypress="getproductbyParcode(event, this.value, {$x});" size="3"
                                               placeholder="الباركود" />
                                        <input name="parcodeType{$x}" id="parcodeType{$x}" type="hidden" />
                                        <input name="productserailid{$x}" id="productserailid{$x}" type="hidden" />
                                        <input name="productQty{$x}" id="productQty{$x}" type="hidden" />
                                    </div>
                                <span class="getProByBarcode correcticon hidden" data-itr="{$x}"></span>
                                </td>

                                <td {if {$billsettingsData[26]->billsettingsvalue} eq 0} {else} style="display:none
                                    !important" {/if}>
                                    <div id="prstoridsiv{$x}">

                                        {if $userdata->userstoreid eq 0}
                                        <select class="select2 clientstore wdt100 autoSaveBillRow" name="prstorid{$x}"
                                                id="prstorid{$x}">
                                            <option value="-1">{$smarty.const.SELL_BILL_SELECT_STORE}</option>
                                            {foreach $storeData as $store}
                                            <option {if {$mymysellbildetales->storeid} eq {$store->storeId}}
                                                selected="selected" {/if}value="{$store->storeId}">{$store->storeName}
                                            </option>
                                            {/foreach}
                                        </select>
                                        {else}
                                        {foreach $storeData as $store}
                                        {if {$store->storeId} eq {$userdata->userstoreid}}{$store->storeName} {/if}
                                        {/foreach}
                                        <input name="prstorid{$x}" id="prstorid{$x}" class="selectstore" type="hidden"
                                               value="{$userdata->userstoreid}" />
                                        {/if}
                                    </div>
                                </td>
                                <td>

                                    <div id="productdiv{$x}">
                                        <input type="hidden" id="product{$x}" name="product{$x}"
                                               class="select2product wdt100 autoSaveBillRow" tabindex="7" />

                                        <input type="hidden" id="oldproduct{$x}" name="oldproduct{$x}"
                                               value="{if $mymysellbildetales->sizeid > 0 && $mymysellbildetales->colorid > 0}hasSizeColor{$mymysellbildetales->sellbilldetailproductid}-{$mymysellbildetales->sizeid}-{$mymysellbildetales->colorid}{else}{$mymysellbildetales->sellbilldetailproductid}{/if}" />
                                        <input type="hidden" id="oldname{$x}" name="oldname{$x}"
                                               value="{$mymysellbildetales->productName}
                                               {if $mymysellbildetales->sizeName != ''}/ {$mymysellbildetales->sizeName}{/if}
                                               {if $mymysellbildetales->colorName != ''}/ {$mymysellbildetales->colorName}{/if}" />

                                    </div>
                                </td>
                                <td {if {$billsettingsData[7]->billsettingsvalue} eq 0} {else} style="display:none
                                    !important" {/if}>
                                    <textarea class="form-control txt-nonraduis enteraction autoSaveBillRow"
                                              name="comment{$x}" id="comment{$x}" rows="1"
                                              tabindex="7">{$mymysellbildetales->note}</textarea>
                                </td>
                                <td
                                    class="wdt100n check_tr_unit {if {$billsettingsData[53]->billsettingsvalue} eq 1}  hidden {/if}">
                                    <div id="productunitdiv{$x}">
                                        <input type="hidden" name="proNum{$x}" id="proNum{$x}" value="" />
                                        <select id="productunit{$x}" name="productunit{$x}"
                                                class="select2 wdt100 autoSaveBillRow" tabindex="7"
                                                onChange="getunitprice({$x});">
                                            <option value="-1"></option>
                                            {foreach $myunitdata{$x} as $mymyunitdata}
                                            <option data-pu-num="{$mymyunitdata->productnumber}" {if
                                                    {$mymysellbildetales->productunitid} eq {$mymyunitdata->productunitid} }
                                                selected="selected" {/if} value="{$mymyunitdata->productunitid}"
                                                >{$mymyunitdata->unitName}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </td>
                                <td
                                    class="wdt100n check_tr_Height {if {$billsettingsData[64]->billsettingsvalue} eq 1||$billsettingsData[100]->billsettingsvalue == 0}  hidden {/if}">
                                    <input type="text" name="proHeight{$x}" id="proHeight{$x}"
                                           value="{$mymysellbildetales->proHeight}"
                                           class="form-control txt-nonraduis enteraction numberinput positivefloat autoSaveBillRow"
                                           onKeyUp="calcQuantity({$x}, event);" tabindex="7" />
                                </td>
                                <td
                                    class="wdt100n check_tr_Width {if {$billsettingsData[64]->billsettingsvalue} eq 1||$billsettingsData[100]->billsettingsvalue == 0}  hidden {/if}">
                                    <input type="text" name="proWidth{$x}" id="proWidth{$x}"
                                           value="{$mymysellbildetales->proWidth}"
                                           class="form-control txt-nonraduis enteraction numberinput positivefloat autoSaveBillRow"
                                           onKeyUp="calcQuantity({$x}, event);" tabindex="7" />
                                </td>
                                <td
                                    class="wdt100n check_tr_quantity {if {$billsettingsData[64]->billsettingsvalue} eq 1}  hidden {/if}">
                                    <input type="text" name="pronum{$x}" id="pronum{$x}"
                                           value="{$mymysellbildetales->sellbilldetailquantity}"
                                           class="form-control txt-nonraduis getprototal enteraction numberinput {if $billsettingsData[113]->billsettingsvalue == 1} positiveNo {else} positivefloat {/if} autoSaveBillRow"
                                           onKeyUp="checkquantity({$x}, event);" value="1" tabindex="7" />
                                </td>
                                <td class="  {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}">
                                    <input name="scunitname{$x}" id="scunitname{$x}"
                                           value="{$mymysellbildetales->otherdetailquantity}"
                                           class="form-control txt-nonraduis positiveNo autoSaveBillRow"
                                           placeholder="{$smarty.const.SELL_BILL_QUANTITY}" type="text" tabindex="7" />
                                </td>

                                <td {if {$billsettingsData[38]->billsettingsvalue} eq 0} {else} style="display:none
                                    !important" {/if}>
                                    <input type="text" name="bouns{$x}" id="bouns{$x}"
                                           class="form-control txt-nonraduis getprototal enteraction numberinput autoSaveBillRow"
                                           value="{$mymysellbildetales->bouns}" tabindex="7" />
                                </td>
                                <td
                                    class="showrowPriceType {if {$billsettingsData[83]->billsettingsvalue} eq 1 || $Programsettingdata->halfPriceStart > 0 || $Programsettingdata->allPriceStart > 0}  {else} hidden {/if}">
                                    <select class="select2 wdt100 autoSaveBillRow" name="pricetypepro{$x}"
                                            id="pricetypepro{$x}">
                                        {if $Programsettingdata->showpriceall eq 1}
                                        <option value="0" {if $manyParcodesPriceType eq 0} selected="selected" {/if}>
                                            {$smarty.const.SELL_BILL_WHOLESALE}</option>{/if}
                                        {if $Programsettingdata->showpriceunit eq 1}
                                        <option value="1" {if $manyParcodesPriceType eq 1} selected="selected" {/if}>
                                            {$smarty.const.SELL_BILL_RETAIL}</option>{/if}
                                        {if $Programsettingdata->showpricehalf eq 1}
                                        <option value="2" {if $manyParcodesPriceType eq 2} selected="selected" {/if}>
                                            {$smarty.const.SELL_BILL_HALF_WHOLESALE}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice4 eq 1}
                                        <option value="4" {if $manyParcodesPriceType eq 4} selected="selected" {/if}>
                                            {$smarty.const.SELL_BILL_PRICE4}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice5 eq 1}
                                        <option value="5" {if $manyParcodesPriceType eq 5} selected="selected" {/if}>
                                            {$smarty.const.SELL_BILL_PRICE5}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice6 eq 1}
                                        <option value="6" {if $manyParcodesPriceType eq 6} selected="selected" {/if}>
                                            {$smarty.const.SELL_BILL_PRICE6}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice7 eq 1}
                                        <option value="7" {if $manyParcodesPriceType eq 7} selected="selected" {/if}>
                                            {$smarty.const.SELL_BILL_PRICE7}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice8 eq 1}
                                        <option value="8" {if $manyParcodesPriceType eq 8} selected="selected" {/if}>
                                            {$smarty.const.SELL_BILL_PRICE8}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice9 eq 1}
                                        <option value="9" {if $manyParcodesPriceType eq 9} selected="selected" {/if}>
                                            {$smarty.const.SELL_BILL_PRICE9}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice10 eq 1}
                                        <option value="10" {if $manyParcodesPriceType eq 10} selected="selected" {/if}>
                                            {$smarty.const.SELL_BILL_PRICE10}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice11 eq 1}
                                        <option value="11" {if $manyParcodesPriceType eq 11} selected="selected" {/if}>
                                            {$smarty.const.SELL_BILL_PRICE11}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice12 eq 1}
                                        <option value="12" {if $manyParcodesPriceType eq 12} selected="selected" {/if}>
                                            {$smarty.const.SELL_BILL_PRICE12}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice13 eq 1}
                                        <option value="13" {if $manyParcodesPriceType eq 13} selected="selected" {/if}>
                                            {$smarty.const.SELL_BILL_PRICE13}</option>
                                        {/if}
                                    </select>
                                </td>
                                <td
                                    class=" {if {$billsettingsData[116]->billsettingsvalue} eq 0 || $Usergroupdata->hideBillPrices == 1}  hidden {/if}">
                                    <input type="text" name="pricebeforcatdis{$x}" id="pricebeforcatdis{$x}"
                                           class="form-control txt-nonraduis positiveNo"
                                           value="{$mymysellbildetales->categorydiscount + $mymysellbildetales->sellbilldetailprice}"
                                           readonly="readonly" />
                                </td>
                                <td class=" {if {$billsettingsData[116]->billsettingsvalue} eq 0}  hidden {/if}">
                                    <input type="text" name="catdis{$x}" id="catdis{$x}"
                                           class="form-control txt-nonraduis sumProDis  positiveNo autoSaveBillRow"
                                           value="{$mymysellbildetales->categorydiscount}" tabindex="7" />
                                </td>
                                <td class=" {if $Usergroupdata->hideBillPrices == 1}hidden{/if} ">
                                    <div id="propricechange{$x}">
                                        <input type="text" name="proprice{$x}" id="proprice{$x}"
                                               value="{$mymysellbildetales->sellbilldetailprice}"
                                               class="form-control getprototal enteraction numberinput txt-nonraduis positivefloat autoSaveBillRow"
                                               value="0" tabindex="7" {if $mymysellbildetales->background
                                        !=""}style="background-color:{$mymysellbildetales->background}"{/if}/>
                                    </div>
                                </td>



                                <td
                                    class="check_tr_discount {if $Usergroupdata->hideBillPrices == 1}hidden{/if} {if {$billsettingsData[8]->billsettingsvalue} eq 1}  hidden {/if}">
                                    <!--input type="text" name="prodis{$x}" id="prodis{$x}"   class="form-control txt-nonraduis getprototal enteraction numberinput" value="{$mymysellbildetales->discountvalue}" tabindex="7"  /-->

                                    <div class="input-group">

                                        <input name="prodis{$x}" id="prodis{$x}" class="form-control txt-nonraduis getprototal enteraction numberinput positiveNo autoSaveBillRow
                                               {if $billsettingsData[34]->billsettingsvalue eq 1} hidden {/if}"
                                               value="{$mymysellbildetales->discountvalue}" tabindex="7" type="text" />
                                        <input name="discounttype{$x}" id="discounttype{$x}" class="form-control txt-nonraduis getprototal enteraction numberinput positivefloat autoSaveBillRow
                                               {if $billsettingsData[34]->billsettingsvalue eq 0} hidden {/if}"
                                               value="{$mymysellbildetales->discounttype}" tabindex="7" type="text" />

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

                                        <span class="input-group-addon small-addon prosellDiscountPerTypeSpan"
                                              id="prosellDiscountPerTypeSpan{$x}" data-itr="{$x}">
                                            {if {$mymysellbildetales->prosellDiscountPerType} eq 0}ض
                                            {else}
                                            خ
                                            {/if}
                                        </span>
                                    </div>
                                    {/if}
                                    <input name="prosellDiscountPerType{$x}" id="prosellDiscountPerType{$x}"
                                           class="getprototal" value="{$mymysellbildetales->prosellDiscountPerType}"
                                           type="hidden" />
                                    <input name="prosellDiscountVal{$x}" id="prosellDiscountVal{$x}" value=""
                                           type="hidden" />

                                </td>

                                <!-------------------------------------discountvalue by hazem---------------------------------------------->
                                <!--td {if {$billsettingsData[8]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                  <input type="text" name="prodisper{$x}" id="prodisper{$x}"  onkeyup="getdiscount({$x});"  class="form-control txt-nonraduis  enteraction numberinput " value="0" tabindex="7"  />
                                </td-->
                                <!-------------------------------------discountvalue by hazem---------------------------------------------->
                                <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                    <div id="prototal{$x}" class="form-control-static">
                                        {$mymysellbildetales->sellbilldetailtotalprice}</div>
                                    <input name="hidden_prototal{$x}" id="hidden_prototal{$x}"
                                           value="{$mymysellbildetales->sellbilldetailtotalprice}" type="hidden"
                                           value="0" />
                                </td>
                                <td class="{if {$Programsettingdata->expiredate} eq 1}  hidden {/if}">
                                    <input type="hidden" name="proSerials{$x}" id="proSerials{$x}" data-itr="{$x}"
                                           class="autoSaveBillRow" value="">
                                    <input type='hidden' id='oldproSerials{$x}'
                                           value='{$mymysellbildetales->soldSerialsInDetails}' />
                                </td>
                                <td class="{if $Programsettingdata->ebillclient eq 0}  hidden {/if}">

                                    <button type="button" class="btn btn-primary Taxes" data-mitr="{$x}"
                                            data-toggle="modal" data-whatever="@mdo"></button>

                                </td>
                                {if {$mymysellbildetales->sellbilldetailtax|@count} < 1} <div class="modal fade"
                                                                                      id="ebillclient{$x}" 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{$x}" data-mitr="{$x}" style="background: #55ff55">
                                                اضافه ضريبه </button>
                                            <button type="button" style="background: #f34141"
                                                    class="btn green-meadow btn-sm pull-right removetaxes"
                                                    id="removetaxes" data-edit='0' data-mitr="{$x}"> حذف </button>
                                            <input type="hidden" id="taxesitr_{$x}" data-mitr="{$x}"
                                                   name="taxesitr_{$x}" value="1">
                                        </div>
                                        <div style="clear: both;"></div>

                                        <ul id="taxes{$x}">
                                            <li id="litaxes_{$x}_1">
                                                <div style="    width: 20% !important;float: right;">
                                                    <input type="hidden" name="type_{$x}_1" class="eTaxType"
                                                           id="eTaxType_{$x}_1" data-mitr="{$x}" data-itr="1">
                                                </div>
                                                <div style="    width: 20% !important;float: right;">
                                                    <input type="hidden" name="subtype_{$x}_1"
                                                           id="eTaxsubtype_{$x}_1" class="eTaxsubtype" data-itr="1"
                                                           data-mitr="{$x}">
                                                </div>
                                                <div style=" width: 20% !important;float: right;">
                                                    <input type="text" name="rate_{$x}_1"
                                                           class="form-control must_go_req ncloseebill rates rate_{$x}"
                                                           id="rate_{$x}_1" data-mitr="{$x}" data-itr="1"
                                                           placeholder="نسبه">
                                                </div>
                                                <div style="width: 20% !important;float: right;">
                                                    <input type="text" name="amount_{$x}_1" class="form-control must_go_req ncloseebill
                                                           amounts  amount_{$x}" id="amount_{$x}_1" data-itr="1"
                                                           data-mitr="{$x}" placeholder="المبلغ">
                                                </div>
                                                <div style="width: 20% !important;float: right;">
                                                    <!--<button type="button"  style="background: #f34141" class="btn green-meadow btn-sm pull-right  removeellbilldetailtax" data-edit='0'  data-itr="1" data-mitr="1"> x </button>-->
                                                </div>
                                            </li>
                                            <div style="clear: both;"></div>
                                        </ul>
                                    </div>
                                    <div style="clear: both;"></div>
                                    <div class="modal-footer" style="text-align: center !important">
                                        <button type="button" data-mitr="{$x}"
                                                style="opacity: 1;background: blue" class="close closeebill"
                                                data-dismiss="modal" aria-hidden="true">اعتماد</button>
                                    </div>
                                </div>

                            </div>
                        </div>
                        {else}
                        <div class="modal fade" id="ebillclient{$x}" 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{$x}" data-mitr="{$x}" style="background: #55ff55"> اضافه ضريبه
                                            </button>
                                            <button type="button" style="background: #f34141"
                                                    class="btn green-meadow btn-sm pull-right removetaxes" data-edit='1'
                                                    data-id="{$mymysellbildetales->sellbilldetailid}" data-itr="{$x}"> حذف </button>
                                            <input type="hidden" id="taxesitr_{$x}" name="taxesitr_{$x}"
                                                   value="{$mymysellbildetales->sellbilldetailtax|@count}">
                                        </div>
                                        <div style="clear: both;"></div>

                                        <ul id="taxes{$x}">
                                            {assign var=ex value=1}
                                            {foreach $mymysellbildetales->sellbilldetailtax as $sellbilldetailtax}
                                            <li id="litaxes_{$x}_{$ex}">
                                                <input type="hidden" name="sellbilldetailtaxid_{$x}_{$ex}"
                                                       value="{$sellbilldetailtax->id}">

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

                                                <div style="    width: 20% !important;float: right;">
                                                    <input type="hidden" name="subtype_{$x}_{$ex}" class="eTaxsubtype"
                                                           id="eTaxsubtype_{$x}_{$ex}" data-mitr="{$x}" data-itr="{$ex}"
                                                           value="{$sellbilldetailtax->subtype}">
                                                </div>

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

                                                <div style="    width: 20% !important;float: right;">
                                                    <input type="text" name="amount_{$x}_{$ex}" class="form-control must_go_req ncloseebill
                                                           amounts  amount_{$x}"
                                                           data-itrolddddddddddddddddddddddddddd="{$x}_{$ex}" data-mitr="{$x}"
                                                           data-itr="{$ex}" id="amount_{$x}_{$ex}" placeholder="المبلغ"
                                                           value="{$sellbilldetailtax->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="{$sellbilldetailtax->id}" data-itroldddddddddddddddd="{$sellbilldetailtax->id}" data-itr="{$ex}" data-mitr="{$x}"> x </button>-->
                                                </div>
                                            </li>
                                            <div style="clear: both;"></div>
                                            {capture assign=ex}{$ex+1}{/capture}
                                            {/foreach}

                                        </ul>
                                    </div>
                                    <div style="clear: both;"></div>
                                    <div class="modal-footer" style="text-align: center !important">
                                        <button type="button" data-mitr="{$x}" style="opacity: 1;background: blue"
                                                class="close closeebill" data-dismiss="modal" aria-hidden="true">اعتماد</button>
                                    </div>
                                </div>

                            </div>
                        </div>
                        {/if}
                        <td>
                            <input type="hidden" name="tempSaveBillIdRow{$x}" id="tempSaveBillIdRow{$x}"
                                   value="{if $tempSaveBillId > 0}{$mymysellbildetales->sellbilldetailid}{else}0{/if}">
                            <button id="remove{$x}" type="button" class="close flt-none removeicon removeproduct autoDelBillRow"
                                    aria-hidden="true">&times;</button>
                        </td>
                        </tr>
                        {capture assign=x}{$x+1}{/capture}
                        {/foreach}





                        {else}



                        <tr id="productraw1">

                            <td {if {$billsettingsData[6]->billsettingsvalue} eq 0} {else} style="display:none !important;"
                                {/if}><a onClick="javascript:showProductModal(1, 7);"
                                         class="newLink btn btn-primary btn-xs conformdelProduct">{$smarty.const.SELL_BILL_NEW}</a>
                            </td>
                            <td {if {$billsettingsData[40]->billsettingsvalue} eq 0} {else} style="display:none !important;"
                                {/if}><span class="proDetails" data-pro="product1">1</span></td>
                            <td {if {$billsettingsData[104]->billsettingsvalue} eq 0} {else} style="display:none !important;"
                                {/if}>
                                <input type="text" name="proSellTrackingSerial1" id="proSellTrackingSerial1"
                                       class="form-control txt-nonraduis autoSaveBillRow" tabindex="7" size="3" />
                            </td>
                            <td class="check_tr_parcode {if {$billsettingsData[59]->billsettingsvalue} eq 1} hidden {/if}">
                                <div id="productparcode1">
                                    <input type="text" name="parcode1" id="parcode1"
                                           class="form-control txt-nonraduis autoSaveBillRow" tabindex="7"
                                           onkeypress="getproductbyParcode(event, this.value, 1);" size="3"
                                           placeholder="{$smarty.const.SELL_BILL_BARCODE}" />
                                    <input name="parcodeType1" id="parcodeType1" type="hidden" />
                                    <input name="productserailid1" id="productserailid1" type="hidden" />
                                    <input name="productQty1" id="productQty1" type="hidden" />
                                </div>
                                <span class="getProByBarcode correcticon hidden" data-itr="1"></span>
                            </td>
                            <td {if {$billsettingsData[26]->billsettingsvalue} eq 0} {else} style="display:none !important;"
                                {/if} >
                                <div id="prstoridsiv1">

                                    {if $userdata->userstoreid eq 0}
                                    <select class="select2 clientstore wdt100 autoSaveBillRow" name="prstorid1" id="prstorid1">
                                        <option value="-1">{$smarty.const.SELL_BILL_SELECT_STORE} </option>
                                        {foreach $storeData as $store}
                                        <option value="{$store->storeId}">{$store->storeName}</option>
                                        {/foreach}
                                    </select>
                                    {else}
                                    {foreach $storeData as $store}
                                    {if {$store->storeId} eq {$userdata->userstoreid}}{$store->storeName} {/if}
                                    {/foreach}
                                    <input name="prstorid1" id="prstorid1" class="selectstore" type="hidden"
                                           value="{$userdata->userstoreid}" />
                                    {/if}
                                </div>
                            </td>

                            <!--  productdiv -->
                            <td>
                                <div id="productdiv1">
                                    <input type="hidden" id="product1" name="product1"
                                           class="select2product wdt100 autoSaveBillRow"
                                           data-placeholder="{$smarty.const.SELL_BILL_SELECT_PRODUCT} " tabindex="7" />
                                </div>
                            </td>

                            <td {if {$billsettingsData[7]->billsettingsvalue} eq 0} {else} style="display:none !important"
                                {/if}>
                                {if $Programsettingdata->sendBillToRestaurant == 1}
                                <img class="drinkDetails" data-productid="" data-itr="1" width="20px" height="20px"
                                     src="../views/default/assets/img/notes2.png" alt="">
                                <span id="notes1"></span>
                                <input type="hidden" name="hiddenNotes1" id="hiddenNotes1" value="">
                                {else}
                                <textarea class="form-control txt-nonraduis enteraction autoSaveBillRow" name="comment1"
                                          id="comment1" rows="1" tabindex="7"></textarea>
                                {/if}
                            </td>

                            <!-- productunitdiv -->
                            <td class="check_tr_unit {if {$billsettingsData[53]->billsettingsvalue} eq 1}  hidden {/if}">
                                <div id="productunitdiv1">
                                    <input type="hidden" name="proNum1" id="proNum1" value="" />
                                    <select id="productunit1" name="productunit1" class="select2 wdt100 autoSaveBillRow"
                                            tabindex="7">
                                        <option value="-1"></option>
                                    </select>
                                </div>
                            </td>

                            <td
                                class="wdt100n check_tr_Height {if {$billsettingsData[64]->billsettingsvalue} eq 1||$billsettingsData[100]->billsettingsvalue == 0}  hidden {/if}">
                                <input type="text" name="proHeight1" id="proHeight1" value="1"
                                       class="form-control txt-nonraduis enteraction numberinput positivefloat autoSaveBillRow"
                                       onKeyUp="calcQuantity(1, event);" tabindex="7" />
                            </td>
                            <td
                                class="wdt100n check_tr_Width {if {$billsettingsData[64]->billsettingsvalue} eq 1||$billsettingsData[100]->billsettingsvalue == 0}  hidden {/if}">
                                <input type="text" name="proWidth1" id="proWidth1" value="1"
                                       class="form-control txt-nonraduis enteraction numberinput positivefloat autoSaveBillRow"
                                       onKeyUp="calcQuantity(1, event);" tabindex="7" />
                            </td>

                            <td class="check_tr_quantity {if {$billsettingsData[64]->billsettingsvalue} eq 1}  hidden {/if}">
                                <input type="text" name="pronum1" id="pronum1"
                                       class="form-control txt-nonraduis getprototal enteraction numberinput {if $billsettingsData[113]->billsettingsvalue == 1} positiveNo {else} positivefloat {/if} autoSaveBillRow"
                                       onKeyUp="checkquantity(1, event);" value="1" tabindex="7" />
                            </td>
                            <td class="  {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}">
                                <input name="scunitname1" id="scunitname1" value="0"
                                       class="form-control txt-nonraduis positiveNo autoSaveBillRow"
                                       placeholder="{$smarty.const.SELL_BILL_QUANTITY}" type="text" tabindex="7" />
                            </td>

                            <td {if {$billsettingsData[38]->billsettingsvalue} eq 0} {else} style="display:none !important;"
                                {/if}>
                                <input type="text" name="bouns1" id="bouns1"
                                       class="form-control txt-nonraduis getprototal enteraction numberinput positiveNo autoSaveBillRow"
                                       value="0" tabindex="7" />
                            </td>
                            <td
                                class="showrowPriceType {if {$billsettingsData[83]->billsettingsvalue} eq 1 || $Programsettingdata->halfPriceStart > 0 || $Programsettingdata->allPriceStart > 0}  {else} hidden {/if}">
                                <select class="select2 wdt100 autoSaveBillRow" name="pricetypepro1" id="pricetypepro1">
                                    {if $Programsettingdata->showpriceall eq 1}
                                    <option value="0" {if $billsettingsData[32]->billsettingsvalue eq 0} selected="selected"
                                        {/if} >{$smarty.const.SELL_BILL_WHOLESALE}</option>
                                    {/if}
                                    {if $Programsettingdata->showpriceunit eq 1}
                                    <option value="1" {if $billsettingsData[32]->billsettingsvalue eq 1} selected="selected"
                                        {/if} >{$smarty.const.SELL_BILL_RETAIL}</option>
                                    {/if}
                                    {if $Programsettingdata->showpricehalf eq 1}
                                    <option value="2" {if $billsettingsData[32]->billsettingsvalue eq 2} selected="selected"
                                        {/if}>{$smarty.const.SELL_BILL_HALF_WHOLESALE} </option>
                                    {/if}
                                    {if $Programsettingdata->showprice4 eq 1}
                                    <option value="4" {if $billsettingsData[32]->billsettingsvalue eq 4} selected="selected"
                                        {/if}>{$smarty.const.SELL_BILL_PRICE4} </option>
                                    {/if}
                                    {if $Programsettingdata->showprice5 eq 1}
                                    <option value="5" {if $billsettingsData[32]->billsettingsvalue eq 5} selected="selected"
                                        {/if}>{$smarty.const.SELL_BILL_PRICE5} </option>
                                    {/if}
                                    {if $Programsettingdata->showprice6 eq 1}
                                    <option value="6" {if $billsettingsData[32]->billsettingsvalue eq 6} selected="selected"
                                        {/if}>{$smarty.const.SELL_BILL_PRICE6} </option>
                                    {/if}
                                    {if $Programsettingdata->showprice7 eq 1}
                                    <option value="7" {if $billsettingsData[32]->billsettingsvalue eq 7} selected="selected"
                                        {/if}>{$smarty.const.SELL_BILL_PRICE7} </option>
                                    {/if}
                                    {if $Programsettingdata->showprice8 eq 1}
                                    <option value="8" {if $billsettingsData[32]->billsettingsvalue eq 8} selected="selected"
                                        {/if}>{$smarty.const.SELL_BILL_PRICE8} </option>
                                    {/if}
                                    {if $Programsettingdata->showprice9 eq 1}
                                    <option value="9" {if $billsettingsData[32]->billsettingsvalue eq 9} selected="selected"
                                        {/if}>{$smarty.const.SELL_BILL_PRICE9} </option>
                                    {/if}
                                    {if $Programsettingdata->showprice10 eq 1}
                                    <option value="10" {if $billsettingsData[32]->billsettingsvalue eq 10} selected="selected"
                                        {/if}>{$smarty.const.SELL_BILL_PRICE10} </option>
                                    {/if}
                                    {if $Programsettingdata->showprice11 eq 1}
                                    <option value="11" {if $billsettingsData[32]->billsettingsvalue eq 11} selected="selected"
                                        {/if}>{$smarty.const.SELL_BILL_PRICE11} </option>
                                    {/if}
                                    {if $Programsettingdata->showprice12 eq 1}
                                    <option value="12" {if $billsettingsData[32]->billsettingsvalue eq 12} selected="selected"
                                        {/if}>{$smarty.const.SELL_BILL_PRICE12} </option>
                                    {/if}
                                    {if $Programsettingdata->showprice13 eq 1}
                                    <option value="13" {if $billsettingsData[32]->billsettingsvalue eq 13} selected="selected"
                                        {/if}>{$smarty.const.SELL_BILL_PRICE13} </option>
                                    {/if}
                                </select>
                            </td>
                            <td
                                class=" {if {$billsettingsData[116]->billsettingsvalue} eq 0 || $Usergroupdata->hideBillPrices == 1}  hidden {/if}">
                                <input type="text" name="pricebeforcatdis1" id="pricebeforcatdis1"
                                       class="form-control txt-nonraduis positiveNo" value="0" readonly="readonly" />
                            </td>

                            <td class=" {if {$billsettingsData[116]->billsettingsvalue} eq 0}  hidden {/if}">
                                <input type="text" name="catdis1" id="catdis1"
                                       class="form-control txt-nonraduis sumProDis positiveNo autoSaveBillRow" value="0"
                                       readonly="readonly" />
                            </td>
                            <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                <div id="propricechange1">
                                    <input type="text" name="proprice1" id="proprice1"
                                           class="form-control getprototal enteraction numberinput txt-nonraduis positivefloat autoSaveBillRow"
                                           value="0" tabindex="7" />
                                </div>
                            </td>


                            <td
                                class="check_tr_discount {if $Usergroupdata->hideBillPrices == 1}hidden{/if} {if {$billsettingsData[8]->billsettingsvalue} eq 1}  hidden {/if}">

                                <div class="input-group">
                                    <input name="prodis1" id="prodis1" class="form-control txt-nonraduis getprototal enteraction numberinput positiveNo autoSaveBillRow
                                           {if $billsettingsData[34]->billsettingsvalue eq 1} hidden {/if}" value="0"
                                           tabindex="7" />
                                    <input name="discounttype1" id="discounttype1" class="form-control txt-nonraduis getprototal enteraction numberinput positivefloat autoSaveBillRow
                                           {if $billsettingsData[34]->billsettingsvalue eq 0} hidden {/if}" value="0"
                                           tabindex="7" />



                                    <span class="input-group-addon small-addon discountSpan" data-itr="1">
                                        {if {$billsettingsData[34]->billsettingsvalue} eq 0}C
                                        {else}
                                        %
                                        {/if}
                                    </span>
                                </div>
                            </td>
                            <td class="selldiscountClass {if $Programsettingdata->showsellpercentage != 1}hidden{/if}">
                                {if $Usergroupdata->canEditAddDiscountPercentage != 1}
                                <span id="prosellDiscountPer_span1">0</span>
                                <input name="prosellDiscountPer1" id="prosellDiscountPer1" value="0"
                                       class="prosellDiscountPerClass getprototal" tabindex="7" type="hidden" />
                                {else}
                                <div class="input-group">
                                    <input name="prosellDiscountPer1" id="prosellDiscountPer1" value="0"
                                           class="form-control txt-nonraduis positiveNo prosellDiscountPerClass getprototal"
                                           tabindex="7" type="text" />
                                    <span class="input-group-addon small-addon prosellDiscountPerTypeSpan"
                                          id="prosellDiscountPerTypeSpan1" data-itr="1">
                                        ض
                                    </span>
                                </div>
                                {/if}
                                <input name="prosellDiscountPerType1" id="prosellDiscountPerType1" class="getprototal" value="0"
                                       type="hidden" />
                                <input name="prosellDiscountVal1" id="prosellDiscountVal1" value="" type="hidden" />

                            </td>

                            <!-------------------------------------discountvalue by hazem---------------------------------------------->
                            <!--td {if {$billsettingsData[8]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                                                                      <input type="text" name="prodisper1" id="prodisper1"  class="form-control txt-nonraduis getprototal enteraction numberinput" value="0" tabindex="7"  />
                                                                                    </td-->
                            <!-------------------------------------discountvalue by hazem---------------------------------------------->
                            <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                <!--<div id="prototal1" class="form-control-static">0</div>-->
                                <!--<input name="hidden_prototal1" id="hidden_prototal1" type="hidden" value="0" />-->
                                <input name="hidden_prototal1" id="hidden_prototal1"
                                       class="editTotal form-control txt-nonraduis enteraction numberinput positiveNo autoSaveBillRow"
                                       value="0" type="text" />
                            </td>
                            <td class="{if {$Programsettingdata->expiredate} eq 1}  hidden {/if}">
                                <input type="hidden" name="proSerials1" id="proSerials1" data-itr="1" class="autoSaveBillRow"
                                       value="">
                            </td>

                            <td class="{if $Programsettingdata->ebillclient eq 0}  hidden {/if}">

                                <button type="button" class="btn btn-primary Taxes" data-mitr="1" data-toggle="modal"
                                        data-whatever="@mdo"></button>

                            </td>
                        <div class="modal fade" id="ebillclient1" 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="addtaxes1" data-mitr="1" style="background: #55ff55"> اضافه ضريبه
                                            </button>
                                            <button type="button" style="background: #f34141"
                                                    class="btn green-meadow btn-sm pull-right removetaxes" id="removetaxes"
                                                    data-edit='0' data-mitr="1"> حذف </button>
                                            <input type="hidden" id="taxesitr_1" data-mitr="1" name="taxesitr_1" value="1">
                                        </div>
                                        <div style="clear: both;"></div>

                                        <ul id="taxes1">
                                            <li id="litaxes_1_1">
                                                <div style="    width: 20% !important;float: right;">
                                                    <input type="hidden" name="type_1_1" class="eTaxType" id="eTaxType_1_1"
                                                           data-mitr="1" data-itr="1">
                                                </div>
                                                <div style="    width: 20% !important;float: right;">
                                                    <input type="hidden" name="subtype_1_1" id="eTaxsubtype_1_1"
                                                           class="eTaxsubtype" data-itr="1" data-mitr="1">
                                                </div>
                                                <div style=" width: 20% !important;float: right;">
                                                    <input type="text" name="rate_1_1"
                                                           class="form-control must_go_req ncloseebill rates rate_1"
                                                           id="rate_1_1" data-mitr="1" data-itr="1" placeholder="نسبه">
                                                </div>
                                                <div style="width: 20% !important;float: right;">
                                                    <input type="text" name="amount_1_1" class="form-control must_go_req ncloseebill
                                                           amounts  amount_1" id="amount_1_1" data-itr="1"
                                                           data-mitr="1" placeholder="المبلغ">
                                                </div>
                                                <div style="width: 20% !important;float: right;">
                                                    <!--<button type="button"  style="background: #f34141" class="btn green-meadow btn-sm pull-right  removeellbilldetailtax" data-edit='0'  data-itr="1" data-mitr="1"> x </button>-->
                                                </div>
                                            </li>
                                            <div style="clear: both;"></div>
                                        </ul>
                                    </div>
                                    <div style="clear: both;"></div>
                                    <div class="modal-footer" style="text-align: center !important">
                                        <button type="button" data-mitr="1" style="opacity: 1;background: blue"
                                                class="close closeebill" data-dismiss="modal" aria-hidden="true">اعتماد</button>
                                    </div>
                                </div>

                            </div>
                        </div>

                        <td>
                            <input type="hidden" name="tempSaveBillIdRow1" id="tempSaveBillIdRow1" value="0">
                            <button id="remove1" data-itr="1" data-mitr="1" type="button"
                                    class="close flt-none removeicon removeproduct autoDelBillRow"
                                    aria-hidden="true">&times;</button>
                        </td>
                        </tr>



                        {/if}
                        </tbody>
                    </table>
                </div>
                <button type="button"
                        class="btn btn-primary pull-left ft-nor {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                    {$smarty.const.SELL_BILL_TOTAL_SALES} <span class="badge wht-clo">
                        <div id="sellbilltotal">0</div>
                    </span>
                    <input type="hidden" name="sellbillprice" id="sellbillprice" value="0" />
                </button>
            </div>
            <div class="clearfix"></div>
            <!-- end of second row-->
            <div class="" {if {$billsettingsData[0]->billsettingsvalue} eq 0} {else} style="display:none !important" {/if}>
                <div class="row">
                    <hr />
                    <div class="col-lg-6">
                        <h4 id="header4retSell">{$smarty.const.RETURN_SELL_BILL_SALES_RETURNS}</h4>
                    </div>
                    <div class="col-lg-6">
                        <button type="button" name="addreturn" id="addreturn"
                                class="btn btn-primary pull-left ft-nor">{$smarty.const.SELL_BILL_ADD_NEW}</button>

                        {if $manyParcodes != 1}
                        <button type="button" class="btn btn-success pull-left ft-nor addManyParcodes" data-type="ret"
                                style="margin-left:3px;">{$smarty.const.SELL_BILL_COMBINED_BARCODE} </button>
                        {/if}
                    </div>
                </div>
                <!-- end of title row-->
                <div class="table-responsive bd-rd">
                    <table class="table billtable table-bordered table-black" id="containerReturn" {if {$billsettingsData[0]->
                        billsettingsvalue} eq 0} {else} style="display:none !important" {/if}>
                        <thead>
                            <tr>
                                <th class="wdt20" {if {$billsettingsData[40]->billsettingsvalue} eq 0} {else}
                                    style="display:none !important;" {/if}>{$smarty.const.SELL_BILL_NUMBER}</th>
                                <th
                                    class="wdt20 {if {$billsettingsData[104]->billsettingsvalue} eq 0} proSellTrackingSerialClass {else} hidden {/if}">
                                    Serial</th><!--السيريال الثانوى-->
                                <th
                                    class="wdt120 check_tr_parcode {if {$billsettingsData[59]->billsettingsvalue} eq 1} hidden {/if}">
                                    {$smarty.const.SELL_BILL_BARCODE}</th>
                                <th class="wdt300 " {if {$billsettingsData[26]->billsettingsvalue} eq 0} {else}
                                    style="display:none !important" {/if}>{$smarty.const.SELL_BILL_STORE}</th>
                                <th class="wdt500">{$smarty.const.SELL_BILL_PRODUCT_NAME}</th>

                                <th class="wdt240" {if {$billsettingsData[7]->billsettingsvalue} eq 0} {else}
                                    style="display:none !important" {/if}>{$smarty.const.SELL_BILL_NOTES}</th>
                                <th
                                    class="wdt100n check_tr_unit {if {$billsettingsData[53]->billsettingsvalue} eq 1}  hidden {/if}">
                                    {$smarty.const.SELL_BILL_UNIT}</th>
                                <th
                                    class="wdt100n check_tr_Height {if {$billsettingsData[64]->billsettingsvalue} eq 1|| $billsettingsData[100]->billsettingsvalue == 0}  hidden {/if}">
                                    الطول</th>
                                <th
                                    class="wdt100n check_tr_Width {if {$billsettingsData[64]->billsettingsvalue} eq 1|| $billsettingsData[100]->billsettingsvalue == 0}  hidden {/if}">
                                    العرض</th>
                                <th
                                    class="wdt100n check_tr_quantity {if {$billsettingsData[64]->billsettingsvalue} eq 1}  hidden {/if}">
                                    {$smarty.const.SELL_BILL_QUANTITY}</th>
                                <th class="wdt100n   {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}">
                                    {$Programsettingdata->scunitname}</th>
                                <th
                                    class="wdt80 showrowPriceType {if {$billsettingsData[83]->billsettingsvalue} eq 1 || $Programsettingdata->halfPriceStart > 0 || $Programsettingdata->allPriceStart > 0}  {else} hidden {/if}">
                                    {$smarty.const.SELL_BILL_PRICE_TYPE}</th>
                                <th class="wdt80 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                    {$smarty.const.SELL_BILL_PRICE}</th>
                                <th
                                    class="wdt80 check_tr_discount {if $Usergroupdata->hideBillPrices == 1}hidden{/if} {if {$billsettingsData[8]->billsettingsvalue} eq 1}  hidden {/if}">
                                    {$smarty.const.SELL_BILL_DISCOUNT}</th>
                                <th class="wdt100n {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                    {$smarty.const.SELL_BILL_TOTAL}
                                    <input name="returnhidden_itr" id="returnhidden_itr" type="hidden"
                                           value="{if $manyParcodes == 1 && $returndetalesitr > 0}{$returndetalesitr}{else}1{/if}" />
                                </th>
                                <th class="check_tr_soldSerials {if {$Programsettingdata->expiredate} eq 1}  hidden {/if}">سريل
                                </th>
                                <th class="wdt20">{$smarty.const.SELL_BILL_DELETE}</th>
                            </tr>
                        </thead>
                        <tbody>
                            {if $manyParcodes == 1 && $returndetalesitr > 0}



                            {assign var=y value=1}
                            {foreach $returnmysellbildetales as $myreturnmysellbildetales}
                            <tr>
                                <td {if {$billsettingsData[40]->billsettingsvalue} eq 0} {else} style="display:none !important;"
                                    {/if}><span class="proDetails" data-pro="returnproduct{$y}">{$y}</span></td>
                                <td {if {$billsettingsData[104]->billsettingsvalue} eq 0} {else} style="display:none
                                    !important;" {/if}>
                                    <input type="text" name="retproSellTrackingSerial{$y}" id="retproSellTrackingSerial{$y}"
                                           class="form-control txt-nonraduis autoSaveBillRowRet" tabindex="7" size="3" />
                                </td>
                                <td class="check_tr_parcode {if {$billsettingsData[59]->billsettingsvalue} eq 1} hidden {/if}">
                                    <div id="returnproductparcode{$y}">
                                        <input type="text" name="returnparcode{$y}" id="returnparcode{$y}"
                                               class="form-control txt-nonraduis autoSaveBillRowRet" placeholder="الباركود"
                                               onkeypress="getreturnproductbyParcode(event, this.value, {$y});" tabindex="301"
                                               value="{$myreturnmysellbildetales->parcode}">
                                        <input name="returnparcodeType{$y}" id="returnparcodeType{$y}" type="hidden"
                                               value="{if $myreturnmysellbildetales->productserailid > 0}serialnumber{/if}" />
                                        <input name="returnproductserailid{$y}" id="returnproductserailid{$y}" type="hidden"
                                               value="{$myreturnmysellbildetales->productserailid}" />
                                        <input name="returnproductQty{$y}" id="returnproductQty{$y}" type="hidden"
                                               value="{$myreturnmysellbildetales->don}" />
                                    </div>
                                </td>

                                <td {if {$billsettingsData[26]->billsettingsvalue} eq 0} {else} style="display:none !important"
                                    {/if}>
                                    <div id="prstoridsiv{$y}">

                                        {if $userdata->userstoreid eq 0}
                                        <select class="select2 clientstore wdt100 autoSaveBillRowRet" name="reprstorid{$y}"
                                                id="reprstorid{$y}">
                                            <option value="-1">اختر مخزن</option>
                                            {foreach $storeData as $store}
                                            <option value="{$store->storeId}" {if {$store->storeId} eq
                                                {$myreturnmysellbildetales->storeid}} selected="selected"
                                                {/if}>{$store->storeName}</option>
                                            {/foreach}
                                        </select>
                                        {else}
                                        {foreach $storeData as $store}
                                        {if {$store->storeId} eq {$myreturnmysellbildetales->storeid}}{$store->storeName} {/if}
                                        {/foreach}
                                        <input name="reprstorid{$y}" id="reprstorid{$y}" class="selectstore" type="hidden"
                                               value="{$myreturnmysellbildetales->storeid}" />
                                        {/if}
                                    </div>
                                </td>

                                <td>
                                    <div id="returnproductdiv{$y}">
                                        <input type="hidden" id="returnproduct{$y}" name="returnproduct{$y}"
                                               class="select2returnproduct wdt100 autoSaveBillRowRet" data-placeholder="اختر منتج"
                                               tabindex="301" />

                                        <input type="hidden" id="reoldproduct{$y}" name="reoldproduct{$y}"
                                               value="{if $myreturnmysellbildetales->sizeid > 0 && $myreturnmysellbildetales->colorid > 0}hasSizeColor{$myreturnmysellbildetales->sellbilldetailproductid}{$myreturnmysellbildetales->returnsellbilldetailproductid}-{$myreturnmysellbildetales->sizeid}-{$myreturnmysellbildetales->colorid}{else}{$myreturnmysellbildetales->sellbilldetailproductid}{$myreturnmysellbildetales->returnsellbilldetailproductid}{/if}" />
                                        <input type="hidden" id="reoldname{$y}" name="reoldname{$y}"
                                               value="{$myreturnmysellbildetales->productName}
                                               {if $myreturnmysellbildetales->sizeName != ''}/ {$myreturnmysellbildetales->sizeName}{/if}
                                               {if $myreturnmysellbildetales->colorName != ''}/ {$myreturnmysellbildetales->colorName}{/if}" />
                                        <input type="hidden" id="netSellQ{$y}" value="" />
                                    </div>
                                </td>




                                <td {if {$billsettingsData[7]->billsettingsvalue} eq 0} {else} style="display:none !important"
                                    {/if}>
                                    <textarea class="form-control txt-nonraduis returnenteraction autoSaveBillRowRet"
                                              name="returncomment{$y}" id="returncomment{$y}" rows="1"
                                              tabindex="301">{$myreturnmysellbildetales->note}</textarea>
                                </td>
                                <td class="check_tr_unit {if {$billsettingsData[53]->billsettingsvalue} eq 1}  hidden {/if}">
                                    <div id="returnproductunitdiv{$y}">

                                        <input type="hidden" name="retProNum{$y}" id="retProNum{$y}" value="" />
                                        <select class="select2 wdt100 autoSaveBillRowRet" id="returnproductunit{$y}"
                                                name="returnproductunit{$y}" onChange="alert(11);
                                                        getreturnunitprice({$y});">
                                            <option value="-1"></option>
                                            {foreach $myreunitdata{$y} as $remymyunitdata}
                                            <option data-pu-num="{$remymyunitdata->productnumber}"
                                                    value="{$remymyunitdata->productunitid}" {if $myreturnmysellbildetales->
                                                productunitid eq $remymyunitdata->productunitid or
                                                $myreturnmysellbildetales->productunitid eq $remymyunitdata->productunitid }
                                                selected="selected" {/if}>{$remymyunitdata->unitName} </option>
                                            {/foreach}
                                        </select>
                                        <input name="oldunit{$y}" id="oldunit{$y}" type="hidden"
                                               value="{$myreturnmysellbildetales->productunitid}" />
                                        <input name="oldunitname{$y}" id="oldunitname{$y}" type="hidden"
                                               value="{$myreturnmysellbildetales->unitName}" />
                                    </div>
                                </td>
                                <td
                                    class="wdt100n check_tr_Height {if {$billsettingsData[64]->billsettingsvalue} eq 1||$billsettingsData[100]->billsettingsvalue == 0}  hidden {/if}">
                                    <input type="text" name="returnproHeight{$y}" id="returnproHeight{$y}"
                                           value="{$myreturnmysellbildetales->proHeight}"
                                           class="form-control txt-nonraduis enteraction numberinput positivefloat autoSaveBillRowRet"
                                           onKeyUp="calcQuantityReturn({$y}, event);" tabindex="301" />
                                </td>
                                <td
                                    class="wdt100n check_tr_Width {if {$billsettingsData[64]->billsettingsvalue} eq 1||$billsettingsData[100]->billsettingsvalue == 0}  hidden {/if}">
                                    <input type="text" name="returnproWidth{$y}" id="returnproWidth{$y}"
                                           value="{$myreturnmysellbildetales->proWidth}"
                                           class="form-control txt-nonraduis enteraction numberinput positivefloat autoSaveBillRowRet"
                                           onKeyUp="calcQuantityReturn({$y}, event);" tabindex="301" />
                                </td>
                                <td
                                    class="check_tr_quantity {if {$billsettingsData[64]->billsettingsvalue} eq 1}  hidden {/if}">
                                    <input type="text" name="returnpronum{$y}" id="returnpronum{$y}"
                                           value="{$myreturnmysellbildetales->returnsellbilldetailquantity}{$myreturnmysellbildetales->sellbilldetailquantity}"
                                           class="form-control txt-nonraduis getreurnprototal returnenteraction {if $billsettingsData[113]->billsettingsvalue == 1} positiveNo {else} positivefloat {/if} autoSaveBillRowRet"
                                           onKeyUp="returncheckquantity({$y}, event);" value="1" tabindex="301" />
                                </td>

                                <td class="  {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}">
                                    <input name="returnscunitname{$y}" id="returnscunitname{$y}"
                                           value="{$myreturnmysellbildetales->otherdetailquantity}"
                                           class="form-control txt-nonraduis positiveNo autoSaveBillRowRet" placeholder="العدد"
                                           type="text" tabindex="7" />
                                </td>
                                <td
                                    class="showrowPriceType {if {$billsettingsData[83]->billsettingsvalue} eq 1 || $Programsettingdata->halfPriceStart > 0 || $Programsettingdata->allPriceStart > 0}  {else} hidden {/if}">
                                    <select class="select2 wdt100 autoSaveBillRowRet" name="retpricetypepro{$y}"
                                            id="retpricetypepro{$y}">
                                        {if $Programsettingdata->showpriceall eq 1}
                                        <option value="0" {if $myreturnmysellbildetales->pricetypepro eq 0} selected="selected"
                                            {/if} >جملة</option>
                                        {/if}
                                        {if $Programsettingdata->showpriceunit eq 1}
                                        <option value="1" {if $myreturnmysellbildetales->pricetypepro eq 1} selected="selected"
                                            {/if} >تجزئة</option>
                                        {/if}
                                        {if $Programsettingdata->showpricehalf eq 1}
                                        <option value="2" {if $myreturnmysellbildetales->pricetypepro eq 2} selected="selected"
                                            {/if}>نصف جملة</option>
                                        {/if}
                                        {if $Programsettingdata->showprice4 eq 1}
                                        <option value="4" {if $myreturnmysellbildetales->pricetypepro eq 4} selected="selected"
                                            {/if}>سعر4</option>
                                        {/if}
                                        {if $Programsettingdata->showprice5 eq 1}
                                        <option value="5" {if $myreturnmysellbildetales->pricetypepro eq 5} selected="selected"
                                            {/if}>سعر5</option>
                                        {/if}
                                        {if $Programsettingdata->showprice6 eq 1}
                                        <option value="6" {if $myreturnmysellbildetales->pricetypepro eq 6} selected="selected"
                                            {/if}>سعر6</option>
                                        {/if}
                                        {if $Programsettingdata->showprice7 eq 1}
                                        <option value="7" {if $myreturnmysellbildetales->pricetypepro eq 7} selected="selected"
                                            {/if}>سعر7</option>
                                        {/if}
                                        {if $Programsettingdata->showprice8 eq 1}
                                        <option value="8" {if $myreturnmysellbildetales->pricetypepro eq 8} selected="selected"
                                            {/if}>سعر8</option>
                                        {/if}
                                        {if $Programsettingdata->showprice9 eq 1}
                                        <option value="9" {if $myreturnmysellbildetales->pricetypepro eq 9} selected="selected"
                                            {/if}>سعر9</option>
                                        {/if}
                                        {if $Programsettingdata->showprice10 eq 1}
                                        <option value="10" {if $myreturnmysellbildetales->pricetypepro eq 10} selected="selected"
                                            {/if}>سعر10</option>
                                        {/if}
                                        {if $Programsettingdata->showprice11 eq 1}
                                        <option value="11" {if $myreturnmysellbildetales->pricetypepro eq 11} selected="selected"
                                            {/if}>سعر11</option>
                                        {/if}
                                        {if $Programsettingdata->showprice12 eq 1}
                                        <option value="12" {if $myreturnmysellbildetales->pricetypepro eq 12} selected="selected"
                                            {/if}>سعر12</option>
                                        {/if}
                                        {if $Programsettingdata->showprice13 eq 1}
                                        <option value="13" {if $myreturnmysellbildetales->pricetypepro eq 13} selected="selected"
                                            {/if}>سعر13</option>
                                        {/if}
                                    </select>
                                </td>
                                <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                    <div id="returnpropricechange{$y}">
                                        <input type="text" name="returnproprice{$y}" id="returnproprice{$y}"
                                               class="form-control getreurnprototal txt-nonraduis returnenteraction numberinput autoSaveBillRowRet"
                                               value="{$myreturnmysellbildetales->returnsellbilldetailprice}{$myreturnmysellbildetales->sellbilldetailprice}"
                                               tabindex="301" />
                                    </div>
                                </td>
                                <td
                                    class="check_tr_discount {if {$billsettingsData[8]->billsettingsvalue} eq 1}  hidden {/if} {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                    <!--input type="text" name="returnprodis{$y}" id="returnprodis{$y}"  class="form-control getreurnprototal  txt-nonraduis returnenteraction numberinput" value="{$myreturnmysellbildetales->discountvalue}" tabindex="301" /-->

                                    <div class="input-group">
                                        <input name="returnprodis{$y}" id="returnprodis{$y}" class="form-control getreurnprototal  txt-nonraduis returnenteraction numberinput autoSaveBillRowRet
                                               {if $billsettingsData[34]->billsettingsvalue eq 1} hidden {/if}"
                                               value="{$myreturnmysellbildetales->discountvalue}" tabindex="301" type="text" />

                                        <input name="returndiscounttype{$y}" id="returndiscounttype{$y}" class="form-control getreurnprototal  txt-nonraduis returnenteraction numberinput autoSaveBillRowRet
                                               {if $billsettingsData[34]->billsettingsvalue eq 0} hidden {/if}"
                                               tabindex="301" value="{$myreturnmysellbildetales->discounttype}" type="text" />


                                        <span class="input-group-addon small-addon retdiscountSpan" data-itr="{$y}">
                                            {if {$billsettingsData[34]->billsettingsvalue} eq 0}C
                                            {else}
                                            %
                                            {/if}
                                        </span>
                                    </div>

                                </td>
                                <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                    <p class="form-control-static" id="reurnprototal{$y}">
                                        {$myreturnmysellbildetales->returnsellbilldetailtotalprice}{$myreturnmysellbildetales->sellbilldetailtotalprice}
                                    </p>
                                    <input name="returnhidden_prototal{$y}" id="returnhidden_prototal{$y}" type="hidden"
                                           value="{$myreturnmysellbildetales->returnsellbilldetailtotalprice}{$myreturnmysellbildetales->sellbilldetailtotalprice}" />
                                </td>
                                <td class="{if {$Programsettingdata->expiredate} eq 1}  hidden {/if}">
                                    <input type="hidden" name="proSerialsRet{$y}" id="proSerialsRet{$y}" data-itr="{$y}"
                                           class="autoSaveBillRowRet" value="">
                                    <input type='hidden' id='oldproSerialsRet{$y}'
                                           value='{$myreturnmysellbildetales->soldSerialsInDetails}' />
                                </td>
                                <td>
                                    <input type="hidden" name="tempSaveBillIdRowRet{$y}" id="tempSaveBillIdRowRet{$y}"
                                           value="{if $tempSaveBillId > 0}{$myreturnmysellbildetales->sellbilldetailid}{$myreturnmysellbildetales->returnsellbilldetailid}{else}0{/if}">
                                    <button type="button" id="returnremove{$y}"
                                            class="close flt-none returnremoveproduct autoDelBillRowRet"
                                            aria-hidden="true">&times;</button>
                                </td>
                            </tr>

                            {capture assign=y}{$y+1}{/capture}
                            {/foreach}





                            {else}



                            <tr>
                                <td {if {$billsettingsData[40]->billsettingsvalue} eq 0} {else} style="display:none !important;"
                                    {/if}><span class="proDetails" data-pro="returnproduct1">1</span></td>
                                <td {if {$billsettingsData[104]->billsettingsvalue} eq 0} {else} style="display:none
                                    !important;" {/if}>
                                    <input type="text" name="retproSellTrackingSerial1" id="retproSellTrackingSerial1"
                                           class="form-control txt-nonraduis autoSaveBillRowRet" tabindex="7" size="3" />
                                </td>
                                <td {if {$billsettingsData[59]->billsettingsvalue} eq 0} {else} style="display:none" {/if}>
                                    <div id="returnproductparcode1">
                                        <input type="text" name="returnparcode1" id="returnparcode1"
                                               class="form-control txt-nonraduis autoSaveBillRowRet"
                                               placeholder="{$smarty.const.SELL_BILL_BARCODE}"
                                               onkeypress="getreturnproductbyParcode(event, this.value, 1);" tabindex="301" />
                                        <input name="returnparcodeType1" id="returnparcodeType1" type="hidden" />
                                        <input name="returnproductserailid1" id="returnproductserailid1" type="hidden" />
                                        <input name="returnproductQty1" id="returnproductQty1" type="hidden" />
                                    </div>
                                </td>
                                <td {if {$billsettingsData[26]->billsettingsvalue} eq 0} {else} style="display:none !important"
                                    {/if}>

                                    <div id="prstoridsiv1">

                                        {if $userdata->userstoreid eq 0}
                                        <select class="select2 clientstore wdt100 autoSaveBillRowRet" name="reprstorid1"
                                                id="reprstorid1">
                                            <option value="-1">{$smarty.const.SELL_BILL_SELECT_STORE}</option>
                                            {foreach $storeData as $store}
                                            <option value="{$store->storeId}">{$store->storeName}</option>
                                            {/foreach}
                                        </select>
                                        {else}
                                        {foreach $storeData as $store}
                                        {if {$store->storeId} eq {$userdata->userstoreid}}{$store->storeName} {/if}
                                        {/foreach}
                                        <input name="reprstorid1" id="reprstorid1" class="selectstore" type="hidden"
                                               value="{$userdata->userstoreid}" />
                                        {/if}
                                    </div>
                                </td>
                                <td>
                                    <div id="returnproductdiv1">

                                        <input type="hidden" id="returnproduct1" name="returnproduct1"
                                               class="select2returnproduct wdt100 autoSaveBillRowRet"
                                               data-placeholder="{$smarty.const.SELL_BILL_SELECT_PRODUCT}" tabindex="301" />
                                        <input type="hidden" id="netSellQ1" value="" />
                                    </div>
                                </td>





                                <td {if {$billsettingsData[7]->billsettingsvalue} eq 0} {else} style="display:none !important"
                                    {/if}>
                                    <textarea class="form-control txt-nonraduis returnenteraction autoSaveBillRowRet"
                                              name="returncomment1" id="returncomment1" rows="1" tabindex="301"></textarea>
                                </td>
                                <td {if {$billsettingsData[53]->billsettingsvalue} eq 0} {else} style="display:none !important"
                                    {/if}>
                                    <div id="returnproductunitdiv1">
                                        <select id="returnproductunit1" name="returnproductunit1"
                                                class="select2 wdt100 autoSaveBillRowRet" tabindex="301">
                                            <option value="-1"></option>
                                        </select>
                                    </div>
                                </td>
                                <td
                                    class="wdt100n check_tr_Height {if {$billsettingsData[64]->billsettingsvalue} eq 1||$billsettingsData[100]->billsettingsvalue == 0}  hidden {/if}">
                                    <input type="text" name="returnproHeight1" id="returnproHeight1" value="1"
                                           class="form-control txt-nonraduis enteraction numberinput positivefloat autoSaveBillRowRet"
                                           onKeyUp="calcQuantityReturn(1, event);" tabindex="301" />
                                </td>
                                <td
                                    class="wdt100n check_tr_Width {if {$billsettingsData[64]->billsettingsvalue} eq 1||$billsettingsData[100]->billsettingsvalue == 0}  hidden {/if}">
                                    <input type="text" name="returnproWidth1" id="returnproWidth1" value="1"
                                           class="form-control txt-nonraduis enteraction numberinput positivefloat autoSaveBillRowRet"
                                           onKeyUp="calcQuantityReturn(1, event);" tabindex="301" />
                                </td>
                                <td
                                    class="check_tr_quantity {if {$billsettingsData[64]->billsettingsvalue} eq 1}  hidden {/if}">
                                    <input type="text" name="returnpronum1" id="returnpronum1"
                                           class="form-control txt-nonraduis getreurnprototal returnenteraction numberinput {if $billsettingsData[113]->billsettingsvalue == 1} positiveNo {else} positivefloat {/if} autoSaveBillRowRet"
                                           onKeyUp="returncheckquantity(1, event);" value="1" tabindex="301" />
                                </td>
                                <td class="  {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}">
                                    <input name="returnscunitname1" id="returnscunitname1" value="0"
                                           class="form-control txt-nonraduis positiveNo autoSaveBillRowRet"
                                           placeholder="{$smarty.const.SELL_BILL_QUANTITY}" type="text" tabindex="7" />
                                </td>
                                <td
                                    class="showrowPriceType {if {$billsettingsData[83]->billsettingsvalue} eq 1 || $Programsettingdata->halfPriceStart > 0 || $Programsettingdata->allPriceStart > 0}  {else} hidden {/if}">
                                    <select class="select2 wdt100 autoSaveBillRowRet" name="retpricetypepro1"
                                            id="retpricetypepro1">

                                        {if $Programsettingdata->showpriceall eq 1}
                                        <option value="0" {if $billsettingsData[32]->billsettingsvalue eq 0} selected="selected"
                                            {/if} >{$smarty.const.SELL_BILL_WHOLESALE}</option>
                                        {/if}
                                        {if $Programsettingdata->showpriceunit eq 1}
                                        <option value="1" {if $billsettingsData[32]->billsettingsvalue eq 1} selected="selected"
                                            {/if} >{$smarty.const.SELL_BILL_RETAIL}</option>
                                        {/if}
                                        {if $Programsettingdata->showpricehalf eq 1}
                                        <option value="2" {if $billsettingsData[32]->billsettingsvalue eq 2} selected="selected"
                                            {/if}>{$smarty.const.SELL_BILL_HALF_WHOLESALE}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice4 eq 1}
                                        <option value="4" {if $billsettingsData[32]->billsettingsvalue eq 4} selected="selected"
                                            {/if}>{$smarty.const.SELL_BILL_PRICE4}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice5 eq 1}
                                        <option value="5" {if $billsettingsData[32]->billsettingsvalue eq 5} selected="selected"
                                            {/if}>{$smarty.const.SELL_BILL_PRICE5}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice6 eq 1}
                                        <option value="6" {if $billsettingsData[32]->billsettingsvalue eq 6} selected="selected"
                                            {/if}>{$smarty.const.SELL_BILL_PRICE6}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice7 eq 1}
                                        <option value="7" {if $billsettingsData[32]->billsettingsvalue eq 7} selected="selected"
                                            {/if}>{$smarty.const.SELL_BILL_PRICE7}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice8 eq 1}
                                        <option value="8" {if $billsettingsData[32]->billsettingsvalue eq 8} selected="selected"
                                            {/if}>{$smarty.const.SELL_BILL_PRICE8}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice9 eq 1}
                                        <option value="9" {if $billsettingsData[32]->billsettingsvalue eq 9} selected="selected"
                                            {/if}>{$smarty.const.SELL_BILL_PRICE9}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice10 eq 1}
                                        <option value="10" {if $billsettingsData[32]->billsettingsvalue eq 10} selected="selected"
                                            {/if}>{$smarty.const.SELL_BILL_PRICE10}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice11 eq 1}
                                        <option value="11" {if $billsettingsData[32]->billsettingsvalue eq 11} selected="selected"
                                            {/if}>{$smarty.const.SELL_BILL_PRICE11}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice12 eq 1}
                                        <option value="12" {if $billsettingsData[32]->billsettingsvalue eq 12} selected="selected"
                                            {/if}>{$smarty.const.SELL_BILL_PRICE12}</option>
                                        {/if}
                                        {if $Programsettingdata->showprice13 eq 1}
                                        <option value="13" {if $billsettingsData[32]->billsettingsvalue eq 13} selected="selected"
                                            {/if}>{$smarty.const.SELL_BILL_PRICE13}</option>
                                        {/if}
                                    </select>
                                </td>
                                <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                    <div id="returnpropricechange1">
                                        <input type="text" name="returnproprice1" id="returnproprice1"
                                               class="form-control getreurnprototal txt-nonraduis returnenteraction numberinput  positivefloat autoSaveBillRowRet"
                                               value="0" tabindex="301" />
                                    </div>
                                </td>
                                <td
                                    class="check_tr_discount {if $Usergroupdata->hideBillPrices == 1}hidden{/if} {if {$billsettingsData[8]->billsettingsvalue} eq 1}  hidden {/if}">

                                    <div class="input-group">
                                        <input name="returnprodis1" id="returnprodis1" class="form-control getreurnprototal  txt-nonraduis returnenteraction numberinput positiveNo autoSaveBillRowRet
                                               {if $billsettingsData[34]->billsettingsvalue eq 1} hidden {/if}"
                                               value="0" tabindex="301" type="text" />



                                        <input name="returndiscounttype1" id="returndiscounttype1" class="form-control getreurnprototal  txt-nonraduis returnenteraction numberinput positiveNo autoSaveBillRowRet
                                               {if $billsettingsData[34]->billsettingsvalue eq 0} hidden {/if}"
                                               value="0" tabindex="301" type="text" />



                                        <span class="input-group-addon small-addon retdiscountSpan" data-itr="1">
                                            {if {$billsettingsData[34]->billsettingsvalue} eq 0}C
                                            {else}
                                            %
                                            {/if}
                                        </span>
                                    </div>
                                </td>
                                <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                    <!--                                    <p class="form-control-static" id="reurnprototal1">0</p>
                                                                                                                                <input name="returnhidden_prototal1" id="returnhidden_prototal1" type="hidden" value="0" />-->
                                    <input name="returnhidden_prototal1" id="returnhidden_prototal1"
                                           class="returnEditTotal form-control txt-nonraduis enteraction numberinput positiveNo autoSaveBillRowRet"
                                           value="0" type="text" />
                                </td>
                                <td class="{if {$Programsettingdata->expiredate} eq 1}  hidden {/if}">
                                    <input type="hidden" name="proSerialsRet1" id="proSerialsRet1" data-itr="1"
                                           class="autoSaveBillRowRet" value="">
                                </td>
                                <td>
                                    <input type="hidden" name="tempSaveBillIdRowRet1" id="tempSaveBillIdRowRet1" value="0">
                                    <button type="button" id="returnremove1"
                                            class="close flt-none returnremoveproduct autoDelBillRowRet"
                                            aria-hidden="true">&times;</button>
                                </td>
                            </tr>


                            {/if}
                        </tbody>
                    </table>
                </div>
                <button type="button"
                        class="btn btn-primary pull-left ft-nor {if $Usergroupdata->hideBillPrices == 1}hidden{/if}" {if
                        {$billsettingsData[0]->
                    billsettingsvalue} eq 0} {else} style="display:none !important"
                    {/if}>{$smarty.const.RETURN_SELL_BILL_TOTAL_SALES_RETURNS} <span class="badge wht-clo"
                                                                                     id="returnsellbilltotal">0</span>
                    <input type="hidden" name="returnsellbillprice" id="returnsellbillprice" value="0" />
                </button>
            </div>

            <!-- end of third row-->

            <div class="row {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                <div class="col-lg-7">
                    <div id="closeebill">

                    </div>
                    <div class="form-group mg-bt5" {if {$billsettingsData[49]->billsettingsvalue} eq 0} {else}
                        style="display:none !important" {/if}>
                        <label class="col-lg-3 control-label">{$smarty.const.SELL_BILL_PAID}</label>
                        <div class="col-lg-3">
                            <input type="text" class="form-control" placeholder="{$smarty.const.SELL_BILL_PAID}" id="genpay2"
                                   onkeyup="calculateremain(this.value);">
                        </div>
                    </div>
                    <!-- end of form-group-->

                    <div class="form-group mg-bt5" {if {$billsettingsData[49]->billsettingsvalue} eq 0} {else}
                        style="display:none !important" {/if}>
                        <label class="col-lg-3 control-label">{$smarty.const.SELL_BILL_REST}</label>
                        <div class="col-lg-3">
                            <p class="form-control-static" id="gen3total2">0 {$currency}</p>
                        </div>
                    </div>
                    <div class="form-group mg-bt5" {if {$Usergroupdata->showProfitInsideBill} eq 1} {else}
                        style="display:none !important" {/if}>
                        <label class="col-lg-3 control-label">ربح الفاتورة</label>
                        <div class="col-lg-3">
                            <input type="text" class="form-control" id="profitVal" readonly>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div class="form-group" {if {$billsettingsData[80]->billsettingsvalue} eq 0} {else} style="display:none"
                        {/if}>
                        <label class="col-lg-3 control-label">{if {$Programsettingdata->delivery} eq
                            0}{$smarty.const.SELL_BILL_HAULAUGE}{else} {$smarty.const.SELL_BILL_DELIVERY} {/if}</label>
                        <div class="col-lg-3">
                            <input type="hidden" id="billsettingsData_80" value="{$billsettingsData[80]->billsettingsvalue}" />
                            <span id="sprytextfield12">
                                <input type="text" class="form-control"
                                       placeholder="{if {$Programsettingdata->delivery} eq 0}{$smarty.const.SELL_BILL_HAULAUGE}{else} {$smarty.const.SELL_BILL_DELIVERY} {/if}"
                                       name="delivery" id="delivery" />
                                <span class="textfieldRequiredMsg">*</span><span
                                    class="textfieldInvalidFormatMsg">{$smarty.const.SELL_BILL_ENTER_CORRECT_VALUE}</span>
                            </span>
                        </div>
                    </div>

                    <div class="form-group mg-bt5" {if {$billsettingsData[80]->billsettingsvalue} eq 0} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-3 control-label">{$smarty.const.SELL_BILL_TOTAL_AMOUNT}</label>
                        <div class="col-lg-7">
                            <p class="form-control-static mg-tp10" id="valdelivery">0</p>
                            <input type="hidden" name="valdeliveryhidden" id="valdeliveryhidden" value="0" />

                        </div>
                    </div>


                    <div class="form-group mg-bt5" {if {$billsettingsData[84]->billsettingsvalue} eq 0} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-3 control-label">{$smarty.const.SELL_BILL_BILL_RESERVATION} </label>
                        <div class="col-lg-3">
                            <input type="checkbox" name="billReservation" id="billReservation" value="1" />
                        </div>
                    </div>
                    <div class="form-group mg-bt5" {if {$billsettingsData[84]->billsettingsvalue} eq 0} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-3 control-label">{$smarty.const.SELL_BILL_BOOKING_EXPIRTY_DATE}</label>
                        <div class="col-lg-3">
                            <span id="billReservationDatesp">
                                <input type="text" class="form-control awdatepicker" autocomplete="off" id="billReservationDate"
                                       data-date-format="yyyy-mm-dd" name="billReservationDate" required="">
                                <span class="textfieldRequiredMsg">*</span></span>
                        </div>
                    </div>
                    <div class="form-group mg-bt5" {if {$billsettingsData[93]->billsettingsvalue} eq 0} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-3 control-label">{$smarty.const.SELL_BILL_COLLECTION_METHOD} </label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input value="0" class="radioR" name="collectionType" type="radio" checked>
                                    {$smarty.const.SELL_BILL_WITHOUT}</label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input value="1" class="radioR" name="collectionType" type="radio">
                                    {$smarty.const.SELL_BILL_CHEQUE} </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input value="2" class="radioR" name="collectionType" type="radio">
                                    {$smarty.const.SELL_BILL_OPEN} </label>
                            </div>

                        </div>
                    </div>
                    <div class="form-group mg-bt5" {if {$billsettingsData[93]->billsettingsvalue} eq 0} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-3 control-label"> {$smarty.const.SELL_BILL_DUE_DATE}</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">
                        </div>
                    </div>

                    <div class="form-group mg-bt5" {if {$billsettingsData[91]->billsettingsvalue} eq 0} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-3 control-label"> {$smarty.const.SELL_BILL_TOTAL_INCLUSIVE_VAT}</label>
                        <div class="col-lg-3">
                            <input type="text" class="form-control positivefloat" id="vatIncludedTotalIfRow" value="" />
                        </div>
                    </div>

                    <div class="form-group mg-bt5" {if {$billsettingsData[120]->billsettingsvalue} neq 1 ||
                        $billsettingsData[121]->billsettingsvalue neq 2} style="display:none" {/if}>
                        <label class="col-lg-3 control-label"> {$smarty.const.SELL_BILL_DECISION_No}</label>
                        <div class="col-lg-3">
                            <input type="text" name="decisionNo" class="form-control positivefloat" id="decisionNo" value="" />
                        </div>
                    </div>
                    <div class="form-group mg-bt5" {if {$billsettingsData[120]->billsettingsvalue} neq 1 ||
                        $billsettingsData[121]->billsettingsvalue neq 2} style="display:none" {/if}>
                        <label class="col-lg-3 control-label"> {$smarty.const.SELL_BILL_DECISION_No}</label>
                        <div class="col-lg-3">
                            <input type="text" name="decisionValue" class="form-control positivefloat" id="decisionValue"
                                   value="" />
                        </div>
                    </div>

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

                <div class="col-lg-5 card">
                    <hr />
                    <div class="form-group mg-bt5" {if {$billsettingsData[58]->billsettingsvalue} eq 0} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-5 col-sm-7 control-label"> {$smarty.const.SELL_BILL_NUMBER_PIECES_SOLD}</label>
                        <div class="col-lg-7 col-sm-5">
                            <p class="form-control-static mg-tp10" id="totalQty">0</p>
                            <input type="hidden" name="sellQuantity" id="sellQuantity" value="0" />
                        </div>
                    </div>
                    <!-- end of form-group-->

                    <div class="form-group mg-bt5" {if {$billsettingsData[0]->billsettingsvalue} eq 0 &&
                        {$billsettingsData[58]->billsettingsvalue} eq 0} {else} style="display:none !important" {/if}>
                        <label class="col-lg-5 col-sm-7 control-label"> {$smarty.const.SELL_BILL_NUMBER_PIECES_RETURNED}</label>
                        <div class="col-lg-7 col-sm-5">
                            <p class="form-control-static mg-tp10" id="returnTotalQty">0</p>
                            <input type="hidden" name="returnsellQuantity" id="returnsellQuantity" value="0" />
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5">
                        <label class="col-lg-5 col-sm-7 control-label">اجمالى النسبه</label>
                        <div class="col-lg-7 col-sm-5">
                            <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 col-sm-7 control-label"> {$smarty.const.SELL_BILL_BILL_VALUE}</label>
                        <div class="col-lg-7 col-sm-5">
                            <p class="form-control-static mg-tp10" id="gentotal">0</p>
                            <input type="hidden" name="sellbilltotalbill" id="sellbilltotalbill" value="0" />
                            <input type="hidden" name="etotal" id="etotal" value="0" />
                        </div>
                    </div>
                    <!-- end of form-group-->
                    {if {$billsettingsData[90]->billsettingsvalue} eq 1 && $billnameAddData->extraDiscountPlace == 1}
                    <div>
                        <!--<hr class="mg-tp5 mg-bt5"/>-->
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 col-sm-7 control-label"> {if $billnameAddData->extraDiscountFixed == 1}
                                ({$billnameAddData->extraDiscountPer}%) {/if} {$smarty.const.SELL_BILL_EXTRA_DISCOUNT}</label>
                            <div class="col-lg-7 col-sm-5">
                                {if $billnameAddData->extraDiscountFixed == 0}
                                <div class="input-group">
                                    <input type="text" name="extraDiscountPer" class="form-control numberinput positiveNo"
                                           id="extraDiscountPer" value="0" />
                                    <span class="input-group-addon">%</span>
                                </div>
                                {else}
                                <input type="hidden" name="extraDiscountPer" id="extraDiscountPer"
                                       value="{$billnameAddData->extraDiscountPer}" />
                                {/if}
                                <div class="input-group" style="padding-top: 1px;">
                                    <input type="text" name="extraDiscountVal" class="form-control numberinput positiveNo"
                                           id="extraDiscountVal" value="0" readonly />
                                    <input type="hidden" name="extraDiscountVal_h" id="extraDiscountVal_h" value="0" />
                                    <span class="input-group-addon">{$Programsettingdata->currancy}</span>
                                </div>
                            </div>
                        </div>
                    </div>
                    {/if}
                    <!-- end of form-group-->
                    <div
                        class="form-group mg-bt5 check_tr_discount {if {$billsettingsData[42]->billsettingsvalue} eq 1}  hidden {/if}">
                        <label class="col-lg-5 col-sm-7 control-label"> {$smarty.const.SELL_BILL_DISCOUNT_TYPE}</label>
                        <div class="col-lg-7 col-sm-5">
                            <select id="distype" name="distype" class="select2 wdt100 autoSaveBillMainPart"
                                    onchange="checkdisValue();">
                                <option {if ($offerId==0 && $billsettingsData[44]->billsettingsvalue eq 0)||(($offerId > 0 ||
                                    $manyParcodes == 1) && $mysellbilldata->sellbilldiscounttype neq 2)} selected="selected"
                                    {/if} value="1">{$smarty.const.SELL_BILL_LIVE}</option>
                                <option {if ($offerId==0 && $billsettingsData[44]->billsettingsvalue eq 1)||(($offerId > 0 ||
                                    $manyParcodes == 1) && $mysellbilldata->sellbilldiscounttype eq 2)} selected="selected"
                                    {/if} value="2">{$smarty.const.SELL_BILL_PERCENTAGE}</option>
                            </select>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div
                        class="form-group mg-bt5 check_tr_discount {if {$billsettingsData[42]->billsettingsvalue} eq 1}  hidden {/if}">
                        <label class="col-lg-5 col-sm-7 control-label"> {$smarty.const.SELL_BILL_DISCOUNT_VALUE}</label>
                        <div class="col-lg-7 col-sm-5"> <span id="sprytextfield4">
                                <div id="percentageSignDiv" class="input-group">
                                    <input type="text" name="gendis" id="gendis" {if
                                           $manyParcodes==1}value="{$mysellbilldata->sellbilldiscount}" {else if
                                    {$billsettingsData[57]->billsettingsvalue} neq 0}value="0"{/if} class="form-control
                                    numberclic positivefloat autoSaveBillMainPart"
                                    placeholder="{$smarty.const.SELL_BILL_DISCOUNT_VALUE}" autocomplete="off" />
                                    <span class="input-group-addon" id="percentageValSpan">0%</span>
                                    <span class="input-group-addon hide" id="percentageSignSpan">%</span>
                                </div>
                                <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">
                                    {$smarty.const.SELL_BILL_ENTER_CORRECT_VALUE}</span>
                            </span> </div>
                    </div>
                    <!-- end of form-group-->
                    {if {$billsettingsData[90]->billsettingsvalue} eq 1 && $billnameAddData->extraDiscountPlace == 0}
                    <div>
                        <!--<hr class="mg-tp5 mg-bt5"/>-->
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 control-label">{if $billnameAddData->extraDiscountFixed == 1}
                                ({$billnameAddData->extraDiscountPer}%) {/if} {$smarty.const.SELL_BILL_EXTRA_DISCOUNT}</label>
                            <div class="col-lg-7">
                                {if $billnameAddData->extraDiscountFixed == 0}
                                <div class="input-group">
                                    <input type="text" name="extraDiscountPer"
                                           class="form-control numberinput positiveNo autoSaveBillMainPart" id="extraDiscountPer"
                                           value="0" />
                                    <span class="input-group-addon">%</span>
                                </div>
                                {else}
                                <input type="hidden" name="extraDiscountPer" id="extraDiscountPer"
                                       value="{$billnameAddData->extraDiscountPer}" />
                                {/if}
                                <div class="input-group" style="padding-top: 1px;">
                                    <input type="text" name="extraDiscountVal" class="form-control numberinput positiveNo"
                                           id="extraDiscountVal" value="0" readonly />
                                    <input type="hidden" name="extraDiscountVal_h" id="extraDiscountVal_h" value="0" />
                                    <span class="input-group-addon">{$Programsettingdata->currancy}</span>
                                </div>
                            </div>
                        </div>
                    </div>
                    {/if}

                    <div class="form-group mg-bt5" {if {$billsettingsData[117]->billsettingsvalue} eq 0} style="display:none"
                        {/if}>
                        <label class="col-lg-5 col-sm-7 control-label"> {$smarty.const.SELL_BILL_PRO_DISCOUNT}</label>
                        <div class="col-lg-7 col-sm-5">
                            <p class="form-control-static mg-tp10" id="productDis">0</p>
                            <input type="hidden" name="totalProDis" id="totalProDis" value="0" />
                        </div>
                    </div>

                    <!-- end of form-group-->
                    <div {if {$billsettingsData[89]->billsettingsvalue} eq 0} style="display:none" {/if}>
                        <hr class="mg-tp5 mg-bt5" />
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 col-sm-7 control-label">{$smarty.const.SELL_BILL_TAX_DEDUCTION}
                                ({$billnameAddData->taxOfDiscountVal}%)</label>
                            <div class="col-lg-7 col-sm-5">
                                <div class="input-group">
                                    <input type="hidden" name="taxOfDiscountPercentage" id="taxOfDiscountPercentage"
                                           value="{$billnameAddData->taxOfDiscountVal}" />
                                    <input type="hidden" name="taxOfDiscountVal_h" id="taxOfDiscountVal_h" value="0" />
                                    <input type="text" name="taxOfDiscountVal"
                                           class="form-control numberinput positiveNo autoSaveBillMainPart" id="taxOfDiscountVal"
                                           value="0" readonly />
                                    <span class="input-group-addon">{$Programsettingdata->currancy}</span>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- end of form-group-->
                    <div {if {$billsettingsData[31]->billsettingsvalue} eq 0} {else} style="display:none" {/if}>
                        <hr class="mg-tp5 mg-bt5" />
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 col-sm-7 control-label"> {$smarty.const.SELL_BILL_VALUE_TAX}</label>
                            <div class="col-lg-7 col-sm-5">
                                <div class="input-group">
                                    <input type="text" name="tax"
                                           class="form-control numberinput positiveNo autoSaveBillMainPart" id="tax"
                                           value="{if $manyParcodes==1}{$mysellbilldata->tax}{else}{$Programsettingdata->vatValue}{/if}"
                                           onkeyup="checkdisValue();" />
                                    <span class="input-group-addon">%</span>
                                </div>
                                <div class="input-group" style="padding-top: 1px;">
                                    <input type="text" name="taxVal" class="form-control numberinput positiveNo" id="taxVal"
                                           value="0" readonly />
                                    <span class="input-group-addon">{$Programsettingdata->currancy}</span>
                                </div>
                            </div>
                        </div>


                    </div>

                    <div {if {$billsettingsData[120]->billsettingsvalue} eq 0} style="display:none" {/if}>
                        <hr class="mg-tp5 mg-bt5" />
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 col-sm-7 control-label"> {$smarty.const.SELL_BILL_MANAGE_EXPENSE}</label>
                            <div class="col-lg-7 col-sm-5">
                                <input type="text" name="manage_ex"
                                       class="form-control numberinput positiveNo autoSaveBillMainPart" id="manage_ex"
                                       value="{$mysellbilldata->manage_ex}" />
                            </div>
                        </div>
                    </div>
                    <div {if {$billsettingsData[120]->billsettingsvalue} eq 0} style="display:none" {/if}>
                        <hr class="mg-tp5 mg-bt5" />
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 col-sm-7 control-label"> {$smarty.const.SELL_BILL_Medical_HALLMARK}</label>
                            <div class="col-lg-7 col-sm-5">
                                <input type="text" name="med_hallmark" readonly
                                       class="form-control numberinput positiveNo autoSaveBillMainPart" id="med_hallmark"
                                       value="{$mysellbilldata->med_hallmark}" />
                            </div>
                        </div>
                    </div>
                    {if {$billsettingsData[120]->billsettingsvalue} eq 1 && {$billsettingsData[121]->billsettingsvalue} eq 0}
                    <div>
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 col-sm-7 control-label"> {$smarty.const.SELL_BILL_PAY_RECEIPT_NO}</label>
                            <div class="col-lg-7 col-sm-5">
                                <input type="text" name="pay_rec_no"
                                       class="form-control numberinput positiveNo autoSaveBillMainPart" id="pay_rec_no"
                                       value="{$mysellbilldata->pay_rec_no}" />
                            </div>
                        </div>
                    </div>
                    <div>
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 col-sm-7 control-label"> {$smarty.const.SELL_BILL_PAY_RECEIPT_VALUE}</label>
                            <div class="col-lg-7 col-sm-5">
                                <input type="text" name="pay_rec_val"
                                       class="form-control numberinput positiveNo autoSaveBillMainPart" id="pay_rec_val"
                                       value="{$mysellbilldata->pay_rec_val}" />
                            </div>
                        </div>
                    </div>
                    {/if}
                    <hr class="mg-tp5 mg-bt5" />
                    <div class="form-group mg-bt5" {if {$billsettingsData[51]->billsettingsvalue} eq 0} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-5 col-sm-7 control-label"> {$smarty.const.SELL_BILL_PURE}</label>
                        <div class="col-lg-7 col-sm-5">
                            <p class="form-control-static mg-tp10" id="gen2total">0</p>
                            <input type="hidden" name="sellbillaftertotalbill" id="sellbillaftertotalbill" value="0" />
                        </div>
                    </div>

                    <!-- end of form-group-->
                    <div class="form-group mg-bt5" {if {$billsettingsData[54]->billsettingsvalue} eq 0} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-5 col-sm-7 control-label"> {$smarty.const.SELL_BILL_PAID}</label>
                        <div class="col-lg-7 col-sm-5">
                            {if {$billsettingsData[86]->billsettingsvalue} eq 0}
                            <input type="text" name="genpay" id="genpay" {if {$billsettingsData[37]->billsettingsvalue} eq 1} "
                            {/if} class="form-control numberinput positivefloat autoSaveBillMainPart" placeholder="0" value="{if
                            $manyParcodes == 1}{$mysellbilldata->sellbilltotalpayed}{else}0{/if}"/>
                            <input type="hidden" name="genpayvisa" id="genpayvisa" value="0" />
                            <input type="hidden" name="visaAccount" id="visaAccount" value="0" />
                            <input type="hidden" name="isBankAccountTransfer" id="isBankAccountTransfer" value="0" />
                            {else}
                            <div class="form-group mg-bt5" {if {$billsettingsData[54]->billsettingsvalue} eq 0} {else}
                                style="display:none" {/if}>
                                <label class="col-lg-5 col-sm-7 control-label">{$smarty.const.SELL_BILL_CASH} </label>
                                <div class="col-lg-7 col-sm-5">
                                    <input type="text" name="genpay" id="genpay" {if {$billsettingsData[37]->billsettingsvalue}
                                    eq 1} " {/if} class="form-control numberinput positivefloat autoSaveBillMainPart"
                                    placeholder="0" value="{if $manyParcodes == 1}{$mysellbilldata->cashPayed}{else}0{/if}"/>
                                </div>
                            </div>
                            <div class="form-group mg-bt5" {if {$billsettingsData[54]->billsettingsvalue} eq 0} {else}
                                style="display:none" {/if}>
                                <label
                                    class="col-lg-5 col-sm-7 control-label">{$smarty.const.SELL_BILL_ELECTRONIC_PAYMENT}</label>
                                <div class="col-lg-7 col-sm-5">
                                    <input type="text" name="genpayvisa" id="genpayvisa" {if
                                           {$billsettingsData[37]->billsettingsvalue} eq 1} " {/if} class="form-control numberinput
                                    positivefloat autoSaveBillMainPart" placeholder="0" value="{if $manyParcodes ==
                                    1}{$mysellbilldata->visaPayed}{else}0{/if}"/>
                                </div>
                            </div>
                            {if {$billnameData->defVisaAccountSelect} eq 0}
                            <input type="hidden" name="visaAccount" id="visaAccount" value="{$billnameData->defVisaAccount}" />
                            {else}
                            <div class="form-group mg-bt5" {if {$billsettingsData[54]->billsettingsvalue} eq 0} {else}
                                style="display:none" {/if}>
                                <label class="col-lg-5 col-sm-7 control-label">{$smarty.const.SELL_BILL_PAYMENT_ACCOUNT}</label>
                                <div class="col-lg-7 col-sm-5">
                                    <select class="select2 wds100 autoSaveBillMainPart" name="visaAccount" id="visaAccount">
                                        <option value="0"></option>
                                        {foreach $bankAccounts as $acc}
                                        <option value="{$acc->accountid}" {if $billnameData->defVisaAccount ==
                                            $acc->accountid}selected{/if}>{$acc->accountname}/{$acc->bankname}</option>
                                        {/foreach}
                                    </select>
                                </div>
                            </div>
                            <div class="form-group mg-bt5" {if {$billnameData->isBankAccountTransfer} eq 1} {else}
                                style="display:none" {/if}>
                                <label class="col-lg-5 col-sm-7 control-label">{$smarty.const.SELL_BILL_BANK_TRANSFER} </label>
                                <div class="col-lg-7 col-sm-5">
                                    <input type="checkbox" name="isBankAccountTransfer" id="isBankAccountTransfer"
                                           class="autoSaveBillMainPart" value="1" />
                                </div>
                            </div>

                            {/if}
                            {/if}
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <hr class="mg-tp5 mg-bt5" />
                    <div class="form-group mg-bt5 bg-yel" {if {$billsettingsData[55]->billsettingsvalue} eq 0} {else}
                        style="display:none" {/if}>
                        <label class="col-lg-5 col-sm-7 control-label">{$smarty.const.SELL_BILL_RESIDUAL} </label>
                        <div class="col-lg-7 col-sm-5">
                            <p class="form-control-static mg-tp10" id="gen3total">0</p>
                        </div>
                    </div>
                    <!-- end of form-group-->

                    <div class="form-group mg-bt5" {if {$billsettingsData[1]->billsettingsvalue} eq 0} style="display:block"
                        {else} style="display:none !important" {/if}>
                        <label class="col-lg-5 col-sm-7 control-label">{$smarty.const.SELL_BILL_REST_DEBT} </label>
                        <div class="col-lg-7 col-sm-5">
                            <p class="form-control-static mg-tp10" id="gen4total">0</p>
                            <input type="hidden" id="gen4totalinput" value="0" />

                            <input type="hidden" id="clientdebtafter" value="0" />
                        </div>
                    </div>
                    <!-- end of form-group-->
                </div>
                <!-- end of totals center-->
            </div>
            <div class="clearfix"></div>
            <!-- end of fourth row-->
            <input type="hidden" value="{$roundNumbersStatus}" id="round_numbers" />
            <input type="hidden" value="{$noOfDecimalPlaces}" id="noOfDecimalPlaces" />
            <input type="hidden" value="{$previousPriceStatus}" id="previousPriceStatus" />
            <input type="hidden" value="{$Programsettingdata->enablequantityfractions}" id="enablequantityfractions" />
            <input type="hidden" value="{$Programsettingdata->roundnumbersbilltotal}" id="roundnumbersbilltotal" />
            <input type="hidden" value="{$Programsettingdata->noOfDecimalPlacesBillTotal}" id="noOfDecimalPlacesBillTotal" />
            <div class="row text-center">
                <button type="button" id="saveBill" onclick="return addDataOnly();"
                        class="btn btn-primary">{$smarty.const.SELL_BILL_SAVE}</button>
                <button type="button" id="saveAndNew" onclick="return addDataAndReturn();"
                        class="btn btn-success">{$smarty.const.SELL_BILL_SAVE_NEW}</button>
                {if {$billsettingsData[94]->billsettingsvalue} eq 0}
                <button type="button" id="saveAndPrint" onclick="return addDataAndPrint();"
                        class="btn btn-success">{$smarty.const.SELL_BILL_SAVE_PRINT}</button>
                {/if}
                {if $Programsettingdata->sellorder == 1}
                <button type="button" id="saveAndNewOrder" onclick="return addDataAndReturnOrder();"
                        class="btn btn-success">{$smarty.const.SELL_BILL_SAVE_NEW_ORDER}</button>
                {/if}
                {if $Programsettingdata->ebill == 1 && $billsettingsData[106]->billsettingsvalue eq 0}
                <button type="button" id="saveAndSend" onclick="return addDataAndSend();" class="btn btn-success">حفظ
                    وارسال</button>
                {/if}


                <!-- <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="{$storenegative}" />
                <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>
</div>
<!-- end of container-->
<!-- 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 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">{$smarty.const.CLIENT_ADD_CLIENT}</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">{$smarty.const.SELL_BILL_CLIENT_NAME}</label>
                        <div class="col-lg-4"> <span id="sprytextfield2">
                                <input class="form-control" placeholder="{$smarty.const.SELL_BILL_CLIENT_NAME}"
                                       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>{$smarty.const.CLIENT_WRONG_MESSAGE}</h4>
                                <p>{$smarty.const.CLIENT_THAT_NAME_ALREADY_TAKEN}</p>
                                <div class="clearfix"></div>
                            </div>
                        </div>
                    </div>




                    <div class="form-group" {if $Programsettingdata->simpleAddClientInBill neq
                        1}style="display:none"{/if}>
                        <label for="clientaddress"
                               class="col-lg-2 control-label">{$Programsettingdata->clientcodname}</label>
                        <div class="col-lg-4">
                            <input class="form-control" placeholder="{$Programsettingdata->clientcodname}"
                                   id="clientcode" name="clientcode" type="text" />
                        </div>
                    </div>


                    <div class="form-group">
                        <label for="txtAddress"
                               class="col-lg-2 control-label">{$smarty.const.CLIENT_COMPANY_REGION}</label>
                        <div class="col-lg-4">
                            <span id="spryselect1">
                                <input {if $Programsettingdata->clientfieldrequired eq 1} required="required" {/if}
                                type="hidden" name="clientareaid" value="0" id="clientareaid"/>
                                <span
                                    class="selectInvalidMsg">{$smarty.const.CLIENT_SELECT_COMPANY_REGION}</span></span>

                        </div>
                    </div>
                    <div class="form-group" {if $Programsettingdata->simpleAddClientInBill neq
                        1}style="display:none"{/if}>
                        <label for="taxnumber" class="col-lg-2 control-label">الرقم الضريبى</label>
                        <div class="col-lg-4">
                            <span id="spryselect1">
                                <input class="form-control" type="text" name="taxnumber" placeholder="الرقم الضريبى"
                                       id="taxnumber">
                                <span class="selectInvalidMsg"></span></span>

                        </div>
                    </div>



                    <!--<div class="form-group">-->
                    <!--<label for="txtAddress" class="col-lg-2 control-label">اسم الشركة</label>-->
                    <!--<div class="col-lg-4">-->

                    <!--<select name="clientareaid" id="clientareaid"  data-placeholder="اختر الشركة" class="select2 wdt100">-->
                    <!--<option value="0">اختر </option>-->
                    <!--{foreach $allclientarea as $myallclientarea}-->
                    <!--<option value="{$myallclientarea->id}">{$myallclientarea->name} </option>-->
                    <!--{/foreach}-->
                    <!--</select>-->

                    <!--</div>-->
                    <!--</div>-->
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label for="newclientdebt"
                               class="col-lg-2 control-label">{$smarty.const.CLIENT_INDEBTEDNESS}</label>
                        <div class="col-lg-4"> <!--<span id="sprytextfield3">-->
                            <input class="form-control numberinput" placeholder="{$smarty.const.CLIENT_INDEBTEDNESS}"
                                   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">{$smarty.const.CLIENT_ADDRESS}</label>
                        <div class="col-lg-4">
                            <input class="form-control" placeholder="{$smarty.const.CLIENT_ADDRESS}" id="clientaddress"
                                   name="clientaddress" type="text" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="clientphone"
                               class="col-lg-2 control-label">{$smarty.const.SELL_BILL_PHONE_NUMBER}</label>
                        <div class="col-lg-4">
                            <input class="form-control numberinput" placeholder="{$smarty.const.SELL_BILL_PHONE_NUMBER}"
                                   id="clientphone" name="clientphone" type="text" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="clientmobile"
                               class="col-lg-2 control-label">{$smarty.const.CLIENT_MOBILE_NUMBER}</label>
                        <div class="col-lg-4">
                            <input class="form-control numberinput" placeholder="{$smarty.const.CLIENT_MOBILE_NUMBER}"
                                   id="clientmobile" name="clientmobile" type="text" />
                        </div>
                    </div>
                    <div class="form-group ">
                        <label class="col-lg-2 control-label">المندوب </label>
                        <div class="col-lg-4">
                            <span>
                                <select name="delegateid" id="delegateid" data-placeholder="اختر "
                                        class="select2 wdt100">


                                    <option value="-1">اختر </option>
                                    {foreach $allDelegate as $delegate}
                                    <option value="{$delegate.userid}">{$delegate.employeename}</option>
                                    {/foreach}
                                </select>
                                <!--<span class="selectInvalidMsg">اختر المحافظة</span>-->
                            </span>

                        </div>
                    </div>
                    <div class="form-group" {if $Programsettingdata->simpleAddClientInBill neq
                        1}style="display:none"{/if}>
                        <label for="debtLimit" class="col-lg-2 control-label">{$smarty.const.CLIENT_DEBT_LIMIT} </label>
                        <div class="col-lg-4">
                            <input type="text" name="debtLimit" class="form-control positivefloat" id="debtLimit"
                                   value="{$Programsettingdata->clientDefaultDebtLimit}">
                        </div>
                    </div>
                    <!-- =================================================   -->

                    <div class="form-group" {if $Programsettingdata->simpleAddClientInBill neq
                        1}style="display:none"{/if}>
                        <label class="col-lg-2 control-label">{$smarty.const.CLIENT_SPECIAL_DISCOUNT} </label>
                        <div class="col-lg-1">
                            <input type="checkbox" name="specialDiscount" id="specialDiscount" value="1" />
                        </div>
                        <div style="display: none" id="specialDiscountVal_div">
                            <label class="col-lg-1 control-label">{$smarty.const.CLIENT_RATIO} </label>
                            <div class="col-lg-2">
                                <input type="text" name="specialDiscountVal" id="specialDiscountVal"
                                       class="form-control positivefloat" placeholder="" value="" />
                            </div>
                        </div>
                    </div>

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

                    <div class="form-group" {if $Programsettingdata->simpleAddClientInBill neq
                        1}style="display:none"{/if}>
                        <label class="col-lg-2 control-label">{$smarty.const.CLIENT_CARD_IMAGE}</label>
                        <div class="col-lg-4">
                            <input type="file" name="file" id="file" />
                        </div>
                    </div>


                    <!-- =================================================   -->
                    <div class="form-group">
                        <label for="clientdetails" class="col-lg-2 control-label">{$smarty.const.CLIENT_COMMENT}</label>
                        <div class="col-lg-4">
                            <textarea class="form-control" rows="3" name="clientdetails" id="clientdetails"></textarea>
                        </div>
                    </div>
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label class="col-lg-2 control-label"> {$smarty.const.SELL_BILL_PRICE_TYPE}</label>
                        <div class="col-lg-4">
                            <span>
                                <select name="priceTypeId" id="priceTypeId"
                                        data-placeholder=" {$smarty.const.SELL_BILL_SELECT}" class="select2 wdt100">
                                    <option value="-1">{$smarty.const.CLIENT_CHOOSE_PRICE_TYPE}</option>
                                    {if $Programsettingdata->showpriceall eq 1}
                                    <option value="0">{$smarty.const.SELL_BILL_WHOLESALE}</option>
                                    {/if}
                                    {if $Programsettingdata->showpriceunit eq 1}
                                    <option value="1">{$smarty.const.SELL_BILL_RETAIL}</option>
                                    {/if}
                                    {if $Programsettingdata->showpricehalf eq 1}
                                    <option value="2">{$smarty.const.SELL_BILL_HALF_WHOLESALE}</option>
                                    {/if}
                                    {if $Programsettingdata->showprice4 eq 1}
                                    <option value="4">{$smarty.const.SELL_BILL_PRICE4}</option>
                                    {/if}
                                    {if $Programsettingdata->showprice5 eq 1}
                                    <option value="5">{$smarty.const.SELL_BILL_PRICE5}</option>
                                    {/if}
                                    {if $Programsettingdata->showprice6 eq 1}
                                    <option value="6">{$smarty.const.SELL_BILL_PRICE6}</option>
                                    {/if}
                                    {if $Programsettingdata->showprice7 eq 1}
                                    <option value="7">{$smarty.const.SELL_BILL_PRICE7}</option>
                                    {/if}
                                    {if $Programsettingdata->showprice8 eq 1}
                                    <option value="8">{$smarty.const.SELL_BILL_PRICE8}</option>
                                    {/if}
                                    {if $Programsettingdata->showprice9 eq 1}
                                    <option value="9">{$smarty.const.SELL_BILL_PRICE9}</option>
                                    {/if}
                                    {if $Programsettingdata->showprice10 eq 1}
                                    <option value="10">{$smarty.const.SELL_BILL_PRICE10}</option>
                                    {/if}
                                    {if $Programsettingdata->showprice11 eq 1}
                                    <option value="11">{$smarty.const.SELL_BILL_PRICE11}</option>
                                    {/if}
                                    {if $Programsettingdata->showprice12 eq 1}
                                    <option value="12">{$smarty.const.SELL_BILL_PRICE12}</option>
                                    {/if}
                                    {if $Programsettingdata->showprice13 eq 1}
                                    <option value="13">{$smarty.const.SELL_BILL_PRICE13}</option>
                                    {/if}
                                </select>
                                <!--<span class="selectInvalidMsg">اختر المحافظة</span>-->
                            </span>

                        </div>
                    </div>
                    <!-- =================================================   -->
                    <div class="form-group" {if $Programsettingdata->simpleAddClientInBill neq
                        1}style="display:none"{/if}>
                        <label for="textDetails" class="col-lg-2 control-label">{$smarty.const.SELL_BILL_STORE}</label>
                        <div class="col-lg-3">
                            <label>
                                <input type="checkbox" class="ckstore" name="store_all" id="store_all" checked="checked"
                                       value="1" />
                                {$smarty.const.CLIENT_ALL_STORES}
                            </label>
                        </div>
                        {foreach $storeData as $data}
                        <div class="col-lg-3">
                            <label>
                                <input type="checkbox" class="clientStore ckstore" name="store{$data->storeId}"
                                       id="store{$data->storeId}" checked="checked" disabled="disabled" value="1" />
                                {$data->storeName}
                            </label>
                        </div>
                        {/foreach}
                    </div>
                    <!-- =================================================   -->
                    <div class="form-group" >
                        <label for="texttype"
                               class="col-lg-2 control-label">{$smarty.const.CLIENT_CUSTOMER_TYPE}</label>
                        <div class="col-lg-3">
                            <label>
                                <input type="checkbox" class="cktype" name="typeClient_all" id="typeClient_all"
                                        value="1" />
                                {$smarty.const.CLIENT_ALL_CUSTOMER_TYPE}
                            </label>
                        </div>
                        {foreach $typeClient as $data}
                        <div class="col-lg-3">
                            <label>
                                <input type="checkbox" class="typeClient cktype" name="type{$data->typeId}"
                                       id="type{$data->typeId}"  value="1" />
                                {$data->typeName}
                            </label>
                        </div>
                        {/foreach}
                    </div>
                    <!-- =================================================   -->
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default savemodel2"
                        data-dismiss="modal">{$smarty.const.CLIENT_NO}</button>
                <button type="button" class="btn btn-primary savemodel1">{$smarty.const.CLIENT_YES}</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->

<!------------------------Client Model----------------------------->
<!-- Modal -->
<div class="modal fade" id="myModalManyParcodes" 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">{$smarty.const.BARCODE_ADD_PRODUCTS_COMBINED_BARCODE}</h4>
            </div>
            <div class="modal-body">
                <form id="manyParcodesForm" action="sellbillController.php?do=addsellBillManyParcodes" method="post"
                      class="form-horizontal">
                    <div class="form-group">
                        <label for="debtLimit"
                               class="col-lg-3 control-label">{$smarty.const.BARCODE_COLLECTED_BARCODE}</label>
                        <div class="col-lg-9">
                            <textarea name="manyParcodes" class="form-control" style="background: url(http://i.imgur.com/2cOaJ.png);
                                      background-attachment: local;
                                      background-repeat: no-repeat;
                                      padding-left: 35px;
                                      padding-top: 10px;
                                      text-align: left !important;
                                      border-color:#ccc;
                                      direction: ltr;" id="manyParcodes" rows="5"></textarea>

                        </div>
                        <div id='hazemc'>1</div>
                    </div>
                    <input type="hidden" name="manyParcodesSupplier" id="manyParcodesSupplier" value="" />
                    <input type="hidden" name="manyParcodesPriceType" id="manyParcodesPriceType" value="" />
                    <input type="hidden" name="manyParcodesStoreid" id="manyParcodesStoreid" value="" />
                    <input type="hidden" name="manyParcodesSellerid" id="manyParcodesSellerid" value="" />
                    <input type="hidden" name="manyParcodesSaveid" id="manyParcodesSaveid" value="" />
                    <input type="hidden" name="addManyParcodesType" id="addManyParcodesType" value="" />
                    <input type="hidden" name="addManyParcodebillnameid" id="addManyParcodebillnameid" value="" />
                    <input type="hidden" name="addManyParcodebilloperationid" id="addManyParcodebilloperationid"
                           value="" />
                    <input type="hidden" name="addManyParcodebillCurrencyId" id="addManyParcodebillCurrencyId"
                           value="" />
                    <input type="hidden" name="addManyParcodebillCFactor" id="addManyParcodebillCFactor" value="" />
                    <input type="hidden" name="addManyParcodebillOtherCFactor" id="addManyParcodebillOtherCFactor"
                           value="" />
                    <input type="hidden" name="addManyParcodeobgyBillType" id="addManyParcodeobgyBillType" value="" />
                    <input type="hidden" name="addManyParcodeknownwayId" id="addManyParcodeknownwayId" value="" />
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default savemodel2"
                        data-dismiss="modal">{$smarty.const.BARCODE_CANCEL}</button>
                <button type="button" class="btn btn-primary"
                        id="doAddManyParcodes">{$smarty.const.BARCODE_COMPLETED}</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">{$smarty.const.PRODUCT_DETAILS}</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">{$smarty.const.PRODUCT_CLOSE}</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->

<!------------------------Client Model----------------------------->
<!-- Modal -->
<div class="modal fade" id="oldAutoSaveBillDataModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-dialog" style="width: 85%;">
        <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="oldAutoSaveBillDataForm" class="form-horizontal">

                </form>
                <form id="oldAutoSaveBillActionForm">
                    <div class="form-group">
                        <label class="col-lg-1 control-label">المطلوب </label>
                        <div class="radio-inline">
                            <label> <input value="1" name="autoSaveOldBillAction" id="autoSaveOldBillAction0"
                                           type="radio" checked>
                                استخدام منتجات الفاتورة الحاليه والغاء السابقه</label>
                        </div>
                        <br />
                        <label class="col-lg-1 control-label"></label>
                        <div class="radio-inline">
                            <label> <input value="2" name="autoSaveOldBillAction" id="autoSaveOldBillAction1"
                                           type="radio">
                                استخدام منتجات الفاتورة السابقه والغاء الحالية</label>
                        </div>
                        <br />
                        <label class="col-lg-1 control-label"></label>
                        <div class="radio-inline">
                            <label> <input value="3" name="autoSaveOldBillAction" id="autoSaveOldBillAction2"
                                           type="radio">
                                دمج منتجات كلا الفاتورتين</label>
                        </div>
                    </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 autoSaveOldBillActionBtn">متابعه</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">{$smarty.const.PRODUCT_ADD_PRODUCT}</h4>
            </div>
            <div class="productForm">
                <div class="modal-body ">
                    {literal}
                    <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;
                            }">
                        {/literal}
                        <div class="form-group">
                            <label for="productCatId"
                                   class="col-lg-2 control-label">{$smarty.const.PRODUCT_MAIN_CLASSIFICATION}</label>
                            <div class="col-lg-4"><span id="spryselect1">
                                    <input type="hidden" name="productAddMultiCatLevel" id="productAddMultiCatLevel"
                                           value="1" />
                                    <select name="productCatId" id="productCatId0" data-level="0"
                                            class="select2 wdt100 productCat">
                                        <option value="-1">{$smarty.const.PRODUCT_CHOOSE_RATING}</option>
                                        {foreach $catDataReport as $data}
                                        <option value="{$data->productCatId}">{$data->productCatName}</option>
                                        {/foreach}
                                    </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>
                        <!---------------------------->

                        <input name="hide_precentage" id="hide_precentage" type="hidden"
                               value="{$Programsettingdata->precentages}" />
                        <input name="hide_realprice" id="hide_realprice" type="hidden"
                               value="{$Programsettingdata->realprice}" />

                        <div class="form-group">
                            <label for="productName" class="col-lg-2 control-label">{$smarty.const.PRODUCT_NAME}</label>
                            <div class="col-lg-4"> <span id="sprytextfield1">
                                    <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>{$smarty.const.CLIENT_WRONG_MESSAGE}</h4>
                                    <p>{$smarty.const.CLIENT_THAT_NAME_ALREADY_TAKEN}</p>
                                    <div class="clearfix"></div>
                                </div>
                            </div>
                        </div>
                        <!---------------------------->

                        <div class="form-group check_tr " {if {$Programsettingdata->parcode} eq 1} style="display:none;"
                            {/if} >
                            <label for="parcode"
                                   class="col-lg-2 control-label">{$smarty.const.SELL_BILL_BARCODE}</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">{$smarty.const.PRODUCT_PURCHASING_PRICE}</label>
                            <div class="col-lg-4"> <span id="sprytextfield5">
                                    <input name="productBuyPrice" type="text" id="productBuyPrice1"
                                           class="numberinput positivefloat buy_price form-control" data-id="1"
                                           size="50" />
                                    <span class="textfieldRequiredMsg">*</span><span
                                        class="textfieldInvalidFormatMsg">{$smarty.const.PRODUCT_ENTER_CORRECT_PRICE}</span></span>
                            </div>
                        </div>
                        <!---------------------------->


                        <div class="form-group" style="{if {$Programsettingdata->realprice} eq 1} display: none; {/if}">
                            <label for="productBuyPrice"
                                   class="col-lg-2 control-label">{$smarty.const.PRODUCT_ACTUAL_PURCHASR_PRICE}</label>
                            <div class="col-lg-4"> <span id="sprytextfield5">
                                    <input style="width: 50%;float: left;" name="productbuypricereal" type="text"
                                           id="buypricereal1" data-type="pricereal"
                                           class="form-control prices  aw_m aw_mt aw_pp numberclic enteraction  numberinput positivefloat buy_pricereal1"
                                           data-id="1" width="10" /></span>
                                <input style="  width: 50%;" name="buypricereal_precentage1" type="text"
                                       id="productBuyPrice1" data-type="pricereal"
                                       class="form-control precentages  aw_m aw_mt aw_pp numberclic enteraction  numberinput positivefloat buypricereal_precentage1"
                                       data-id="1" width="10" />
                                <span class="textfieldRequiredMsg">*</span><span
                                    class="textfieldInvalidFormatMsg">{$smarty.const.PRODUCT_ENTER_CORRECT_PRICE}</span></span>
                            </div>
                        </div>
                        <!---------------------------->
                        <div class="form-group">
                            <label for="productSellAllPrice"
                                   class="col-lg-2 control-label">{$smarty.const.PRODUCT_WHOLESALE_PRICE}</label>
                            <div class="col-lg-4"> <span id="sprytextfield6">
                                    <!--<input name="productSellAllPrice" type="text" id="productSellAllPrice" class="numberinput form-control" onkeyup="populateSellPrice();"  size="50"   />-->
                                    <input
                                        style="{if {$Programsettingdata->precentages} eq 1} width: 100%; {else} width: 50%; {/if} float: left;"
                                        name="productSellAllPrice" type="text" id="productSellAllPrice"
                                        data-type="buytotal"
                                        class="form-control prices aw_m aw_mt aw_pp numberclic positivefloat buy_total1 enteraction numberinput"
                                        data-id="1" width="10" />
                                    <input
                                        style="{if {$Programsettingdata->precentages} eq 1} display: none; {/if}  width: 50%;"
                                        name="buytotal_precentage1" type="text" id="productBuyPrice1"
                                        data-type="buytotal"
                                        class="form-control  aw_m aw_mt aw_pp numberclic enteraction precentages numberinput positivefloat buytotal_precentage1"
                                        data-id="1" width="10" />
                                    <span class="textfieldRequiredMsg">*</span><span
                                        class="textfieldInvalidFormatMsg">{$smarty.const.PRODUCT_ENTER_CORRECT_PRICE}</span></span>
                            </div>
                        </div>
                        <!---------------------------->

                        <div class="form-group">
                            <!--<label for="productSellHalfPrice" class="col-lg-2 control-label">سعر بيع الجمله التجزئة</label>-->
                            <label for="productSellHalfPrice"
                                   class="col-lg-2 control-label">{$smarty.const.PRODUCT_HALF_WHOLESALE_PRICE} </label>
                            <div class="col-lg-4"> <span id="sprytextfield7">
                                    <!--<input name="productSellHalfPrice" type="text" id="productSellHalfPrice" class=" form-control numberinput"   size="50"   />-->
                                    <input
                                        style="{if {$Programsettingdata->precentages} eq 1} width: 100%; {else} width: 50%; {/if}float: left;"
                                        name="productSellHalfPrice" type="text" data-type="buyhalf"
                                        id="productSellHalfPrice"
                                        class="form-control  aw_m aw_mt aw_pp numberclic prices enteraction numberinput positivefloat buy_hafe1"
                                        data-id="1" width="10" />
                                    <input
                                        style=" {if {$Programsettingdata->precentages} eq 1} display: none; {/if} width: 50%;"
                                        name="buyhalf_precentage1" type="text" id="productBuyPrice1" data-type="buyhalf"
                                        class="form-control  aw_m aw_mt aw_pp numberclic enteraction  precentages numberinput positivefloat buyhafe_precentage1"
                                        data-id="1" width="10" />
                                    <span class="textfieldRequiredMsg">*</span><span
                                        class="textfieldInvalidFormatMsg">{$smarty.const.PRODUCT_ENTER_CORRECT_PRICE}</span></span>
                            </div>
                        </div>
                        <!---------------------------->

                        <div class="form-group">
                            <!--<label for="productSellUnitPrice" class="col-lg-2 control-label">سعر بيع الوحده</label>-->
                            <label for="productSellUnitPrice"
                                   class="col-lg-2 control-label">{$smarty.const.PRODUCT_RETAIL_PRICE}</label>
                            <div class="col-lg-4"> <span id="sprytextfield8">
                                    <!--<input name="productSellUnitPrice" type="text" id="productSellUnitPrice" class=" form-control numberinput"  size="50"   />-->
                                    <input
                                        style="{if {$Programsettingdata->precentages} eq 1} width: 100%; {else} width: 50%; {/if} float: left;"
                                        name="productSellUnitPrice" type="text" data-type="buypart"
                                        id="productSellUnitPrice"
                                        class="form-control  aw_m aw_mt aw_pp numberclic prices enteraction numberinput positivefloat buy_part1"
                                        data-id="1" width="20" />
                                    <input
                                        style=" {if {$Programsettingdata->precentages} eq 1} display: none; {/if} width: 50%;"
                                        name="buypart_precentage1" type="text" id="productBuyPrice1" data-type="buypart"
                                        class="form-control  aw_m aw_mt aw_pp numberclic enteraction precentages numberinput positivefloat buypart_precentage1"
                                        data-id="1" width="10" />
                                    <span class="textfieldRequiredMsg">*</span><span
                                        class="textfieldInvalidFormatMsg">{$smarty.const.PRODUCT_ENTER_CORRECT_PRICE}</span></span>
                            </div>
                        </div>
                        <!---------------------------->

                        <div class="form-group">
                            <label for="inputEmail1"
                                   class="col-lg-2 control-label">{$smarty.const.PRODUCT_QUANTITY}</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">{$smarty.const.PRODUCT_ENTER_CORRECT_QUANTITY}</span></span>
                            </div>
                        </div>

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

                        <div class="form-group check_tr_limitamount " {if {$Programsettingdata->limitamount} eq 1}
                            style="display:none;" {/if}>
                            <label for="limitamount"
                                   class="col-lg-2 control-label">{$smarty.const.PRODUCT_MAXIMUM}</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">{$smarty.const.PRODUCT_ENTER_CORRECT_QUANTITY}</span></span>
                            </div>
                        </div>



                        <!---------------------------->
                        <div class="form-group ">
                            <label for="inputEmail1"
                                   class="col-lg-2 control-label">{$smarty.const.PRODUCT_IN_MENU}</label>
                            <div class="col-lg-4">



                                <label>
                                    <input value="0" class="radioR" name="inMenu1" checked="checked" type="radio" />

                                    {$smarty.const.CLIENT_YES} </label>

                                <label>
                                    <input value="1" class="noradioR" name="inMenu1" type="radio" />
                                    {$smarty.const.CLIENT_NO} </label>



                            </div>
                        </div>
                        <!---------------------------->
                        <div class="form-group check_tr_production " {if {$Programsettingdata->production} eq 1}
                            style="display:none;" {/if}>
                            <label for="inputEmail1"
                                   class="col-lg-2 control-label">{$smarty.const.PRODUCT_MANUFACTURING}</label>
                            <div class="col-lg-4">



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

                                    {$smarty.const.CLIENT_YES} </label>

                                <label>
                                    <input value="0" class="noradioR" name="type1" checked="checked" type="radio" />
                                    {$smarty.const.CLIENT_NO} </label>



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


                        <div class="form-group check_tr_service " {if {$Programsettingdata->service} eq 1}
                            style="display:none;" {/if}>
                            <label for="inputEmail1"
                                   class="col-lg-2 control-label">{$smarty.const.PRODUCT_SERVICE}</label>
                            <div class="col-lg-4">

                                <label class='color-black'>
                                    <input value="1" class="radioR isservice" name="isservice1" type="radio" />
                                    {$smarty.const.CLIENT_YES} </label>

                                <label class='color-black'>
                                    <input value="0" class="noradioR isservice" name="isservice1" checked="checked"
                                           type="radio" />
                                    {$smarty.const.CLIENT_NO} </label>
                            </div>

                        </div>

                        <div class="form-group check_tr_date " {if {$Programsettingdata->date} eq 1}
                            style="display:none;" {/if}>
                            <label for="productDate" class="col-lg-2 control-label">{$smarty.const.PRODUCT_DATE}</label>
                            <div class="col-lg-4"> <span id="sprytextfield11">
                                    <input name="productDate" type="text" id="productDate" value="{$today}"
                                           class=" form-control awdatepicker" autocomplete="off"
                                           data-date-format="yyyy-mm-dd" size="50" />
                                    <span class="textfieldRequiredMsg">*</span></span></div>
                        </div>
                        <!---------------------------->

                        <div class="form-group check_tr_period " {if {$Programsettingdata->expiredate} eq 1}
                            style="display:none;" {/if}>
                            <label for="productDate"
                                   class="col-lg-2 control-label">{$smarty.const.PRODUCT_EXPIRY_PERIOD}</label>
                            <div class="col-lg-4"> <span id="sprytextfield11">
                                    <input style="width: 83%;" name="expireDate" type="text" id="expireDate" value="0"
                                           class=" form-control numberinput" size="50" />
                                    <span
                                        style="float: left;margin-top: -27px; color: white;font-size: 15px;font-weight: bold;">{$smarty.const.PRODUCT_DAY}</span>
                                    <span class="textfieldRequiredMsg">*</span></span></div>
                        </div>
                        <!--------------------------------  adding units   ----------------------------->

                        <div class="row check_tr_mesurunit " {if {$Programsettingdata->measuringunit} eq 1}
                            style="display:none;" {/if}>
                            <div class="row">
                                <hr />
                                <div class="col-lg-6">
                                    <h4>{$smarty.const.PRODUCT_MEASUREMENT_UNITS}</h4>
                                </div>
                                <div class="col-lg-6">
                                    <button type="button" name="addrawUnit" id="addrawUnit"
                                            class="btn btn-primary pull-left ft-nor">{$smarty.const.PRODUCT_ADD_UNITS}
                                    </button>
                                </div>
                            </div>
                            <!-- end of title row-->
                            <div class="table-responsive">
                                <table class="table billtable table-bordered" id="containerUnit">
                                    <thead>
                                        <tr>
                                            <th class="wdt120">{$smarty.const.PRODUCT_MEASRUING_UNITS}</th>
                                            <th class="wdt120">{$smarty.const.PRODUCT_NUMBER_UNITS}</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">




                                                    {foreach $unitsData as $unit}


                                                    <option value="{$unit->unitId}">{$unit->unitName}</option>


                                                    {/foreach}


                                                </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">{$smarty.const.CLIENT_NO}</button>
                    <button type="submit" class="btn btn-primary">{$smarty.const.CLIENT_YES}</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>
                <span style="font-weight:bold">{$smarty.const.STORE_QUANTITY_AVAILABLE_STOCK}</span>
            </div>
            <div class="modal-body"> {$smarty.const.STORE_ENOUGH_QUANTITY_STOCK}<br />
                {$smarty.const.STORE_QUANTITY_STOCK}<span id="errorquantity"></span> </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default"
                        data-dismiss="modal">{$smarty.const.PRODUCT_CLOSE}</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<input type="hidden" id="allowBillDelete" value="{$Usergroupdata->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">{$smarty.const.PERMISSION_DELETE}</h4>
            </div>
            <div class="modal-body">
                <form id="clientInfo2" action="#" method="post" class="form-horizontal">
                    <div class="form-group">
                        <label for="newclientName"
                               class="col-lg-4 control-label">{$smarty.const.PERMISSION_PASSWORD_CONTINUE}</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">{$smarty.const.BARCODE_CANCEL}</button>
                <button type="button" class="btn btn-primary"
                        id="ckPassDel">{$smarty.const.PERMISSION_CONTINUE}</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<!-- ======================= accountstree Modal Box =========== -->
<!-- Modal -->
<div class="modal fade" id="drinkDetailsModal" tabindex="-1" role="dialog" aria-labelledby="drinkDetailsModalLabel"
     aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content bg-modal">
            <div class="modal-header">
                <button type="button" class="close pull-left" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">
                    <label>تفاصيل </label>
                </h4>
            </div>
            <div class="modal-body">
                <form id="drinkDetailsInfo" action="#" method="post" class="form-horizontal">

                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default closeAccountsTreeForm" id="cancel"
                        data-dismiss="modal">اغلاق</button>
                <button type="button" id="insert" class="btn btn-primary saveDrinkDetails">حفظ</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->

<!------------------------Client Model----------------------------->
<!-- Modal -->
<div class="modal fade" id="fillPriceOfferModal" 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">{$smarty.const.SELL_BILL_OFFER_FILL}</h4>
            </div>
            <div class="modal-body" id="offersModalDiv">

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default savemodel2" data-dismiss="modal">إغلاق</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<!-- ============================================= -->
<form id="tempForm" class="hidden"></form>
{literal}
<script type="text/javascript">
    var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "real");
    var billReservationDatesp = null;
    if ($('#billsettingsData_80').val() == "0") {
        var sprytextfield12 = new Spry.Widget.ValidationTextField("sprytextfield12", "real");
    }
    $('#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');
        }
    });
    $('#typeClient_all').live('click', function () {
        if ($(this).attr('checked') == 'checked') {
            $('.typeClient').attr('checked', 'checked');
            $('.typeClient').attr('disabled', 'disabled');
        } else {
            $('.typeClient').removeAttr('checked');
            $('.typeClient').removeAttr('disabled');
        }
    });
    $('#billReservation').live('change', function () {
        if ($('#billReservation').is(':checked')) {
            billReservationDatesp = new Spry.Widget.ValidationTextField("billReservationDatesp");
        } else {
            billReservationDatesp.resetClasses(); //.reset();   //Resets any validation css on the form
            billReservationDatesp.destroy();
            billReservationDatesp = null;
        }
    });
    /* -----------------------------------------------------------------------*/
    $('#billTemplatesId').live('change', function (e) {
        var template = $(this).val();
        var billnameid = $('#billnameid').val();
        $.ajax({
            type: 'POST',
            url: 'sellbillAjaxController.php?do=getTemplateProducts',
            data: {template: template, billnameid: billnameid},
            async: false,
            success: function (data) {
                if (data != "") {
                    $('#manyParcodes').html(data);
                    //$('#myModalManyParcodes').modal('show');
                    $('#doAddManyParcodes').click();
                }
            }
        });
    });
    /* -----------------------------------------------------------------------*/


    /* -----------------------------------------------------------------------*/
    //for save bill in restaurant
    $('.drinkDetails').live('click', function (e) {
        e.preventDefault();
        e.stopPropagation();
        var itr = $(this).attr('data-itr');
        var productId = $('#product' + itr).val();
        var quantity = $('#pronum' + itr).val();

        saveDrinkDetails(productId, 'bill', itr, quantity);

    });
    function saveDrinkDetails(productId, tableId, itr, quantity) {
        $.ajax({
            type: 'POST',
            url: 'sellbillAjaxController.php?do=saveDrinkDetails',
            data: {productId: productId, tableId: tableId, itr: itr, quantity: quantity},
            async: false,
            success: function (data) {
                if (data != "") {
                    $('#drinkDetailsInfo').html(data);
                    $('#drinkDetailsModal').modal('show');
                }
            }
        });
    }
    $('.saveDrinkDetails').live('click', function (e) {
        e.preventDefault();
        if ($('#drinkDetailsInfo').valid()) {
            var notes = $('#notes').val();
            var quantity = Number($('#quantity').val());
            var printedQuantity = Number($('#printedQuantity').val());
            var thisItr = Number($('#thisItr').val());
            var total = 0;
            var totalStr = '';
            var totalAsNote = '';
            $('.drinkDetailsClass').each(function () {
                var val = Number($(this).val());

                var thisId = $(this).attr('id');
                total += val;
                switch (thisId) {
                    case 'sugarPlusPlus':
                        if (val != 0) {
                            totalStr += val + ' زيادة عالى ';
                        }
                        totalAsNote += val + ',';
                        break;
                    case 'sugarPlus':
                        if (val != 0) {
                            totalStr += val + ' زيادة ';
                        }
                        totalAsNote += val + ',';
                        break;
                    case 'mano':
                        if (val != 0) {
                            totalStr += val + ' مانو ';
                        }
                        totalAsNote += val + ',';
                        break;
                    case 'sugarExact':
                        if (val != 0) {
                            totalStr += val + ' مظبوط ';
                        }
                        totalAsNote += val + ',';
                        break;
                    case 'sugarMinus':
                        if (val != 0) {
                            totalStr += val + ' عالريحه ';
                        }
                        totalAsNote += val + ',';
                        break;
                    case 'sugarNo':
                        if (val != 0) {
                            totalStr += val + ' ساده ';
                        }
                        totalAsNote += val + ',';
                        break;
                }
            });
            totalStr = totalStr.slice(0, -1);
            totalAsNote = totalAsNote.slice(0, -1);
            if (total != quantity) {
                alert('عفوا لم تدخل تفاصيل كل الطلبات');
            } else {
                $('#notes' + thisItr).html(totalStr);
                $('#hiddenNotes' + thisItr).val(totalAsNote);
                $('#drinkDetailsModal').modal('hide');
            }

        }
    });
    /*-----------------------------------------------------------*/
    //plugin bootstrap minus and plus
    //https://bootsnipp.com/snippets/featured/buttons-minus-and-plus-in-input

    $('.btn-number').live('click', function (e) {
        e.preventDefault();

        fieldName = $(this).attr('data-field');
        type = $(this).attr('data-type');
        var input = $("input[name='" + fieldName + "']");
        var currentVal = parseInt(input.val());
        if (!isNaN(currentVal)) {
            if (type == 'minus') {

                if (currentVal > input.attr('min')) {
                    input.val(currentVal - 1).change();
                }
                if (parseInt(input.val()) == input.attr('min')) {
                    $(this).attr('disabled', true);
                }

            } else if (type == 'plus') {

                if (currentVal < input.attr('max')) {
                    input.val(currentVal + 1).change();
                }
                if (parseInt(input.val()) == input.attr('max')) {
                    $(this).attr('disabled', true);
                }

            }
        } else {
            input.val(0);
        }
    });
    $('.input-number').live('focusin', function (e) {
        $(this).data('oldValue', $(this).val());
    });
    $('.input-number').live('change', function (e) {

        minValue = parseInt($(this).attr('min'));
        maxValue = parseInt($(this).attr('max'));
        valueCurrent = parseInt($(this).val());

        name = $(this).attr('name');
        if (valueCurrent >= minValue) {
            $(".btn-number[data-type='minus'][data-field='" + name + "']").removeAttr('disabled')
        } else {
            alert('عفوا وصلت للحد الادنى');
            $(this).val($(this).data('oldValue'));
        }
        if (valueCurrent <= maxValue) {
            $(".btn-number[data-type='plus'][data-field='" + name + "']").removeAttr('disabled')
        } else {
            alert('عفوا وصلت للحد الاقصى');
            $(this).val($(this).data('oldValue'));
        }


    });

    /* -----------------------------------------------------------------------*/
    $('.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(mitr, itr);

            }
        });
    });


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

    });

    $('.removeellbilldetailtax').live('click', function (e) {
        var mitr = $(this).attr('data-mitr');
        var itr = $(this).attr('data-itr');
        var edit = Number($(this).attr('data-edit'));
        var id = Number($(this).attr('data-id'));
        if (edit == 1 && id) {
            $.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 product = Number($('#product' + mitr).val());
        if (product < 1) {
            $('#ebillclient' + mitr).modal('hide');
        } else {
            $('#ebillclient' + mitr).modal('show');
            var eTaxsubtype = $("#eTaxsubtype_" + mitr + '_1').val();
            if (!eTaxsubtype) {
                Taxes(mitr, 1);
            }

            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();
            }

        }
    });
    $('.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);

    }
    ;
    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()});
    }
    ;


    $('.input-number').live('keydown', function (e) {
        // Allow: backspace, delete, tab, escape, enter and .
        if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 190]) !== -1 ||
                // Allow: Ctrl+A
                        (e.keyCode == 65 && e.ctrlKey === true) ||
                        // Allow: home, end, left, right
                                (e.keyCode >= 35 && e.keyCode <= 39)) {
                    // let it happen, don't do anything
                    return;
                }
                // Ensure that it is a number and stop the keypress
                if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
                    e.preventDefault();
                }
            });
    /*-----------------------------------------------------------*/
</script>
{/literal}


<!--{literal}
<script type="text/javascript">
    /*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");*/

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