OA CRM 스캐너 바코드 입력

2567 단어
js 
function zhekou(){
	$("#field2").val($("#field1").val()*$("#grandTotal").html()/100);
}
window.onload=function(){

	setInterval(zhekou,500);
	
	$("#stockout_title").focus();
	
	
}
// 
$('#stockout_title').keydown(function(e){
	if(e.keyCode==13){
	  var bm=$('#stockout_title').val();
	  
	  
	  $.ajax({
		  type: "GET",
		  url: "/t/getCustomer.php",
		  dataType: "JSON",
		  data:"bm="+bm,
		  cache: false,
		  success: function(j){
	
			$("#account_id").val(j.id);
			$("#account_id_text").val(j.account_name);
			
		  }

		});



	}
});


// 
$('#stockout_title').keydown(function(e){
	if(e.keyCode==13){
	  var bm=$('#stockout_title').val();
	  
	  
	  $.ajax({
		  type: "GET",
		  url: "/t/getProduct.php",
		  dataType: "JSON",
		  data:"bm="+bm,
		  cache: false,
		  success: function(j){
			pList.addRow();
				
			var zh=$("#prod_tb > tbody > tr").eq(-1);
			zh.find(":text").eq(0).val(bm);// 
			zh.find(":text").eq(1).val(j.product_name);// 
			zh.find(":text").eq(2).val(j.product_specification);// 
			zh.find(":text").eq(3).val(j.measure_id);// 
			zh.find(":text").eq(4).val("1");// 
			zh.find(":text").eq(5).val(j.product_price);// 
			
			
		  }

		});



	}
});


php 부분
getCustomer.php
<?
include_once("inc/conn.php");

$conn=TD::conn();
mysql_query("set names utf8",$conn);
$q=mysql_query("select * from crm_product where product_code='$bm'",$conn);
$r=mysql_fetch_array($q);
//print_r($r);
echo json_encode($r);


?>

 getProduct.php
<?
include_once("inc/conn.php");

$conn=TD::conn();
mysql_query("set names utf8",$conn);
$q=mysql_query("select * from crm_account where account_code='$bm'",$conn);
$r=mysql_fetch_array($q);
echo json_encode($r);


?>

좋은 웹페이지 즐겨찾기