$wsql->close();
    }
    $csql->SetQuery("select * from #@__saleback where rdh='{$did}'");
}
$csql->Execute();
$rowcount = $csql->GetTotalRow();
if ($rowcount == 0) {
    echo "<tr><td>&nbsp;</td></tr>";
} else {
    echo "<tr class='row_color_head'><td>货号</td><td>名称</td><td>规格</td><td>分类</td><td>单位</td><td>售价</td><td>退回原因<td>退回数量</td><td>删除</tr>";
    while ($row = $csql->GetArray()) {
        $nsql = new dedesql(false);
        $query1 = "select * from #@__basic where cp_number='" . $row['productid'] . "'";
        $nsql->setquery($query1);
        $nsql->execute();
        $row1 = $nsql->getone();
        $amoney += $row1['cp_sale'] * $row['number'];
        $anum += $row['number'];
        echo "<tr onMouseMove=\"javascript:this.bgColor='#EBF1F6';\" onMouseOut=\"javascript:this.bgColor='#FFFFFF';\"><td>" . $row['productid'] . "</td><td>&nbsp;" . $row1['cp_name'] . "</td><td>" . $row1['cp_gg'] . "</td><td>" . get_name($row1['cp_categories'], 'categories') . ">" . get_name($row1['cp_categories_down'], 'categories') . "</td><td>" . get_name($row1['cp_dwname'], 'dw') . "</td><td>¥" . $row1['cp_sale'] . "</td><td>" . $row['r_text'] . "</td><td>" . $row['number'] . "</td><td><a href='current_order_back.php?action=del&id=" . $row['id'] . "&rid=" . $row['rdh'] . "'>删除</a></td></tr>";
        $nsql->close();
    }
}
echo "<tr><td>&nbsp;共计:</td><td></td><td></td><td></td><td>&nbsp;金额:</td><td>¥" . $amoney . "</td><td align='right'>数量:</td><td>" . $anum . "</td></tr></table>";
$csql->close();
?>
	  </td>
     </tr></form>
    </table>
</body>
</html>
		 &nbsp;&nbsp;
		 </td>
		</tr></form>
	   </table>
	  </td>
     </tr>
	 <form method="post" name="sel">
     <tr>
      <td bgcolor="#FFFFFF">
       <?php 
$asql = new dedesql(false);
$aquery = "select sum(amoney) as imoney from #@__accounts where atype='收入'";
$aquery1 = "select sum(amoney) as omoney from #@__accounts where atype='支出'";
$asql->setquery($aquery);
$asql->execute();
$rs = $asql->getone();
$imoney = $rs['imoney'];
$asql->setquery($aquery1);
$asql->execute();
$rs = $asql->getone();
$omoney = $rs['omoney'];
$asql->close();
if ($imoney < $omoney) {
    $moneystring = "亏损:¥" . ($omoney - $imoney) . "元,总收入:¥" . $imoney . ",总支出:¥" . $omoney;
} elseif ($imoney - $omoney == 0) {
    $moneystring = "收支平衡,总收入:¥" . $imoney . ",总支出:¥" . $omoney;
} else {
    $moneystring = "盈利:¥" . ($imoney - $omoney) . "元,总收入:¥" . $imoney . ",总支出:¥" . $omoney;
}
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" id=\"table_border\">";
if ($action == 'seek') {
function getbank($id)
{
    $banksql = new dedesql(false);
    $banksql->SetQuery("select * from #@__bank where id='{$id}'");
    $banksql->Execute();
    $bankr = $banksql->gettotalrow();
    if ($bankr == 1) {
        $rs = $banksql->getone();
        return $rs['bank_name'];
    } else {
        return "<font color=red>已删除银行</font>";
    }
    $banksql->close();
}