<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
<link rel="stylesheet" type="text/css" href="{$vd['sc']}css/main.css"/>
</head>
<body>
<div id="titleDiv">
<div style="float:left"><a href="index.php?a=Home"><img src="{$vd['sc']}images/home.png" style="vertical-align:middle" border="0"/></a></div><div style="float:left;padding-top:8px;padding-left:3px;"><a href="index.php?a=Home" title="回到后台首页"><font color="#000">桌面</font></a> <span style="font-size:7px;">>></span> 一卡通手工返点结算</div>
<div style="float:right;"><a href="index.php?m=mod_home&a=Help&t=admin_b2b_poll_index" onFocus="this.blur()" title="查看分类相关帮助"><img src="{$vd['sc']}images/help.gif" style="vertical-align:middle" border="0"/></a></div>
</div>
<div id="contentTip" style="display:none;"></div>
<form id="cform" method="post" action="index.php?m=mod_b2b&c=Reward&a=CheckOut">
<div id="content" class="cwarpper">
<div class="cbodyHead"></div>
<div class="cwarpper1">
<div class="ctitle">一卡通返点手工结算</div>
<table border="0" id="ctable1" class="ctable">
  <tr>
    <td class="tablelt">选择经销商：</td>
    <td class="tablert">
    	<select name="aid" id="aid">
    		<option value="0">请选择代理商</option>
    		<!--foreach($vd['agent'] as $item){-->
    		<option value="{$item['aid']}">{$item['company']}({$item['aid']})</option>
    		<!--}-->
    	</select>
    </td>
  </tr>
  <tr>
    <td class="tablelt">起始时间：</td>
    <td class="tablert">
      <input type="text" name="startdate" value="<!--echo date('Y-m-d').' 00:00:00';-->" style="vertical-align:middle;" id="startdate" onMouseOver="iEvent('mouseover',this)" onFocus="iEvent('focus',this)" onBlur="iEvent('blur',this)" onMouseOut="iEvent('mouseout',this)" />
      <img src="{$vd['sc']}images/calender.gif" onclick="dateDialog('startdate')" style="vertical-align:middle;cursor:pointer;margin-left:0px;"/>
    </td>
  </tr>
  <tr>
    <td class="tablelt">结束时间：</td>
    <td class="tablert">
      <input type="text" name="enddate" value="<!--echo date('Y-m-d').' 23:59:00';-->" style="vertical-align:middle;"  id="enddate" onMouseOver="iEvent('mouseover',this)" onFocus="iEvent('focus',this)" onBlur="iEvent('blur',this)" onMouseOut="iEvent('mouseout',this)" />
      <img src="{$vd['sc']}images/calender.gif" onclick="dateDialog('enddate')" style="vertical-align:middle;cursor:pointer;margin-left:0px;"/>
    </td>
  </tr>
  <tr>
    <td class="tablelt">
      系统计算出返点：
    </td>
    <td class="tablert">
      <input name="ar" id="ar" type="text" readonly style="background:#f0f0f0"/> {$vd['lang']['moneyunit']} <span style="color:#cccccc"></span><input type="button" value="计算" class="button" onclick="getSum()"/>
    </td>
  </tr>
  <tr>
    <td class="tablelt">
      实际返点金额：
    </td>
    <td class="tablert">
      <input name="ap" id="ap" type="text"/> {$vd['lang']['moneyunit']} <span style="color:#cccccc"></span>
    </td>
  </tr>
  <tr>
    <td class="tablelt">返点备注：</td>
    <td class="tablert"><textarea name="remarks" wrap="VIRTUAL" cols="30" rows="3" scrolling="yes" style="padding:5px"></textarea>
    </td>
  </tr>
  <tr>
    <td class="tablelt">注意：</td>
    <td class="tablert">
      
    </td>
  </tr>
  <tr>
    <td class="tablelt" style="height:80px"></td>
    <td class="tablert">
      <input type="submit" value="发放返点 &gt;&gt" class="btn"/>
      <input type="reset" value="重 置" class="btn"/>
    </td>
  </tr>
</table>
<input type="hidden" value="{$item['id']}" name="id" id="id"/>
</div>
<div class="cbodyFoot"></div>
</div>
<div id="opcontent" style="display:none">
  <div class="optxt">
    
  </div>
</div>
</form>
<script type="text/javascript">
  sc = "{$vd['sc']}";
  var ctablenum = 2;
</script>
<script src="{$vd['sc']}js/content.js" type="text/javascript"></script>
<script type="text/javascript">
function getSum()
{
  var xmlhttpsum = null;
  
  // 针对 Mozilla等浏览器的代码：
  if (window.XMLHttpRequest)
  {
    xmlhttpsum=new XMLHttpRequest();
  }
  // 针对 IE 的代码：
  else if (window.ActiveXObject)
  {
    xmlhttpsum=new ActiveXObject("Microsoft.XMLHTTP");
  }
  
  tstartdate  = escape($("startdate").value);
  tenddate    = escape($("enddate").value);
  taid      = $("aid").options[$("aid").selectedIndex].value;
  
  if(taid == 0)
  {
  	alert("请先选择代理商");
  	return;
  }

  myurl       = "index.php?m=mod_b2b&c=reward&a=Compute&startdate="+tstartdate+"&enddate="+tenddate+"&aid="+taid;

  if (xmlhttpsum!=null)
  {
    xmlhttpsum.onreadystatechange=function(){
      // 如果 xmlhttp 显示为 "loaded"
      if (xmlhttpsum.readyState==4)
      {
        // 如果为 "OK"
        if (xmlhttpsum.status==200)
        {
          // 其他代码..
          var ackdata=xmlhttpsum.responseText;

          $("ar").value = ackdata;
        }
        else
        {
          alert("您的浏览器不支持XMLHTTP")
        }
      }
    };

    xmlhttpsum.open("post", myurl, true);
    xmlhttpsum.setRequestHeader('Content-type','application/x-www-form-urlencoded');
    xmlhttpsum.send('');
  }
  else
  {
    alert("您的浏览器不支持XMLHTTP")
  }
}
</script>
</body>
</html>
