$row[17] = number_format($billingItem->tarifaSobreExcedente, 6, ',', '.'); $row[18] = number_format($billingItem->fixo, 2, ',', '.'); $row[19] = number_format($billingItem->variavel, 2, ',', '.'); $row[20] = number_format($billingItem->acrescimoDesconto, 2, ',', '.'); $row[21] = number_format($receitaTotal, 2, ',', '.'); $row[22] = $parcelaAtual; $row[23] = $salesPersonName; InsereLinhaPlanilha($currentRow, $startColumn, $row); $grandTotal += $receitaTotal; // Soma a receita total do equipamento ( fixo mais variável ) } $currentRow++; $total = array('Total da Receita: ' . number_format($grandTotal, 2, ',', '.'), '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); InsereLinhaPlanilha($currentRow, $startColumn, $total, '80BB80FF', 45, PHPExcel_Style_Alignment::HORIZONTAL_CENTER); $activeSheet->mergeCells(GetNameFromNumber($colNum + 0) . $currentRow . ':' . GetNameFromNumber($colNum + sizeof($headers) - 1) . $currentRow); } $objPhpExcel = new PHPExcel(); $activeSheet = $objPhpExcel->getActiveSheet(); $activeSheet->setTitle('Relatório de Faturamento'); ClearBackground('A1:AF999'); $activeSheet->setCellValue('B2', 'Relatório de Faturamento'); $styleArray = array('font' => array('bold' => true, 'size' => 25)); $activeSheet->getStyle('B2:C2')->applyFromArray($styleArray); unset($styleArray); $calendar = new Calendar(); $activeSheet->setCellValue('B4', 'Mês: ' . $calendar->GetMonthName($billingMonth) . ' ' . 'Ano: ' . $billingYear); BuildReportTable('B', '6'); $objWriter = PHPExcel_IOFactory::createWriter($objPhpExcel, "Excel5"); $objWriter->save('php://output'); // Fecha a conexão com o banco de dados $dataConnector->CloseConnection();
} $currentRow++; $row = array(); $row[0] = $equipmentModelStats->model; $row[1] = $manufacturerName; $row[2] = $equipmentModelStats->equipmentCount; $row[3] = number_format($equipmentModelStats->revenue, 2, ',', '.'); InsereLinhaPlanilha($currentRow, $startColumn, $row); $equipCount = $equipCount + $equipmentModelStats->equipmentCount; $somaReceita = $somaReceita + $equipmentModelStats->revenue; } } $subTotal = array('', '', $equipCount, number_format($somaReceita, 2, ',', '.')); $currentRow++; InsereLinhaPlanilha($currentRow, $startColumn, $subTotal, '80AAFFFF', 20, PHPExcel_Style_Alignment::HORIZONTAL_CENTER); } $objPhpExcel = new PHPExcel(); $activeSheet = $objPhpExcel->getActiveSheet(); $activeSheet->setTitle('Relação entre custos e receitas'); ClearBackground('A1:AK1999'); $activeSheet->setCellValue('B2', 'Relação entre custos e receitas'); $styleArray = array('font' => array('bold' => true, 'size' => 25)); $activeSheet->getStyle('B2:C2')->applyFromArray($styleArray); unset($styleArray); $calendar = new Calendar(); $activeSheet->setCellValue('B4', 'Mês: ' . $calendar->GetMonthName($mesFaturamento) . ' ' . 'Ano: ' . $anoFaturamento); BuildReportTable('B', '6'); $objWriter = PHPExcel_IOFactory::createWriter($objPhpExcel, "Excel5"); $objWriter->save('php://output'); // Fecha a conexão com o banco de dados $dataConnector->CloseConnection();