<input type="hidden" id="changeBuyPriceChangeSellInProductCtrl" value="{$Programsettingdata->changeBuyPriceChangeSellInProductCtrl}"/>
<input type="hidden" id="newBuyPrice" value="{$newBuyPrice}"/>
<input type="hidden" name="productIdForPrices" id="productIdForPrices" value="{$productsData->productId}"/>
<table id="product_Table"  class="table table-black">
    <tr>
        <td colspan="2">الإسم</td>

        <td >سعر الشراء القديم</td>
        <td >سعر الشراء الجدبد</td>
        <td  class="hidden">سعر الشراء الفعلى</td>
        <td>سعر الجمله</td>
        <td >سعر  نصف الجمله </td>
        <td>سعر التجزئة</td>
    </tr>
    <tr>
        <td  colspan="2"><textarea disabled name="productName1" id="productName1" class="form-control" rows="2">{$productsData->productName}</textarea></td>
        <td><input data-id="1" name="oldproductBuyPrice1" disabled type="text" id="oldproductBuyPrice1" class="form-control wd50 aw_m aw_mt aw_pp numberclic"  value="{$productsData->productBuyPrice}" /></td>
        <td><span id="sprytextfield1">
                <input name="productBuyPrice1" data-id="1" type="text" id="productBuyPrice1" class="form-control newBuyPrice wd50 aw_m aw_mt aw_pp numberclic buy_price numberinput"  value="{$productsData->productBuyPrice}" />
                <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل رقم</span></span></td>
        <td class="hidden"><span id="sprytextfield1">
                <input style="width: 50%;float: left;" name="productbuypricereal1" value="{$productsData->productbuypricereal}" type="text" id="buypricereal1"  data-type="pricereal"  class="form-control prices  aw_m aw_mt aw_pp numberclic  numberinput positivefloat buy_pricereal1" data-id="1" width="10"/></span>
            <input style="  width: 50%;"  name="buypricereal_precentage1"  value="{$productsData->buypricereal_precentage}" type="text" id="productBuyPrice1" data-type="pricereal"  class="form-control precentages  aw_m aw_mt aw_pp numberclic  numberinput positivefloat buypricereal_precentage1" data-id="1" width="10" />

            <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل رقم</span></span></td>
        <td><span id="sprytextfield2">
                <input name="productSellAllPrice1" type="text" id="productSellAllPrice" data-type="buytotal"  class="form-control prices aw_m aw_mt aw_pp numberclic positivefloat buy_total1 numberinput" value="{$productsData->productSellAllPrice}" data-id="1" width="10"/>
                <input name="buytotal_precentage1" type="text"  value="{$productsData->buytotal_precentage}" id="productBuyPrice1"   data-type="buytotal" class="form-control hidden aw_m aw_mt aw_pp numberclic precentages 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" data-type="buyhalf" id="productSellHalfPrice" value="{$productsData->productSellHalfPrice}"   class="form-control  aw_m aw_mt aw_pp numberclic prices numberinput positivefloat buy_hafe1" data-id="1" width="10"/>
                <input  name="buyhalf_precentage1" type="text" id="productBuyPrice1"  value="{$productsData->buyhalf_precentage}"   data-type="buyhalf" class="form-control hidden aw_m aw_mt aw_pp numberclic  precentages 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" data-type="buypart"  id="productSellUnitPrice"  class="form-control  aw_m aw_mt aw_pp numberclic prices enteraction numberinput positivefloat buy_part1"   value="{$productsData->productSellUnitPrice}" data-id="1"  width="20"/>
                <input  name="buypart_precentage1" type="text" id="productBuyPrice1" data-type="buypart"   value="{$productsData->buypart_precentage}"    class="form-control hidden 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">أدخل رقم</span></span></td>
    </tr>
    <tr>
        <td colspan="10"><!--------------------------------  adding units   ----------------------------->

            <div id="addUnitsDiv1" class="{if {$Programsettingdata->measuringunit} eq 1} hidden {/if}">
                <div class="table-responsive">
                    <table id="unitsTable1"  class="table table-black" >
                        {assign var=j value=1}
                        {foreach $productUnitsData as $proUnit}
                        <tr>
                            <td>
                                <div>
                                    <label class="control-label">وحدة القياس</label>
                                    <!--<select name="productunit1_disabled{$j}" id="productunit1_disabled{$j}" disabled="disabled" data-placeholder="اختر" class="select2 wdt100 aw_m1 chosenproduct"  tabindex="12">-->
                                    <!--<option value="-1">اختر وحدة القياس</option>-->
                                    {foreach $unitsData as $unit}
                                    <!--<option value="{$unit->unitId}" {if $proUnit->unitid eq $unit->unitId}selected{/if}>{$unit->unitName}</option>-->
                                    {if $proUnit->unitid eq $unit->unitId}{$unit->unitName}{/if}
                                    {/foreach}
                                    <!--</select>-->
                                    <input name="productunit1{$j}" id="productunit1{$j}" type="hidden" value="{$proUnit->unitid}" />
                                    <input name="productunitid{$j}" id="productunitid{$j}" type="hidden" value="{$proUnit->productunitid}" />
                                </div>
                            </td>
                            <td>
                                <div>
                                    <label class="control-label">عدد الوحدات</label>
                                    <input name="productnumber1{$j}" readonly="readonly"  id="productnumber1{$j}" type="text" value="{$proUnit->productnumber}" class="form-control"/>
                                </div>
                            </td>
                            <td>
                                <div>
                                    <label class="control-label">الباركود</label>
                                    <input disabled name="proUnitParcode1{$j}" id="proUnitParcode1{$j}" type="text" class="form-control numberinput positiveNo" value="{$proUnit->proUnitParcode}" data-unit-itr="1{$j}" data-unitid-itr="{$j}" onblur="checkUnitbarcodewithid(this.value, $(this).data('unitid-itr'), $(this).data('unit-itr'));"/>
                                </div>
                            </td>
                            <td>
                                <div>
                                    <label class="control-label">سعر الشراء</label>
                                    <input name="proUnitBuyPrice1{$j}" id="proUnitBuyPrice1{$j}" type="text" class="form-control positivefloat" value="{$proUnit->proUnitBuyPrice}"/>
                                </div>
                            </td>
                            <td>
                                <div>
                                    <label class="control-label">سعر الجملة</label>
                                    <input name="proUnitSellAllPrice1{$j}" id="proUnitSellAllPrice1{$j}" type="text" class="form-control positivefloat" value="{$proUnit->proUnitSellAllPrice}"/>
                                </div>
                            </td>
                            <td>
                                <div>
                                    <label class="control-label">سعر نص جملة</label>
                                    <input name="proUnitSellHalfPrice1{$j}" id="proUnitSellHalfPrice1{$j}" type="text" class="form-control positivefloat" value="{$proUnit->proUnitSellHalfPrice}"/>
                                </div>
                            </td>
                            <td>
                                <div>
                                    <label class="control-label">سعر قطاعى</label>
                                    <input name="proUnitSellUnitPrice1{$j}" id="proUnitSellUnitPrice1{$j}" type="text" class="form-control positivefloat" value="{$proUnit->proUnitSellUnitPrice}"/>
                                </div>
                            </td>
                        </tr>
                        {capture assign=j}{$j+1}{/capture}
                        {/foreach}
                    </table>
                </div>
                <!--end unitsTable-->
            </div>
            <input name="unitsItr1" id="unitsItr1" type="hidden" value="{$countProductUnits}" />

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

            <input name="productItr" id="productItr" type="hidden" value="1" />
        </td>
    </tr>
</table>

<script>
    //$('#productBuyPrice1').val($('#newBuyPrice').val()).keyup();
    $('.newBuyPrice').val($('#newBuyPrice').val());
</script>