<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">
                {literal}
                <form class="nameToBeChecked form-horizontal" action="billsettingsController.php?do=add" method="post"
                      onsubmit="if (Spry.Widget.Form.validate(this)) {
                                  checkName(event, 'billname', 'name');
                                  return true;
                              } else {
                                  return false;
                              }"><!--validate the form before checking name-->
                    {/literal}
                    <div class="form-group">
                        <label class="col-lg-2 control-label">اسم الفاتورة</label>
                        <div class="col-lg-4"> <span id="sprytextfield1">
                                <input type="text" name="name" id="name" class="form-control"
                                       placeholder="اسم الفاتورة" />
                                <span class="textfieldRequiredMsg">ادخل اسم الفاتورة</span></span>

                            <div id="nameError" class="alert alert-block alert-danger fade in" style="display:none">
                                <button type="button" class="close pull-left" data-dismiss="alert"
                                        aria-hidden="true">&times;</button>
                                <h4>رسالة خطأ</h4>
                                <p>هذا الإسم مستخدم من قبل</p>
                                <div class="clearfix"></div>
                            </div>

                        </div>
                    </div>

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

                    <div class="form-group">
                        <label class="col-lg-2 control-label">مشتريات/ مبيعات </label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input name="billType" type="radio" checked="checked" value="0" />مبيعات
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="billType" type="radio" value="1" />مشتريات
                                </label>
                            </div>
                        </div>
                    </div>



                    <div class="form-group">
                        <label class="col-lg-2 control-label">امر شراء او امر بيع <br />(لا توجد بها مردودات)</label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input name="ordertype" type="radio" {if {$data->ordertype} eq 0} checked="checked"
                                    {/if} value="0" />لا
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="ordertype" type="radio" {if {$data->ordertype} eq 1} checked="checked"
                                    {/if} value="1" />نعم
                                </label>
                            </div>
                        </div>
                    </div>
                    <!--==============================-->
                    <div class="form-group">
                        <label class="col-lg-2 control-label">اظهار منتجات وكميات فقط <br />(لا تنطبق الا على امر
                            الشراء)</label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input name="productAndQuantityOnly" type="radio" checked="checked" value="0" />لا
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="productAndQuantityOnly" type="radio" value="1" />نعم
                                </label>
                            </div>
                        </div>
                    </div>


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



                    <div class="form-group">
                        <label class="col-lg-2 control-label">يؤثر فى الخزنة<br />(لا تنطبق الا على امر الشراء) </label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input name="saveeffect" type="radio" {if {$data->saveeffect} eq 0}
                                    checked="checked" {/if} value="0" />نعم
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="saveeffect" type="radio" {if {$data->saveeffect} eq 1}
                                    checked="checked" {/if} value="1" />لا
                                </label>
                            </div>
                        </div>
                    </div>

                    <!--==============================-->
                    <div class="form-group">
                        <label class="col-lg-2 control-label">يؤثر فى المخزن<br />(لا تنطبق الا على امر البيع) </label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input name="storeeffect" type="radio" value="1" />نعم
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="storeeffect" type="radio" value="0" />لا
                                </label>
                            </div>
                        </div>
                    </div>

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

                    <div class="form-group">
                        <label class="col-lg-2 control-label">نوع الفاتورة</label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input name="billType2" type="radio" checked="checked" value="0" />عادى
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="billType2" type="radio" value="1" />بصريات
                                </label>
                            </div>
                        </div>
                    </div>
                    <!--==============================-->

                    <div class="form-group">
                        <label class="col-lg-2 control-label">الباركود المستخدم فى الفاتورة</label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input name="parcodeType" type="radio" checked="checked" value="0" />باركود
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="parcodeType" type="radio" value="1" />باركود مخصص
                                </label>
                            </div>
                        </div>
                    </div>
                    <!--==============================-->

                    {assign var=j value=1}
                    {foreach $allBillproperty as $myBillproperty}

                    {if {$myBillproperty->billpropertyname} eq 'نوع السعر'}


                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />جمله</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="2" />نصف جمله</label>
                        </div>

                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />تجزئة </label>
                        </div>
                    </div>


                    {elseif {$myBillproperty->billpropertyname} eq 'نوع الفاتوره'}


                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />عادى</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />اذن صرف</label>
                        </div>

                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="2" />امر شراء </label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'نوع الخصم لكل منتج'}
                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />مباشر</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />نسبة</label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'ضريبه المبيعات المدفوعه'}
                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />اظهار</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />اخفاء</label>
                        </div>

                        <!--   -->
                        <label class="col-lg-2 control-label" style="float: none">-- اسم الضريبه</label>
                        <div class="col-lg-4 radio-inline" style="float: none"> <span id="sprytextfield6">
                                <input type="text" name="taxname" class="form-control col-lg-2" placeholder="اسم الضريبه" value="ضريبه القيمة المضافة"/>
                                <span class="textfieldRequiredMsg">ادخل اسم الضريبه</span></span>
                        </div>

                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'المدفوع اكبر من قيمه الفاتوره'}


                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />لا</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />نعم</label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'البحث باسم التصنيف والمنتج فقط'}


                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />نعم</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />البحث باسم اللون والمقاس ايضا
                                <span style="color: red">"ابطأ فى البحث"</span> </label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'تجميع المنتجات المتشابه مع بعضها' ||
                    {$myBillproperty->billpropertyname} eq 'ربط نوع السعر بالعميل'}


                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />لا</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />نعم</label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'نوع الخصم العام'}


                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />مباشر</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />نسبة</label>
                        </div>

                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="2" />الاثنان معا </label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'طباعة بيانات'}


                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />اعدادات
                                البرنامج</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />الفرع</label>
                        </div>

                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="2" />اخفاء </label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq "print_client_name"}
                    {elseif {$myBillproperty->billpropertyname} eq "a4" ||{$myBillproperty->billpropertyname} eq "طباعة a5"}
                    {elseif {$myBillproperty->billpropertyname} eq 'طباعة'}


                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}
                            "فواتير البيع فقط"</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />نموذج
                                1</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />نموذج 2</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="2" />نموذج 3 </label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="3" />نموذج 4 </label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="4" />نموذج 5 </label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="5" />نموذج 6 </label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="6" />نموذج 7 </label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="7" />نموذج 8 </label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="8" />نموذج 9 </label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="9" />نموذج 10 </label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="10" />نموذج 11 </label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="11" />نموذج 12 </label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="12" />نموذج 13 </label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq "تفعيل ميزان الباركود"}
                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0"
                                       class="parcodeSettingClass" />اظهار</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1"
                                       class="parcodeSettingClass" />اخفاء</label>
                        </div>
                    </div>
                    <div class="form-group parcodeSettingFields">
                        <label class="col-lg-2 control-label">الكود المميز</label>
                        <div class="col-lg-4">
                            <span id="sprytextfield2">
                                <input type="text" name="posFlag" id="posFlag" class="form-control positiveNo" value="">
                                <span class="textfieldRequiredMsg">هذا الحقل مطلوب</span>
                        </div>
                    </div>
                    <div class="form-group parcodeSettingFields">
                        <label class="col-lg-2 control-label">عدد ارقام كود المنتج</label>
                        <div class="col-lg-4">
                            <span id="sprytextfield3">
                                <input type="text" name="posCode" id="posCode" class="form-control positiveNo" value="">
                                <span class="textfieldRequiredMsg">هذا الحقل مطلوب</span>
                        </div>
                    </div>
                    <div class="form-group parcodeSettingFields">
                        <label class="col-lg-2 control-label">الخانة التالية تعبر عن</label>
                        <div class="radio-inline">
                            <label>
                                <input name="posType" type="radio" checked="checked" value="0" />وزن المنتج</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="posType" type="radio" value="1" />سعر المنتج</label>
                        </div>
                    </div>
                    <div class="form-group parcodeSettingFields ">
                        <label class="col-lg-2 control-label">عدد ارقام الخانة التالية</label>
                        <div class="col-lg-4">
                            <span id="sprytextfield4">
                                <input type="text" name="posWeightPrice" id="posWeightPrice"
                                       class="form-control positiveNo" value="">
                                <span class="textfieldRequiredMsg">هذا الحقل مطلوب</span>
                        </div>
                    </div>
                    <div class="form-group parcodeSettingFields">
                        <label class="col-lg-2 control-label">تمييز اخر الباركود</label>
                        <div class="col-lg-4">
                            <span id="sprytextfield5">
                                <input type="text" name="checkDigit" id="checkDigit" class="form-control positiveNo"
                                       value="">
                                <span class="textfieldRequiredMsg">هذا الحقل مطلوب</span>
                        </div>
                        <div class="col-lg-6">
                            <label class="control-label">
                                <span style="color:red">ملحوظة :</span> القيمة صفر تعنى اى قيمة
                            </label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'زر حفظ يعود الى'}
                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />تفاصيل
                                الفاتورة</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />فاتورة جديدة</label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'البائع - المندوب إلزامى'}


                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />لا</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />نعم</label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq "اقرار استلام بضاعه"}
                    <div class="form-group">
                        <label class="col-lg-2 control-label">اقرار استلام بضاعه</label>
                        <div class="col-lg-4">
                            <input type="text" name="goodsReceiptApproval" id="goodsReceiptApproval"
                                   class="form-control" value="">

                            <!-- fatma => should not be like that but it fix error -->
                            <input name="billpropertyid{$j}" type="hidden" value="{$myBillproperty->billpropertyid}" />
                            <input name="settingsvalue{$j}" type="hidden" value="0" />
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq "الهامش"}
                    <div class="form-group">
                        <label class="col-lg-2 control-label">الهامش</label>
                        <div class="col-lg-4">
                            <input name="billpropertyid{$j}" type="hidden" value="{$myBillproperty->billpropertyid}" />
                            <span id="sprytextfieldmargin">
                                <input type="text" name="settingsvalue{$j}" id="settingsvalue{$j}"
                                       class="form-control positiveNo" value="0">
                                <span class="textfieldRequiredMsg">هذا الحقل مطلوب</span>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq "التعليق على العميل"}
                    <div class="form-group">
                        <label class="col-lg-2 control-label">التعليق على العميل </label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input name="commentClient" type="radio" checked="checked" value="0" />اظهار
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="commentClient" type="radio" value="1" />اخفاء
                                </label>
                            </div>
                        </div>
                    </div>


                    {elseif {$myBillproperty->billpropertyname} eq "الشحن او التوصيل"}
                    <div class="form-group">
                        <label class="col-lg-2 control-label">الشحن او التوصيل </label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input name="delivery" type="radio" checked="checked" value="0" />اظهار
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="delivery" type="radio" value="1" />اخفاء
                                </label>
                            </div>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq "الفواتير المحفوظة"}
                    <div class="form-group">
                        <label class="col-lg-2 control-label">الفواتير المحفوظة </label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input name="delivery" type="radio" checked="checked" value="1" />اظهار
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="delivery" type="radio" value="0" />اخفاء
                                </label>
                            </div>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq "الطول و العرض"}
                    <div class="form-group">
                        <label class="col-lg-2 control-label">الطول و العرض </label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input name="delivery" type="radio" checked="checked" value="1" />اظهار
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="delivery" type="radio" value="0" />اخفاء
                                </label>
                            </div>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'نوع السعر مع كل صف'}


                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />لا</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />نعم</label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq "الدفع الالكترونى"}
                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0"
                                       class="visaPaymentClass" />لا</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1"
                                       class="visaPaymentClass" />نعم</label>
                        </div>
                    </div>
                    <div class="form-group visaPaymentFields" style="display: none">
                        <label class="col-lg-2 control-label">الحساب الافتراضى للدفع الالكترونى</label>
                        <div class="col-lg-4">
                            <span id="spryselect1">
                                <select class="select2 wds100" name="defVisaAccount" id="defVisaAccount">
                                    <option></option>
                                    {foreach $bankAccounts as $acc}
                                    <option value="{$acc->accountid}">{$acc->accountname}/{$acc->bankname}</option>
                                    {/foreach}
                                </select>
                                <span class="selectRequiredMsg">هذا الحقل مطلوب</span>
                        </div>
                    </div>
                    <div class="form-group visaPaymentFields" style="display: none">
                        <label class="col-lg-2 control-label">الحساب الافتراضى للدفع الالكترونى</label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input name="defVisaAccountSelect" type="radio" checked="checked"
                                           value="0" />اخفاء</label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="defVisaAccountSelect" type="radio" value="1" />اختيار من القائمة
                                    المنسدلة</label>
                            </div>
                        </div>
                    </div>
                    <div class="form-group visaPaymentFields">
                        <label class="col-lg-2 control-label">خيار التحويل البنكى</label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input name="isBankAccountTransfer" type="radio" checked="checked"
                                           value="0" />اخفاء</label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="isBankAccountTransfer" type="radio" value="1" />اظهار</label>
                            </div>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq "خزنة الفاتورة"}
                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />خزنة
                                المستخدم</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />اختيار من متعدد</label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'طباعة التصنيف بدل المنتجات'}


                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />لا</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />نعم</label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'فاتورة ضريبية'}


                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />لا</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />نعم</label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'تفعيل الحفظ التلقائى'}


                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />لا</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />نعم</label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'نوع العميل'}


                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />اجل</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />نقدى</label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq "ضريبة خصم"}
                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0"
                                       class="taxOfDiscountClass" />لا</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1"
                                       class="taxOfDiscountClass" />نعم</label>
                        </div>
                    </div>
                    <div class="form-group taxOfDiscountfields">
                        <label class="col-lg-2 control-label">قيمة ضريبة الخصم</label>
                        <div class="col-lg-4">
                            <input name="billpropertyid{$j}" type="hidden" value="{$myBillproperty->billpropertyid}" />
                            <span id="sprytextfieldTaxOfDiscountVal">
                                <input type="text" name="taxOfDiscountVal" id="taxOfDiscountVal"
                                       class="form-control positivefloat" value="0">
                                <span class="textfieldRequiredMsg">هذا الحقل مطلوب</span>
                        </div>
                    </div>
                    <div class="form-group taxOfDiscountfields">
                        <label class="col-lg-2 control-label">طباعة ضريبة الخصم</label>
                        <div class="radio-inline">
                            <label>
                                <input name="taxOfDiscountPrint" type="radio" checked="checked" value="0" />نعم</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="taxOfDiscountPrint" type="radio" value="1" />لا</label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq "خصم اضافى"}
                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0"
                                       class="extraDiscountClass" />لا</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1"
                                       class="extraDiscountClass" />نعم</label>
                        </div>
                    </div>
                    <div class="form-group extraDiscountfields">
                        <label class="col-lg-2 control-label">تطبيق الخصم الاضافى</label>
                        <div class="radio-inline">
                            <label>
                                <input name="extraDiscountPlace" type="radio" checked="checked" value="0" />بعد
                                الخصم</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="extraDiscountPlace" type="radio" value="1" />قبل الخصم</label>
                        </div>
                    </div>
                    <div class="form-group extraDiscountfields">
                        <label class="col-lg-2 control-label">تثبيت النسبة</label>
                        <div class="radio-inline">
                            <label>
                                <input name="extraDiscountFixed" type="radio" checked="checked" value="0"
                                       class="extraDiscountFixedClass" />لا</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="extraDiscountFixed" type="radio" value="1"
                                       class="extraDiscountFixedClass" />نعم</label>
                        </div>
                    </div>
                    <div class="form-group extraDiscountFixedfield">
                        <label class="col-lg-2 control-label">نسبة الخصم الاضافى</label>
                        <div class="col-lg-4">
                            <span id="sprytextfieldExtraDiscountPer">
                                <input type="text" name="extraDiscountPer" id="extraDiscountPer"
                                       class="form-control positivefloat" value="0">
                                <span class="textfieldRequiredMsg">هذا الحقل مطلوب</span>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'رد المنتجات لعميل'}


                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />كل
                                المنتجات</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />المنتجات المباعة مسبقا
                                فقط</label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'العدد' && $myBillproperty->billpropertyid eq 117}


                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />عدد
                                عشرى</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />عدد صحيح</label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'طباعة الإجمالي قبل الخصم'}
                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />اظهار</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />اخفاء</label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'العملاء فى فاتورة مشتريات'}
                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />اظهار</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />اخفاء</label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'عرض خصم التصنيف في المنتج'}
                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />اظهار</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />اخفاء</label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'عرض إجمالي الخصومات'}
                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />اظهار</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />اخفاء</label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'أوامر البيع تؤثر في المخزن'}
                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />نعم</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />لا</label>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'رقم فاتورة البيع'}
                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />اظهار</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />اخفاء</label>
                        </div>
                    </div>
                    {elseif $myBillproperty->billpropertyname eq "تنبيه لو سعر البيع اقل من سعر الشراء"}
                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />لا</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />سعر الشراء </label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="2" />اخر سعر شراء</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="3" />اخر سعر شراء بعد الخصم</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="4" />متوسط سعر الشراء </label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="5" />متوسط سعر الشراء بعد الخصم
                            </label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="6" />اخر سعر شراء شامل القيمة
                                المضافة</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="7" />متوسط سعر الشراء شامل القيمة
                                المضافة </label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="8" />المتوسط العام </label>
                        </div>
                        <!--                        <div class="radio-inline">
                                                    <label>
                                                        <input name="settingsvalue{$j}" type="radio" value="9" />سعر الشراء الحقيقى</label>
                                                </div>-->
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'فاتورة المراكز الطبية المتخصصة'}
                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" class="med_centers" />نعم</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0"
                                       class="med_centers" />لا</label>
                        </div>
                    </div>

                    {elseif {$myBillproperty->billpropertyname} eq 'الجهة الكفيلة'}
                    <div id="med_finance" style="display: none;">
                        <div class="form-group">
                            <label
                                class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                            <div class="radio-inline">
                                <label>
                                    <input name="settingsvalue{$j}" type="radio" checked="checked"
                                           value="0" />أهالي</label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="billpropertyid{$j}" type="hidden"
                                           value="{$myBillproperty->billpropertyid}" />
                                    <input name="settingsvalue{$j}" type="radio" value="1" />التأمين الصحي</label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="billpropertyid{$j}" type="hidden"
                                           value="{$myBillproperty->billpropertyid}" />
                                    <input name="settingsvalue{$j}" type="radio" value="2" />نفقة دولة</label>
                            </div>
                        </div>
                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'العميل الافتراضى للفاتوره'}
                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>

                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />نقدى</label>
                        </div>

                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />نقدى اجل</label>
                        </div>

                    </div>
                    {elseif {$myBillproperty->billpropertyname} eq 'فاتوره بيع من عميل لمورد' || {$myBillproperty->billpropertyname} eq 'الاضافة'}
                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>

                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" value="1" />اظهار</label>
                        </div>

                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="0" checked="checked"/>اخفاء</label>
                        </div>

                    </div>
                    {else}
                    <div class="form-group">
                        <label
                            class="col-lg-2 control-label">{$myBillproperty->billpropertyid}-{$myBillproperty->billpropertyname}</label>
                        <div class="radio-inline">
                            <label>
                                <input name="billpropertyid{$j}" type="hidden"
                                       value="{$myBillproperty->billpropertyid}" />
                                <input name="settingsvalue{$j}" type="radio" checked="checked" value="0" />اظهار</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input name="settingsvalue{$j}" type="radio" value="1" />اخفاء</label>
                        </div>
                    </div>
                    {/if}
                    {capture assign=j}{$j+1}{/capture}
                    {/foreach}
                    <input name="countallBillproperty" type="hidden" value="{$countallBillproperty}" />

                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <button type="submit" 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");

    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
    var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
    var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4");
    var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5");
    var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6");
    var sprytextfieldmargin = new Spry.Widget.ValidationTextField("sprytextfieldmargin");

    $(".parcodeSettingClass").live('change', function () {
        var val = $(this).val();
        if (val == 0) {
            $('.parcodeSettingFields').show();
            sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
            sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
            sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4");
            sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5");
        } else {
            $('.parcodeSettingFields').hide();
            sprytextfield2.destroy();
            sprytextfield3.destroy();
            sprytextfield4.destroy();
            sprytextfield5.destroy();
        }
    });

    var spryselect1 = '';//new Spry.Widget.ValidationSelect("spryselect1", {invalidValue: "-1"});
    $(".visaPaymentClass").live('change', function () {
        var val = $(".visaPaymentClass:checked").val();
        if (val == 0) {
            $('.visaPaymentFields').hide();
            try {
                spryselect1.destroy();
            } catch (e) {
            }
        } else {
            $('.visaPaymentFields').show();
            spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {invalidValue: "-1"});
        }
    });
    $(".visaPaymentClass").change();

    var sprytextfieldTaxOfDiscountVal = '';//new Spry.Widget.ValidationTextField("sprytextfieldTaxOfDiscountVal");
    $(".taxOfDiscountClass").live('change', function () {
        var val = $(".taxOfDiscountClass:checked").val();
        if (val == 0) {
            $('.taxOfDiscountfields').hide();
            $('#taxOfDiscountVal').val('0');
            try {
                sprytextfieldTaxOfDiscountVal.destroy();
            } catch (e) {
            }
        } else {
            $('.taxOfDiscountfields').show();
            sprytextfieldTaxOfDiscountVal = new Spry.Widget.ValidationTextField("sprytextfieldTaxOfDiscountVal");
        }
    });
    $(".taxOfDiscountClass").change();

    $(".extraDiscountClass").live('change', function () {
        var val = $(".extraDiscountClass:checked").val();
        if (val == 0) {
            $('.extraDiscountfields').hide();
            $("#extraDiscountFixed0").attr('checked', 'checked').change();
        } else {
            $('.extraDiscountfields').show();
        }
    });
    $(".extraDiscountClass").change();

    var sprytextfieldExtraDiscountPer = '';//new Spry.Widget.ValidationTextField("sprytextfieldExtraDiscountPer");
    $(".extraDiscountFixedClass").live('change', function () {
        var val = $(".extraDiscountFixedClass:checked").val();
        if (val == 0) {
            $('.extraDiscountFixedfield').hide();
            $('#extraDiscountPer').val('0');
            try {
                sprytextfieldExtraDiscountPer.destroy();
            } catch (e) {
            }
        } else {
            $('.extraDiscountFixedfield').show();
            sprytextfieldExtraDiscountPer = new Spry.Widget.ValidationTextField("sprytextfieldExtraDiscountPer");
        }
    });
    $(".extraDiscountFixedClass").change();

    $(".med_centers").live('change', function () {
        var val = $(".med_centers:checked").val();
        if (val == 0) {
            $('#med_finance').hide();
        } else {
            $('#med_finance').show();
        }
    });
    $(".med_centers").change();

</script>
{/literal}