
<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">
            <div class="panel-heading">
                <h3 class="panel-title"> اضافة فايده عميل</h3>
            </div>

            <div class="panel-body">

                <form action="FaidaController.php?do=add" method="post" id="form1" class="form-horizontal nameToBeChecked">

                    <div class="form-group mg-bt5">
                        <label class="col-lg-2 control-label">اسم العميل</label>
                        <div class="col-lg-4"> <span id="spryclient">
                                <div id="clientDiv">

                                    <input type="hidden" name="supplier" id="supplier" class="select2Supp"/>
                                    <input type="hidden" name="oldsupplierid" id="oldsupplierid" value="1"/>
                                    <input type="hidden" name="oldsuppliername" id="oldsuppliername" value="نقدى"/>

                                </div>
                                <span class="selectInvalidMsg">*</span></span> </div>
                    </div>
                    <hr class="mg-bt5 mg-tp5"/>
                    <input type="hidden" name="userstoreid" id="userstoreid" value="{$userdata->userstoreid}"/>
                    <input type="hidden" name="userstoreidForClient" id="userstoreidForClient" value="{$userdata->userstoreid}"/>
                    <div {if {$billsettingsData[2]->billsettingsvalue} eq 0}  {else} style="display:none" {/if} >
                        {if {$billsettingsData[26]->billsettingsvalue} eq 1}

                        <!------ {if {$billsettingsData[2]->billsettingsvalue} eq 0}  {else} style="display:none" {/if}---------------------->
                        <div class="form-group mg-bt5">


                            {if $userdata->userstoreid  eq 0}
                            <label class="col-lg-2 control-label">المخزن</label>
                            <div class="col-lg-4">
                                <select class="select2 wdt100 clientstore" name="storeid" id="storeid">
                                    <option value="-1">اختر مخزن</option>
                                    {foreach $storeData as $store}
                                    <option value="{$store->storeId}" {if $manyParcodes == 1 && $manyParcodesStoreid eq $store->storeId} selected="selected" {/if}>{$store->storeName}</option>

                                    {/foreach}
                                </select>
                            </div>
                            {else}

                            <div style="display:none">

                                <select class="select2 wdt100 clientstore" name="storeid" id="storeid" >
                                    <option value="-1">اختر مخزن</option>

                                    {foreach $storeData as $store}


                                    <option {if {$store->storeId} eq {$userdata->userstoreid}} selected="selected"   {/if}value="{$store->storeId}">{$store->storeName}</option>


                                    {/foreach}


                                </select>
                            </div>
                            <!--input name="storeid" id="storeid"  type="hidden" value="{$userdata->userstoreid}" /-->
                            <label class="col-lg-4 control-label">المخزن</label>
                            <div class="col-lg-8 clientstoretxt">
                                {foreach $storeData as $store}
                                {if {$store->storeId} eq {$userdata->userstoreid}}{$store->storeName} {/if}
                                {/foreach}
                            </div>
                            {/if}

                        </div>
                        {else}


                        <div  style="display:none">
                            <select class="select2 wdt100 clientstore" name="storeid" id="storeid" >

                                <option value="-1">اختر مخزن</option>
                                {foreach $storeData as $store}



                                <option {if {$store->storeId} eq {$userdata->userstoreid}} selected="selected"   {/if}value="{$store->storeId}">{$store->storeName}</option>


                                {/foreach}


                            </select>
                        </div>
                        {/if}

                    </div>



                    <!-- hidden ===============================-->
                    <input type="hidden" name="newproductItr" id="newproductItr" />
                    <input type="hidden" name="allDiscounts" id="allDiscounts" value="0" />
                    <input type="hidden" name="newproductTabIndex" id="newproductTabIndex" />
                    <input type="hidden" name="billnameid" id="billnameid" value="{$billnameid}"/>
                    <input type="hidden" name="settingreturn" id="settingreturn" value="{$billsettingsData[0]->billsettingsvalue}"/>
                    <input type="hidden" name="settingclient" id="settingclient" value="{$billsettingsData[1]->billsettingsvalue}"/>
                    <input type="hidden" name="settingstore" id="settingstore" value="{$billsettingsData[2]->billsettingsvalue}"/>
                    <input type="hidden" name="settingseller" id="settingseller" value="{$billsettingsData[3]->billsettingsvalue}"/>
                    <input type="hidden" name="settingparcode" id="settingparcode" value="{$billsettingsData[4]->billsettingsvalue}"/>
                    <input type="hidden" name="settingdate" id="settingdate" value="{$billsettingsData[5]->billsettingsvalue}"/>
                    <input type="hidden" name="settingnewproduct" id="settingnewproduct" value="{$billsettingsData[6]->billsettingsvalue}"/>
                    <input type="hidden" name="settingcomment" id="settingcomment" value="{$billsettingsData[7]->billsettingsvalue}"/>
                    <input type="hidden" name="settingdiscount" id="settingdiscount" value="{$billsettingsData[8]->billsettingsvalue}"/>
                    <input type="hidden" name="settingQuantitiyFocus" id="settingQuantitiyFocus" value="{$billsettingsData[9]->billsettingsvalue}"/>
                    <input type="hidden" name="settingUnit" id="settingUnit" value="{$billsettingsData[10]->billsettingsvalue}"/>
                    <input type="hidden" name="settingQuantityAlert" id="settingQuantityAlert" value="{$billsettingsData[13]->billsettingsvalue}"/>


                    <input type="hidden" name="morestore" id="morestore" value="{$billsettingsData[26]->billsettingsvalue}"/>
                    <input type="hidden" name="sumSameProductForStore" id="sumSameProductForStore" value="{$billsettingsData[73]->billsettingsvalue}"/>
                    <input type="hidden" name="usePriceTypeOfClient" id="usePriceTypeOfClient" value="{$billsettingsData[74]->billsettingsvalue}"/>
                    <input type="hidden" name="saveBtnGoesTo" id="saveBtnGoesTo" value="{$billsettingsData[75]->billsettingsvalue}"/>
                    <input type="hidden" name="printURL" id="printURL" value="{$printURL}"/>
                    <input type="hidden" name="sellerIsRequired" id="sellerIsRequired" value="{$billsettingsData[76]->billsettingsvalue}"/>

                    <input type="hidden" name="searchvalue" id="searchvalue" value="{$Programsettingdata->searchvalue}"/>
                    <input type="hidden" name="directDiscount" id="directDiscount" value="{$Usergroupdata->directDiscount}"/>
                    <input type="hidden" name="percentageDiscount" id="percentageDiscount" value="{$Usergroupdata->percentageDiscount}"/>
                    <input type="hidden" name="searchvalue" id="priceupdate" value="{$Usergroupdata->priceupdate}"/>

                    <input type="hidden" name="ordertype" id="ordertype" value="{$billnameData->ordertype}"/>
                    <input type="hidden" name="saveeffect" id="saveeffect" value="{$billnameData->saveeffect}"/>
                    <input type="hidden" name="discountrowtype" id="discountrowtype" value="{$billsettingsData[34]->billsettingsvalue}"/>
                    <input type="hidden" name="multiclient" id="multiclient" value="{$billsettingsData[37]->billsettingsvalue}"/>


                    <input type="hidden" name="showdiscountrow" id="showdiscountrow" value="{$billsettingsData[8]->billsettingsvalue}"/>

                    <input type="hidden" name="showbouns" id="showbouns" value="{$billsettingsData[38]->billsettingsvalue}"/>
                    <input type="hidden" name="showclientdetail" id="showclientdetail" value="{$billsettingsData[39]->billsettingsvalue}"/>
                    <input type="hidden" name="showtotal" id="showtotal" value="{$billsettingsData[41]->billsettingsvalue}"/>
                    <input type="hidden" name="shownumber" id="shownumber" value="{$billsettingsData[40]->billsettingsvalue}"/>
                    <input type="hidden" name="payedSetting" id="payedSetting" value="{$billsettingsData[71]->billsettingsvalue}"/>
                    <input type="hidden" name="manyParcodesVal_h" id="manyParcodesVal_h" value="{$manyParcodes}"/>
                    <input type="hidden" name="showrowPriceType" id="showrowPriceType" value="{$billsettingsData[83]->billsettingsvalue}"/>
                    <!--<input type="hidden" name="userstoreid" id="userstoreid" value="{$userdata->userstoreid}"/>-->
                    <input type="hidden" name="scunitnamevalue" id="scunitnamevalue" value="{$Programsettingdata->scunitname}"/>
                    <input type="hidden" id="allowBillDelete" value="{$Usergroupdata->allowBillDelete}"/>
                    <input name="hidden_debt" id="hidden_debt" type="hidden" value="0" />
                    <input type="hidden" name="returnsellbillprice" id="returnsellbillprice" value="0"/>
                    <input type="hidden" value="{$roundNumbersStatus}" id="round_numbers" name="round_numbers"/>
                    <input type="hidden" name="sellbilltotalbill" id="sellbilltotalbill" value="0"/>
                    <input type="hidden" name="distype" id="distype" value="-1"/>
                    <input type="hidden" name="tax" class="form-control numberinput positiveNo"  id="tax" value="{$Programsettingdata->vatValue}" onkeyup="checkdisValue();"/>
                    <input type="hidden" name="taxVal" class="form-control numberinput positiveNo"  id="taxVal" value="0" readonly/>
                    <input type="hidden" name="sellbillaftertotalbill" id="sellbillaftertotalbill" value="0"/>
                    <input type="hidden" name="gendis" id="gendis" {if {$billsettingsData[57]->billsettingsvalue} neq 0}value="0"{/if}  class="form-control numberclic positivefloat" placeholder="قيمة الخصم"  autocomplete="off" />
                    <input type="hidden" name="clientdebtafter" id="clientdebtafter" value="0"/>
                    <input type="hidden" name="hiddenpricetype" id="hiddenpricetype" value="0"/>
                    <!--<input type="hidden" name="pricetype" id="pricetype" value="0"/>-->
                    <input type="hidden" name="genpay" id="genpay"   {if {$billsettingsData[37]->billsettingsvalue} eq 1} "   {/if} class="form-control numberinput positivefloat"  placeholder="0"/>









                    <!-- end of hidden ===============================-->

                    <div class="row" {if {$billsettingsData[14]->billsettingsvalue} eq 0}  {else} style="display:none !important"  {/if}>
                        <div class="row">
                            <div class="col-lg-6" style="padding: 0 39px 8px;">
                                <h4>المنتجات</h4>
                            </div>
                            <div class="col-lg-6">
                                <button type="button" name="addpro" id="addpro" class="btn btn-primary pull-left ft-nor"> اضافة جديد</button>

                            </div>
                        </div>
                        <!-- end of title row-->
                        <div class="table-responsive bd-gr">
                            <table class="table billtable table-bordered  table-black" id="containerpros">
                                <thead>
                                <tr>

                                    <th class="wdt20" {if {$billsettingsData[6]->billsettingsvalue} eq 0}  {else} style="display:none !important;" {/if}>جديد</th>

                                    <th class="wdt20" {if {$billsettingsData[40]->billsettingsvalue} eq 0}  {else} style="display:none !important;" {/if}>رقم</th>

                                    <th   class="wdt120 check_tr_parcode {if {$billsettingsData[59]->billsettingsvalue} eq 1} hidden {/if}">الباركود</th>
                                    <th {if {$billsettingsData[26]->billsettingsvalue} eq 0}  {else} style="display:none !important;" {/if} class="wdt300" >المخزن</th>
                                    <th class="wdt400">اسم المنتج</th>
                                    <th {if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} class="wdt240">ملاحظات</th>
                                    <th  class="wdt100n check_tr_unit {if {$billsettingsData[53]->billsettingsvalue} eq 1}  hidden {/if}">الوحدة</th>
                                    <th class="wdt100n check_tr_quantity {if {$billsettingsData[64]->billsettingsvalue} eq 1}  hidden {/if}" >العدد</th>
                                    <th class="wdt100n   {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}" >{$Programsettingdata->scunitname}</th>

                                    <th class="wdt20" {if {$billsettingsData[38]->billsettingsvalue} eq 0}  {else} style="display:none !important;" {/if}>Bouns</th>
                                    <th class="wdt80 showrowPriceType {if {$billsettingsData[83]->billsettingsvalue} eq 1}  {else} hidden {/if}">نوع السعر</th>
                                    <th class="wdt80">السعر</th>

                                    <th class="wdt100n check_tr_disco8unt {if {$billsettingsData[8]->billsettingsvalue} eq 1}  hidden {/if}">الخصم</th>




                                    <!-------------------------------------discountvalue by hazem---------------------------------------------->
                                    <!--th {if {$billsettingsData[8]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} class="wdt80"> نسبة الخصم</th-->
                                    <!-------------------------------------discountvalue by hazem---------------------------------------------->
                                    <th class="wdt100n">
                                        <input name="hidden_itr" id="hidden_itr" type="hidden" value="{if $manyParcodes == 1}{$detalesitr}{else}1{/if}" />
                                        الاجمالى</th>
                                    <th>حذف</th>
                                </tr>
                                </thead>
                                <tbody>
                                {if $manyParcodes == 1}


                                {assign var=x value=1}
                                {foreach $mysellbildetales as $mymysellbildetales}

                                <tr  id="productraw1">
                                    <td {if {$billsettingsData[6]->billsettingsvalue} eq 0}  {else} style="display:none !important;" {/if}><a onClick="javascript:showProductModal({$x}, 7);" class="newLink btn btn-primary btn-xs conformdelProduct" >جديد</a></td>

                                    <td {if {$billsettingsData[40]->billsettingsvalue} eq 0}  {else} style="display:none !important;" {/if}>{$x}</td>

                                    <td class="wdt120 check_tr_parcode {if {$billsettingsData[59]->billsettingsvalue} eq 1}  hidden {/if}">
                                        <div id="productparcode{$x}" >
                                            <input type="text" name="parcode{$x}" id="parcode{$x}"  value="{$mymysellbildetales->parcode}"  class="form-control txt-nonraduis" tabindex="7"  onkeypress="getproductbyParcode(event, this.value, {$x});" size="3"  placeholder="الباركود" />
                                            <input name="parcodeType{$x}" id="parcodeType{$x}" type="hidden"/>
                                            <input name="productserailid{$x}" id="productserailid{$x}" type="hidden" />
                                            <input name="productQty{$x}" id="productQty{$x}" type="hidden" />
                                        </div>
                                    </td>

                                    <td  {if {$billsettingsData[26]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                        <div id="prstoridsiv{$x}">

                                            {if $userdata->userstoreid  eq 0}
                                            <select class="select2 wdt100" name="prstorid{$x}" id="prstorid{$x}">
                                                <option value="-1">اختر مخزن</option>
                                                {foreach $storeData as $store}
                                                <option {if {$mymysellbildetales->storeid} eq {$store->storeId}} selected="selected" {/if}value="{$store->storeId}">{$store->storeName}</option>
                                                {/foreach}
                                            </select>
                                            {else}
                                            {foreach $storeData as $store}
                                            {if {$store->storeId} eq {$userdata->userstoreid}}{$store->storeName} {/if}
                                            {/foreach}
                                            <input name="prstorid{$x}" id="prstorid{$x}" class="selectstore" type="hidden" value="{$userdata->userstoreid}" />
                                            {/if}
                                        </div>
                                    </td>
                                    <td>

                                        <div id="productdiv{$x}">
                                            <input type="hidden" id="product{$x}" name="product{$x}"  class="select2product wdt100"   tabindex="7" />

                                            <input type="hidden" id="oldproduct{$x}" name="oldproduct{$x}"  value="{if $mymysellbildetales->sizeid > 0 && $mymysellbildetales->colorid > 0}hasSizeColor{$mymysellbildetales->sellbilldetailproductid}-{$mymysellbildetales->sizeid}-{$mymysellbildetales->colorid}{else}{$mymysellbildetales->sellbilldetailproductid}{/if}"  />
                                            <input type="hidden" id="oldname{$x}" name="oldname{$x}"  value="{$mymysellbildetales->productName}
                                               {if $mymysellbildetales->sizeName != ''}/ {$mymysellbildetales->sizeName}{/if}
                                               {if $mymysellbildetales->colorName != ''}/ {$mymysellbildetales->colorName}{/if}"  />

                                        </div>
                                    </td>
                                    <td {if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else}  style="display:none !important"  {/if}>
                                        <textarea class="form-control txt-nonraduis enteraction" name="comment{$x}" id="comment{$x}" rows="1" tabindex="7">{$mymysellbildetales->note}</textarea>
                                    </td>
                                    <td class="wdt100n check_tr_unit {if {$billsettingsData[53]->billsettingsvalue} eq 1}  hidden {/if}">
                                        <div id="productunitdiv{$x}">
                                            <select id="productunit{$x}" name="productunit{$x}" class="select2 wdt100" tabindex="7"  onChange="getunitprice({$x});">
                                                <option value="-1"></option>
                                                {foreach $myunitdata{$x} as $mymyunitdata}
                                                <option   {if {$mymysellbildetales->productunitid} eq {$mymyunitdata->productunitid} } selected="selected"  {/if}   value="{$mymyunitdata->productunitid}" >{$mymyunitdata->unitName}</option>
                                                {/foreach}
                                            </select>
                                        </div>
                                    </td>
                                    <td class="wdt100n check_tr_quantity {if {$billsettingsData[64]->billsettingsvalue} eq 1}  hidden {/if}">
                                        <input type="text" name="pronum{$x}" id="pronum{$x}"  value="{$mymysellbildetales->sellbilldetailquantity}" class="form-control txt-nonraduis getprototal enteraction numberinput positivefloat" onKeyUp="checkquantity({$x}, event);" value="1" tabindex="7" />
                                    </td>
                                    <td class="  {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}">
                                        <input name="scunitname{$x}" id="scunitname{$x}" value="{$mymysellbildetales->otherdetailquantity}" class="form-control txt-nonraduis positiveNo" placeholder="العدد" type="text" tabindex="7" />
                                    </td>

                                    <td {if {$billsettingsData[38]->billsettingsvalue} eq 0}  {else}  style="display:none !important"  {/if}>
                                        <input type="text" name="bouns{$x}" id="bouns{$x}"  class="form-control txt-nonraduis getprototal enteraction numberinput"  value="{$mymysellbildetales->bouns}" tabindex="7" />
                                    </td>
                                    <td class="showrowPriceType {if {$billsettingsData[83]->billsettingsvalue} eq 1}  {else} hidden {/if}">
                                        <select class="select2 wdt100" name="pricetypepro{$x}" id="pricetypepro{$x}">
                                            <option value="0" {if $manyParcodesPriceType eq 0} selected="selected" {/if} >جملة</option>
                                            <option value="1" {if $manyParcodesPriceType eq 1} selected="selected" {/if} >تجزئة</option>
                                            <option value="2" {if $manyParcodesPriceType eq 2} selected="selected" {/if}>نصف جملة</option>
                                        </select>
                                    </td>
                                    <td>
                                        <div id="propricechange{$x}">
                                            <input type="text" name="proprice{$x}" id="proprice{$x}" value="{$mymysellbildetales->sellbilldetailprice}"  class="form-control getprototal enteraction numberinput txt-nonraduis positivefloat" value="0" tabindex="7" {if $mymysellbildetales->background !=""}style="background-color:{$mymysellbildetales->background}"{/if}/>
                                        </div>
                                    </td>


                                    <td class="check_tr_discount {if {$billsettingsData[8]->billsettingsvalue} eq 1}  hidden {/if}">
                                        <!--input type="text" name="prodis{$x}" id="prodis{$x}"   class="form-control txt-nonraduis getprototal enteraction numberinput" value="{$mymysellbildetales->discountvalue}" tabindex="7"  /-->


                                        <input name="prodis{$x}" id="prodis{$x}"   class="form-control txt-nonraduis getprototal enteraction numberinput positiveNo" value="{$mymysellbildetales->discountvalue}" tabindex="7"   />
                                        <input  name="discounttype{$x}" id="discounttype{$x}"      class="form-control txt-nonraduis getprototal enteraction numberinput positiveNo hidden" value="{$mymysellbildetales->discounttype}" tabindex="7"   />
                                    </td>
                                    <!-------------------------------------discountvalue by hazem---------------------------------------------->
                                    <!--td {if {$billsettingsData[8]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                      <input type="text" name="prodisper{$x}" id="prodisper{$x}"  onkeyup="getdiscount({$x});"  class="form-control txt-nonraduis  enteraction numberinput " value="0" tabindex="7"  />
                                    </td-->
                                    <!-------------------------------------discountvalue by hazem---------------------------------------------->
                                    <td>
                                        <div id="prototal{$x}" class="form-control-static">{$mymysellbildetales->sellbilldetailtotalprice}</div>
                                        <input name="hidden_prototal{$x}" id="hidden_prototal{$x}" value="{$mymysellbildetales->sellbilldetailtotalprice}" type="hidden" value="0" />
                                    </td>
                                    <td>
                                        <button id="remove{$x}" type="button" class="close flt-none removeicon removeproduct" aria-hidden="true">&times;</button>
                                    </td>
                                </tr>
                                {capture assign=x}{$x+1}{/capture}
                                {/foreach}





                                {else}



                                <tr  id="productraw1">

                                    <td {if {$billsettingsData[6]->billsettingsvalue} eq 0}  {else} style="display:none !important;" {/if}><a onClick="javascript:showProductModal(1, 7);" class="newLink btn btn-primary btn-xs conformdelProduct" >جديد</a></td>
                                    <td {if {$billsettingsData[40]->billsettingsvalue} eq 0}  {else} style="display:none !important;" {/if}>1</td>
                                    <td  class="check_tr_parcode {if {$billsettingsData[59]->billsettingsvalue} eq 1} hidden {/if}"    >
                                        <div id="productparcode1" >
                                            <input type="text" name="parcode1" id="parcode1"  class="form-control txt-nonraduis" tabindex="7"  onkeypress="getproductbyParcode(event, this.value, 1);" size="3"  placeholder="الباركود" />
                                            <input name="parcodeType1" id="parcodeType1" type="hidden"/>
                                            <input name="productserailid1" id="productserailid1" type="hidden" />
                                            <input name="productQty1" id="productQty1" type="hidden" />
                                        </div>
                                    </td>
                                    <td {if {$billsettingsData[26]->billsettingsvalue} eq 0}  {else} style="display:none !important;" {/if} >
                                        <div id="prstoridsiv1">

                                            {if $userdata->userstoreid  eq 0}
                                            <select class="select2 wdt100" name="prstorid1" id="prstorid1">
                                                <option value="-1">اختر مخزن</option>
                                                {foreach $storeData as $store}
                                                <option value="{$store->storeId}">{$store->storeName}</option>
                                                {/foreach}
                                            </select>
                                            {else}
                                            {foreach $storeData as $store}
                                            {if {$store->storeId} eq {$userdata->userstoreid}}{$store->storeName} {/if}
                                            {/foreach}
                                            <input name="prstorid1" id="prstorid1" class="selectstore" type="hidden" value="{$userdata->userstoreid}" />
                                            {/if}
                                        </div>
                                    </td>

                                    <!--  productdiv -->
                                    <td>
                                        <div id="productdiv1">
                                            <input type="hidden" id="product1" name="product1"  class="select2product wdt100"  data-placeholder="اختر منتج"  tabindex="7" />
                                        </div>
                                    </td>

                                    <td {if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else}  style="display:none !important"  {/if}>
                                        <textarea class="form-control txt-nonraduis enteraction" name="comment1" id="comment1" rows="1" tabindex="7"></textarea>
                                    </td>

                                    <!-- productunitdiv -->
                                    <td class="check_tr_unit {if {$billsettingsData[53]->billsettingsvalue} eq 1}  hidden {/if}">
                                        <div id="productunitdiv1">
                                            <select id="productunit1" name="productunit1" class="select2 wdt100" tabindex="7">
                                                <option value="-1"></option>
                                            </select>
                                        </div>
                                    </td>


                                    <td class="check_tr_quantity {if {$billsettingsData[64]->billsettingsvalue} eq 1}  hidden {/if}">
                                        <input type="text" name="pronum1" id="pronum1"  class="form-control txt-nonraduis getprototal enteraction numberinput positivefloat" onKeyUp="checkquantity(1, event);" value="1" tabindex="7" />
                                    </td>
                                    <td class="  {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}">
                                        <input name="scunitname1" id="scunitname1" value="0"  class="form-control txt-nonraduis positiveNo" placeholder="العدد" type="text" tabindex="7" />
                                    </td>

                                    <td {if {$billsettingsData[38]->billsettingsvalue} eq 0}  {else} style="display:none !important;" {/if}>
                                        <input type="text" name="bouns1" id="bouns1"  class="form-control txt-nonraduis getprototal enteraction numberinput positiveNo"  value="0" tabindex="7" />
                                    </td>
                                    <td class="showrowPriceType {if {$billsettingsData[83]->billsettingsvalue} eq 1}  {else} hidden {/if}">
                                        <select class="select2 wdt100" name="pricetypepro1" id="pricetypepro1">
                                            <option value="0" {if $billsettingsData[32]->billsettingsvalue eq 0} selected="selected" {/if} >جملة</option>
                                            <option value="1" {if $billsettingsData[32]->billsettingsvalue eq 1} selected="selected" {/if} >تجزئة</option>
                                            <option value="2" {if $billsettingsData[32]->billsettingsvalue eq 2} selected="selected" {/if}>نصف جملة</option>
                                        </select>
                                    </td>
                                    <td>
                                        <div id="propricechange1">
                                            <input type="text" name="proprice1" id="proprice1"  class="form-control getprototal enteraction numberinput txt-nonraduis positivefloat" value="0" tabindex="7" />
                                        </div>
                                    </td>


                                    <td class="check_tr_discount {if {$billsettingsData[8]->billsettingsvalue} eq 1}  hidden {/if}">

                                        <input name="prodis1" id="prodis1"   class="form-control txt-nonraduis getprototal enteraction numberinput positiveNo" value="0" tabindex="7"   {if {$billsettingsData[34]->billsettingsvalue} eq 0} type="text" {else}  type="hidden" {/if}/>
                                        <input  name="discounttype1" id="discounttype1"     class="form-control txt-nonraduis getprototal enteraction numberinput positiveNo" value="0" tabindex="7"    {if {$billsettingsData[34]->billsettingsvalue} eq 1} type="text" {else}  type="hidden" {/if}/>
                                    </td>
                                    <!-------------------------------------discountvalue by hazem---------------------------------------------->
                                    <!--td {if {$billsettingsData[8]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                      <input type="text" name="prodisper1" id="prodisper1"  class="form-control txt-nonraduis getprototal enteraction numberinput" value="0" tabindex="7"  />
                                    </td-->
                                    <!-------------------------------------discountvalue by hazem---------------------------------------------->
                                    <td>
                                        <!--<div id="prototal1" class="form-control-static">0</div>-->
                                        <!--<input name="hidden_prototal1" id="hidden_prototal1" type="hidden" value="0" />-->
                                        <input  name="hidden_prototal1" id="hidden_prototal1" class="editTotal form-control txt-nonraduis enteraction numberinput positiveNo" value="0" type="text"/>
                                    </td>
                                    <td>
                                        <button id="remove1" type="button" class="close flt-none removeicon removeproduct" aria-hidden="true">&times;</button>
                                    </td>
                                </tr>



                                {/if}
                                </tbody>
                            </table>
                        </div>
                        <button type="button" class="btn btn-primary pull-left ft-nor">
                            اجمالى المبيعات <span class="badge wht-clo">
                        <div id="sellbilltotal">0</div>
                    </span>
                            <input type="hidden" name="sellbillprice" id="sellbillprice" value="0"/>
                        </button>
                    </div>

                    <div class="form-group">
                        <label for="textDetails" class="col-lg-2 control-label"> المقدم</label>
                        <div class="col-lg-4">

                            <input type="text" class="form-control" name="presenter" id="presenter">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="textDetails" class="col-lg-2 control-label">الاقساط</label>
                        <div class="col-lg-4">
                            <select class="select2 wdt100 prem" name="Installment_duration">

                                <option value="0">اختر القسط</option>
                                <option value="{$Programsettingdata->three_months}">3 شهور</option>
                                <option value="{$Programsettingdata->six_months}">6 شهور</option>
                                <option value="{$Programsettingdata->twelve_months}">12 شهر</option>
                                <option value="{$Programsettingdata->eighteen_months}">18 شهر</option>
                                <option value="{$Programsettingdata->twentyfour_months}">24 شهر</option>
                                <option value="{$Programsettingdata->thirty_months}">30 شهر</option>
                                <option value="{$Programsettingdata->sixthirty_months}">36 شهر</option>
                                <option value="{$Programsettingdata->fortytwo_months}">42 شهر</option>
                                <option value="{$Programsettingdata->fortyeight_months}">48 شهر</option>
                            </select>

                        </div>
                    </div>

                    <div class="form-group">
                        <label for="textDetails" class="col-lg-2 control-label">نسبه الزيادة</label>
                        <div class="col-lg-4">

                            <input type="text" class="form-control" name="premium" id="premium" required><span style="float: left;margin-top: -21px;margin-left: 8px;">%</span>
                        </div>
                    </div>





                    <div class="form-group">
                        <label for="textDetails" class="col-lg-2 control-label">الاجمالي العام</label>
                        <div class="col-lg-4">

                            <input type="text" class="form-control" name="total_amount" id="totalafteprem" readonly>
                            <input type="hidden" class="form-control" name="total_amounthidden" id="totalaftepremhidden" readonly>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="textDetails" class="col-lg-2 control-label">التعليق</label>
                        <div class="col-lg-4">

                            <textarea class="form-control" rows="3" name="textDetails" id="textDetails"></textarea>

                        </div>
                    </div>





                    <div class="row  hidden-print m10" >
                        <div class="col-lg-12 text-center">
                            <button type="submit"  id="saveBtn" class="btn btn-primary">
                                <i class="glyphicon glyphicon-ok "></i>  حفظ</button>

                            <a href="premiumController.php?do=show" style="color: white" id="rtnBtn" class="btn btn-dark">
                                <i class="glyphicon glyphicon-backward"></i>  رجوع</a>
                        </div>



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

                </form>


            </div> <!-- end of panel-body-->

        </div>  <!-- end of panel panel-default-->

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

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


<!------------------------Client Model----------------------------->
<!-- Modal -->
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content bg-modal">
            <div class="modal-header">
                <button type="button" class="close pull-left savemodel2" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">اضافة عميل</h4>
            </div>
            <div class="modal-body">
                <form id="clientInfo" action="#" method="post" class="form-horizontal">
                    <div class="form-group">
                        <label for="newclientName" class="col-lg-2 control-label">اسم العميل</label>
                        <div class="col-lg-4"> <span id="sprytextfield2">
                                <input class="form-control" placeholder="اسم العميل" id="newclientName"   name="newclientName" type="text"  required="required"/>
                                <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 for="clientaddress" class="col-lg-2 control-label">{$Programsettingdata->clientcodname}</label>
                        <div class="col-lg-4">
                            <input class="form-control" placeholder="{$Programsettingdata->clientcodname}" id="clientcode" name="clientcode" type="text"/>
                        </div>
                    </div>


                    <div class="form-group">
                        <label for="txtAddress" class="col-lg-2 control-label">الشركة - المنطقة</label>
                        <div class="col-lg-4">
                            <span id="spryselect1">
                                <input  {if $Programsettingdata->clientfieldrequired eq 1}  required="required" {/if} type="hidden" name="clientareaid" value="0" id="clientareaid"/>
                                <span class="selectInvalidMsg">اختر الشركة - المنطقة</span></span>

                        </div>
                    </div>
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label for="newclientdebt" class="col-lg-2 control-label">المديونية</label>
                        <div class="col-lg-4"> <!--<span id="sprytextfield3">-->
                            <input class="form-control numberinput" placeholder="المديونية" id="newclientdebt" name="newclientdebt" type="text" required="required"/>
                            <!--<span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">ادخل المديونية صحيحة</span></span>--> </div>
                    </div>
                    <div class="form-group">
                        <label for="clientaddress" class="col-lg-2 control-label">العنوان</label>
                        <div class="col-lg-4">
                            <input class="form-control" placeholder="العنوان" id="clientaddress" name="clientaddress" type="text"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="clientphone" class="col-lg-2 control-label">رقم التليفون</label>
                        <div class="col-lg-4">
                            <input class="form-control numberinput" placeholder="رقم التليفون" id="clientphone" name="clientphone" type="text"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="clientmobile" class="col-lg-2 control-label">رقم الموبايل</label>
                        <div class="col-lg-4">
                            <input class="form-control numberinput" placeholder="رقم الموبايل" id="clientmobile"  name="clientmobile" type="text"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="debtLimit" class="col-lg-2 control-label"> حد الدين</label>
                        <div class="col-lg-4">
                            <input type="text" name="debtLimit" class="form-control positivefloat" id="debtLimit" value="{$Programsettingdata->clientDefaultDebtLimit}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="clientdetails" class="col-lg-2 control-label">التعليق</label>
                        <div class="col-lg-4">
                            <textarea  class="form-control" rows="3" name="clientdetails" id="clientdetails"></textarea>
                        </div>
                    </div>
                    <!-- =================================================   -->


                    <div class="form-group">
                        <label for="debtLimit" class="col-lg-2 control-label"> رقم البطاقه</label>
                        <div class="col-lg-4">
                            <input type="number" name="card_number" placeholder="رقم البطاقه" class="form-control" id="card number">
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-lg-2 control-label">إرفاق ملف</label>
                        <div class="col-lg-4">
                            <input type="file" name="file_faida" id="file_faida"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label  class="col-lg-2 control-label">نوع السعر </label>
                        <div class="col-lg-4">
                            <span >
                                <select name="priceTypeId" id="priceTypeId"  data-placeholder="اختر " class="select2 wdt100">


                                    <option value="-1">اختر نوع السعر </option>
                                    <option value="0">جملة</option>
                                    <option value="1">تجزئة</option>
                                    <option value="2">نصف جملة</option>
                                </select>
                                <!--<span class="selectInvalidMsg">اختر المحافظة</span>-->
                            </span>

                        </div>
                    </div>
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label for="textDetails" class="col-lg-2 control-label">المخزن</label>
                        <div class="col-lg-3">
                            <label>
                                <input type="checkbox" class="ckstore" name="store_all" id="store_all" checked="checked" value="1" />
                                كل المخازن
                            </label>
                        </div>
                        {foreach $storeData as $data}
                        <div class="col-lg-3">
                            <label>
                                <input type="checkbox" class="clientStore ckstore" name="store{$data->storeId}" id="store{$data->storeId}" checked="checked" disabled="disabled" value="1" />
                                {$data->storeName}
                            </label>
                        </div>
                        {/foreach}
                    </div>
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label for="texttype" class="col-lg-2 control-label">نوع العميل</label>
                        <div class="col-lg-3">
                            <label>
                                <input type="checkbox" class="cktype" name="typeClient_all" id="typeClient_all" checked="checked" value="1" />
                                كل انوع العملاء
                            </label>
                        </div>
                        {foreach $typeClient as $data}
                        <div class="col-lg-3">
                            <label>
                                <input type="checkbox" class="typeClient cktype" name="type{$data->typeId}" id="type{$data->typeId}" checked="checked" value="1" />
                                {$data->typeName}
                            </label>
                        </div>
                        {/foreach}
                    </div>
                    <!-- =================================================   -->
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default savemodel2" data-dismiss="modal">لا</button>
                <button type="button" class="btn btn-primary savemodelclient">نعم</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->
