<?php /* Smarty version Smarty-3.1.11, created on 2025-12-29 21:07:54
         compiled from "..\views\default\sellbillview\showdetail.html" */ ?>
<?php /*%%SmartyHeaderCode:107426952d18ab29232-08606269%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '52bcccba0ad218d81ae6124d9206589a94f52762' => 
    array (
      0 => '..\\views\\default\\sellbillview\\showdetail.html',
      1 => 1757738702,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '107426952d18ab29232-08606269',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'billnameAddData' => 0,
    'billsettingsData' => 0,
    'sellbillData' => 0,
    'Programsettingdata' => 0,
    'billId' => 0,
    'billStatus' => 0,
    'myclientdata' => 0,
    'allCostcenter' => 0,
    'myallCostcenter' => 0,
    'Usergroupdata' => 0,
    'sellbilldetailData' => 0,
    'manyStores' => 0,
    'mysupplierdata' => 0,
    'billnameid' => 0,
    'x' => 0,
    'sellbilldetail' => 0,
    'sellbilldetailtaxdata' => 0,
    'data' => 0,
    'sellbillimage' => 0,
    'quantity' => 0,
    'taxvalue' => 0,
    'bankAccount' => 0,
    'billPayments' => 0,
    'ordertype' => 0,
    'sellbill' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_6952d18b944ff7_68420859',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_6952d18b944ff7_68420859')) {function content_6952d18b944ff7_68420859($_smarty_tpl) {?><style>
    .serial-success {
        background-color: #6ed96e !important;
    }

    .serial-error {
        background-color: #f47c7c !important;
    }

    @media print {

        tr>.myblack {
            border: 1px solid black !important;
        }


        .myleft {
            padding-top: 20px !important;
        }

        .myright {

            margin-top: 50px !important;
            float: right !important;
            margin-bottom: 10px !important;
        }

        .margintop {
            margin-top: 90px !important;
        }
    }
</style>
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">ادارة الفواتير</a></li>
            <li><a href="#">فواتير المبيعات</a></li>
            <li class="active">تفاصيل فاتورة مبيعات</li>
        </ol>
        <h3><?php echo $_smarty_tpl->tpl_vars['billnameAddData']->value->name;?>
</h3>
        <hr />
        <form class="form-horizontal " role="form" action="sellbillController.php?do=serializeProducts" method="post"
              id="serialsForm">
            <div class="row ">
                <div class="col-lg-8">
                    <div class="form-group" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[61]->billsettingsvalue;?>
<?php $_tmp1=ob_get_clean();?><?php if ($_tmp1==0){?> style="display:block"
                        <?php }else{ ?> style="display:none" <?php }?>>
                        <label class="col-lg-3 control-label  myleft">رقم الفاتورة</label>
                        <div class="col-lg-9">
                            <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbillserial;?>
 </p>
                        </div>
                    </div>
                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->clientserial==1){?>
                    <div class="form-group">
                        <label class="col-lg-3 control-label myleft">الرقم التسلسلي</label>
                        <div class="col-lg-9">
                            <p class="form-control-static"><?php if ($_smarty_tpl->tpl_vars['sellbillData']->value->taxBillNumber>0){?><?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->taxBillNumber;?>
<?php }else{ ?><?php echo $_smarty_tpl->tpl_vars['billId']->value;?>
<?php }?></p>
                        </div>
                    </div>
                    <?php }?>
                    <!-- end of form-group-->

                    <div class="form-group" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[5]->billsettingsvalue;?>
<?php $_tmp2=ob_get_clean();?><?php if ($_tmp2==0){?> style="display:block"
                        <?php }else{ ?> style="display:none" <?php }?> >
                        <label class="col-lg-3 control-label myleft">تاريخ الفاتورة</label>
                        <div class="col-lg-9">
                            <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbilldate;?>
 </p>
                        </div>
                    </div>

                    <div class="form-group" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[102]->billsettingsvalue;?>
<?php $_tmp3=ob_get_clean();?><?php if ($_tmp3==0){?> style="display:block"
                        <?php }else{ ?> style="display:none" <?php }?> >
                        <label class="col-lg-3 control-label myleft">تاريخ التسليم</label>
                        <div class="col-lg-9">
                            <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->datestarting;?>
 </p>
                        </div>
                    </div>

                    <div class="form-group" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[110]->billsettingsvalue;?>
<?php $_tmp4=ob_get_clean();?><?php if ($_tmp4==0){?> style="display:block"
                        <?php }else{ ?> style="display:none" <?php }?> >
                        <label class="col-lg-3 control-label myleft"><?php echo @SELL_BILL_STATUS;?>
</label>
                        <div class="col-lg-9">
                            <p class="form-control-static"> <?php if ($_smarty_tpl->tpl_vars['billStatus']->value=="new"){?>
                                <?php echo @SELL_BILL_STATUS_NEW;?>

                                <?php }elseif($_smarty_tpl->tpl_vars['billStatus']->value=="prepare"){?>
                                <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[111]->billsettingsvalue==0){?>
                                <?php echo @SELL_BILL_STATUS_PREPARE;?>

                                <?php }else{ ?>
                                <?php echo @SELL_BILL_STATUS_FACTORY_SEND;?>

                                <?php }?>
                                <?php }elseif($_smarty_tpl->tpl_vars['billStatus']->value=="shipped"){?>
                                <?php if ($_smarty_tpl->tpl_vars['billsettingsData']->value[111]->billsettingsvalue==0){?>
                                <?php echo @SELL_BILL_STATUS_SHIPPED;?>

                                <?php }else{ ?>
                                <?php echo @SELL_BILL_STATUS_FACTORY_DELIVERED;?>

                                <?php }?>
                                <?php }elseif($_smarty_tpl->tpl_vars['billStatus']->value=="deliver"){?>
                                <?php echo @SELL_BILL_STATUS_DELIVERED;?>

                                <?php }elseif($_smarty_tpl->tpl_vars['billStatus']->value=="refused"){?>
                                <?php echo @SELL_BILL_STATUS_REFUSED;?>

                                <?php }?> </p>
                        </div>
                    </div>
                    <!-- end of form-group-->

                    <div <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[35]->billsettingsvalue;?>
<?php $_tmp5=ob_get_clean();?><?php if ($_tmp5==0){?> <?php }else{ ?> style="display:none" <?php }?> >
                        <div class="form-group">
                            <label class="col-lg-3 control-label myleft">رقم السيارة</label>
                            <div class="col-lg-9">
                                <p class="form-control-static">
                                    <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->carnumber;?>

                                </p>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-lg-3 control-label myleft">نوع السيارة</label>
                            <div class="col-lg-9">
                                <p class="form-control-static">
                                    <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->cartype;?>

                                </p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-3 control-label myleft">شاسية السيارة</label>
                            <div class="col-lg-9">
                                <p class="form-control-static">
                                    <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->carchase;?>

                                </p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-3 control-label myleft">موتور السيارة</label>
                            <div class="col-lg-9">
                                <p class="form-control-static">
                                    <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->carmotor;?>

                                </p>
                            </div>
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-lg-3 control-label myleft">اسم العميل المؤقت</label>
                        <div class="col-lg-9">
                            <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->tempclientName;?>
 </p>
                        </div>
                    </div>
                    <!-- end of form-group-->



                    <div <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[39]->billsettingsvalue;?>
<?php $_tmp6=ob_get_clean();?><?php if ($_tmp6==0){?> <?php }else{ ?> style="display:none" <?php }?> >
                        <div id="divclientdata">
                            <div class="form-group">
                                <label class="col-lg-3 control-label myleft">عنوان العميل </label>
                                <div class="col-lg-9">
                                    <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['myclientdata']->value->clientaddress;?>
</p>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-lg-3 control-label myleft">رقم التليفون</label>
                                <div class="col-lg-9">
                                    <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['myclientdata']->value->clientphone;?>
 <?php if ($_smarty_tpl->tpl_vars['myclientdata']->value->clientmobile!=''){?> - <?php echo $_smarty_tpl->tpl_vars['myclientdata']->value->clientmobile;?>
<?php }?></p>
                                </div>


                            </div>


                            <div class="form-group">
                                <label class="col-lg-3 control-label myleft">كود العميل</label>
                                <div class="col-lg-9 color-white">
                                    <?php echo $_smarty_tpl->tpl_vars['myclientdata']->value->clientcode;?>

                                </div>


                            </div>

                        </div>

                    </div>
                </div>
                <!-- end of bill no-->

                <div class="col-lg-4 hidden-print">
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[45]->billsettingsvalue;?>
<?php $_tmp7=ob_get_clean();?><?php if ($_tmp7==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label myleft">مركز التكلفة </label>
                        <div class="col-lg-7">

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

                            <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->costcenterid;?>
<?php $_tmp8=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['myallCostcenter']->value->id;?>
<?php $_tmp9=ob_get_clean();?><?php if ($_tmp8==$_tmp9){?> <?php echo $_smarty_tpl->tpl_vars['myallCostcenter']->value->name;?>
 <?php }?>
                            <?php } ?>


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

                </div>

                <div class="col-lg-4">
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[1]->billsettingsvalue;?>
<?php $_tmp10=ob_get_clean();?><?php if ($_tmp10==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label myleft">اسم العميل</label>
                        <div class="col-lg-7">
                            <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbillclientname;?>
 </p>
                        </div>
                    </div>
                    <!-- end of form-group-->

                    <div class="form-group mg-bt5 <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[56]->billsettingsvalue;?>
<?php $_tmp11=ob_get_clean();?><?php if ($_tmp11==0){?> <?php }else{ ?> style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label myleft">رصيد الدين</label>
                        <div class="col-lg-7">
                            <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbilltotaldeptbefor;?>
 </p>
                        </div>
                    </div>
                    <!-- end of form-group-->

                    <div class="form-group mg-bt5">
                        <!--<?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[68]->billsettingsvalue;?>
<?php $_tmp12=ob_get_clean();?><?php if ($_tmp12==0){?> <?php }else{ ?>  style="display:none"    <?php }?>-->
                        <label class="col-lg-5 control-label">نوع السعر</label>
                        <div class="col-lg-7">
                            <p class="form-control-static"> <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbilldetailData']->value[0]->pricetype;?>
<?php $_tmp13=ob_get_clean();?><?php if ($_tmp13==1){?>
                                تجزئة
                                <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbilldetailData']->value[0]->pricetype;?>
<?php $_tmp14=ob_get_clean();?><?php if ($_tmp14==0){?>
                                جملة
                                <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbilldetailData']->value[0]->pricetype;?>
<?php $_tmp15=ob_get_clean();?><?php if ($_tmp15==2){?>
                                نصف جملة
                                <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbilldetailData']->value[0]->pricetype;?>
<?php $_tmp16=ob_get_clean();?><?php if ($_tmp16==4){?>
                                سعر4
                                <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbilldetailData']->value[0]->pricetype;?>
<?php $_tmp17=ob_get_clean();?><?php if ($_tmp17==5){?>
                                سعر5
                                <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbilldetailData']->value[0]->pricetype;?>
<?php $_tmp18=ob_get_clean();?><?php if ($_tmp18==6){?>
                                سعر6
                                <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbilldetailData']->value[0]->pricetype;?>
<?php $_tmp19=ob_get_clean();?><?php if ($_tmp19==7){?>
                                سعر7
                                <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbilldetailData']->value[0]->pricetype;?>
<?php $_tmp20=ob_get_clean();?><?php if ($_tmp20==8){?>
                                سعر8
                                <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbilldetailData']->value[0]->pricetype;?>
<?php $_tmp21=ob_get_clean();?><?php if ($_tmp21==9){?>
                                سعر9
                                <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbilldetailData']->value[0]->pricetype;?>
<?php $_tmp22=ob_get_clean();?><?php if ($_tmp22==10){?>
                                سعر10
                                <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbilldetailData']->value[0]->pricetype;?>
<?php $_tmp23=ob_get_clean();?><?php if ($_tmp23==11){?>
                                سعر11
                                <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbilldetailData']->value[0]->pricetype;?>
<?php $_tmp24=ob_get_clean();?><?php if ($_tmp24==12){?>
                                سعر12
                                <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbilldetailData']->value[0]->pricetype;?>
<?php $_tmp25=ob_get_clean();?><?php if ($_tmp25==13){?>
                                سعر13
                                <?php }}}}}}}}}}}}}?> </p>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <?php if ($_smarty_tpl->tpl_vars['manyStores']->value!=1){?>
                    <hr class="mg-bt5 mg-tp5 hidden-print" />
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[2]->billsettingsvalue;?>
<?php $_tmp26=ob_get_clean();?><?php if ($_tmp26==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label myleft">المخزن</label>
                        <div class="col-lg-7">
                            <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->storeName;?>
 </p>
                        </div>
                    </div>
                    <?php }?>
                    <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[123]->billsettingsvalue;?>
<?php $_tmp27=ob_get_clean();?><?php if ($_tmp27==1){?>
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[2]->billsettingsvalue;?>
<?php $_tmp28=ob_get_clean();?><?php if ($_tmp28==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label myleft">بيع للمورد</label>
                        <div class="col-lg-7">
                            <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['mysupplierdata']->value->suppliername;?>
 </p>
                        </div>
                    </div>
                    <?php }?>
                    <!-- end of form-group-->

                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[3]->billsettingsvalue;?>
<?php $_tmp29=ob_get_clean();?><?php if ($_tmp29==0){?>
                        style="display:block" <?php }else{ ?> style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label myleft">اسم <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==0){?>
                            بائع <?php }elseif($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==1){?>مندوب <?php }elseif($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==2){?>طبيب <?php }?></label>
                        <div class="col-lg-7">
                            <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->employeename;?>
 </p>
                        </div>
                    </div>
                    <?php if ($_smarty_tpl->tpl_vars['sellbillData']->value->obygyVisitId>0){?>
                    <div class="form-group mg-bt5">
                        <label class="col-lg-5 control-label myleft">الطبيب المحول</label>
                        <div class="col-lg-7">
                            <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->obgyRefDoc;?>
 </p>
                        </div>
                    </div>
                    <?php }?>
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[101]->billsettingsvalue;?>
<?php $_tmp30=ob_get_clean();?><?php if ($_tmp30==0){?>
                        style="display:block" <?php }else{ ?> style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label myleft">عملية الفاتورة </label>
                        <div class="col-lg-7">
                            <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->billoperationName;?>

                        </div>
                    </div>
                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[101]->billsettingsvalue;?>
<?php $_tmp31=ob_get_clean();?><?php if ($_tmp31==0){?>
                        style="display:block" <?php }else{ ?> style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label myleft">نوع الفاتورة </label>
                        <div class="col-lg-7">
                            <?php if ($_smarty_tpl->tpl_vars['sellbillData']->value->obgyBillType==1){?>مباشر<?php }elseif($_smarty_tpl->tpl_vars['sellbillData']->value->obgyBillType==2){?>مستهلك<?php }elseif($_smarty_tpl->tpl_vars['sellbillData']->value->obgyBillType==3){?>استقبال<?php }?>
                        </div>
                    </div>



                    <!-- end of form-group-->
                    <div class="form-group mg-bt5">
                        <label class="col-lg-5 control-label myleft">اسم المستخدم</label>
                        <div class="col-lg-7">
                            <p class="form-control-static">
                                <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->useremployeename;?>

                            </p>
                        </div>
                    </div><!-- end of form-group-->
                    <!-- end of form-group-->
                    <div class="form-group mg-bt5">
                        <label class="col-lg-5 control-label myleft">التعليق</label>
                        <div class="col-lg-7">
                            <p class="form-control-static">
                                <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->comment;?>

                            </p>
                        </div>
                    </div><!-- end of form-group-->
                    <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[109]->billsettingsvalue;?>
<?php $_tmp32=ob_get_clean();?><?php if ($_tmp32==0){?>
                    <div class="form-group mg-bt5">
                        <label class="col-lg-5 control-label myleft">طرق المعرفة</label>
                        <div class="col-lg-7">
                            <p class="form-control-static">
                                <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->wayName;?>

                            </p>
                        </div>
                    </div>
                    <?php }?>
                    <!-- end of form-group-->
                </div>
                <!-- end of client info-->

            </div>
            <!-- end of frist row-->
            <!-- hidden ===============================-->
            <input type="hidden" name="billnameid" id="billnameid" value="<?php echo $_smarty_tpl->tpl_vars['billnameid']->value;?>
" />
            <input type="hidden" name="settingreturn" id="settingreturn"
                   value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[0]->billsettingsvalue;?>
" />
            <input type="hidden" name="settingclient" id="settingclient"
                   value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[1]->billsettingsvalue;?>
" />
            <input type="hidden" name="settingstore" id="settingstore"
                   value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[2]->billsettingsvalue;?>
" />
            <input type="hidden" name="settingseller" id="settingseller"
                   value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[3]->billsettingsvalue;?>
" />
            <input type="hidden" name="settingparcode" id="settingparcode"
                   value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[4]->billsettingsvalue;?>
" />
            <input type="hidden" name="settingdate" id="settingdate"
                   value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[5]->billsettingsvalue;?>
" />
            <input type="hidden" name="settingnewproduct" id="settingnewproduct"
                   value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[6]->billsettingsvalue;?>
" />
            <input type="hidden" name="settingcomment" id="settingcomment"
                   value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[7]->billsettingsvalue;?>
" />
            <input type="hidden" name="settingdiscount" id="settingdiscount"
                   value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[8]->billsettingsvalue;?>
" />
            <input type="hidden" name="settingQuantitiyFocus" id="settingQuantitiyFocus"
                   value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[9]->billsettingsvalue;?>
" />
            <input type="hidden" name="settingUnit" id="settingUnit"
                   value="<?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[10]->billsettingsvalue;?>
" />

            <!-- end of hidden ===============================-->
            <div class="clearfix"></div>
            <div class="margintop"></div>

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

            <div class="row">
                <div class="row">
                    <hr class='hidden-print' />
                    <div class="col-lg-6">
                        <h4>المبيعات</h4>
                    </div>
                </div>
                <!-- end of title row-->

                <div class="table-responsive">
                    <table class="table billtable table-bordered table-black" id="containerpros">
                        <thead>
                            <tr>
                                <th class="wdt60 myblack" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[40]->billsettingsvalue;?>
<?php $_tmp33=ob_get_clean();?><?php if ($_tmp33==0){?> <?php }else{ ?>
                                    style="display:none !important;" <?php }?>>رقم</th>
                                <th class="wdt60 myblack" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[59]->billsettingsvalue;?>
<?php $_tmp34=ob_get_clean();?><?php if ($_tmp34==0){?> <?php }else{ ?>
                                    style="display:none !important" <?php }?> class="wdt120">الباركود</th>
                                <th class="wdt300 myblack">اسم المنتج</th>
                                <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[26]->billsettingsvalue;?>
<?php $_tmp35=ob_get_clean();?><?php if ($_tmp35==0){?>

                                <th class="wdt240 myblack">المخزن</th>


                                <?php }?>

                                <th class=" myblack hidden-print" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[7]->billsettingsvalue;?>
<?php $_tmp36=ob_get_clean();?><?php if ($_tmp36==0){?>
                                    <?php }else{ ?> style="display:none !important" <?php }?> class="wdt240">ملاحظات</th>
                                <th class=" myblack wdt100n" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[53]->billsettingsvalue;?>
<?php $_tmp37=ob_get_clean();?><?php if ($_tmp37==0){?> <?php }else{ ?>
                                    style="display:none !important" <?php }?>">الوحدة</th>
                                <th class="wdt100n myblack" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp38=ob_get_clean();?><?php if ($_tmp38==0){?> <?php }else{ ?>
                                    style="display:none" <?php }?>>العدد</th>
                                <th
                                    class="wdt100n check_tr_unit  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
<?php $_tmp39=ob_get_clean();?><?php if ($_tmp39=='0'){?>  hidden <?php }?>">
                                    <?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
</th>
                                <th
                                    class="wdt100n myblack <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1||$_smarty_tpl->tpl_vars['billsettingsData']->value[116]->billsettingsvalue==0){?>hidden<?php }?>">
                                    السعر
                                    قبل الخصم
                                </th>
                                <th
                                    class="wdt100n myblack <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[116]->billsettingsvalue;?>
<?php $_tmp40=ob_get_clean();?><?php if ($_tmp40==0){?>  hidden <?php }?>">
                                    <?php echo @SELL_BILL_CAT_DISCOUNT;?>
</th>
                                <th class="wdt100n myblack <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">السعر
                                </th>

                                <th class="wdt100n myblack <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">
                                    الاجمالى قبل الخصم</th>
                                <th class=" myblack <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[8]->billsettingsvalue;?>
<?php $_tmp41=ob_get_clean();?><?php if ($_tmp41==0){?> <?php }else{ ?> style="display:none" <?php }?>
                                    class="wdt100n">الخصم</th>
                                <th class="wdt100n myblack <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">
                                    الاجمالى</th>
                                <th class="wdt100n myblack"> سريل</th>
                            </tr>
                        </thead>
                        <tbody>

                            <?php $_smarty_tpl->tpl_vars['x'] = new Smarty_variable(1, null, 0);?>
                            <?php  $_smarty_tpl->tpl_vars['sellbilldetail'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['sellbilldetail']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['sellbilldetailData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['sellbilldetail']->key => $_smarty_tpl->tpl_vars['sellbilldetail']->value){
$_smarty_tpl->tpl_vars['sellbilldetail']->_loop = true;
?>
                            <tr>
                                <td class=" myblack" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[40]->billsettingsvalue;?>
<?php $_tmp42=ob_get_clean();?><?php if ($_tmp42==0){?> <?php }else{ ?>
                                    style="display:none !important;" <?php }?>><?php echo $_smarty_tpl->tpl_vars['x']->value;?>
</td>
                                <td class=" myblack" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[59]->billsettingsvalue;?>
<?php $_tmp43=ob_get_clean();?><?php if ($_tmp43==0){?> <?php }else{ ?>
                                    style="display:none" <?php }?>>
                                    <div id="productparcode1">
                                        <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->parcode;?>
 </p>
                                    </div>
                                </td>
                                <td class=" myblack">
                                    <div id="productdiv1">
                                        <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->productName;?>
/
                                            <?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->productCatName;?>

                                            <?php if ($_smarty_tpl->tpl_vars['sellbilldetail']->value->sizeName!=''){?>/ <?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->sizeName;?>
<?php }?>
                                            <?php if ($_smarty_tpl->tpl_vars['sellbilldetail']->value->colorName!=''){?>/ <?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->colorName;?>
<?php }?>
                                        </p>
                                    </div>
                                </td>

                                <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[26]->billsettingsvalue;?>
<?php $_tmp44=ob_get_clean();?><?php if ($_tmp44==0){?>
                                <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->storeName;?>
<?php $_tmp45=ob_get_clean();?><?php if ($_tmp45!=''){?>
                                <td class=" myblack">
                                    <div id="productparcode1">
                                        <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->storeName;?>
 </p>
                                    </div>
                                </td>
                                <?php }else{ ?>
                                <td class=" myblack">
                                    <div id="productparcode1">
                                        <p class="form-control-static">

                                            <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->storeName;?>

                                        </p>
                                    </div>
                                </td>
                                <?php }?>
                                <?php }?>



                                <td class=" myblack  <?php if ($_smarty_tpl->tpl_vars['sellbilldetail']->value->note==''){?> hidden-print<?php }?>" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[7]->billsettingsvalue;?>
<?php $_tmp46=ob_get_clean();?><?php if ($_tmp46==0){?> <?php }else{ ?> style="display:none
                                    !important" <?php }?>>
                                    <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->note;?>
 </p>
                                </td>
                                <td class=" myblack" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[53]->billsettingsvalue;?>
<?php $_tmp47=ob_get_clean();?><?php if ($_tmp47==0){?> <?php }else{ ?>
                                    style="display:none" <?php }?>>
                                    <div id="productunitdiv1">
                                        <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->unitName;?>
 </p>
                                    </div>
                                </td>

                                <td class=" myblack" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[64]->billsettingsvalue;?>
<?php $_tmp48=ob_get_clean();?><?php if ($_tmp48==0){?> <?php }else{ ?>
                                    style="display:none" <?php }?>>
                                    <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->sellbilldetailquantity;?>
 </p>
                                </td>

                                <td
                                    class="check_tr_quantity  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->scunitname;?>
<?php $_tmp49=ob_get_clean();?><?php if ($_tmp49=='0'){?>  hidden <?php }?>">
                                    <?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->otherdetailquantity;?>

                                </td>
                                <td
                                    class=" myblack <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1||$_smarty_tpl->tpl_vars['billsettingsData']->value[116]->billsettingsvalue==0){?>hidden<?php }?>">
                                    <div id="propricechange1">
                                        <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->sellbilldetailprice+$_smarty_tpl->tpl_vars['sellbilldetail']->value->categorydiscount;?>
 </p>
                                    </div>
                                </td>

                                <td class=" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[116]->billsettingsvalue;?>
<?php $_tmp50=ob_get_clean();?><?php if ($_tmp50==0){?>  hidden <?php }?>">
                                    <p class="form-control-static"><?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->categorydiscount;?>
</p>
                                </td>

                                <td class=" myblack <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">
                                    <div id="propricechange1">
                                        <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->sellbilldetailprice;?>
 </p>
                                    </div>
                                </td>


                                <td class=" myblack <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">
                                    <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->sellbilldetailtotalprice+$_smarty_tpl->tpl_vars['sellbilldetail']->value->discountvalue;?>
 </p>
                                </td>
                                <td class=" myblack <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[8]->billsettingsvalue;?>
<?php $_tmp51=ob_get_clean();?><?php if ($_tmp51==0){?> <?php }else{ ?> style="display:none"
                                    <?php }?>>
                                    <p class="form-control-static">
                                        <?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->discountvalue;?>

                                    </p>
                                </td>
                                <td class=" myblack <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">
                                    <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->sellbilldetailtotalprice;?>
 </p>
                                </td>
                                <td class=" myblack">
                                    <?php if (($_smarty_tpl->tpl_vars['sellbilldetail']->value->sizeid==0&&$_smarty_tpl->tpl_vars['sellbilldetail']->value->parcode==$_smarty_tpl->tpl_vars['sellbilldetail']->value->productParcode)||($_smarty_tpl->tpl_vars['sellbilldetail']->value->sizeid>0&&$_smarty_tpl->tpl_vars['sellbilldetail']->value->parcode==$_smarty_tpl->tpl_vars['sellbilldetail']->value->productParcodeSC)){?>
                                    <?php if ($_smarty_tpl->tpl_vars['sellbilldetail']->value->soldSerialsInDetails!=''){?>
                                    <?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->soldSerialsInDetails;?>

                                    <?php }else{ ?>
                                    <input type="hidden" name="proSerials<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="proSerials<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                           class="proSerials"
                                           data-pro="<?php if ($_smarty_tpl->tpl_vars['sellbilldetail']->value->sizeid>0&&$_smarty_tpl->tpl_vars['sellbilldetail']->value->colorid>0){?>hasSizeColor<?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->sellbilldetailproductid;?>
-<?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->sizeid;?>
-<?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->colorid;?>
<?php }else{ ?><?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->sellbilldetailproductid;?>
<?php }?>"
                                           data-quantity="<?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->sellbilldetailquantity*$_smarty_tpl->tpl_vars['sellbilldetail']->value->productnumber;?>
" data-store="<?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->storeid;?>
"/>
                                    <input type="hidden" name="proid<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="proid<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                           value="<?php if ($_smarty_tpl->tpl_vars['sellbilldetail']->value->sizeid>0&&$_smarty_tpl->tpl_vars['sellbilldetail']->value->colorid>0){?>hasSizeColor<?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->sellbilldetailproductid;?>
-<?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->sizeid;?>
-<?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->colorid;?>
<?php }else{ ?><?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->sellbilldetailproductid;?>
<?php }?>" />
                                    <input type="hidden" name="requiredQuantity<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="requiredQuantity<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                           value="<?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->sellbilldetailquantity*$_smarty_tpl->tpl_vars['sellbilldetail']->value->productnumber;?>
" />
                                    <input type="hidden" name="sellbilldetailid<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" id="sellbilldetailid<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
"
                                           value="<?php echo $_smarty_tpl->tpl_vars['sellbilldetail']->value->sellbilldetailid;?>
" />
                                    <?php }?>
                                    <?php }else{ ?>
                                    -
                                    <?php }?>
                                </td>
                            </tr>
                            <?php $_smarty_tpl->_capture_stack[0][] = array('default', 'x', null); ob_start(); ?><?php echo $_smarty_tpl->tpl_vars['x']->value+1;?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
                            <?php } ?>
                        <input type="hidden" name="itr" id="itr" value="<?php echo $_smarty_tpl->tpl_vars['x']->value;?>
" />
                        <input type="hidden" name="sellbillId" id="sellbillId"
                               value="<?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbillid;?>
" />
                        <input type="hidden" name="sellbillclientId" id="sellbillclientId"
                               value="<?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbillclientid;?>
" />
                        </tbody>

                    </table>
                </div>
                <button type="button"
                        class="btn btn-primary pull-left ft-nor <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>"> اجمالى
                    المبيعات <span class="badge wht-clo">
                        <div id="sellbilltotal"><?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbilltotalbill;?>
</div>
                    </span> </button>
            </div>
            <!-- end of second row-->

            <div class="row">


                <div class="col-lg-7">

                    <div id="closeebill">
                        <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['sellbilldetailtaxdata']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                        <div class="form-group mg-bt5">
                            <label class="col-lg-3 control-label"><?php echo $_smarty_tpl->tpl_vars['data']->value['subtype'];?>
 - <?php echo $_smarty_tpl->tpl_vars['data']->value['type'];?>
</label>
                            <div class="col-lg-3"><?php echo $_smarty_tpl->tpl_vars['data']->value['amount'];?>
</div>
                        </div>
                        <?php } ?>
                    </div>
                    <div class="form-group" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[80]->billsettingsvalue;?>
<?php $_tmp52=ob_get_clean();?><?php if ($_tmp52==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-2 control-label"><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->delivery;?>
<?php $_tmp53=ob_get_clean();?><?php if ($_tmp53==0){?>شحن<?php }else{ ?> توصيل
                            <?php }?></label>
                        <div class="col-lg-4">
                            <p name="delivery" id="delivery"><?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->delivery;?>
</p>
                            <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">ادخل
                                القيمة صحيحة</span>
                        </div>
                    </div>

                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[80]->billsettingsvalue;?>
<?php $_tmp54=ob_get_clean();?><?php if ($_tmp54==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-2 control-label">الاجمالي العام</label>
                        <div class="col-lg-7">
                            <p class="form-control-static mg-tp10" id="valdelivery"><?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->totalafterdelivery;?>

                            </p>
                            <!--<input type="hidden" name="valdeliveryhidden" id="valdeliveryhidden" value="0"/>-->

                        </div>
                    </div>
                    <?php if ($_smarty_tpl->tpl_vars['sellbillimage']->value['images']){?>
                    <div>
                        <img src="../views/default/images/sellbill/<?php echo $_smarty_tpl->tpl_vars['sellbillimage']->value['images'];?>
"
                             style="width: 100px;height: 100px;border: 1px solid;border-radius: 6px;">
                    </div>
                    <?php }?>

                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[120]->billsettingsvalue;?>
<?php $_tmp55=ob_get_clean();?><?php if ($_tmp55!=1||$_smarty_tpl->tpl_vars['billsettingsData']->value[121]->billsettingsvalue!=2){?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-2 control-label">رقم القرار</label>
                        <div class="col-lg-7">
                            <p><?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->decisionNo;?>
</p>
                        </div>
                    </div>

                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[120]->billsettingsvalue;?>
<?php $_tmp56=ob_get_clean();?><?php if ($_tmp56!=1||$_smarty_tpl->tpl_vars['billsettingsData']->value[121]->billsettingsvalue!=2){?>  style="display:none" <?php }?>>
                        <label class="col-lg-2 control-label">قيمة القرار</label>
                        <div class="col-lg-7">
                            <p><?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->decisionValue;?>
</p>
                        </div>
                    </div>
                </div>


                <div class="col-lg-5 total-bill">
                    <hr />



                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[58]->billsettingsvalue;?>
<?php $_tmp57=ob_get_clean();?><?php if ($_tmp57==0){?> <?php }else{ ?>
                        style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label" style="font-size:14px;">عدد القطع المباعة</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="totalQty">

                                <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellQuantity;?>
<?php $_tmp58=ob_get_clean();?><?php if ($_tmp58<=0){?> <?php echo $_smarty_tpl->tpl_vars['quantity']->value;?>
 <?php }else{ ?> <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellQuantity;?>

                                <?php }?>

                            </p>

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


                    <div class="form-group mg-bt5 <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">
                        <label class="col-lg-5 control-label">قيمة الفاتورة</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="gentotal"><?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbilltotalbill;?>
</p>
                        </div>
                    </div>

                    <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[90]->billsettingsvalue;?>
<?php $_tmp59=ob_get_clean();?><?php if ($_tmp59==1&&$_smarty_tpl->tpl_vars['billnameAddData']->value->extraDiscountPlace==1){?>
                    <div class="form-group mg-bt5 <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">
                        <label class="col-lg-5 control-label">خصم اضافى </label>
                        <div class="col-lg-7">
                            <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->extraDiscountVal;?>
 </p>
                        </div>
                    </div>
                    <?php }?>
                    <!-- end of form-group-->

                    <div class="form-group mg-bt5 <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[57]->billsettingsvalue;?>
<?php $_tmp60=ob_get_clean();?><?php if ($_tmp60==0){?> <?php }else{ ?> style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label">نوع الخصم</label>
                        <div class="col-lg-7">
                            <p class="form-control-static"> <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbilldiscounttype;?>
<?php $_tmp61=ob_get_clean();?><?php if ($_tmp61==1){?>
                                مباشر
                                <?php }else{ ?>
                                بنسبة
                                <?php }?> </p>
                        </div>
                    </div>
                    <!-- end of form-group-->

                    <div class="form-group mg-bt5 <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>  <?php if ($_smarty_tpl->tpl_vars['sellbillData']->value->sellbilldiscount==''){?> hidden-print<?php }?>"
                         <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[57]->billsettingsvalue;?>
<?php $_tmp62=ob_get_clean();?><?php if ($_tmp62==0){?> <?php }else{ ?> style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label">قيمة الخصم</label>
                        <div class="col-lg-7">
                            <div <?php if ($_smarty_tpl->tpl_vars['sellbillData']->value->sellbilldiscounttype==1){?> class="input-group"<?php }?>>
                                <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbilldiscount;?>
 <?php if ($_smarty_tpl->tpl_vars['sellbillData']->value->sellbilldiscounttype==1){?>
                                    <span class=" hidden-print">
                                        (<?php echo rtrim(rtrim(sprintf("%.2f",($_smarty_tpl->tpl_vars['sellbillData']->value->sellbilldiscount*100/$_smarty_tpl->tpl_vars['sellbillData']->value->sellbilltotalbill)),'0'),'.');?>

                                        %)</span>
                                    <?php }?>
                                </p>
                            </div>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[90]->billsettingsvalue;?>
<?php $_tmp63=ob_get_clean();?><?php if ($_tmp63==1&&$_smarty_tpl->tpl_vars['billnameAddData']->value->extraDiscountPlace==0){?>
                    <div class="form-group mg-bt5 <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">
                        <label class="col-lg-5 control-label">خصم اضافى </label>
                        <div class="col-lg-7">
                            <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->extraDiscountVal;?>
 </p>
                        </div>
                    </div>
                    <?php }?>
                    <!-- end of form-group-->
                    <div <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[31]->billsettingsvalue;?>
<?php $_tmp64=ob_get_clean();?><?php if ($_tmp64==0){?> <?php }else{ ?> style="display:none" <?php }?>>
                        <hr class="mg-tp5 mg-bt5 hidden-print <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>" />
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 control-label">ضريبه القيمة المضافة</label>
                            <div class="col-lg-7 color-white">
                                <div class="input-group">
                                    <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->tax;?>
 %
                                </div>
                                <div class="input-group" style="padding-top: 1px;">
                                    <?php echo $_smarty_tpl->tpl_vars['taxvalue']->value;?>

                                    <?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->currancy;?>

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

                    <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[117]->billsettingsvalue;?>
<?php $_tmp65=ob_get_clean();?><?php if ($_tmp65==0){?>
                        style="display:none"
                        <?php }?>>
                        <label class="col-lg-5 col-sm-7 control-label"> <?php echo @SELL_BILL_PRO_DISCOUNT;?>
</label>
                        <div class="col-lg-7 col-sm-5">
                            <p class="form-control-static mg-tp10" id="productDis"><?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->totalprodiscount;?>
</p>
                        </div>
                    </div>

                    <!-- end of form-group-->
                    <div class="<?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[89]->billsettingsvalue;?>
<?php $_tmp66=ob_get_clean();?><?php if ($_tmp66==0){?> style="display:none" <?php }?>>
                        <hr class="mg-tp5 mg-bt5 hidden-print" />
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 control-label"> ضريبه خصم </label>
                            <div class="col-lg-7 color-white">

                                <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->taxOfDiscountVal;?>

                            </div>
                        </div>
                    </div>
                    <hr class="mg-tp5 mg-bt5 hidden-print" />
                    <div class="" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[120]->billsettingsvalue;?>
<?php $_tmp67=ob_get_clean();?><?php if ($_tmp67==0){?> style="display:none" <?php }?>>
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 control-label"> قيمة المصروفات الإدارية</label>
                            <div class="col-lg-7 color-white">

                                <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->manage_ex;?>

                            </div>
                        </div>
                    </div>
                    <div class="" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[120]->billsettingsvalue;?>
<?php $_tmp68=ob_get_clean();?><?php if ($_tmp68==0){?> style="display:none" <?php }?>>
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 control-label"> قيمة الدمغة الطبية</label>
                            <div class="col-lg-7 color-white">

                                <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->med_hallmark;?>

                            </div>
                        </div>
                    </div>
                    <div class="" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[120]->billsettingsvalue;?>
<?php $_tmp69=ob_get_clean();?><?php if ($_tmp69==0){?> style="display:none" <?php }?>>
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 control-label">رقم إيصال الدفع</label>
                            <div class="col-lg-7 color-white">
                                <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->pay_rec_no;?>

                            </div>
                        </div>
                    </div>
                    <div class="" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[120]->billsettingsvalue;?>
<?php $_tmp70=ob_get_clean();?><?php if ($_tmp70==0){?> style="display:none" <?php }?>>
                        <div class="form-group mg-bt5">
                            <label class="col-lg-5 control-label"> قيمة إيصال الدفع</label>
                            <div class="col-lg-7 color-white">

                                <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->pay_rec_val;?>

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

                    <div class="clearfix"></div>

                    <hr class="mg-tp5 mg-bt5 hidden-print" />
                    <div class="form-group mg-bt5 <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[52]->billsettingsvalue;?>
<?php $_tmp71=ob_get_clean();?><?php if ($_tmp71==0){?> <?php }else{ ?> style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label">الصافى</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="gen2total"><?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbillaftertotalbill;?>
 </p>
                        </div>
                    </div>
                    <!-- end of form-group-->
                    <div class="clearfix"></div>

                    <div class="form-group mg-bt5 <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[54]->billsettingsvalue;?>
<?php $_tmp72=ob_get_clean();?><?php if ($_tmp72==0){?> <?php }else{ ?> style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label">المدفوع</label>
                        <div class="col-lg-7">
                            <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[86]->billsettingsvalue;?>
<?php $_tmp73=ob_get_clean();?><?php if ($_tmp73==0){?>
                            <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbilltotalpayed;?>
 </p>
                            <input type="hidden" name="genpayvisa" id="genpayvisa" value="0" />
                            <input type="hidden" name="visaAccount" id="visaAccount" value="0" />
                            <input type="hidden" name="isBankAccountTransfer" id="isBankAccountTransfer" value="0" />
                            <?php }else{ ?>
                            <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[54]->billsettingsvalue;?>
<?php $_tmp74=ob_get_clean();?><?php if ($_tmp74==0){?> <?php }else{ ?>
                                style="display:none" <?php }?>>
                                <label class="col-lg-5 control-label">كاش</label>
                                <div class="col-lg-7">
                                    <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbilltotalpayed-$_smarty_tpl->tpl_vars['sellbillData']->value->visaPayed;?>
 </p>
                                </div>
                            </div>
                            <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[54]->billsettingsvalue;?>
<?php $_tmp75=ob_get_clean();?><?php if ($_tmp75==0){?> <?php }else{ ?>
                                style="display:none" <?php }?>>
                                <label class="col-lg-5 control-label">دفع الكترونى</label>
                                <div class="col-lg-7">
                                    <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->visaPayed;?>
 </p>
                                </div>
                            </div>

                            <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[54]->billsettingsvalue;?>
<?php $_tmp76=ob_get_clean();?><?php if ($_tmp76==0){?> <?php }else{ ?>
                                style="display:none" <?php }?>>
                                <label class="col-lg-5 control-label">حساب الدفع</label>
                                <div class="col-lg-7">
                                    <p class="form-control-static"> <?php echo $_smarty_tpl->tpl_vars['bankAccount']->value->accountname;?>
/<?php echo $_smarty_tpl->tpl_vars['bankAccount']->value->bankname;?>

                                    </p>
                                </div>
                            </div>
                            <div class="form-group mg-bt5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billnameAddData']->value->isBankAccountTransfer;?>
<?php $_tmp77=ob_get_clean();?><?php if ($_tmp77==1){?> <?php }else{ ?>
                                style="display:none" <?php }?>>
                                <label class="col-lg-5 control-label">تحويل بنكى</label>
                                <div class="col-lg-7">
                                    <p class="form-control-static"><?php if ($_smarty_tpl->tpl_vars['sellbillData']->value->isBankAccountTransfer==1){?> نعم
                                        <?php }else{ ?> لا<?php }?> </p>
                                </div>
                            </div>
                            <?php }?>
                        </div>
                    </div>
                    <!-- end of form-group-->

                    <hr class="mg-tp5 mg-bt5 hidden-print" />
                    <div class="form-group mg-bt5 bg-yel <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[55]->billsettingsvalue;?>
<?php $_tmp78=ob_get_clean();?><?php if ($_tmp78==0){?> <?php }else{ ?> style="display:none" <?php }?>>
                        <label class="col-lg-5 control-label">المتبقى</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="gen3total"><?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbillfinalbill;?>
 </p>
                        </div>
                    </div>
                    <!-- end of form-group-->

                    <div class="form-group mg-bt5 <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[1]->billsettingsvalue;?>
<?php $_tmp79=ob_get_clean();?><?php if ($_tmp79==0){?> style="display:block" <?php }else{ ?> style="display:none
                        !important" <?php }?>>
                        <label class="col-lg-5 control-label">باقى الدين</label>
                        <div class="col-lg-7">
                            <p class="form-control-static" id="gen4total"><?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbilltotaldeptafter;?>
 </p>
                        </div>
                    </div>
                    <!-- end of form-group-->
                </div>
                <!-- end of totals center-->
            </div>
            <!-- end of fourth row-->

            <?php if (count($_smarty_tpl->tpl_vars['billPayments']->value)>0){?>
            <div class="row <?php if ($_smarty_tpl->tpl_vars['Usergroupdata']->value->hideBillPrices==1){?>hidden<?php }?>">
                <div class="row">
                    <hr class='hidden-print' />
                    <div class="col-lg-6">
                        <h4>دفعات على الفاتورة</h4>
                    </div>
                </div>
                <table class="table billtable table-bordered table-black" id="billPaymentsTBL">
                    <thead>
                        <tr>
                            <th> م</th>
                            <th> قيمة الفاتورة</th>
                            <th> قيمة الدين قبل</th>
                            <th> القيمة المدفوعة </th>
                            <th> قيمة الدين بعد</th>
                            <th> تاريخ الدفع</th>
                            <th> طريقة الدفع</th>
                            <th> المستخدم</th>
                        </tr>
                    </thead>

                    <tbody>

                        <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['billPayments']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                        <tr class="gradeA ">
                            <td> <?php echo $_smarty_tpl->tpl_vars['data']->value['itra'];?>
</td>
                            <td> <?php echo $_smarty_tpl->tpl_vars['data']->value['finalnetbillvalue'];?>
 </td>
                            <td> <?php echo $_smarty_tpl->tpl_vars['data']->value['wait_before'];?>
</td>
                            <td> <?php echo $_smarty_tpl->tpl_vars['data']->value['clientdebtchangeamount'];?>
 </td>
                            <td> <?php echo $_smarty_tpl->tpl_vars['data']->value['wait_after'];?>
</td>
                            <td> <?php echo $_smarty_tpl->tpl_vars['data']->value['date'];?>
 </td>
                            <td> <?php echo $_smarty_tpl->tpl_vars['data']->value['paytype'];?>
 </td>
                            <td> <?php echo $_smarty_tpl->tpl_vars['data']->value['userName'];?>
 </td>
                        </tr>
                        <?php } ?>


                    </tbody>
                </table>
                <br><br>


            </div>
            <?php }?>

            <div class="row hidden-print">
                <?php if ($_smarty_tpl->tpl_vars['ordertype']->value==1){?>
                <!-- buttons for offers-->

                <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->conditions;?>
<?php $_tmp80=ob_get_clean();?><?php if ($_tmp80==0&&$_smarty_tpl->tpl_vars['sellbillData']->value->orderSavedBillId==0){?>
                <a href="sellbillController.php?do=saveOfferAsBill&offerId=<?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbillid;?>
"
                   onclick="$(this).hide()"><button type="button" class="btn btn-primary">حفظ كفاتورة</button></a>
                <?php }?>





                <?php }elseif($_smarty_tpl->tpl_vars['ordertype']->value!=1){?>
                <!-- buttons for bills-->




                <!--<button type="submit"  class="btn btn-primary">رجوع</button>-->
                <button type="button" class="btn btn-primary" id="saveSerials">حفظ السريلات </button>

                <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->deletedsellid;?>
<?php $_tmp81=ob_get_clean();?><?php if ($_tmp81>0&&$_smarty_tpl->tpl_vars['ordertype']->value==0){?>
                <a target="_new"
                   href="<?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->controlname;?>
.php?do=showDetail&sellbillid=<?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->deletedsellid;?>
">
                    <button type="button" class="btn btn-primary">الايصال القديم</button></a>
                <?php }?>
                <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->printingpapersize;?>
<?php $_tmp82=ob_get_clean();?><?php if ($_tmp82==0&&$_smarty_tpl->tpl_vars['ordertype']->value==0){?>
                <a target="_new" href="sellbillprintController.php?do=showDetail3&id=<?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbillid;?>
">
                    <button type="button" class="btn btn-info">طباعه ايصال كبير</button></a>
                <?php }?>


                
                <a target="_new"
                   href="sellbillprintController.php?do=showDetail2&id=<?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbillid;?>
&ordertype=<?php echo $_smarty_tpl->tpl_vars['ordertype']->value;?>
">
                    <button type="button" class="btn btn-info">طباعه ايصال</button></a>
                
                <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->sellorder;?>
<?php $_tmp83=ob_get_clean();?><?php if ($_tmp83==1){?>
                <a target="_new"
                   href="sellbillprintController.php?do=showDetail2&id=<?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbillid;?>
&ordertype=<?php echo $_smarty_tpl->tpl_vars['ordertype']->value;?>
&sellorder=1">
                    <button type="button" class="btn btn-info">طباعه ايصال امر بيع</button></a>
                <?php }?>
                <?php if ($_smarty_tpl->tpl_vars['ordertype']->value==0){?>
                <a target="_new" href="sellbillprintController.php?do=showpermission&id=<?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbillid;?>
">
                    <button type="button" class="btn btn-info">طباعه اذن صرف كامل</button></a>

                <a target="_new"
                   href="sellbillprintController.php?do=showmorepermission&id=<?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbillid;?>
">
                    <button type="button" class="btn btn-info">طباعه اذن صرف منفرد</button></a>
                <?php }?>



                <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->ebill==1&&$_smarty_tpl->tpl_vars['sellbillData']->value->conditions!=1){?>
                <span id="ebill_<?php echo $_smarty_tpl->tpl_vars['sellbill']->value->sellbillid;?>
">
                    <?php if (empty($_smarty_tpl->tpl_vars['sellbillData']->value->estatus)){?>
                    <a href="javascript:;" data-sellbillid="<?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbillid;?>
" type="button"
                       class="btn btn-default  sendbill "> ارسال</a>
                    <?php }elseif($_smarty_tpl->tpl_vars['sellbillData']->value->estatus=='-1'||$_smarty_tpl->tpl_vars['sellbillData']->value->estatus=='-2'){?>
                    <a href="javascript:;" data-sellbillid="<?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbillid;?>
" type="button"
                       class="btn btn-default  sendbill"> حدث خطأ </a>
                    <a href="sellbillController.php?do=ebillerrors&sellbillid=<?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->sellbillid;?>
" type="button"
                       class="btn btn-default"> المشكله</a>
                    <?php }else{ ?>
                    <a href="electronicinvoice.php?do=detail&uuid=<?php echo $_smarty_tpl->tpl_vars['sellbillData']->value->estatus;?>
" type="button"
                       class="btn btn-default"> تفاصيل</a>
                    <?php }?>
                </span>
                <?php }?>




                <?php }?>







            </div>
            <!-- end of fifth row-->

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

<script>


    $('.sendbill').live('click', function (e) {
        var sellbillid = Number($(this).attr('data-sellbillid'));
        $(this).hide();
        $("#ebill_" + sellbillid).html("<span><img style=width:30px;height:30px' src='../views/default/assets/img/icons8-spinner.gif'/></span>");
        var thisIs = $(this);
        if (sellbillid > 0) {

            $.ajax({
                type: "POST",
                url: 'eBillRequests.php?do=etsellbill',
                data: {sellbillid: sellbillid},
                success: function (data) {
                    $("#ebill_" + sellbillid).html("");
                    $(thisIs).show();
                    if (data == 1) {
                        $('#ebill_' + sellbillid).html('تم الارسال ');
                    } else {
                        $('#ebill_' + sellbillid).html(' حدث خطأ');
                        window.open('sellbillController.php?do=ebillerrors&sellbillid=' + sellbillid);
                    }
                }
            });
        }
    });

    $(function () {
        $(".proSerials").select2({
            placeholder: "",
            //minimumInputLength: document.getElementById("searchvalue").value,
            inimumInputLength: 0,
            multiple: true,
            //maximumSelectionSize: 2,
            quietMillis: 100,
            ajax: {
                url: "sellbillAjaxController.php?do=productAvailableParcodes",
                dataType: 'json',
                data: function (term, page) {
                    return {
                        term: term, //search term
                        pro: $(this).data('pro'),
                        store: $(this).data('store')
                    };
                },
                results: function (data) {
                    return {results: data};
                }
            },
            formatResult: function (data) {
                $html = '<span>' + data.text + '</span >/<span style="color:chocolate">' + parseFloat(data.don) + '</span >';
                if (data.enddate != "0000-00-00")
                    $html += '/<span>' + data.enddate + '</span >';
                return $html;
            },
            formatSelection: function (data) {
                $html = '<span>' + data.text + '</span >/<span style="color:chocolate">' + parseFloat(data.don) + '</span >';
                if (data.enddate != "0000-00-00")
                    $html += '/<span>' + data.enddate + '</span >';
                return $html;
            },
            initSelection: function (element, callback) {
                var item = element.val().split(':');
                //  var data = {id: item[0], text: item[1]};
                var data = {id: item[0], text: item[1]};
                callback(data);
            },
            //dropdownCssClass: "bigdrop", // apply css that makes the dropdown taller
        });
    }).on('change', function (e) {
        var id = e.target.id;
        var selectedData = $("#" + id).select2('data');
        var requiredQuantity = $("#" + id).data('quantity');//e.target.dataset.quantity;

        var selctedQuantity = 0;
        for (var i = 0; i < selectedData.length; i++) {
            selctedQuantity += Number(selectedData[i].don);
        }

        $("#" + id).parent().find('ul').removeClass('serial-success serial-error');
        $("#" + id).parent().find('li').removeClass('serial-success serial-error');
        $("#" + id).removeClass('serial-success serial-error');
        if (selctedQuantity > 0) {
            if (selctedQuantity >= requiredQuantity) {
                $("#" + id).parent().find('ul').addClass('serial-success');
                $("#" + id).parent().find('li').addClass('serial-success');
                $("#" + id).addClass('serial-success');
            } else {
                $("#" + id).parent().find('ul').addClass('serial-error');
                $("#" + id).parent().find('li').addClass('serial-error');
                $("#" + id).addClass('serial-error');
            }
        }
    });

    $('#saveSerials').on('click', function () {
        var validFlag = 1;
        $(".proSerials").each(function () {
            if ($(this).hasClass('serial-success')) {

            } else {
                validFlag = 0;
                alert('تأكد من ادخال جميع السريلات وبالكميات المطلوبة');
                return false;
            }
        });

        if (validFlag == 1) {
            $('#serialsForm').submit();
        }
    });

</script>
<?php }} ?>