<style>

</style>
<div id="addproduct" style="display:none"> {foreach $productData as $product}
    <option value="{$product->productid}">{$product->productName}</option>
    {/foreach}
</div>
<div id="imageClose" style="display:none"> <img alt="" src="{$path}/images/close.png" /> </div>
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">المخازن</a></li>
            <li><a href="storemovementController.php?do=show">التحويل بين المخازن</a></li>
            <li class="active">تعديل تحويل</li>
        </ol>
        <h3>تعديل تحويل بين المخازن</h3>
        <hr />
        <form class="form-horizontal " role="form"
            action="storemovementController.php?do=update&operationnum={$loadData[0]->operationnum}" method="post"
            id="sellbillForm">
            <div class="row">
                <input type="hidden" name="searchvalue" id="searchvalue" value="{$Programsettingdata->searchvalue}" />
                <!---onChange="loadStoreTo(this.value);"-->
                <input type="hidden" name="edit" id="edit" value="1" />
                <div class="{if $Programsettingdata->storeserial eq 0} hidden {/if}">
                    <div class="form-group">
                        <label class="col-lg-2 "> رقم ايصال التحويل</label>
                        <!--  <span style="margin-right: 23px;">
                        <input style="margin-bottom: 7px;" class="positiveNo" type="text" name="operationnum"
                            id="operationnum" value="{$loadData->operationnum}" {if $Programsettingdata->operationnumEdit ==
                        1}readonly{/if}/>  
                    </span>-->
                        <div class="col-lg-8">
                            <input type="hidden" name="operationnum" value="{$loadData[0]->operationnum}" />
                            {$loadData[0]->operationnum}
                        </div>
                    </div>

                </div>
                <div id="opNoError" style="display:none;"></div>
                <div class="form-group">
                    <label class="col-lg-2 control-label">من المخزن</label>
                    <div class="col-lg-8"> <span id="spryselect1">
                            <input type="hidden" name="storeidfrom" id="storeidfrom"
                                value="{$loadData[0]->storeidfrom}">
                            {$loadData[0]->storefromName}
                    </div>
                </div>
                <div class="form-group storeTo">
                    <label class="col-lg-2 control-label">إلى المخزن</label>
                    <div class="col-lg-8">
                        <input type="hidden" name="storeidto" id="storeidto" value="{$loadData[0]->storeidto}">
                        {$loadData[0]->storetoName}
                    </div>
                </div>
                <div class="form-group {if $usergroupdata->storeSupervisorShow == 0} hidden {/if}">
                    <label class="col-lg-2 control-label">التحويل </label>
                    <div class="col-lg-8">
                        {if $loadData[0]->recieveType eq 0}مباشر{else}عن طريق مخزن وسيط {/if}
                        <input value="{$loadData[0]->recieveType}" class="radioR" name="recieveType" type="hidden">
                    </div>
                </div>
                {if $Programsettingdata->workerbetweenstores == 0}
                <div class="form-group">
                    <label class="col-lg-2 control-label">السائق</label>
                    <div class="col-lg-8">
                        {$loadData[0]->employeename}
                        <input type="hidden" name="driver" value="{$loadData[0]->driverid}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-2 control-label">مدة انجاز السائق بالساعة</label>
                    <div class="col-lg-8">
                        {$loadData[0]->drivertimeout}
                        <input type="hidden" class="form-control positiveNo checkme" name="drivertimeout"
                            id="drivertimeout" value="{$loadData[0]->drivertimeout}">
                    </div>
                </div>
                {/if}
                <div class="form-group">
                    {$whatPrice}
                    <label class="col-lg-2 control-label">اظهر سعر </label>
                    <div class="col-lg-8">
                        {if $loadData[0]->priceType eq "productBuyPrice"}
                        <div class="radio-inline">
                            <label>
                                <input value="productBuyPrice" class="radioR whatPrice" name="whatPrice" id="whatPrice1"
                                    type="radio" checked="checked">
                                الشراء </label>
                        </div>
                        {elseif $loadData[0]->priceType eq "productSellAllPrice"}
                        <div class="radio-inline">
                            <label>
                                <input value="productSellAllPrice" class="radioR whatPrice" name="whatPrice"
                                    id="whatPrice2" type="radio" checked="checked">
                                جملة </label>
                        </div>
                        {elseif $loadData[0]->priceType eq "productSellHalfPrice"}
                        <div class="radio-inline">
                            <label>
                                <input value="productSellHalfPrice" class="radioR whatPrice" name="whatPrice"
                                    id="whatPrice3" type="radio" checked="checked">
                                نص جملة </label>
                        </div>
                        {elseif $loadData[0]->priceType eq "productSellUnitPrice"}
                        <div class="radio-inline">
                            <label>
                                <input value="productSellUnitPrice" class="radioR whatPrice" name="whatPrice"
                                    id="whatPrice4" type="radio" checked="checked">
                                قطاعى </label>
                        </div>
                        {else}
                        <div class="radio-inline">
                            <label>
                                <input value="hide" class="radioR whatPrice" name="whatPrice" id="whatPrice0"
                                    type="radio" checked="checked">
                                بدون </label>
                        </div>
                        {/if}

                    </div>
                </div>
                {if $loadData[0]->comment}
                <div class="form-group row">
                    <label class="col-lg-2 control-label">تعليق</label>
                    <div class="col-lg-4">
                        <textarea name="comment" id="comment" rows="3" readonly
                            class="form-control">{$loadData[0]->comment}</textarea>
                    </div>
                </div>
                {/if}
            </div>
            <!-- end of frist row-->
            <input name="storenegative" type="hidden" value="{$storenegative}" id="storenegative" />
            <div class="row">
                <div class="row">
                    <hr />
                    <div class="col-lg-6">
                        <h4>المنتجات</h4>
                    </div>
                    <div class="col-lg-6  hidden-print">
                        <button type="button" name="addpro" id="addpro" class="btn btn-primary pull-left ft-nor"> اضافة
                            جديد</button>
                    </div>
                </div>
                <!-- end of title row-->
                <div class="table-responsive">
                    <table class="table billtable table-bordered table-black " id="containerpros">
                        <thead>
                            <tr>
                                <th class="wdt200">رقم</th>
                                <th class="wdt120 check_tr {if {$Programsettingdata->parcode} eq 1} hidden {/if}">
                                    الباركود</th>
                                <th class="wdt400">اسم المنتج</th>
                                <th class="wdt200">الكمية الحالية</th>
                                <th class="wdt200">الكمية المحولة</th>
                                <th class="wdt200 pricesClass" {if $loadData[0]->priceType == "hide"}
                                    style="display:none" {/if}>السعر</th>
                                <th class="wdt200 pricesClass" {if $loadData[0]->priceType == "hide"}
                                    style="display:none" {/if}>السعر الاجمالي</th>
                                <th
                                    class="wdt200 ck_expireDate {if {$Programsettingdata->expiredate} eq 1}  hidden {/if}">
                                    ت الصلاحية</th>
                                <th class="wdt200 ck_comment">تعليق</th>
                                <th class="hidden-print">حذف</th>
                            </tr>
                        </thead>
                        <tbody>
                            {assign var=i value=1}
                            {assign var=x value=0}
                            {assign var=y value=0}
                            {assign var=dailyentryids value=""}
                            {foreach $loadData as $myloadData}
                            <tr>
                                <td>{$i}</td>
                                <td class=" check_tr {if {$Programsettingdata->parcode} eq 1} hidden {/if}">
                                    <input type="text" name="parcode{$i}" id="parcode{$i}" class="form-control parcode"
                                        value="{$myloadData->parcode}" />
                                </td>
                                <td>
                                    <div id="myproductselect">
                                        <input type="hidden" class="select2product wdt400 myproduct" data-itr="{$i}"
                                            name="product{$i}" id="product{$i}" data-placeholder="اختر منتج" />
                                        <input type="hidden" name="oldproductname{$i}" id="oldproductname{$i}"
                                            value="{$myloadData->productName} / {$myloadData->productCatName}" />
                                        <input type="hidden" name="oldproductid{$i}" id="oldproductid{$i}"
                                            value="{$myloadData->productid}" />
                                    </div>
                                </td>
                                <td>
                                    <div id="quantity1">
                                        <input type="text" name="currentquantity{$i}" id="currentquantity{$i}"
                                            class="form-control getprototal  positiveNo txt-nonraduis"
                                            value="{$myloadData->productquantity}" tabindex="7" readonly />
                                    </div>
                                </td>
                                <td>
                                    <input type="text" name="productamount{$i}" onkeyup="checkdata({$i})"
                                        id="productamount{$i}"
                                        class="form-control getprototal  positivefloat txt-nonraduis"
                                        value="{$myloadData->transferproductamount}" tabindex="7" />
                                </td>
                                <td class="pricesClass" {if $myloadData->priceType == "hide"} style="display:none"
                                    {/if}>
                                    <input type="text" name="pricePro{$i}" id="pricePro{$i}"
                                        class="form-control txt-nonraduis"
                                        value="{$myloadData->price/$myloadData->transferproductamount}" tabindex="7"
                                        readonly />
                                        <input type="hidden" name="{$loadData[0]->priceType}{$i}" id="{$loadData[0]->priceType}{$i}"
                                        value="{$myloadData->price/$myloadData->transferproductamount}" />
                                </td>
                                <td class="pricesClass" {if $myloadData->priceType=="hide"}style="display:none" {/if}>
                                    <input type="text" name="price{$i}" id="price{$i}"
                                        class="form-control txt-nonraduis getPriceTotal" value="{$myloadData->price}"
                                        tabindex="7" readonly />
                                </td>
                                <td class="{if {$Programsettingdata->expiredate} eq 1}  hidden {/if}">
                                    <input type="hidden" name="proSerials{$i}" id="proSerials{$i}" data-itr="{$i}"
                                        value="">
                                </td>
                                <td class="{if {$Programsettingdata->expiredate} eq 1}  hidden {/if}">
                                    <input type="hidden" name="proSerials{$i}" id="proSerials{$i}" data-itr="{$i}"
                                        value="">
                                </td>
                                <td>
                                    <textarea name="comment{$i}" id="comment{$i}" class="form-control"
                                        style="height: 25px;">{$myloadData->comment}</textarea>
                                </td>
                                <td id="{$i}" class="hidden-print">
                                    <button id="remove{$i}" type="button"
                                        class="close flt-none removeicon removeproduct"
                                        aria-hidden="true">&times;</button>
                                </td>
                            </tr>
                            {assign var=x value=$x+$myloadData->transferproductamount}
                            {assign var=y value=$y+$myloadData->price}
                            {assign var=i value=$i+1}
                            {/foreach}

                            <input type="hidden" name="productitr" id="productitr" value="{count($loadData)}" />
                        </tbody>
                    </table>
                    <button type="button" class="btn btn-primary pull-left ft-nor">
                        اجمالى الكمية المحولة <span class="badge wht-clo">
                            <div id="totalQuantityMove">{$x}</div>
                        </span>
                    </button>
                    {if $loadData[0]->priceType != "hide"}
                    <button type="button" class="btn btn-primary pull-left ft-nor pricesClass"
                        style="margin-left: 3px;">
                        اجمالى السعر<span class="badge wht-clo">
                            <div id="totalQuantityMovePrice">{$y}</div>
                        </span>
                    </button>
                    {/if}
                </div>
            </div>

            <!-- end of second row-->
            <input type="hidden" name="add_print" id="add_print" value="0" />

            <br />
            <div class="row  hidden-print">
                <button type="button" id="saveBtn" class="btn btn-primary">حفظ</button>
                <button type="button" id="add_print_btn" class="btn btn-success">حفظ وطباعة بإذن</button>
                <button type="button" id="add_print_btn2" class="btn btn-success">حفظ وطباعة </button>
            </div>
            <!-- end of fifth row-->

        </form>
    </div>
    <!-- end of container-->
</div>

<input type="hidden" name="sumSameProductForStore" id="sumSameProductForStore"
    value="{$Programsettingdata->sumSameProductForStore}" />
<input type="hidden" name="showStoreToDetail" id="showStoreToDetail" value="{$Programsettingdata->showStoreToDetail}" />