Report export

This commit is contained in:
Hillel Coren 2017-08-03 12:18:36 +03:00
parent 5f01112498
commit 0b81c3299d
4 changed files with 18 additions and 12 deletions

View File

@ -570,6 +570,9 @@ if (! defined('APP_NAME')) {
];
define('CACHED_TABLES', serialize($cachedTables));
// Fix for mPDF: https://github.com/kartik-v/yii2-mpdf/issues/9
define('_MPDF_TTFONTDATAPATH', storage_path('framework/cache/'));
// TODO remove these translation functions
function uctrans($text)
{

View File

@ -185,7 +185,7 @@ class ReportController extends BaseController
$sheet->cells('A1:'.Utils::num2alpha(count($columns_labeled)-1).'1', function($cells) {
$cells->setBackground('#777777');
$cells->setFontColor('#FFFFFF');
$cells->setFontSize(14);
$cells->setFontSize(13);
$cells->setFontFamily('Calibri');
$cells->setFontWeight('bold');
});

View File

@ -1,4 +1,5 @@
<?php
//https://github.com/PHPOffice/PHPExcel/issues/556#issuecomment-216722159
switch (PHP_OS) {
case 'WINNT':
@ -323,7 +324,7 @@ return array(
|--------------------------------------------------------------------------
*/
'DomPDF' => array(
'path' => base_path('vendor/dompdf/dompdf/')
'path' => base_path('vendor/dompdf/dompdf/'),
),
/*

View File

@ -78,7 +78,8 @@
{!! Former::open()->addClass('report-form')->rules(['start_date' => 'required', 'end_date' => 'required']) !!}
<div style="display:none">
{!! Former::text('action') !!}
{!! Former::text('action') !!}
{!! Former::text('format') !!}
</div>
{!! Former::populateField('start_date', $startDate) !!}
@ -157,13 +158,13 @@
<center>
{!! Former::select('format')
->label(trans('texts.format_export'))
->options(['csv' => 'CSV', 'pdf' => 'PDF', 'xlsx' => 'Excel']) !!}
{!! Button::primary(trans('texts.export'))
->withAttributes(array('onclick' => 'onExportClick()'))
->appendIcon(Icon::create('export'))
->large() !!}
{!! DropdownButton::primary(trans('texts.export'))
->large()
->withContents([
['url' => 'javascript:onExportClick("csv")', 'label' => 'CSV'],
['url' => 'javascript:onExportClick("xlsx")', 'label' => 'XLSX'],
['url' => 'javascript:onExportClick("pdf")', 'label' => 'PDF'],
]) !!}
{!! Button::success(trans('texts.run'))
->withAttributes(array('id' => 'submitButton'))
->submit()
@ -256,8 +257,9 @@
<script type="text/javascript">
function onExportClick() {
function onExportClick(format) {
$('#action').val('export');
$('#format').val(format);
$('#submitButton').click();
$('#action').val('');
}
@ -368,4 +370,4 @@
keyboardNavigation: false
});
@stop
@stop