anchor.diff:  					'<th class="uk-text-center numeric">'+productOBJ.medicine[i].price_per_unit+'</th>'+
   					'<th class="uk-text-center numeric">'+productOBJ.medicine[i].total_price_med+'</th>'+
   					'<th class="uk-text-center numeric">'+productOBJ.medicine[i].med_dis+'</th>'+
  -					'<th class="uk-text-center "><input type="text" class="uk-width-1-2 numeric" value="'+productOBJ.medicine[i].med_dis_branch+'" /></th>'+
  -					'<th class="uk-text-center numeric">'+productOBJ.medicine[i].med_total+'</th>'+
  +					'<th class="uk-text-center "><input type="text" class="uk-width-1-2 numeric uk-text-right dismedicine dismedicine'+i+'" readonly="readonly" data-mbindex="'+i+'"'+
  +					'value="'+productOBJ.medicine[i].med_dis_branch+'" /></th>'+
  +					'<th class="uk-text-center countall numeric meddistotal'+i+'">'+productOBJ.medicine[i].med_total+'</th>'+
  +					'<th class="hidden"><input type="text" class="mtotal'+i+'" name="eveyamount"  value="'+productOBJ.medicine[i].med_total+'"  /></th>'+
   					'<th><button data-index="'+i+'" class="uk-button uk-button-danger uk-button-small delmedicine"  type="button" >x</button></th>'+ 
   					'</tr>';
   						$('.showallmedicine').append(appall)
  
positive.code: 						        </tr>
  						    </thead> 
  						    <tbody class="showpro">
  							<!-- <tr>
  								<th class="uk-text-center" colspan="6">No data available in table</th>
  								
  							</tr> -->
  						    </tbody>
  						</table>
  						</div><hr>
  
