require dirname(__FILE__) . "/include/config_base.php";
require dirname(__FILE__) . "/include/config_rglobals.php";
?>
<!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 href="style/main.css" rel="stylesheet" type="text/css" />
</head>
<body oncontextmenu="return false">
<?php 
if ($action == 'del') {
    $dsql = new Dedesql(false);
    $delstring = "delete from #@__kcbackgys where id='{$id}'";
    $dsql->executenonequery($delstring);
    $dsql->close();
    header("Location:current_order_back.php?action=normal&did=" . $rid);
}
?>
	<table width="100%" border="0" cellpadding="0" cellspacing="2">
     <tr>
      <td><strong>&nbsp;客户退货详细产品</strong></td>
     </tr>
	 <form method="post" name="sel">
     <tr>
      <td bgcolor="#FFFFFF">
       <?php 
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" id=\"table_border\">";
$csql = new Dedesql(false);
if ($pid == '') {
if ($action == 'save') {
    //保存入库单及记录
    if ($labid == '' || $kc_number == '' || $pid == '') {
        showmsg('执行了带有非法参数的文件', '-1');
        exit;
    }
    $bsql = new Dedesql(false);
    $query = "select * from #@__mainkc where p_id='{$pid}'";
    $bsql->SetQuery($query);
    $bsql->Execute();
    $rowcount = $bsql->GetTotalRow();
    if ($rowcount == 0) {
        ShowMsg('非法参数或没有此产品信息!', '-1');
        exit;
    } else {
        $bsql->executenonequery("update #@__mainkc set number='{$kc_number}',l_id='{$labid}' where p_id='" . $pid . "'");
        $loginip = getip();
        $logindate = getdatetimemk(time());
        $username = str_replace($cfg_cookie_encode, '', $_COOKIE['VioomaUserID']);
        WriteNote('修改产品' . get_name($pid, 'name') . '资料成功', $logindate, $loginip, $username);
        ShowMsg('产品信息已成功修改', 'system_kc.php');
        $bsql->close();
        exit;
    }
} else {
    if ($pid == '' || $lid == '') {
        echo "<script language='javascript'>alert('非法参数');history.go(-1);</script>";
        exit;
    }
    ?>
<body onload="form1.seek_text.focus()">