<? include('include.php');?>
<?
/*
$ghrq="2015-12-11 00:00:00";

$startdate=strtotime(date("Y-m-d"));//今天 
$enddate=strtotime($ghrq);//归还日期
$yqts=round(($startdate-$enddate)/3600/24); //逾期天数
echo $yqts;
*/









$fdname=trim($_GET['dzbh']);
$fdname=$fdname?$fdname:'801';
//echo $fdname;
?>
<SCRIPT language=javascript src="inc/nj.js" type=text/javaScript></SCRIPT>
<SCRIPT language=javascript src="inc/editnj.js" type=text/javaScript></SCRIPT>
<link href="css/bc.css" rel="stylesheet" type="text/css">
<script language=javascript>
function showjs(dzbh)
{
ashow("psbookmain.php","?action=find&dname="+dzbh)
showinfob('psbookmain_j.php','?action=find&dzbh='+dzbh)
}












function chk()
{

var ldname
ldname=document.form1.dzinfo.value

if(ldname.length==0)
{
alert("查找的读者名称编号不能为空")
document.form1.dzinfo.focus();
return false
}
ashow("psbookmain.php","?action=find&dname="+ldname)
//showinfob('psbookmain_j.php','?action=find&spbm='+spbm+'&dzbh='+dzbh)
//showinfoa("psbookmain_t.php","?action=find&dname=LOVE")

document.getElementById("infoa").style.display="none";
//document.getElementById("infob").style.display="none";

document.getElementById("infoa").innerHTML="";
document.getElementById("infob").innerHTML="";
document.form1.dzinfo.value="";
return false
}



function chk_book()
{
if(!document.getElementById("dh"))  //ajax以后，有了此对象
{
alert("请先查找读者")
document.form1.dzinfo.focus();
return false
}

if(document.getElementById("h2"))  //如果读者有两行
{
alert("请选定一名读者")
document.form1.dzinfo.focus();
return false
}



var mdname
mdname=document.form1.bookinfo.value

if(mdname.length==0)
{
alert("查找的图书名称不能为空")

document.form1.bookinfo.focus();
return false
}

//alert("查找的图书名称编号不能为空000")

//alert(mdname)

var dzbh
	//alert(document.getElementById("h1").value)
	dzbh=document.getElementById("h1").value
	//alert(document.getElementById("h1").value)

showinfoa("psbookmain_t.php","?action=find&dname="+mdname+"&dzbh="+dzbh)

//alert('ok')
document.getElementById("infoa").style.display="";
document.getElementById("infob").style.display="";
document.form1.bookinfo.value="";



//	ashow("psbookmain.php","?action=find&dname="+ldname)
return false

}




function chkjbook(spbm)
{


	if(!document.getElementById("dh"))  //ajax以后，有了此对象
{
alert("请先查找读者")
document.form1.dzinfo.focus();
return false
}

if(document.getElementById("h2"))  //如果读者有两行
{
alert("请选定一名读者")
document.form1.dzinfo.focus();
return false
}

var dzbh
	dzbh=document.getElementById("h1").value

var pskkje
	pskkje=document.getElementById("pskkje_"+spbm).value


if(pskkje.length==0 || isNaN(pskkje))
	{
alert('扣款金额为空或者只能为数字')
	document.getElementById("pskkje_"+spbm).focus();
return false
	}



var isjkc
	isjkc=fun(spbm);

//alert(isjkc)

if(isjkc==2)
	{
	jkc=6;//需要减一本可借数量
	}
	else
	{
	jkc=5; //不需要减一本可借数量，反之就是要加上库存
	}

yjkc=jkc-5;



var truthBeTold = window.confirm("确定对本书进行破损丢失处理吗？扣款"+pskkje+"元，减"+yjkc+"本库存");
if (truthBeTold)
  {
showinfob('psbookmain_j.php','?action=ps&spbm='+spbm+'&dzbh='+dzbh+"&pskkje="+pskkje+"&jkc="+jkc)
  alert("处理成功")
  }

return false

}

function fun(spbm){
	//alert(spbm)
	obj = document.getElementsByName("isjkc_"+spbm);
	check_val = [];
	for(k in obj){
		if(obj[k].checked)
			check_val.push(obj[k].value);
	}
	return check_val;
}



function chkjbooka()
{

alert('ok')
if(!document.getElementById("dh"))  //ajax以后，有了此对象
{
alert("请先查找读者")
document.form1.dzinfo.focus();
return false
}

if(document.getElementById("h2"))  //如果读者有两行
{
alert("请选定一名读者")
document.form1.dzinfo.focus();
return false
}




//showinfob('psbookmain_b.php','?action=find&spbm=<?=$spbm?>')




}






function chkkey()
{
if(event.keyCode=='13') 
{ 
return chk_book();
}
}


function chkkeydz()
{
if(event.keyCode=='13') 
{ 
return chk();
}
}





function showa(obj)
{
var str=getIE(obj)
var temp=str.split(",")
var top=temp[0]
var left=temp[1]
var objDiv=document.getElementById("infoa")
objDiv.style.left=temp[1];
objDiv.style.top=parseInt(temp[0])+parseInt(obj.offsetHeight);
objDiv.style.width=obj.offsetWidth;
}

function getIE(e){
var t=e.offsetTop;
var l=e.offsetLeft;
while(e=e.offsetParent){
t+=e.offsetTop;
l+=e.offsetLeft;
}
return (t+","+l);
}


</script>

<body onload="show('psbookmain.php','?action=find&dname=<?=$fdname?>')">
<div align="center" class=t>【图书丢失破损管理】</div>
<br>

<form name=form1>
     
  <TABLE class=gridView id=ctl00_ContentPlaceHolder2_GridView1
      style="WIDTH: 100%; BORDER-COLLAPSE: collapse" cellSpacing=0 rules=all
      border=1>
    <tr class= scope=col> 
      <td height="31" class= scope=col>借阅证号或名称【支持模糊查询】：</td>
      <td height="31" scope=col>图书ISBN、编号或名称【支持模糊查询】：</td>
    </tr>
    <tr class= scope=col> 
      <td height="31" class= scope=col> 
        <div align="right"></div>
        <div align="left"> 
          <input type="text" name="dzinfo" id="puter" maxlength="50" size="30" value=""  tabindex=1 onkeydown=chkkeydz()>
          <input type="button" name="submit" value="查找读者" onclick="return chk()" tabindex=2>
        </div>
        </td>
      <td height="31" scope=col> 
        <div align="right"></div>
        <div align="left"> 
          <input type="text" name="bookinfo" id="puter0" maxlength="50" size="30" value=""  tabindex=3 onkeydown=chkkey()>
          <input type="button" name="submit" value="查找图书"  onclick="return chk_book()" tabindex=4>
        </div>
        </td>
    </tr>
    <tr scope=col> 
      <td height="2"  scope=col> 
        <div id="info"> </div>
      </td>
      <td height="2" scope=col> 
        <div id="infoa"> </div>
      </td>
    </tr>
    <tr> 
      <td colspan="2" height="24"> 
        <div align="center"> 
          <div id="infob"> </div>
        </div>
      </td>
    </tr>
  </table>
</form>
 

  
  

  