Merge adding PDF to invoice report
This commit is contained in:
parent
a821523589
commit
32b09563b1
2 changed files with 25 additions and 15 deletions
|
|
@ -87,6 +87,20 @@ class InvoiceReport extends AbstractReport
|
|||
exit;
|
||||
}
|
||||
|
||||
if ($this->isExport && $exportFormat == 'zip-invoices') {
|
||||
if (! extension_loaded('GMP')) {
|
||||
die(trans('texts.gmp_required'));
|
||||
}
|
||||
$zip = Archive::instance_by_useragent(date('Y-m-d') . '_' . str_replace(' ', '_', trans('texts.invoices')));
|
||||
foreach ($clients->get() as $client) {
|
||||
foreach ($client->invoices as $invoice) {
|
||||
$zip->add_file($invoice->getFileName(), $invoice->getPDFString());
|
||||
}
|
||||
}
|
||||
$zip->finish();
|
||||
exit;
|
||||
}
|
||||
|
||||
foreach ($clients->get() as $client) {
|
||||
foreach ($client->invoices as $invoice) {
|
||||
$isFirst = true;
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@
|
|||
->raw() !!}
|
||||
|
||||
{!! Button::normal(trans('texts.export'))
|
||||
->withAttributes(['onclick' => 'onExportClick()'])
|
||||
->withAttributes(['style' => 'display:none', 'onclick' => 'onExportClick()', 'data-bind' => 'visible: showExportButton'])
|
||||
->appendIcon(Icon::create('download-alt')) !!}
|
||||
|
||||
{!! Button::normal(trans('texts.cancel_schedule'))
|
||||
|
|
@ -487,18 +487,6 @@
|
|||
}, 1);
|
||||
});
|
||||
|
||||
// parse 1,000.00 or 1.000,00
|
||||
function convertStringToNumber(str) {
|
||||
str = str + '' || '';
|
||||
if (str.indexOf(':') >= 0) {
|
||||
return roundToTwo(moment.duration(str).asHours());
|
||||
} else {
|
||||
return NINJA.parseFloat(str);
|
||||
var number = Number(str.replace(/[^0-9\-]+/g, ''));
|
||||
return number / 100;
|
||||
}
|
||||
}
|
||||
|
||||
function ReportTypeModel(type, transType) {
|
||||
var self = this;
|
||||
self.type = type;
|
||||
|
|
@ -568,7 +556,7 @@
|
|||
options.push(new SubgroupModel('method', "{{ trans('texts.method') }}"));
|
||||
} else if (reportType == 'profit_and_loss') {
|
||||
options.push(new SubgroupModel('type', "{{ trans('texts.type') }}"));
|
||||
} else if (reportType == 'task') {
|
||||
} else if (reportType == 'task' || reportType == 'task_details') {
|
||||
options.push(new SubgroupModel('project', "{{ trans('texts.project') }}"));
|
||||
} else if (reportType == 'client') {
|
||||
options.push(new SubgroupModel('country', "{{ trans('texts.country') }}"));
|
||||
|
|
@ -592,6 +580,10 @@
|
|||
options.push(new ExportFormatModel('zip', 'ZIP - {{ trans('texts.documents') }}'));
|
||||
}
|
||||
|
||||
if (['{{ ENTITY_INVOICE }}'].indexOf(self.report_type()) >= 0) {
|
||||
options.push(new ExportFormatModel('zip-invoices', 'ZIP - {{ trans('texts.invoices') }}'));
|
||||
}
|
||||
|
||||
return options;
|
||||
});
|
||||
|
||||
|
|
@ -635,7 +627,7 @@
|
|||
});
|
||||
|
||||
self.enableScheduleButton = ko.computed(function() {
|
||||
return self.export_format() == 'zip' ? 'disabled' : 'enabled';
|
||||
return ['zip', 'zip-invoices'].indexOf(self.export_format()) >= 0 ? 'disabled' : 'enabled';
|
||||
});
|
||||
|
||||
self.showScheduleButton = ko.computed(function() {
|
||||
|
|
@ -645,6 +637,10 @@
|
|||
self.showCancelScheduleButton = ko.computed(function() {
|
||||
return !! scheduledReportMap[self.report_type()];
|
||||
});
|
||||
|
||||
self.showExportButton = ko.computed(function() {
|
||||
return self.export_format() != '';
|
||||
});
|
||||
}
|
||||
|
||||
$(function(){
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue