require_once 'lib/DbUtils.php'; use IP\DbUtils as DB; $db = new DB(); use IP\Request; $request = new Request(); $keys = array('idvaluation' => 'id', 'name' => 'Name', 'institute' => 'Institute', 'createdDate' => 'Created On', 'userName' => 'User Created', 'developedBy' => 'Developed By', 'contactEmail' => 'Email', 'contactMobile' => 'Mobile', 'technology' => 'Technology', 'techType' => 'Type', 'ipCategory' => 'IP Category', 'ipState' => 'IP State', 'valuationMethod' => 'Method', 'valuation' => 'Valuation', 'fxa' => 'Fixed costs specific to R&D', 'ifc' => 'Incremental Fixed Costs', 'ppm' => 'Price/Unit of Compiting Product', 'pp' => 'Product Price/Unit', 'svm' => 'Units Sold Annualy of Compiting Product', 'sv' => 'Sales Volume of Developed Product', 'rm' => 'Expected Revenue of Compiting Product', 'r' => 'Expected Revenue', 'p' => 'Expected Profits (%)', 'yr' => 'Expected Life of Technology', 'dr' => 'Discount Rate (%)', 'adc' => 'Administration Cost (yearly %)', 'it' => 'Income Tax (Per year %)', 'expectedGrowth' => 'Expected Sales Growth', 'g' => 'Growth Rate (%)', 'pricingStratagy' => 'Pricing Strategy', 'pr' => 'Pricing Factor (%)', 'd' => 'Depreciation rate (%)', 'oc' => 'R&D Expenses/year', 's' => 'Salary', 't' => 'Time spent on R&D (in months)', 'op' => 'No. of Outputs from R&D', 'oh' => 'Overheads (if any)', 'ry' => 'Royalty Rate (%)', 'opx' => 'Operating Expenses(%)', 'ifx' => 'Incremental Fixed Costs(%)', 'Cost Method' => 'Cost Method', 'Royalty Method' => 'Royalty Method', 'Profit Split Method' => 'Profit Split Method', 'Market Method' => 'Market Method', 'All' => 'All'); $request->setAccessHeader(); if ($request->handleOptions()) { error_log('Option request. Exit...', 0); exit; } $input = $request->getJSON(); $token = $input->id ? $input->id : $_GET['token']; $userId = $input->userId ? $input->userId : $_GET['userId']; //error_log($token); $request->setHeader('Authorization', 'Bearer ' . $token); if (!$request->validate()) { echo 'You do not have permision to download this file!!!'; error_log('Validation failed. Not authorized!!'); exit; } $result = $db->getValuation($id, $userId); $objPHPExcel = new PHPExcel(); // DEMO ONLY (potentially unsafe) $objPHPExcel->setActiveSheetIndex(0); $activeSheet = $objPHPExcel->getActiveSheet(); //$objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Hello'); //$objPHPExcel->getActiveSheet()->SetCellValue('B2', 'world!'); //$objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Hello'); //$objPHPExcel->getActiveSheet()->SetCellValue('D2', 'world!'); // Rename sheet