芝麻web文件管理V1.00
编辑当前文件:/home/krishnamexports/www/panel/excel/Examples/orderList.php
getProperties()->setCreator("Maarten Balliauw") ->setLastModifiedBy("Maarten Balliauw") ->setTitle("Office 2007 XLSX Test Document") ->setSubject("Office 2007 XLSX Test Document") ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") ->setKeywords("office 2007 openxml php") ->setCategory("Test result file"); // Add some data $objPHPExcel->setActiveSheetIndex(0) ->setCellValue('A1', 's.no.') ->setCellValue('B1', 'Date') ->setCellValue('C1', 'Invoce No.') ->setCellValue('D1', 'Customer Name') ->setCellValue('E1', 'Cust. GST') ->setCellValue('F1', 'Cust. Address') ->setCellValue('G1', 'State') ->setCellValue('H1', 'Mobile') ->setCellValue('I1', 'Total Qty') ->setCellValue('J1', 'Total Taxble Value') ->setCellValue('K1', 'SGST%') ->setCellValue('L1', 'SGST') ->setCellValue('M1', 'CGST%') ->setCellValue('N1', 'CGST') ->setCellValue('O1', 'IGST%') ->setCellValue('P1', 'IGST') ->setCellValue('Q1', 'Total'); // Miscellaneous glyphs, UTF-8 $i = 2; $j = 1; $sgst = ""; $cgst = ""; $igst = ""; $sql = mysqli_query($cn,$_SESSION['orderQuery']); while($rows = mysqli_fetch_array($sql)) { $sqlEmployee = mysqli_query($cn,"select * from `tbl_employee` where `id`='".$rows['distributor_id']."'"); $sqlEmployeeData = mysqli_fetch_array($sqlEmployee); $sqlOrder = mysqli_query($cn,"select * from `tbl_order` where `order_id`='".$rows['order_id']."'"); $productCount = mysqli_num_rows($sqlOrder); $sqlOrderData = mysqli_fetch_array($sqlOrder); if($sqlEmployeeData['state_id']==22) { $sgst = orderIgstTotal($rows['order_id'])/2; $cgst = orderIgstTotal($rows['order_id'])/2; $igst = ""; } else { $sgst = ""; $cgst = ""; $igst = orderIgstTotal($rows['order_id']); } $objPHPExcel->setActiveSheetIndex(0) ->setCellValue('A'.$i, $j) ->setCellValue('B'.$i, date('d-m-Y',strtotime($rows['order_date']))) ->setCellValue('C'.$i, str_pad($rows['order_id'], 4, "0", STR_PAD_LEFT)) ->setCellValue('D'.$i, $sqlEmployeeData['company_name']) ->setCellValue('E'.$i, $sqlEmployeeData['gst']) ->setCellValue('F'.$i, $sqlEmployeeData['address']) ->setCellValue('G'.$i, state($sqlEmployeeData['state_id'])) ->setCellValue('H'.$i, $sqlEmployeeData['mobile']) ->setCellValue('I'.$i, $productCount) ->setCellValue('J'.$i, orderBeforeGstTotal($rows['order_id'])) ->setCellValue('K'.$i, "9%") ->setCellValue('L'.$i, $sgst) ->setCellValue('M'.$i, "9%") ->setCellValue('N'.$i, $cgst) ->setCellValue('O'.$i, "18%") ->setCellValue('P'.$i, $igst) ->setCellValue('Q'.$i, orderTotal($rows['order_id'])); $i++; $j++; } // Rename worksheet $objPHPExcel->getActiveSheet()->setTitle('Simple'); // Set active sheet index to the first sheet, so Excel opens this as the first sheet $objPHPExcel->setActiveSheetIndex(0); // Redirect output to a client's web browser (Excel5) header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename='.$setExcelName.".xls"); header('Cache-Control: max-age=0'); // If you're serving to IE 9, then the following may be needed header('Cache-Control: max-age=1'); // If you're serving to IE over SSL, then the following may be needed header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 header ('Pragma: public'); // HTTP/1.0 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save('php://output'); exit;