<?php /* Smarty version Smarty-3.1.11, created on 2023-10-10 14:39:38
         compiled from "../views/default/productview/edit.html" */ ?>
<?php /*%%SmartyHeaderCode:86373733165253105342ca0-93491617%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '1fd12e484a1673b03a9064a698efa80d03effc71' => 
    array (
      0 => '../views/default/productview/edit.html',
      1 => 1696937850,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '86373733165253105342ca0-93491617',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_6525310565d8b2_53515808',
  'variables' => 
  array (
    'Programsettingdata' => 0,
    'productsData' => 0,
    'alldata' => 0,
    'data' => 0,
    'myhtml' => 0,
    'vehicletypes' => 0,
    'vehicle' => 0,
    'companyproduces' => 0,
    'company' => 0,
    'productUnitsData' => 0,
    'j' => 0,
    'unitsData' => 0,
    'unit' => 0,
    'proUnit' => 0,
    'countProductUnits' => 0,
    'isCollective' => 0,
    'noOfRows' => 0,
    'Productionrateproduct' => 0,
    'i' => 0,
    'x' => 0,
    'rows' => 0,
    'material' => 0,
    'y' => 0,
    'myUnit' => 0,
    'allSizeColor' => 0,
    'sizeColorStoreDetail' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_6525310565d8b2_53515808')) {function content_6525310565d8b2_53515808($_smarty_tpl) {?>
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">المنتجات</a></li>
            <li><a href="#">المنتجات </a></li>
            <li class="active">تعديل منتج</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">
                <h3 class="panel-title">تعديل منتج</h3>
            </div>
            <div class="panel-body">
                <input type="hidden" id="searchvalue" value="0"/>
                <input type="hidden" id="changeBuyPriceChangeSellInProductCtrl" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->changeBuyPriceChangeSellInProductCtrl;?>
"/>
                <input type="hidden" id="productBuyPrice1Old" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->productBuyPrice;?>
" />
                
                <form class="nameToBeChecked form-horizontal" id="productEditForm" action="productController.php?do=update"  method="post" enctype="multipart/form-data"
                      onsubmit="
                              if ($('#productName1').val() == '') {
                                  return false;
                              }
                              //                        if (checkNameWithId(event, 'product', 'productName1', 'productId')) {
                              //                            return true;
                              //                        } else {
                              //                            return false;
                              //                        }
                      ">
                    <!--validate the form before checking name-->
                    
                    <input type="hidden" id="ebillsetting" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->ebill;?>
">
                    <input name="productId" id="productId" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->productId;?>
" />
                    <input name="level" id="level" type="hidden" value="1" />
                    <input name="productCatId0" id="productCatId0" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->productCatId;?>
" />

                    <div class="form-group">
                        <label class="col-lg-2 control-label">تصنيف المنتج</label>
                        <div class="col-lg-4"> <span id="spryselect1">
                                <select name="productCatId" data-placeholder="" class="select2 wdt100" tabindex="1">
                                    <option value="-1">اختر المنتج الرئيسي</option>
                                    <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['alldata']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                    <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->productCatId;?>
" <?php if ($_smarty_tpl->tpl_vars['productsData']->value->productCatId==$_smarty_tpl->tpl_vars['data']->value->productCatId){?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['data']->value->productCatName;?>
</option>
                                    <?php } ?>
                                </select>
                                <span class="selectInvalidMsg">اختر تصنيف</span><span class="selectRequiredMsg">اختر تصنيف</span></span> </div>
                    </div>
                    <a class="btn pull-left btn-primary " id="reCalcUnitPrices"><u>تعديل اسعار الوحدات</u></a>
                    <input type="hidden" name="dailyentryid" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->dailyentryid;?>
"/>

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

                    <table id="product_Table"  class="table table-black">
                        <tr>
                            <td colspan="2">الإسم</td>

                            <td >سعر الشراء</td>
                            <td >الخصم المرجح</td>
                            <td >سعر الشراء الفعلى</td>
                            <td>سعر الجمله</td>
                            <td >سعر  نصف الجمله </td>
                            <td>سعر التجزئة</td>
                        </tr>
                        <tr >

                            <td  colspan="2"><span id="sprytextfield7">


                                    <!--<input name="productName1" type="text" id="productName1" size="9" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->productName;?>
" class="form-control" onchange="checkProductNameForEdit($('#productName1').val(), $('#productId').val(), $('#productCatId0').val())"/>-->
                                    <textarea name="productName1" id="productName1" class="form-control" onchange="checkProductNameForEdit($('#productName1').val(), $('#productId').val(), $('#productCatId0').val())" rows="2"><?php echo $_smarty_tpl->tpl_vars['productsData']->value->productName;?>
</textarea>
                                    <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>
                                    <p>هذا الاسم مستخدم من قبل</p>
                                    <div class="clearfix"></div>
                                </div>
                            </td>

                            <td><span id="sprytextfield1">
                                    <input name="productBuyPrice1" data-id="1" type="text" id="productBuyPrice1" class="form-control wd50 aw_m aw_mt aw_pp numberclic buy_price enteraction numberinput"  value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->productBuyPrice;?>
" />
                                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل رقم</span></span></td>
                            <td><span id="sprytextfield1">
                                    <input name="weightedDiscount1" disabled data-id="1" type="text" id="weightedDiscount1" class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput"  value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->weightedDiscount;?>
" />
                                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل رقم</span></span></td>
                            <td><span id="sprytextfield1">
                                    <input style="width: 50%;float: left;" name="productbuypricereal1" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->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"  value="<?php echo floatval($_smarty_tpl->tpl_vars['productsData']->value->buypricereal_precentage);?>
" type="text" id="productBuyPrice1" data-type="pricereal" tabindex="-1"  readonly class="form-control precentages success  aw_m aw_mt aw_pp numberclic enteraction  numberinput positivefloat buypricereal_precentage1" data-id="1" width="10" />

                                <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل رقم</span></span></td>
                            <td><span id="sprytextfield2">
                                    <input style="width: 50%;float: left;" name="productSellAllPrice1" type="text" id="productSellAllPrice" data-type="buytotal"  class="form-control prices aw_m aw_mt aw_pp numberclic positivefloat buy_total1 enteraction numberinput" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->productSellAllPrice;?>
" data-id="1" width="10"/>
                                    <input style="  width: 50%;"  name="buytotal_precentage1" type="text"  value="<?php echo floatval($_smarty_tpl->tpl_vars['productsData']->value->buytotal_precentage);?>
" id="productBuyPrice1"   data-type="buytotal" tabindex="-1"  readonly class="form-control  aw_m aw_mt aw_pp numberclic enteraction precentages success numberinput positivefloat buytotal_precentage1" data-id="1" width="10"/>
                                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل رقم</span></span></td>
                            <td><span id="sprytextfield3">
                                    <!--<input name="productSellHalfPrice1"   type="text" id="productSellHalfPrice1"  class="form-control wd50 aw_m aw_mt aw_pp numberclic buy_hafe1 enteraction numberinput"  value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->productSellHalfPrice;?>
" />-->
                                    <input  style="width: 50%;float: left;"  name="productSellHalfPrice1" type="text" data-type="buyhalf" id="productSellHalfPrice" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->productSellHalfPrice;?>
"   class="form-control  aw_m aw_mt aw_pp numberclic prices enteraction numberinput positivefloat buy_hafe1" data-id="1" width="10"/>
                                    <input style="  width: 50%;"  name="buyhalf_precentage1" type="text" id="productBuyPrice1"  value="<?php echo floatval($_smarty_tpl->tpl_vars['productsData']->value->buyhalf_precentage);?>
"   data-type="buyhalf" tabindex="-1"  readonly class="form-control  aw_m aw_mt aw_pp numberclic enteraction  precentages success numberinput positivefloat buyhafe_precentage1" data-id="1" width="10"/>

                                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل رقم</span></span></td>
                            <td><span id="sprytextfield4">
                                    <!--<input name="productSellUnitPrice1"   type="text" id="productSellUnitPrice1" class="form-control wd50 aw_m aw_mt aw_pp numberclic buy_part1 enteraction numberinput"   value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->productSellUnitPrice;?>
"/>-->
                                    <input  style="width: 50%;float: left;" name="productSellUnitPrice1" type="text" data-type="buypart"  id="productSellUnitPrice"  class="form-control  aw_m aw_mt aw_pp numberclic prices enteraction numberinput positivefloat buy_part1"   value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->productSellUnitPrice;?>
" data-id="1"  width="20"/>
                                    <input style="  width: 50%;"  name="buypart_precentage1" type="text" id="productBuyPrice1" data-type="buypart"   value="<?php echo floatval($_smarty_tpl->tpl_vars['productsData']->value->buypart_precentage);?>
" tabindex="-1"  readonly class="form-control  aw_m aw_mt aw_pp numberclic enteraction precentages success numberinput positivefloat buypart_precentage1" data-id="1" width="10"/>
                                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل رقم</span></span></td>
                        </tr>
                        <tr>
                            <td class=" check_tr <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->parcode;?>
<?php $_tmp1=ob_get_clean();?><?php if ($_tmp1==1){?> hidden <?php }?>">الباركود</td>
                            <td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->expiredate;?>
<?php $_tmp2=ob_get_clean();?><?php if ($_tmp2==1){?> hidden <?php }?>> مدة الصلاحية</td>
                            <td >الكمية</td>
                            <td class="<?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->date;?>
<?php $_tmp3=ob_get_clean();?><?php if ($_tmp3==1){?> hidden <?php }?>">التاريخ</td>
                            <td  class=" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->limitamount;?>
<?php $_tmp4=ob_get_clean();?><?php if ($_tmp4==1){?> hidden <?php }?>">الحد الأدنى للمنتج</td>
                            <td class="<?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->isCaf!=1&&$_smarty_tpl->tpl_vars['Programsettingdata']->value->isRestaurent!=1){?> hidden <?php }?>">فى المنيو</td>
                            <td>إخفاء</td>
                        </tr>
                        <tr>
                            <td class=" check_tr <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->parcode;?>
<?php $_tmp5=ob_get_clean();?><?php if ($_tmp5==1){?> hidden <?php }?>">
                                <input name="parcode1" type="text" required id="parcode1" size="9" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->parcode;?>
" class="form-control" onblur="checkbarcodewithid(this.value, 1);"/>
                            </td>
                            <td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->expiredate;?>
<?php $_tmp6=ob_get_clean();?><?php if ($_tmp6==1){?> hidden <?php }?>><input name="expireDate1" type="text" required  id="expireDate1" size="9" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->expireDate;?>
" style="width: 71%;"> <span style="float: left;margin-top: -27px; color: white;font-size: 15px;font-weight: bold;">يوم</span></td>
                            <td><span id="sprytextfield5">
                                    <input name="productquantity1" readonly="readonly"  type="text" id="productquantity1" class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->sumProductQuantity;?>
"/>
                                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل رقم</span></span></td>
                            <td  class="<?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->date;?>
<?php $_tmp7=ob_get_clean();?><?php if ($_tmp7==1){?> hidden <?php }?>">
                                <input name="productDate1"  type="text" id="productDate1" size="9"  value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->productDate;?>
" required class="form-control awdatepicker" autocomplete="off"  data-date-format="yyyy-mm-dd"/>
                            </td>
                            <td class=" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->limitamount;?>
<?php $_tmp8=ob_get_clean();?><?php if ($_tmp8==1){?> hidden <?php }?>"><span id="sprytextfield6">
                                    <input name="limitamount1"   type="text" id="limitamount1" class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->limitamount;?>
"/>
                                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل رقم</span></span></td>
                            <td class="<?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->isCaf!=1&&$_smarty_tpl->tpl_vars['Programsettingdata']->value->isRestaurent!=1){?> hidden <?php }?>">
                                <div class="form-group">
                                    <div class="col-lg-12">
                                        <div class="radio-inline">
                                            <label>
                                                <input value="0"  class="radioR" name="inMenu1"   type="radio"  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['productsData']->value->inMenu;?>
<?php $_tmp9=ob_get_clean();?><?php if ($_tmp9==0){?> checked="checked"  <?php }?> />

                                                نعم </label>
                                        </div>
                                        <div class="radio-inline">
                                            <label>
                                                <input value="1"  class="noradioR" name="inMenu1"   type="radio" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['productsData']->value->inMenu;?>
<?php $_tmp10=ob_get_clean();?><?php if ($_tmp10==1){?> checked="checked"  <?php }?> />
                                                لا </label>
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="form-group">
                                    <div class="col-lg-12">
                                        <div class="radio-inline">
                                            <input name="conditions" type="radio" value="1" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['productsData']->value->conditions;?>
<?php $_tmp11=ob_get_clean();?><?php if ($_tmp11==1){?> checked="checked" <?php }?> />
                                            نعم
                                            </label>
                                        </div>
                                        <div class="radio-inline">
                                            <label>
                                                <input name="conditions" type="radio" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['productsData']->value->conditions;?>
<?php $_tmp12=ob_get_clean();?><?php if ($_tmp12==0){?> checked="checked" <?php }?> value="0" />
                                                لا</label>
                                        </div>
                                    </div>
                                </div>
                            </td>
                        </tr>

                        <tr>
                            <td>متوسط سعر الشراء</td>
                            <td>متوسط سعر الشراء مع الخصم</td>
                            <td>متوسط سعر الشراء شامل القيمة المضافة</td>
                            <td>المتوسط العام</td>
                            <td>اخر سعر شراء</td>
                            <td>اخر سعر شراء مع الخصم</td>
                            <td>اخر سعر شراء شامل القيمة المضافة</td>
                        </tr>
                        <tr>
                            <td>
                                <input name="meanbuyprice1"  type="text" id="meanbuyprice1" class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->meanbuyprice;?>
"/>
                            </td>
                            <td>
                                <input name="meanbuyprice_withDiscount1"  type="text" id="meanbuyprice_withDiscount1" class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->meanbuyprice_withDiscount;?>
"/>
                            </td>
                            <td>
                                <input name="meanbuyprice_withTax1"  type="text" id="meanbuyprice_withTax1" class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->meanbuyprice_withTax;?>
"/>
                            </td>
                            <td>
                                <input name="overAllAveragePrice1" type="text" id="overAllAveragePrice1" class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->overAllAveragePrice;?>
"/>
                            </td>
                            <td>
                                <input name="lastbuyprice1" type="text" id="lastbuyprice1" class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->lastbuyprice;?>
"/>
                            </td>
                            <td>
                                <input name="lastbuyprice_withDiscount1" type="text" id="lastbuyprice_withDiscount1" class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->lastbuyprice_withDiscount;?>
"/>
                            </td>
                            <td>
                                <input name="lastbuyprice_withTax1" type="text" id="lastbuyprice_withTax1" class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->lastbuyprice_withTax;?>
"/>
                            </td>
                        </tr>
                        <tr>
                            <td   colspan="3" class="check_tr_description <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->description;?>
<?php $_tmp13=ob_get_clean();?><?php if ($_tmp13==1){?> hidden <?php }?>">التعليق</td>
                            <td>خدمة</td>
                            <td class=" check_tr_production <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->production;?>
<?php $_tmp14=ob_get_clean();?><?php if ($_tmp14==1){?> hidden <?php }?>">تصنيع</td>
                            <td class=" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->ebill;?>
<?php $_tmp15=ob_get_clean();?><?php if ($_tmp15!=1){?> hidden <?php }?>">نوع الباركود الضريبى</td>
                            <td class=" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->ebill;?>
<?php $_tmp16=ob_get_clean();?><?php if ($_tmp16!=1){?> hidden <?php }?>">الباركود الضريبى</td>
                        </tr>
                        <tr>
                            <td   colspan="3" class=" check_tr_description <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->description;?>
<?php $_tmp17=ob_get_clean();?><?php if ($_tmp17==1){?> hidden <?php }?>">
                                <textarea name="productDescription1" id="productDescription1" cols="20" rows="5" class="form-control"><?php echo $_smarty_tpl->tpl_vars['productsData']->value->productDescription;?>
</textarea>
                            </td>
                            <td>
                                <div class="form-group">
                                    <div class="col-lg-12">
                                        <div class="radio-inline">
                                            <label>
                                                <input value="1"  class="radioR" name="isService"   type="radio"  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['productsData']->value->isService;?>
<?php $_tmp18=ob_get_clean();?><?php if ($_tmp18==1){?> checked="checked"  <?php }?> />

                                                نعم </label>
                                        </div>
                                        <div class="radio-inline">
                                            <label>
                                                <input value="0"  class="noradioR" name="isService"   type="radio" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['productsData']->value->isService;?>
<?php $_tmp19=ob_get_clean();?><?php if ($_tmp19==0){?> checked="checked"  <?php }?> />
                                                لا </label>
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td class=" check_tr_production <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->production;?>
<?php $_tmp20=ob_get_clean();?><?php if ($_tmp20==1){?> hidden <?php }?>">
                                <div class="form-group">
                                    <div class="col-lg-12">
                                        <div class="radio-inline">
                                            <label>
                                                <input value="1"  class="radioR" name="type"   type="radio"  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['productsData']->value->type;?>
<?php $_tmp21=ob_get_clean();?><?php if ($_tmp21==1){?> checked="checked"  <?php }?> />

                                                نعم </label>
                                        </div>
                                        <div class="radio-inline">
                                            <label>
                                                <input value="0"  class="noradioR" name="type"   type="radio" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['productsData']->value->type;?>
<?php $_tmp22=ob_get_clean();?><?php if ($_tmp22==0){?> checked="checked"  <?php }?> />
                                                لا </label>
                                        </div>
                                    </div>
                                </div>
                            </td>

                            <td class=" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->ebill;?>
<?php $_tmp23=ob_get_clean();?><?php if ($_tmp23!=1){?> hidden <?php }?>">

                                <div class="form-group">
                                    <div class="col-lg-12">
                                        <div class="radio-inline">
                                            <label>
                                                <input value="GS1" class="noradioR" name="TypeOfBarcodeInTax" type="radio" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['productsData']->value->TypeOfBarcodeInTax;?>
<?php $_tmp24=ob_get_clean();?><?php if ($_tmp24=='GS1'){?> checked="checked"  <?php }?> />
                                                GS1 </label>
                                        </div>

                                        <div class="radio-inline">
                                            <label>
                                                <input value="EGS"  class="radioR" name="TypeOfBarcodeInTax"   type="radio"  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['productsData']->value->TypeOfBarcodeInTax;?>
<?php $_tmp25=ob_get_clean();?><?php if ($_tmp25=='EGS'){?> checked="checked"  <?php }?> />

                                                EGS </label>
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td class=" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->ebill;?>
<?php $_tmp26=ob_get_clean();?><?php if ($_tmp26!=1){?> hidden <?php }?>">

                                <input name="barcodeInTax" type="text" id="barcodeInTax" class="form-control" autocomplete="off" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->barcodeInTax;?>
">
                            </td>

                        </tr>
                        <tr>
                            <td   colspan="3">صورة</td>
                            <td  colspan="3">حساب الشجرة</td>
                        </tr>
                        <tr>
                            <td   colspan="3">
                                <?php if ($_smarty_tpl->tpl_vars['productsData']->value->logo!=''&&$_smarty_tpl->tpl_vars['productsData']->value->logo!="."){?><img src="../views/default/images/product_image/<?php echo $_smarty_tpl->tpl_vars['productsData']->value->logo;?>
" alt="" width="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->displayWidth;?>
" height="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->displayHeight;?>
" style="cursor: pointer;" onclick="window.open($(this).attr('src'))" / > <?php }?>
                                <input type="file" name="logo" id="logo" class="form-control" placeholder="صورة" />
                                <input type="hidden" name="oldlogo" id="oldlogo"  value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->logo;?>
" /></td>
                            <td  colspan="3">
                                <select class="select2" name="treeId" id="treeId">
                                    <?php echo $_smarty_tpl->tpl_vars['myhtml']->value;?>

                                </select>
                            </td>
                        </tr>

                        <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->importproduct==1){?>
                        <tr >
                            <td colspan="1">E الإسم</td>
                            <td colspan="1">كود</td>
                            <td colspan="1">رقم القطعة</td>
                            <td colspan="1">نوع السياره</td>
                            <td colspan="2">الشركه المنتجه للصنف    </td>
                            <td colspan="1">وزن</td>
                            <td colspan="1">منشأ</td>
                            <td colspan="1">رمز النظام المنسق</td>
                            <td colspan="1">صلاحيه</td>
                            <td colspan="1" class="power1">تاريخ الانتاج</td>
                            <td colspan="1" class="power1">مدة الصلاحيه</td>


                        </tr>
                        <tr>

                            <td colspan="1">
                                <input name="productNameE1" type="text" id="productNameE1" width="100%"   class="form-control" data-itra="1" data-id="1"  value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->partNumber;?>
">
                            </td>
                            <td colspan="1">
                                <input name="procode1"  type="text" id="procode1" width="100%"   class="form-control" data-itra="1" data-id="1" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->procode;?>
">
                            </td>
                            <td colspan="1">
                                <input name="partNumber1"  type="text" id="partNumber1" width="100%"   class="form-control positivefloat" data-itra="1" data-id="1"  value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->partNumber;?>
">
                            </td>
                            <td colspan="1">
                                <select name="vehicleType1" id="vehicleType1"  class="select2 wdt100 vehicleType" >
                                    <option value="-1">اختر</option>
                                    <?php  $_smarty_tpl->tpl_vars['vehicle'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['vehicle']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['vehicletypes']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['vehicle']->key => $_smarty_tpl->tpl_vars['vehicle']->value){
$_smarty_tpl->tpl_vars['vehicle']->_loop = true;
?>
                                    <option value="<?php echo $_smarty_tpl->tpl_vars['vehicle']->value->id;?>
" <?php if ($_smarty_tpl->tpl_vars['productsData']->value->vehicleType==$_smarty_tpl->tpl_vars['vehicle']->value->id){?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['vehicle']->value->typename;?>
</option>
                                    <?php } ?>
                                </select>


                            </td>
                            <td colspan="2">
                                <select name="company1" id="company1"  class="select2 wdt100 vehicleType" data-id="1" data-itra="1" >
                                    <option value="-1">اختر</option>
                                    <?php  $_smarty_tpl->tpl_vars['company'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['company']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['companyproduces']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['company']->key => $_smarty_tpl->tpl_vars['company']->value){
$_smarty_tpl->tpl_vars['company']->_loop = true;
?>
                                    <option value="<?php echo $_smarty_tpl->tpl_vars['company']->value->id;?>
" <?php if ($_smarty_tpl->tpl_vars['productsData']->value->company==$_smarty_tpl->tpl_vars['company']->value->id){?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['company']->value->companyname;?>
</option>
                                    <?php } ?>
                                </select>
                            </td>
                            <td colspan="1">
                                <input name="weight1" type="text" id="weight1" width="100%"   class="form-control positivefloat" data-itra="1" data-id="1"  value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->weight;?>
">
                            </td>
                            <td colspan="1">
                                <input name="origin1" type="text" id="origin1" width="100%"   class="form-control" data-itra="1" data-id="1"  value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->origin;?>
">
                            </td>
                            <td colspan="1">
                                <input name="hscode1" type="text" id="hscode1" width="100%"   class="form-control positivefloat" data-itra="1" data-id="1"  value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->hscode;?>
">
                            </td>
                            <td colspan="1">
                                <div class="form-group" style="font-size:13px">
                                    <label class='color-black'>
                                        <input value="0"  class="power" data-itra="1" name="power1" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['productsData']->value->power;?>
<?php $_tmp27=ob_get_clean();?><?php if ($_tmp27==0){?> checked="checked"  <?php }?>   type="radio"  data-id="1"/>
                                        نعم </label>

                                    <label class='color-black'>
                                        <input value="1"  class="power"  data-itra="1" name="power1" type="radio" data-id="1" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['productsData']->value->power;?>
<?php $_tmp28=ob_get_clean();?><?php if ($_tmp28==1){?> checked="checked"  <?php }?> />
                                        لا </label>
                                </div>
                            </td>
                            <td colspan="1" class="power1">
                                <input name="ProductionDate1" type="text" id="ProductionDate1" width="100%"   class="form-control awdatepicker" data-date-format="yyyy-mm-dd"  data-itra="1" data-id="1"  value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->ProductionDate;?>
">
                            </td>
                            <td colspan="1" class="power1">
                                <input name="expiry1"  type="text" id="expiry1" width="100%"   class="form-control positivefloat" data-itra="1" data-id="1"  value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->expiry;?>
">
                            </td>
                        </tr>
                        <?php }?>
                        <tr>
                            <td colspan="10"><!--------------------------------  adding units   ----------------------------->

                                <div id="addUnitsDiv1" class="<?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->measuringunit;?>
<?php $_tmp29=ob_get_clean();?><?php if ($_tmp29==1){?> hidden <?php }?>">
                                    <div class="table-responsive">
                                        <table id="unitsTable1"  class="table table-black" >
                                            <?php $_smarty_tpl->tpl_vars['j'] = new Smarty_variable(1, null, 0);?>
                                            <?php  $_smarty_tpl->tpl_vars['proUnit'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['proUnit']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['productUnitsData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['proUnit']->key => $_smarty_tpl->tpl_vars['proUnit']->value){
$_smarty_tpl->tpl_vars['proUnit']->_loop = true;
?>
                                            <tr>
                                                <td>
                                                    <div>
                                                        <label class="control-label">وحدة القياس</label>
                                                        <select name="productunit1_disabled<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" id="productunit1_disabled<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" disabled="disabled" data-placeholder="اختر" class="select2 wdt100 aw_m1 chosenproduct"  tabindex="12">
                                                            <option value="-1">اختر وحدة القياس</option>


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

                                                            <?php } ?>


                                                        </select>
                                                        <input name="productunit1<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" id="productunit1<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['proUnit']->value->unitid;?>
" />
                                                        <input name="productunitid<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" id="productunitid<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['proUnit']->value->productunitid;?>
" />
                                                    </div>
                                                </td>
                                                <td>
                                                    <div>
                                                        <label class="control-label">عدد الوحدات</label>
                                                        <input name="productnumber1<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" readonly="readonly"  id="productnumber1<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" type="text" value="<?php echo $_smarty_tpl->tpl_vars['proUnit']->value->productnumber;?>
" class="form-control"/>
                                                    </div>
                                                </td>
                                                <td class=" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->ebill;?>
<?php $_tmp30=ob_get_clean();?><?php if ($_tmp30!=1){?> hidden <?php }?>">
                                                    <div>
                                                        <label class="control-label"> وحدة القياس الضريبية </label>
                                                        <input name="unitInTax1<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
"  id="unitInTax1<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" class="unitInTaxClass" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['proUnit']->value->unitInTax;?>
" data-old="<?php echo $_smarty_tpl->tpl_vars['proUnit']->value->unitInTax;?>
"/>
                                                    </div>
                                                </td>
                                                <td>
                                                    <div>
                                                        <label class="control-label">الباركود</label>
                                                        <input name="proUnitParcode1<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" id="proUnitParcode1<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" type="text" class="form-control numberinput positiveNo" value="<?php echo $_smarty_tpl->tpl_vars['proUnit']->value->proUnitParcode;?>
" data-unit-itr="1<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" data-unitid-itr="<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" onblur="checkUnitbarcodewithid(this.value, $(this).data('unitid-itr'), $(this).data('unit-itr'));"/>
                                                    </div>
                                                </td>
                                                <td>
                                                    <div>
                                                        <label class="control-label">سعر الشراء</label>
                                                        <input name="proUnitBuyPrice1<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" id="proUnitBuyPrice1<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" type="text" class="form-control positivefloat" value="<?php echo $_smarty_tpl->tpl_vars['proUnit']->value->proUnitBuyPrice;?>
"/>
                                                    </div>
                                                </td>
                                                <td>
                                                    <div>
                                                        <label class="control-label">سعر الجملة</label>
                                                        <input name="proUnitSellAllPrice1<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" id="proUnitSellAllPrice1<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" type="text" class="form-control positivefloat" value="<?php echo $_smarty_tpl->tpl_vars['proUnit']->value->proUnitSellAllPrice;?>
"/>
                                                    </div>
                                                </td>
                                                <td>
                                                    <div>
                                                        <label class="control-label">سعر نص جملة</label>
                                                        <input name="proUnitSellHalfPrice1<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" id="proUnitSellHalfPrice1<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" type="text" class="form-control positivefloat" value="<?php echo $_smarty_tpl->tpl_vars['proUnit']->value->proUnitSellHalfPrice;?>
"/>
                                                    </div>
                                                </td>
                                                <td>
                                                    <div>
                                                        <label class="control-label">سعر قطاعى</label>
                                                        <input name="proUnitSellUnitPrice1<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" id="proUnitSellUnitPrice1<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
" type="text" class="form-control positivefloat" value="<?php echo $_smarty_tpl->tpl_vars['proUnit']->value->proUnitSellUnitPrice;?>
"/>
                                                    </div>
                                                </td>
                                                <td><a id="remove1<?php echo $_smarty_tpl->tpl_vars['j']->value;?>
"  onclick="removeUnits(1, <?php echo $_smarty_tpl->tpl_vars['j']->value;?>
);" class="removeUnits">X</a></td>
                                            </tr>
                                            <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'j', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['j']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                            <?php } ?>
                                        </table>
                                    </div>
                                    <!--end unitsTable-->
                                    </                            div>
                                    <input                            class="addUnits btn btn-warning  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->measuringunit;?>
<?php $_tmp31=ob_get_clean();?><?php if ($_tmp31==1){?> hidden <?php }?>" onClick="addUnits(1);" type="button"  value="إضافة وحدة قياس"/>
                                    <input name="unitsItr1" id="unitsItr1" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['countProductUnits']->value;?>
" />

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

                                    <input name="productItr" id="productItr" type="hidden" value="1" />
                            </td>
                        </tr>
                        <?php if ($_smarty_tpl->tpl_vars['isCollective']->value==1){?>
                        <tr>
                            <td colspan="10"><!--------------------------------  adding units   ----------------------------->
                                <input type="hidden" name="searchvalue" id="searchvalue" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->searchvalue;?>
"/>
                                <div class="panel panel-default panel-m">
                                    <div class="panel-heading">
                                        <h3 class="panel-title">المكونات</h3>
                                        <input type="hidden" name="isCollective" id="isCollective" value="1"/>
                                    </div>
                                    <div class="panel-body">
                                        <div class="row">
                                            <input type="hidden" name="rowitr" id="rowitr" value="<?php echo $_smarty_tpl->tpl_vars['noOfRows']->value;?>
" />
                                            <input type="hidden" name="notRawMaterialsOnly" id="notRawMaterialsOnly" value="1"/>
                                            <div class="col-lg-12">
                                                <button type="button" name="addrow" id="addrow" class="btn btn-primary pull-left ft-nor"> اضافة </button>
                                                <button type="button" style="display:none;" name="addrow" id="addrow" class="btn btn-primary pull-left ft-nor" onclick="addrow();"> اضافة جديد</button>
                                            </div>

                                        </div>
                                        <table class="table billtable table-bordered table-black col-lg-4" id="table">
                                            <thead>
                                                <tr>
                                                    <th class="wdt400">المنتجات الخام</th>
                                                    <th  class="wdt200"><span class="sr-only">وحدة القياس</span></th>
                                                    <!--<th  class="wdt200">نسبة المشاركة </th>-->
                                                    <th  class="wdt200" >عدد الوحدات</th>
                                                    <th class="wdt200">حذف</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);?>
                                                <?php $_smarty_tpl->tpl_vars['y'] = new Smarty_variable(1, null, 0);?>
                                                <?php  $_smarty_tpl->tpl_vars['x'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['x']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['Productionrateproduct']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['x']->key => $_smarty_tpl->tpl_vars['x']->value){
$_smarty_tpl->tpl_vars['x']->_loop = true;
?>
                                                <tr>
                                                    <td ><input type="hidden" name="productionRateProductId<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="productionRateProductId<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
"  value="<?php echo $_smarty_tpl->tpl_vars['x']->value->productionRateProductId;?>
"/>

                                                        <!--  <input type="hidden"  class="select2RawMaterials wdt300" name="product<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="product<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" data-placeholder=" اختر منتج خام"  />-->

                                                        <!--               <input type="hidden"   name="oldproduct<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="oldproduct<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['x']->value->productId;?>
"  />
                                                                                          <input type="hidden"   name="oldproductname<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="oldproductname<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['x']->value->productName;?>
"  />-->

                                                        <select class="select2 wdt300" name="product<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="product<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" >


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

                                                                    <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['material']->value->productId;?>
<?php $_tmp32=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['x']->value->ingridientId;?>
<?php $_tmp33=ob_get_clean();?><?php if ($_tmp32==$_tmp33){?>selected="selected"<?php }?> ><?php echo $_smarty_tpl->tpl_vars['material']->value->productName;?>
</option>
                                                            <?php } ?>


                                                        </select>
                                                    </td>
                                                    <td>
                                                        <div id="unitDiv<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
">
                                                            <select name="unitId<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="unitId<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" class="select2 wdt300">
                                                                <?php  $_smarty_tpl->tpl_vars['myUnit'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['myUnit']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['productUnitData'.($_smarty_tpl->tpl_vars['y']->value)]->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['myUnit']->key => $_smarty_tpl->tpl_vars['myUnit']->value){
$_smarty_tpl->tpl_vars['myUnit']->_loop = true;
?>
                                                                <option value="<?php echo $_smarty_tpl->tpl_vars['myUnit']->value->productunitid;?>
" data-pronum="<?php echo $_smarty_tpl->tpl_vars['myUnit']->value->productnumber;?>
"
                                                                        <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['myUnit']->value->productunitid;?>
<?php $_tmp34=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['x']->value->unitId;?>
<?php $_tmp35=ob_get_clean();?><?php if ($_tmp34==$_tmp35){?>selected="selected"<?php }?>

                                                                    ><?php echo $_smarty_tpl->tpl_vars['myUnit']->value->unitName;?>
</option>

                                                                <?php } ?>
                                                            </select>
                                                            <input type="hidden" name="productBuyPrice<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="productBuyPrice<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['x']->value->productBuyPrice;?>
"/>
                                                            <input type="hidden" name="lastbuyprice<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="lastbuyprice<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['x']->value->lastbuyprice;?>
"/>
                                                            <input type="hidden" name="lastbuyprice_withDiscount<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="lastbuyprice_withDiscount<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['x']->value->lastbuyprice_withDiscount;?>
"/>
                                                            <input type="hidden" name="meanbuyprice<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="meanbuyprice<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['x']->value->meanbuyprice;?>
"/>
                                                            <input type="hidden" name="meanbuyprice_withDiscount<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="meanbuyprice_withDiscount<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['x']->value->meanbuyprice_withDiscount;?>
"/>
                                                        </div>

                                                        <!--<input type="hidden"   name="oldUnit<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="oldUnit<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['x']->value->unitId;?>
"  />
                                                                            <input type="hidden"   name="oldUnitName<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="oldUnitName<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['x']->value->unitName;?>
"  /> -->
                                                    </td>
                                                    <!--                                    <td><div id="table">
                                                                                                <input type="text" name="input<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="input<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
"  class="form-control check" value="<?php echo $_smarty_tpl->tpl_vars['x']->value->rate;?>
" tabindex=""  />
                                                                                            </div></td>-->
                                                    <td><div id="table">
                                                            <input  name="inputt<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="inputt<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
"  class="form-control positive" value="<?php echo $_smarty_tpl->tpl_vars['x']->value->quantity;?>
" tabindex="" />
                                                        </div></td>
                                                    <td id="<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
">
                                                        <button id="remove<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" name="remove<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" type="button" class="close flt-none removeicon removeproduct"  aria-hidden="true" onclick="removerow();">&times;</button>
                                                    </td>
                                                </tr>
                                                <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'i', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['i']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'y', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['y']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                                                <?php } ?>
                                            </tbody>
                                        </table>
                                        <p>&nbsp; </p>
                                        <div>
                                            <!--h4><u>حساب تكلفة المنتج من المكونات</u></h4-->
                                            <button type="button" class="btn btn-primary ft-nor"> التكلفة بسعر الشراء
                                                <span class="badge wht-clo"><div id="productBuyPrice"><?php echo $_smarty_tpl->tpl_vars['productsData']->value->productBuyPrice;?>
</div></span></button>
                                            &nbsp;
                                            <button type="button" class="btn btn-primary ft-nor"> التكلفة باخر سعر شراء
                                                <span class="badge wht-clo"><div id="lastbuyprice"><?php echo $_smarty_tpl->tpl_vars['productsData']->value->lastbuyprice;?>
</div></span></button>
                                            &nbsp;
                                            <button type="button" class="btn btn-primary ft-nor"> التكلفة باخر سعر شراء مع الخصم
                                                <span class="badge wht-clo"><div id="lastbuyprice_withDiscount"><?php echo $_smarty_tpl->tpl_vars['productsData']->value->lastbuyprice_withDiscount;?>
</div></span></button>
                                            &nbsp;
                                            <button type="button" class="btn btn-primary ft-nor"> التكلفة بمتوسط سعر الشراء
                                                <span class="badge wht-clo"><div id="meanbuyprice"><?php echo $_smarty_tpl->tpl_vars['productsData']->value->meanbuyprice;?>
</div></span></button>
                                            &nbsp;
                                            <button type="button" class="btn btn-primary ft-nor"> التكلفة بمتوسط سعر الشراء مع الخصم
                                                <span class="badge wht-clo"><div id="meanbuyprice_withDiscount"><?php echo $_smarty_tpl->tpl_vars['productsData']->value->meanbuyprice_withDiscount;?>
</div></span></button>

                                            <input type="hidden" name="productBuyPrice_h" id="productBuyPrice_h" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->productBuyPrice;?>
"/>
                                            <input type="hidden" name="lastbuyprice_h" id="lastbuyprice_h" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->lastbuyprice;?>
"/>
                                            <input type="hidden" name="lastbuyprice_withDiscount_h" id="lastbuyprice_withDiscount_h" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->lastbuyprice_withDiscount;?>
"/>
                                            <input type="hidden" name="meanbuyprice_h" id="meanbuyprice_h" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->meanbuyprice;?>
"/>
                                            <input type="hidden" name="meanbuyprice_withDiscount_h" id="meanbuyprice_withDiscount_h" value="<?php echo $_smarty_tpl->tpl_vars['productsData']->value->meanbuyprice_withDiscount;?>
"/>
                                        </div>
                                        <br/>
                                        <div class="clearfix"></div>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <?php }?>
                        <?php if ($_smarty_tpl->tpl_vars['productsData']->value->hasSizeAndColor==1){?>
                        <input name="hasSizeAndColor" type="hidden" value="1">
                        <tr>
                            <td colspan="10"><!--------------------------------  adding units   ----------------------------->
                                <div class="panel panel-default panel-m">
                                    <div class="panel-heading">
                                        <h3 class="panel-title">المقاسات والالوان</h3>
                                        <input type="hidden" name="isCollective" id="isCollective" value="1"/>
                                    </div>
                                    <div class="panel-body">
                                        <div class="row">
                                            <div class="col-lg-5" id="rightpart" style="display: inline">
                                                <label for="sizes" class="col-lg-4 control-label">المقاسات</label>
                                                <select class="select2" name="sizes[]" id="sizes" multiple="multiple">
                                                    <option value="-1">كل المقاسات</option>
                                                    <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allSizeColor']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                                    <?php if ($_smarty_tpl->tpl_vars['data']->value->type==0){?>
                                                    <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->name;?>
</option>
                                                    <?php }?>
                                                    <?php } ?>
                                                </select>
                                            </div>
                                            <div class="col-lg-5" id="leftpart" style="display: inline">
                                                <label for="colors" class="col-lg-4 control-label">الالوان</label>
                                                <select class="select2" name="colors[]" id="colors" multiple="multiple">
                                                    <option value="-1">كل الالوان</option>
                                                    <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allSizeColor']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                                    <?php if ($_smarty_tpl->tpl_vars['data']->value->type==1){?>
                                                    <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->name;?>
</option>
                                                    <?php }?>
                                                    <?php } ?>
                                                </select>
                                            </div>
                                            <div class="col-lg-2" id="leftpart" style="display: inline">
                                                <button type="button"  class="btn btn-success pull-left" style="margin-top: 3px;" id="SizeColorQuantity">ادخال الكميات للكل </button>
                                                <button type="button"  class="btn btn-success pull-left" style="margin-top: 5px;" id="SizeColorQuantity_onlyNew">اضافة للموجود </button>
                                            </div>


                                        </div>
                                        <div class="clearfix"></div>
                                        <br/>
                                        <div class="row" id="quantity_div">
                                            <table class="table">
                                                <thead>
                                                    <tr>
                                                        <th>الباركود</th>
                                                        <th>المقاس</th>
                                                        <th>اللون</th>
                                                        <th>حذف</th>
                                                    </tr>
                                                </thead>
                                                <tbody id="SizeColorTB">
                                                    <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);?>
                                                    <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['sizeColorStoreDetail']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                                    <tr>
                                                        <td>
                                                            <input type="hidden" name="sizecolorstoredetail_id<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="sizecolorstoredetail_id<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
">
                                                            <input type="hidden" name="size_detail<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="size_detail<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['data']->value->sizeid;?>
">
                                                            <input type="hidden" name="color_detail<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="color_detail<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['data']->value->colorid;?>
">

                                                            <input type="text" class="form-control" name="parcode_detail<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="parcode_detail<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['data']->value->parcode;?>
"></td>
                                                        <td><input type="text" class="form-control" readonly="" value="<?php echo $_smarty_tpl->tpl_vars['data']->value->sizeName;?>
"></td>
                                                        <td><input type="text" class="form-control" readonly="" value="<?php echo $_smarty_tpl->tpl_vars['data']->value->colorName;?>
"></td>
                                                        <td><a class="btn btn-default btn-lg removeicon removethis"></a></td>
                                                    </tr>
                                                    <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable($_smarty_tpl->tpl_vars['i']->value+1, null, 0);?>
                                                    <?php } ?>
                                                </tbody>
                                            </table>
                                            <input type="hidden" id="sizeColorItr" name="sizeColorItr" value="<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
"/>
                                        </div>
                                        <br/>
                                        <div class="clearfix"></div>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <?php }?>
                    </table>
                    <!--==============================-->

                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <button type="submit"  id="submit" class="btn btn-primary pull-left">تعديل</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div id="productUnitsDiv" style="display:none;">
            <option value="-1">اختر وحدة القياس</option>
            <?php  $_smarty_tpl->tpl_vars['unit'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['unit']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['unitsData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['unit']->key => $_smarty_tpl->tpl_vars['unit']->value){
$_smarty_tpl->tpl_vars['unit']->_loop = true;
?>
            <option value="<?php echo $_smarty_tpl->tpl_vars['unit']->value->unitId;?>
"><?php echo $_smarty_tpl->tpl_vars['unit']->value->unitName;?>
</option>
            <?php } ?> </div>
    </div>
</div>

<script type="text/javascript">
    var spryte                                   xtfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "real");
            var spry                                   textfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "real");
            var sp
    rytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "real");
    var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "real");
            va                                   r sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "integer");
    var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6", "integer");
    var sprytextfield7 = new Spry.Widget.ValidationTextField("sprytextfield7");
    var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {invalidValue: "-1"});
    $(function () {
        $('#reCalcUnitPrices').on('click', function () {
            $('[id^="productnumber"]').each(function () {
                var itr = $(this).attr('id').slice(13);
                var unitNum = Number($(this).val());
                var proUnitBuyPrice = unitNum * Number($('#productBuyPrice1').val());
                var proUnitSellAllPrice = unitNum * Number($('#productSellAllPrice').val());
                var proUnitSellHalfPrice = unitNum * Number($('#productSellHalfPrice').val());
                var proUnitSellUnitPrice = unitNum * Number($('#productSellUnitPrice').val());
                $('#proUnitBuyPrice' + itr).val(Number(proUnitBuyPrice.toFixed(3)));
                $('#proUnitSellAllPrice' + itr).val(Number(proUnitSellAllPrice.toFixed(3)));
                $('#proUnitSellHalfPrice' + itr).val(Number(proUnitSellHalfPrice.toFixed(3)));
                $('#proUnitSellUnitPrice' + itr).val(Number(proUnitSellUnitPrice.toFixed(3)));
            })
        })
        $('.unitInTaxClass').each(function () {
            var unitInTaxSelectID = $(this).attr('id');
            var old = $(this).data('old');
            $('#' + unitInTaxSelectID).select2({
                placeholder: "اختر",
                minimumInputLength: 0, // document.getElementById("searchvalue").value,
                multiple: false,
                quietMillis: 100,
                ajax: {
                    url: "eBillRequests.php?do=unit-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
            });
            $('#' + unitInTaxSelectID).select2("data", {id: old, text: old});
        });
    });


</script>
<?php }} ?>