Example #1
0
<?php

include_once './Classes/PHPExcel.php';
include_once './Classes/PHPExcel/Writer/Excel5.php';
include_once "../libs/conn.php";
include_once '../libs/budgetDB.php';
$downLoad = false;
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'download') {
    $downLoad = true;
}
$budget = getBudgetsByBudgetId($_REQUEST["budgetId"]);
$budgetItems = getBudgetItemsByBudgetId($_REQUEST["budgetId"], true, false);
$fileName = str2GBK(urldecode($budget[0]["projectName"])) . ".xls";
$cancel_time = date("YmdHis");
// 创建一个处理对象实例
$objExcel = new PHPExcel();
// 创建文件格式写入对象实例, uncomment
//$objWriter = new PHPExcel_Writer_Excel5($objExcel);
$objWriter = PHPExcel_IOFactory::createWriter($objExcel, 'Excel5');
//设置文档基本属性       encode error ,dont konw why
/*$compay = "author";
$objProps = $objExcel->getProperties();       
$objProps->setCreator($compay);  
$objProps->setLastModifiedBy(urldecode($compay));     
$objProps->setTitle($compay);       
$objProps->setTitle(str2GBK(urldecode($budget[0]['projectName'])));       
$objProps->setSubject($compay);       
$objProps->setDescription($compay);       
$objProps->setKeywords($compay));       
$objProps->setCategory($compay)); */
//*************************************
Example #2
0
include_once "businessDB.php";
$action = $_REQUEST["action"];
$res = "";
$isParseResut = true;
switch ($action) {
    case "list":
        $res = getBudgets();
        break;
    case "listIds":
        $res = getBudgetIds();
        $isParseResut = false;
        break;
        //获取预算所有条目
    //获取预算所有条目
    case "itemlist":
        $res = getBudgetItemsByBudgetId($_REQUEST["budgetId"]);
        break;
        //添加预算
    //添加预算
    case "add":
        $res = addBudget($_REQUEST);
        break;
        //添加小项
    //添加小项
    case "addItem":
        $res = addItem($_REQUEST);
        break;
        //添加大项
    //添加大项
    case "addBigItem":
        $res = addBigItem($_REQUEST);