<div class="row">
    <div class="container">

        <ol class="breadcrumb">
            <li><a href="#">المصروفات والايرادات</a></li>
            <li><a href="transfermoneyController.php?do=show">الخزن</a></li>
            <li class="active">التحويل بين الخزن</li>
        </ol>


        <div class="panel panel-default panel-m">
            <div class="panel-heading">
                <h3 class="panel-title">اضافة تحويل بين الخزن</h3>
            </div>
            <div class="panel-body">



                <form id="myTranMnyform" class="form-horizontal" role="form" action="transfermoneyController.php?do=add"
                    method="post">
                  <!--   <div class="form-group">
                        <label for="saveidfrom" class="col-lg-2 control-label">من الخزنة</label>
                        <div class="col-lg-4">
                            <select class="select2 wdt100" name="saveidfrom" id="saveidfrom" onChange="loadsaveTo();">
                                <option value="-1">اختر خزنة</option>
                                {foreach $saveData as $save}
                                <option data-curr="{$save->currencyId}" data-curr-name="{$save->currencyName}"
                                    data-cfactor="{$save->conversionFactor}"
                                    data-othercfactor="{$save->otherconversionFactor}" value="{$save->saveid}">
                                    {$save->savename} {if $Programsettingdata->showCurrency == 1}-
                                    {$save->currencyName}{/if}</option>
                                {/foreach}
                            </select>
                            <div id="fromError" style="display:none;"></div>
                        </div>
                    </div> -->



                    {if $searchinonesave == 1}
                    <input type="hidden" name="saveidfrom" id="saveidfrom" value="{$allSave}" />
                    
                    {else}
                    <div class="form-group">
                        <label for="saveidfrom" class="col-lg-2 control-label">من الخزنة</label>
                        <div class="col-lg-4">
                            <select class="select2 wdt100" name="saveidfrom" id="saveidfrom" onChange="loadsaveTo();">
                                <option value="-1">اختر خزنة</option>
                                {foreach $allSave as $data}
                                <option data-curr="{$data->currencyId}" data-curr-name="{$data->currencyName}"
                                    data-cfactor="{$data->conversionFactor}"
                                    data-othercfactor="{$data->otherconversionFactor}" value="{$data->saveid}" {if $saveid == $data->saveid}selected{/if}>{$data->savename} {if
                                    $Programsettingdata->showCurrency == 1} - {$data->currencyName}{/if}</option>
                                {/foreach}
                            </select>
                            <div id="fromError" style="display:none;"></div>
                        </div>
                    </div>
                    {/if}
                    
                    <!-- =================================================   -->



                    <div class="form-group">
                        <label for="savecurrentvalue" class="col-lg-2 control-label">القيمة الحالية</label>
                        <div class="col-lg-4">
                            <div class="input-group">
                                <input type="text" name="savecurrentvalue" id="savecurrentvalue"
                                    class="form-control numberinput" value="0" readonly="readonly" />
                                <span class="input-group-addon currencyTextFrom">{$currency}</span>
                            </div>

                        </div>
                    </div>

                    <div class="form-group" {if $Programsettingdata->showCurrency != 1}style="display:none;"{/if}>
                        <label class="col-lg-2 control-label">معامل التحويل خزنة من</label>
                        <div class="col-lg-4">
                            <input type="text" name="cFactorFrom" id="cFactorFrom" class="form-control positivefloat calcOther"
                                onkeyup="checksaveValue();" style="display: inline-block;width: 35%" readonly/>
                            =
                            <div class="input-group" style="display: inline;">
                                <input type="text" name="otherCFactorFrom" id="otherCFactorFrom"
                                    class="form-control positivefloat calcOther"
                                    style="display: inline-block;width: 35%" readonly/>
                                <span class="input-group-addon"
                                    style="display: inline-block;width: 24%">{$currency}</span>
                            </div>
                        </div>
                    </div>
                    <!-- =================================================   -->


                    <div class="form-group">
                        <label for="saveidto" class="col-lg-2 control-label">إلى الخزنة</label>
                        <div class="col-lg-4">
                            <div id="saveTo">
                                <select class="select2 wdt100" name="saveidto" id="saveidto">
                                    <option value="-1">اختر خزنة</option>
                                </select>
                            </div>
                            <div id="toError" style="display:none;"></div>

                        </div>
                    </div>

                    <!-- =================================================   -->                    
                    <div class="form-group" {if $Programsettingdata->showCurrency != 1}style="display:none;"{/if}>
                        <label class="col-lg-2 control-label">معامل التحويل خزنة الى</label>
                        <div class="col-lg-4">
                            <input type="text" name="cFactorTo" id="cFactorTo" class="form-control positivefloat calcOther"
                                onkeyup="checksaveValue();" style="display: inline-block;width: 35%" readonly/>
                            =
                            <div class="input-group" style="display: inline;">
                                <input type="text" name="otherCFactorTo" id="otherCFactorTo"
                                    class="form-control positivefloat calcOther"
                                    style="display: inline-block;width: 35%" onkeyup="SaveToMoneyChangeReCalcCfactor('otherCFactorTo');"/>
                                <span class="input-group-addon"
                                    style="display: inline-block;width: 24%">{$currency}</span>
                            </div>
                        </div>
                    </div>
                    <!-- =================================================   -->

                    <div class="form-group">
                        <label for="transfermoneyvalueCurr" class="col-lg-2 control-label">القيمة المحولة بعملة خزنة من</label>
                        <div class="col-lg-4">
                            <div class="input-group">
                                <input type="text" name="transfermoneyvalueCurr" id="transfermoneyvalueCurr"
                                    class="form-control positivefloat" value="0"
                                    onKeyUp="checksaveValue('transfermoneyvalueCurr');" />
                                <span class="input-group-addon currencyTextFrom">{$currency}</span>
                            </div>
                            <div id="valueError" style="display:none;"></div>

                        </div>
                    </div>
                    <div class="form-group" {if $Programsettingdata->showCurrency != 1}style="display:none;"{/if}>
                        <label for="transfermoneyvalueCurrSaveTo" class="col-lg-2 control-label">القيمة المحولة بعملة
                            خزنة الى</label>
                        <div class="col-lg-4">
                            <div class="input-group">
                                <input type="text" name="transfermoneyvalueCurrSaveTo" id="transfermoneyvalueCurrSaveTo"
                                    class="form-control positivefloat" value="0"
                                    onkeyup="SaveToMoneyChangeReCalcCfactor('transfermoneyvalueCurrSaveTo');"/><!--onKeyUp="checksaveValue('transfermoneyvalue');"-->
                                <span class="input-group-addon currencyTextTo">{$currency}</span>
                            </div>

                        </div>
                    </div>
                    <div class="form-group" style="display: none;">
                        <!--{if $Programsettingdata->showCurrency != 1}style="display:none;"{/if}-->
                        <label for="transfermoneyvalue" class="col-lg-2 control-label">القيمة المحولة بالعملة
                            الرئيسية</label>
                        <div class="col-lg-4">
                            <div class="input-group">
                                <input type="text" name="transfermoneyvalue" id="transfermoneyvalue"
                                    class="form-control positivefloat" value="0"
                                    onKeyUp="checksaveValue('transfermoneyvalue');" />
                                <span class="input-group-addon">{$currency}</span>
                            </div>
                            <div id="valueError" style="display:none;"></div>

                        </div>
                    </div>

                    <div class="form-group mg-bt5">
                        <label class="col-lg-2 control-label"> التعليق </label>
                        <div class="col-lg-4">
                            <textarea name="comment" id="antherDetailes" class=" form-control" cols="45"
                                rows="5"></textarea>
                        </div>
                    </div>


                    <!-- =================================================   -->
                    <input type="hidden" name="printTxt" id="printTxt" value="0" />
                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">

                            <button type="button" id="saveAndPrint" class="btn btn-success pull-left">حفظ
                                وطباعة</button>

                            <button type="button" id="saveTrnMnyBtn" class="btn btn-primary pull-left">حفظ
                                الامر</button>
                        </div>
                    </div>


                </form>
            </div>
        </div>




    </div>
</div>



{literal}

<script type="text/javascript">

    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "real");
    var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", { isRequired: false, invalidValue: "-1" });
</script>

<script>
    $('#saveAndPrint').on('click', function () {
        $('#saveTrnMnyBtn').attr('disabled');
        $('#printTxt').val(1);
        $('#saveTrnMnyBtn').trigger('click');
    });
</script>

{/literal}