negative.code: 				productOBJ.chang_promotion = 0
  			})
  			
  		$(document).on("click",".disdoc",function(){
  			$("#btn_dis").val($(this).data("tindex"))
  			$(".numeric").autoNumeric('init');
  			let modal = UIkit.modal('#disdocModel');
  			$('.clear').val(0);
  			modal.show();
  		})
  		$(document).on("click","#btn_dis",function(){			
  			if($('input[name=disalltypedoc]:checked').val() == 1){
  				$(".disdoc"+$(this).val()).val($('#disbaht').val())
  			}else{			
  				$(".disdoc"+$(this).val()).val(((parseFloat(productOBJ.treatment[$(this).val()].treat_total) * parseFloat($('#disper').val()))/100).toFixed(2))
  			}
  			productOBJ.treatdocdis = (parseFloat(productOBJ.treatment[$(this).val()].treat_total) - (parseFloat($(".disdoc"+$(this).val()).val().replace(/,/g,"")) + parseFloat($(".disbranch"+$(this).val()).val().replace(/,/g,"")) )).toFixed(2)
  			
  			$('.treattotal'+$(this).val()).text(addCommas(productOBJ.treatdocdis))
  			$('.ttotal'+$(this).val()).val(productOBJ.treatdocdis)
  			readtotalall()
  
  		}) 
  		$(document).on("change","input[name=disalltypedoc]",function(){
  			if($(this).val() == 1)
  				$('#disper').val(0)
  			else
  				$('#disbaht').val(0)	
  		})
  		/* end dis doc */
  		$(document).on("click",".disbranch",function(){
  			$("#btn_disbranch").val($(this).data("tbindex"))
  			$(".numeric").autoNumeric('init');
  			let modal = UIkit.modal('#disbranchModel');
  			$('.clear').val(0);
  			modal.show();
  		})
  		$(document).on("click","#btn_disbranch",function(){			
  			if($('input[name=disalltypebranch]:checked').val() == 1){
  				$(".disbranch"+$(this).val()).val($('#disbahtbranch').val())
  			}else{			
  				$(".disbranch"+$(this).val()).val(((parseFloat(productOBJ.treatment[$(this).val()].treat_total) * parseFloat($('#disperbranch').val()))/100).toFixed(2))
  			}
  			productOBJ.treatdocdis = (parseFloat(productOBJ.treatment[$(this).val()].treat_total) - (parseFloat($(".disbranch"+$(this).val()).val().replace(/,/g,"")) + parseFloat($(".disdoc"+$(this).val()).val().replace(/,/g,"")) ) ).toFixed(2)
  			$('.treattotal'+$(this).val()).text(addCommas(productOBJ.treatdocdis))
  			$('.ttotal'+$(this).val()).val(productOBJ.treatdocdis)
  			readtotalall()
  
  		}) 
  		$(document).on("change","input[name=disalltypebranch]",function(){
  			if($(this).val() == 1)
  				$('#disperbranch').val(0)
  			else
  				$('#disbahtbranch').val(0)	
  		})
  		/* end dis branch treat */
  		$(document).on("click",".dismedicine",function(){
  			$("#btn_disbranchmedicine").val($(this).data("mbindex"))
  			$(".numeric").autoNumeric('init');
  			let modal = UIkit.modal('#disbranchMedicine');
  			$('.clear').val(0);
  			modal.show();
  		})
  		$(document).on("click","#btn_disbranchmedicine",function(){			
  			if($('input[name=disalltypebranchmedicine]:checked').val() == 1){
  				$(".dismedicine"+$(this).val()).val($('#disbahtbranchmedicine').val())
  			}else{			
  				$(".dismedicine"+$(this).val()).val(((parseFloat(productOBJ.medicine[$(this).val()].med_total) * parseFloat($('#disperbranchmedicine').val()))/100).toFixed(2))
  			}
  			productOBJ.meddistotal = (parseFloat(productOBJ.medicine[$(this).val()].med_total) - (parseFloat($(".dismedicine"+$(this).val()).val().replace(/,/g,"")))).toFixed(2)
  			$('.meddistotal'+$(this).val()).text(addCommas(productOBJ.meddistotal))
  			$('.mtotal'+$(this).val()).val(productOBJ.meddistotal)
  			readtotalall()
  
  		}) 
  		$(document).on("change","input[name=disalltypebranchmedicine]",function(){
  			if($(this).val() == 1)
  				$('#disperbranchmedicine').val(0)
  			else
  				$('#disbahtbranchmedicine').val(0)	
  		})		
  		/* end dis branch medicine */
  		$(document).on("click",".disproduct",function(){
  			$("#btn_disbranchproduct").val($(this).data("pbindex"))
  			$(".numeric").autoNumeric('init');
  			let modal = UIkit.modal('#disbranchProduct');
  			$('.clear').val(0);
  			modal.show();
  		})
  		$(document).on("click","#btn_disbranchproduct",function(){			
  			if($('input[name=disalltypebranchproduct]:checked').val() == 1){
  				$(".disproduct"+$(this).val()).val($('#disbahtbranchproduct').val())
  			}else{			
  				$(".disproduct"+$(this).val()).val(((parseFloat(productOBJ.product[$(this).val()].pro_total) * parseFloat($('#disperbranchproduct').val()))/100).toFixed(2))
  			}
  			productOBJ.prodistotal = (parseFloat(productOBJ.product[$(this).val()].pro_total) - (parseFloat($(".disproduct"+$(this).val()).val().replace(/,/g,"")))).toFixed(2)
  			
  			$('.prodistotal'+$(this).val()).text(addCommas(productOBJ.prodistotal))
  			$('.ptotal'+$(this).val()).val(productOBJ.prodistotal)
  			readtotalall()
  		}) 
  		$(document).on("change","input[name=disalltypebranchproduct]",function(){
  			if($(this).val() == 1)
  				$('#disperbranchproduct').val(0)
  			else
  				$('#disbahtbranchproduct').val(0)	
  		})		
  		/* end dis branch product */
  			$(document).on("keyup",".dper",function(){
  			let dper1 = "";			
  			let bper1 = "";
  			if($(this).data("dcb") == 1){
  				dper1 = parseFloat($(this).val())
  				bper1 = parseFloat((parseFloat($('.disbranch'+$('#btn_dis').val()).val().replace(/,/g,"")) / parseFloat(productOBJ.treatment[$('#btn_dis').val()].treat_total))*100)
  			}else if($(this).data("dcb") == 2){
  				bper1 = parseFloat($(this).val())
  				dper1 = parseFloat((parseFloat($('.disdoc'+$('#btn_disbranch').val()).val().replace(/,/g,"")) / parseFloat(productOBJ.treatment[$('#btn_disbranch').val()].treat_total))*100)
  			}
  			
   			if($(this).autoNumeric('get')>100){
  				swalall()
  			    $(this).val(0);  
  			} 
  			 if(Math.abs(dper1 + bper1)>100){
  				 	swalall()
  				   	$(this).val(0);  
  				}  
  		})
  
  		$(document).on("keyup",".dbaht",function(){
  			let db1 = "";			
  			let bb1 = "";
  			let cc1 = "";
  			let total1= "";
  			if($(this).data("dcb") == 3){
  				db1 = parseFloat($(this).val())
  				bb1 = parseFloat((parseFloat($('.disbranch'+$('#btn_dis').val()).val().replace(/,/g,""))))
  				cc1 = $('#btn_dis').val()
  				total1 = parseFloat(productOBJ.treatment[cc1].treat_total)
  			}else if($(this).data("dcb") == 4){
  				db1 = parseFloat($(this).val())
  				bb1 = parseFloat((parseFloat($('.disdoc'+$('#btn_disbranch').val()).val().replace(/,/g,""))))
  				cc1 = $('#btn_disbranch').val()
  				total1 = parseFloat(productOBJ.treatment[cc1].treat_total)
  			}else if($(this).data("dcb") == 7){
  				cc1 = $('#btn_disbranchmedicine').val()
  				total1 = parseFloat(productOBJ.medicine[cc1].med_total)
  			}else if($(this).data("dcb") == 8){
  				cc1 = $('#btn_disbranchproduct').val()
  				total1 = parseFloat(productOBJ.product[cc1].pro_total)
  			}
  			
  			if($(this).autoNumeric('get')>total1){
  						swalall()
  			    	    $(this).val(0);  
  			}
  			if(Math.abs(db1 + bb1)>total1 ){
  				swalall()
  	    	    $(this).val(0);
  			}
  		})
  		function swalall() {
  			swal(
  		    		  'WARNING!',
  		    	      'ค่าเงินไม่สามารถลดเกิน 100%ได้ :)',
  		    	      'error'
  		    	    )
  		}
  			function addCommas(nStr)
  			{
  				nStr += '';
  				x = nStr.split('.');
  				x1 = x[0];
  				x2 = x.length > 1 ? '.' + x[1] : '';
  				var rgx = /(\d+)(\d{3})/;
  				while (rgx.test(x1)) {
  					x1 = x1.replace(rgx, '$1' + ',' + '$2');
  				}
  				return x1 + x2;
  			}
  		</script>
  		</div>
  	</body>
  