if ($number = getGP('number', 'P')) { $wheresql .= " AND number ='" . $number . "'"; } if ($type = getGP('type', 'P')) { $wheresql .= " AND goods_type ='" . $type . "'"; } $vuidtype = getGP('vuidtype', 'P'); if (!is_superadmin() && $vuidtype == '') { $wheresql .= " AND uid = {$_USER->id}"; } if ($vuidtype != '') { $wheresql .= " " . get_subordinate($_USER->id, 'uid'); } $sql = "SELECT * FROM " . DB_TABLEPRE . "office_goods WHERE 1 {$wheresql} ORDER BY id desc"; $result = $db->query($sql); while ($row = $db->fetch_array($result)) { $key1 = $db->fetch_one_array("SELECT sum(purchase) as purchase FROM " . DB_TABLEPRE . "office_goods_stock WHERE officegoods='" . $row["id"] . "' "); $key2 = $db->fetch_one_array("SELECT sum(recordnum) as recordnum FROM " . DB_TABLEPRE . "office_goods_record WHERE officegoods='" . $row["id"] . "' and (type='1' or type='3') "); $num_read = $key1[purchase] - $key2[recordnum]; $archive = array("" . $row[number] . "", "" . get_goods_type_name($row['goods_type']) . "", "" . $row['title'] . "", "" . $row['specification'] . "", "" . $row['unit'] . "", "" . $row['price'] . "RMB", "" . $row['num_read'] . $row['unit'] . "", "" . $row['content'] . "", "" . str_replace("-", ".", $row[date]) . "", "" . get_realname($row['uid']) . ""); $content[] = $archive; } $excel = new ExcelWriter($outputFileName); if ($excel == false) { echo $excel->error; } foreach ($content as $v) { $excel->writeLine($v); } $excel->sendfile($outputFileName); }
?> class="split" <?php } ?> > <td class="checkbox"> <?php get_boxlistkey("id[]", $row['id'], $row['uid'], $_USER->id); ?> </td> <td width="60"><?php echo $row['number']; ?> </td> <td width="100"><?php echo get_goods_type_name($row['goods_type']); ?> </td> <td class="title"> <?php echo $row['title']; ?> </td> <td width="100"><?php echo $row['specification']; ?> </td> <td width="60"><?php echo $row['unit']; ?> </td>
if ($goods_type = getGP('goods_type', 'P')) { $wheresql .= " AND goods_type ='" . $goods_type . "'"; } if ($type = getGP('type', 'P')) { $wheresql .= " AND type ='" . $type . "'"; } $vuidtype = getGP('vuidtype', 'P'); if (!is_superadmin() && $vuidtype == '') { $key1 = $db->result("SELECT * FROM " . DB_TABLEPRE . "office_goods_key where examination like '%" . get_realname($_USER->id) . "%' "); if ($key1['examination'] == '') { $wheresql .= " AND uid = {$_USER->id}"; } } if ($vuidtype != '') { $wheresql .= " AND " . get_subordinate($_USER->id, 'uid'); } $sql = "SELECT * FROM " . DB_TABLEPRE . "office_goods_record WHERE 1 {$wheresql} ORDER BY id desc"; $result = $db->query($sql); while ($row = $db->fetch_array($result)) { $archive = array("" . $row[number] . "", "" . get_goods_type_name($row['goods_type']) . "", "" . $row['title'] . "", "" . $row['specification'] . "", "" . $row['price'] . "RMB", "" . get_realdepaname($row['department']) . "", "" . $row['recorduser'] . "", "" . $row['recordnum'] . $row['unit'] . "", "" . str_replace("-", ".", $row[date]) . "", "" . $row['examination'] . ""); $content[] = $archive; } $excel = new ExcelWriter($outputFileName); if ($excel == false) { echo $excel->error; } foreach ($content as $v) { $excel->writeLine($v); } $excel->sendfile($outputFileName); }