Skip to content
Code-Schnipsel Gruppen Projekte

Revisionen vergleichen

Änderungen werden so angezeigt, als ob die Quellrevision mit der Zielrevision zusammengeführt würde. Erfahre mehr über den Vergleich von Revisionen.

Quelle

Zielprojekt auswählen
No results found

Ziel

Zielprojekt auswählen
  • quiqqer/invoice
1 Ergebnis
Änderungen anzeigen
Commits auf Quelle (9)
...@@ -22,7 +22,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -22,7 +22,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
'text!package/quiqqer/invoice/bin/backend/controls/panels/Journal.Total.html', 'text!package/quiqqer/invoice/bin/backend/controls/panels/Journal.Total.html',
'css!package/quiqqer/invoice/bin/backend/controls/panels/Journal.css', 'css!package/quiqqer/invoice/bin/backend/controls/panels/Journal.css',
'css!package/quiqqer/erp/bin/backend/payment-status.css' 'css!package/quiqqer/erp/bin/backend/payment-status.css'
], function( ], function (
QUI, QUI,
QUIPanel, QUIPanel,
QUIButton, QUIButton,
...@@ -68,11 +68,12 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -68,11 +68,12 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
'$onClickOpenInvoice', '$onClickOpenInvoice',
'$onClickCreateCredit', '$onClickCreateCredit',
'$onClickReversal', '$onClickReversal',
'$onClickDownload',
'$onSearchKeyUp', '$onSearchKeyUp',
'linkTransaction' 'linkTransaction'
], ],
initialize: function(options) { initialize: function (options) {
this.setAttributes({ this.setAttributes({
icon: 'fa fa-money', icon: 'fa fa-money',
title: QUILocale.get(lg, 'erp.panel.invoice.text') title: QUILocale.get(lg, 'erp.panel.invoice.text')
...@@ -109,7 +110,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -109,7 +110,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
/** /**
* Refresh the grid * Refresh the grid
*/ */
refresh: function() { refresh: function () {
this.Loader.show(); this.Loader.show();
if (!this.$Grid) { if (!this.$Grid) {
...@@ -150,10 +151,10 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -150,10 +151,10 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
paid_status: [status], paid_status: [status],
search: this.$currentSearch, search: this.$currentSearch,
currency: this.$Currency.getAttribute('value') currency: this.$Currency.getAttribute('value')
}).then(function(result) { }).then(function (result) {
let gridData = result.grid; let gridData = result.grid;
gridData.data = gridData.data.map(function(entry) { gridData.data = gridData.data.map(function (entry) {
const Icon = new Element('span'); const Icon = new Element('span');
switch (parseInt(entry.type)) { switch (parseInt(entry.type)) {
...@@ -212,7 +213,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -212,7 +213,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
this.$Total.set('html', Mustache.render(templateTotal, result.total)); this.$Total.set('html', Mustache.render(templateTotal, result.total));
this.Loader.hide(); this.Loader.hide();
}.bind(this)).catch(function(err) { }.bind(this)).catch(function (err) {
console.error(err); console.error(err);
this.Loader.hide(); this.Loader.hide();
}.bind(this)); }.bind(this));
...@@ -222,22 +223,22 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -222,22 +223,22 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
* refresh the button status * refresh the button status
* disabled or enabled * disabled or enabled
*/ */
$refreshButtonStatus: function() { $refreshButtonStatus: function () {
if (!this.$Grid) { if (!this.$Grid) {
return; return;
} }
const selected = this.$Grid.getSelectedData(), buttons = this.$Grid.getButtons(); const selected = this.$Grid.getSelectedData(), buttons = this.$Grid.getButtons();
const Actions = buttons.filter(function(Button) { const Actions = buttons.filter(function (Button) {
return Button.getAttribute('name') === 'actions'; return Button.getAttribute('name') === 'actions';
})[0]; })[0];
const Payment = Actions.getChildren().filter(function(Button) { const Payment = Actions.getChildren().filter(function (Button) {
return Button.getAttribute('name') === 'addPayment'; return Button.getAttribute('name') === 'addPayment';
})[0]; })[0];
const CreditNote = Actions.getChildren().filter(function(Button) { const CreditNote = Actions.getChildren().filter(function (Button) {
return Button.getAttribute('name') === 'createCreditNote'; return Button.getAttribute('name') === 'createCreditNote';
})[0]; })[0];
...@@ -269,7 +270,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -269,7 +270,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
/** /**
* event : on create * event : on create
*/ */
$onCreate: function() { $onCreate: function () {
// Buttons // Buttons
this.addButton({ this.addButton({
name: 'total', name: 'total',
...@@ -286,7 +287,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -286,7 +287,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
disabled: true, disabled: true,
showIcons: false, showIcons: false,
events: { events: {
onChange: function(Menu, Item) { onChange: function (Menu, Item) {
self.$Currency.setAttribute('value', Item.getAttribute('value')); self.$Currency.setAttribute('value', Item.getAttribute('value'));
self.$Currency.setAttribute('text', Item.getAttribute('value')); self.$Currency.setAttribute('text', Item.getAttribute('value'));
self.refresh(); self.refresh();
...@@ -335,10 +336,10 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -335,10 +336,10 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
}, },
events: { events: {
onChange: this.refresh, onChange: this.refresh,
onPeriodSelectClose: function(Filter) { onPeriodSelectClose: function (Filter) {
self.$periodFilter = Filter.getValue(); self.$periodFilter = Filter.getValue();
}, },
onPeriodSelectOpen: function(Filter) { onPeriodSelectOpen: function (Filter) {
if (self.$periodFilter) { if (self.$periodFilter) {
Filter.setAttribute('from', self.$periodFilter.from); Filter.setAttribute('from', self.$periodFilter.from);
Filter.setAttribute('to', self.$periodFilter.to); Filter.setAttribute('to', self.$periodFilter.to);
...@@ -438,6 +439,15 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -438,6 +439,15 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
} }
}); });
Actions.appendChild({
icon: 'fa fa-download',
text: QUILocale.get(lg, 'dialog.invoice.download.button'),
events: {
onClick: this.$onClickDownload
}
});
this.fireEvent('actionButtonCreate', [ this.fireEvent('actionButtonCreate', [
this, this,
Actions Actions
...@@ -715,7 +725,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -715,7 +725,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
/** /**
* event : on resize * event : on resize
*/ */
$onResize: function() { $onResize: function () {
if (!this.$Grid) { if (!this.$Grid) {
return; return;
} }
...@@ -740,7 +750,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -740,7 +750,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
/** /**
* event: on inject * event: on inject
*/ */
$onInject: function() { $onInject: function () {
const self = this, const self = this,
value = this.$Status.getValue(); value = this.$Status.getValue();
...@@ -753,7 +763,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -753,7 +763,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
QUIAjax.get([ QUIAjax.get([
'package_quiqqer_currency_ajax_getAllowedCurrencies', 'package_quiqqer_currency_ajax_getAllowedCurrencies',
'package_quiqqer_currency_ajax_getDefault' 'package_quiqqer_currency_ajax_getDefault'
], function(currencies, currency) { ], function (currencies, currency) {
let i, len, entry, text; let i, len, entry, text;
if (!currencies.length || currencies.length === 1) { if (!currencies.length || currencies.length === 1) {
...@@ -781,7 +791,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -781,7 +791,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
'package': 'quiqqer/currency' 'package': 'quiqqer/currency'
}); });
this.$Currency.getContextMenu(function(ContextMenu) { this.$Currency.getContextMenu(function (ContextMenu) {
ContextMenu.setAttribute('showIcons', false); ContextMenu.setAttribute('showIcons', false);
}); });
}, },
...@@ -789,7 +799,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -789,7 +799,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
/** /**
* event: on panel destroy * event: on panel destroy
*/ */
$onDestroy: function() { $onDestroy: function () {
Invoices.removeEvents({ Invoices.removeEvents({
onPostInvoice: this.$onInvoicesChange onPostInvoice: this.$onInvoicesChange
}); });
...@@ -798,7 +808,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -798,7 +808,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
/** /**
* event: on show * event: on show
*/ */
$onShow: function() { $onShow: function () {
if (this.$Search.value !== '') { if (this.$Search.value !== '') {
return; return;
} }
...@@ -809,18 +819,18 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -809,18 +819,18 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
/** /**
* event: invoices changed something * event: invoices changed something
*/ */
$onInvoicesChange: function() { $onInvoicesChange: function () {
this.refresh(); this.refresh();
}, },
//region Buttons events //region Buttons events
$onClickCreateInvoice: function() { $onClickCreateInvoice: function () {
return Invoices.createInvoice().then(function(invoiceId) { return Invoices.createInvoice().then(function (invoiceId) {
require([ require([
'package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice', 'package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice',
'utils/Panels' 'utils/Panels'
], function(TemporaryInvoice, PanelUtils) { ], function (TemporaryInvoice, PanelUtils) {
const Panel = new TemporaryInvoice({ const Panel = new TemporaryInvoice({
invoiceId: invoiceId, invoiceId: invoiceId,
'#id': invoiceId '#id': invoiceId
...@@ -828,8 +838,8 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -828,8 +838,8 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
PanelUtils.openPanelInTasks(Panel); PanelUtils.openPanelInTasks(Panel);
}); });
}.bind(this)).catch(function(Exception) { }.bind(this)).catch(function (Exception) {
QUI.getMessageHandler().then(function(MH) { QUI.getMessageHandler().then(function (MH) {
if (typeof Exception.getMessage !== 'undefined') { if (typeof Exception.getMessage !== 'undefined') {
MH.addError(Exception.getMessage()); MH.addError(Exception.getMessage());
return; return;
...@@ -843,7 +853,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -843,7 +853,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
/** /**
* event : on PDF Export button click * event : on PDF Export button click
*/ */
$onPDFExportButtonClick: function(Button) { $onPDFExportButtonClick: function (Button) {
const selectedData = this.$Grid.getSelectedData(); const selectedData = this.$Grid.getSelectedData();
if (!selectedData.length) { if (!selectedData.length) {
...@@ -867,8 +877,8 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -867,8 +877,8 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
entityType = 'Invoice'; entityType = 'Invoice';
} }
return new Promise(function(resolve) { return new Promise(function (resolve) {
require(['package/quiqqer/invoice/bin/backend/utils/Dialogs'], function(Dialogs) { require(['package/quiqqer/invoice/bin/backend/utils/Dialogs'], function (Dialogs) {
Dialogs.openPrintDialog(Entry.hash, entityType).catch((err) => { Dialogs.openPrintDialog(Entry.hash, entityType).catch((err) => {
QUI.getMessageHandler().then((MH) => { QUI.getMessageHandler().then((MH) => {
MH.addError(err.getMessage()); MH.addError(err.getMessage());
...@@ -883,7 +893,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -883,7 +893,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
/** /**
* event : on payment add button click * event : on payment add button click
*/ */
$onAddPaymentButtonClick: function(Button) { $onAddPaymentButtonClick: function (Button) {
const self = this, selectedData = this.$Grid.getSelectedData(); const self = this, selectedData = this.$Grid.getSelectedData();
if (!selectedData.length) { if (!selectedData.length) {
...@@ -896,26 +906,26 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -896,26 +906,26 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
require([ require([
'package/quiqqer/payment-transactions/bin/backend/controls/IncomingPayments/AddPaymentWindow' 'package/quiqqer/payment-transactions/bin/backend/controls/IncomingPayments/AddPaymentWindow'
], function(AddPaymentWindow) { ], function (AddPaymentWindow) {
new AddPaymentWindow({ new AddPaymentWindow({
entityId: hash, entityId: hash,
entityType: 'Invoice', entityType: 'Invoice',
events: { events: {
onSubmit: function(Win, data) { onSubmit: function (Win, data) {
self.addPayment(hash, data.amount, data.payment_method, data.date).then(function() { self.addPayment(hash, data.amount, data.payment_method, data.date).then(function () {
Button.setAttribute('textimage', 'fa fa-money'); Button.setAttribute('textimage', 'fa fa-money');
self.refresh(); self.refresh();
}); });
}, },
onSubmitExisting: (txId) => { onSubmitExisting: (txId) => {
self.linkTransaction(hash, txId).then(function() { self.linkTransaction(hash, txId).then(function () {
Button.setAttribute('textimage', 'fa fa-money'); Button.setAttribute('textimage', 'fa fa-money');
self.refresh(); self.refresh();
}); });
}, },
onClose: function() { onClose: function () {
Button.setAttribute('textimage', 'fa fa-money'); Button.setAttribute('textimage', 'fa fa-money');
} }
} }
...@@ -928,7 +938,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -928,7 +938,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
* *
* @return {Promise} * @return {Promise}
*/ */
$onClickCopyInvoice: function() { $onClickCopyInvoice: function () {
const selected = this.$Grid.getSelectedData(); const selected = this.$Grid.getSelectedData();
if (!selected.length) { if (!selected.length) {
...@@ -937,7 +947,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -937,7 +947,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
const hash = selected[0].hash; const hash = selected[0].hash;
return new Promise(function(resolve) { return new Promise(function (resolve) {
require([ require([
'package/quiqqer/erp/bin/backend/controls/dialogs/CopyErpEntityDialog' 'package/quiqqer/erp/bin/backend/controls/dialogs/CopyErpEntityDialog'
], (CopyErpEntityDialog) => { ], (CopyErpEntityDialog) => {
...@@ -957,13 +967,13 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -957,13 +967,13 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
* *
* @param {Object} data * @param {Object} data
*/ */
$onClickInvoiceDetails: function(data) { $onClickInvoiceDetails: function (data) {
const row = data.row, ParentNode = data.parent; const row = data.row, ParentNode = data.parent;
ParentNode.setStyle('padding', 10); ParentNode.setStyle('padding', 10);
ParentNode.set('html', '<div class="fa fa-spinner fa-spin"></div>'); ParentNode.set('html', '<div class="fa fa-spinner fa-spin"></div>');
Invoices.getArticleHtml(this.$Grid.getDataByRow(row).hash).then(function(result) { Invoices.getArticleHtml(this.$Grid.getDataByRow(row).hash).then(function (result) {
ParentNode.set('html', ''); ParentNode.set('html', '');
new Element('div', { new Element('div', {
...@@ -979,7 +989,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -979,7 +989,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
* @param {object} data - cell data * @param {object} data - cell data
* @return {Promise} * @return {Promise}
*/ */
$onClickOpenInvoice: function(data) { $onClickOpenInvoice: function (data) {
if (typeof data !== 'undefined' if (typeof data !== 'undefined'
&& typeof data.cell !== 'undefined' && typeof data.cell !== 'undefined'
&& ( && (
...@@ -991,14 +1001,14 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -991,14 +1001,14 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
const self = this, Cell = data.cell, position = Cell.getPosition(), const self = this, Cell = data.cell, position = Cell.getPosition(),
rowData = this.$Grid.getDataByRow(data.row); rowData = this.$Grid.getDataByRow(data.row);
return new Promise(function(resolve) { return new Promise(function (resolve) {
require([ require([
'qui/controls/contextmenu/Menu', 'qui/controls/contextmenu/Menu',
'qui/controls/contextmenu/Item' 'qui/controls/contextmenu/Item'
], function(QUIMenu, QUIMenuItem) { ], function (QUIMenu, QUIMenuItem) {
const Menu = new QUIMenu({ const Menu = new QUIMenu({
events: { events: {
onBlur: function() { onBlur: function () {
Menu.hide(); Menu.hide();
Menu.destroy(); Menu.destroy();
} }
...@@ -1009,7 +1019,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1009,7 +1019,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
icon: rowData.display_type.className, icon: rowData.display_type.className,
text: QUILocale.get(lg, 'journal.contextMenu.open.invoice'), text: QUILocale.get(lg, 'journal.contextMenu.open.invoice'),
events: { events: {
onClick: function() { onClick: function () {
self.openInvoice(rowData.hash); self.openInvoice(rowData.hash);
} }
} }
...@@ -1019,10 +1029,10 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1019,10 +1029,10 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
icon: 'fa fa-user-o', icon: 'fa fa-user-o',
text: QUILocale.get(lg, 'journal.contextMenu.open.user'), text: QUILocale.get(lg, 'journal.contextMenu.open.user'),
events: { events: {
onClick: function() { onClick: function () {
require( require(
['package/quiqqer/customer/bin/backend/Handler'], ['package/quiqqer/customer/bin/backend/Handler'],
function(CustomerHandler) { function (CustomerHandler) {
CustomerHandler.openCustomer(rowData.customer_id); CustomerHandler.openCustomer(rowData.customer_id);
} }
); );
...@@ -1035,14 +1045,14 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1035,14 +1045,14 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
icon: 'fa fa-check', icon: 'fa fa-check',
text: QUILocale.get(lg, 'journal.contextMenu.change.status'), text: QUILocale.get(lg, 'journal.contextMenu.change.status'),
events: { events: {
onClick: function() { onClick: function () {
require([ require([
'package/quiqqer/invoice/bin/backend/controls/panels/status/StatusWindow' 'package/quiqqer/invoice/bin/backend/controls/panels/status/StatusWindow'
], function(StatusWindow) { ], function (StatusWindow) {
new StatusWindow({ new StatusWindow({
hash: rowData.hash, hash: rowData.hash,
events: { events: {
statusChanged: function() { statusChanged: function () {
self.refresh(); self.refresh();
} }
} }
...@@ -1070,7 +1080,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1070,7 +1080,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
if (rowData.globalProcessId && rowData.globalProcessId !== '') { if (rowData.globalProcessId && rowData.globalProcessId !== '') {
require([ require([
'package/quiqqer/erp/bin/backend/controls/process/ProcessWindow' 'package/quiqqer/erp/bin/backend/controls/process/ProcessWindow'
], function(ProcessWindow) { ], function (ProcessWindow) {
new ProcessWindow({ new ProcessWindow({
globalProcessId: rowData.globalProcessId globalProcessId: rowData.globalProcessId
}).open(); }).open();
...@@ -1094,7 +1104,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1094,7 +1104,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
* *
* @return {Promise} * @return {Promise}
*/ */
$onClickCreateCredit: function() { $onClickCreateCredit: function () {
const selected = this.$Grid.getSelectedData(); const selected = this.$Grid.getSelectedData();
if (!selected.length) { if (!selected.length) {
...@@ -1103,11 +1113,11 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1103,11 +1113,11 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
const self = this, invoiceId = selected[0].hash; const self = this, invoiceId = selected[0].hash;
return new Promise(function(resolve) { return new Promise(function (resolve) {
require([ require([
'package/quiqqer/invoice/bin/backend/utils/Dialogs' 'package/quiqqer/invoice/bin/backend/utils/Dialogs'
], function(Dialogs) { ], function (Dialogs) {
Dialogs.openCreateCreditNoteDialog(invoiceId).then(function(newId) { Dialogs.openCreateCreditNoteDialog(invoiceId).then(function (newId) {
if (!newId) { if (!newId) {
return; return;
} }
...@@ -1125,7 +1135,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1125,7 +1135,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
* *
* @return {Promise} * @return {Promise}
*/ */
$onClickReversal: function() { $onClickReversal: function () {
const selected = this.$Grid.getSelectedData(); const selected = this.$Grid.getSelectedData();
if (!selected.length) { if (!selected.length) {
...@@ -1134,15 +1144,15 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1134,15 +1144,15 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
const self = this, invoiceId = selected[0].hash; const self = this, invoiceId = selected[0].hash;
return new Promise(function(resolve) { return new Promise(function (resolve) {
require([ require([
'package/quiqqer/invoice/bin/backend/utils/Dialogs' 'package/quiqqer/invoice/bin/backend/utils/Dialogs'
], function(Dialogs) { ], function (Dialogs) {
Dialogs.openReversalDialog(invoiceId).then(function(result) { Dialogs.openReversalDialog(invoiceId).then(function (result) {
Dialogs.openPrintDialog(result.reversalHash, 'Canceled'); Dialogs.openPrintDialog(result.reversalHash, 'Canceled');
return self.refresh(); return self.refresh();
}).then(resolve).catch(function(Exception) { }).then(resolve).catch(function (Exception) {
QUI.getMessageHandler().then(function(MH) { QUI.getMessageHandler().then(function (MH) {
console.error(Exception); console.error(Exception);
if (typeof Exception.getMessage !== 'undefined') { if (typeof Exception.getMessage !== 'undefined') {
...@@ -1159,6 +1169,20 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1159,6 +1169,20 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
}); });
}, },
$onClickDownload: function () {
const selected = this.$Grid.getSelectedData();
if (!selected.length) {
return Promise.resolve();
}
const hash = selected[0].hash;
require(['package/quiqqer/invoice/bin/backend/utils/Dialogs'], (Dialogs) => {
Dialogs.openDownloadDialog(hash);
});
},
//endregion //endregion
/** /**
...@@ -1166,8 +1190,8 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1166,8 +1190,8 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
* *
* @param {Number|String} invoiceId * @param {Number|String} invoiceId
*/ */
downloadPdf: function(invoiceId) { downloadPdf: function (invoiceId) {
return new Promise(function(resolve) { return new Promise(function (resolve) {
const id = 'download-invoice-' + invoiceId; const id = 'download-invoice-' + invoiceId;
new Element('iframe', { new Element('iframe', {
...@@ -1184,25 +1208,26 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1184,25 +1208,26 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
} }
}).inject(document.body); }).inject(document.body);
(function() { (function () {
// document.getElements('#' + id).destroy(); // document.getElements('#' + id).destroy();
resolve(); resolve();
}).delay(1000, this); }).delay(1000, this);
}); });
}, },
/** /**
* Open an invoice panel * Open an invoice panel
* *
* @param {Number|String} hash - ID or hash of the invoice * @param {Number|String} hash - ID or hash of the invoice
* @return {Promise} * @return {Promise}
*/ */
openInvoice: function(hash) { openInvoice: function (hash) {
return new Promise(function(resolve) { return new Promise(function (resolve) {
require([ require([
'package/quiqqer/invoice/bin/backend/controls/panels/Invoice', 'package/quiqqer/invoice/bin/backend/controls/panels/Invoice',
'utils/Panels' 'utils/Panels'
], function(InvoicePanel, PanelUtils) { ], function (InvoicePanel, PanelUtils) {
const Panel = new InvoicePanel({ const Panel = new InvoicePanel({
hash: hash, hash: hash,
'#id': hash '#id': hash
...@@ -1224,16 +1249,16 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1224,16 +1249,16 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
* *
* @return {Promise} * @return {Promise}
*/ */
addPayment: function(hash, amount, paymentMethod, date) { addPayment: function (hash, amount, paymentMethod, date) {
const self = this; const self = this;
this.Loader.show(); this.Loader.show();
return Invoices.addPaymentToInvoice(hash, amount, paymentMethod, date).then(function() { return Invoices.addPaymentToInvoice(hash, amount, paymentMethod, date).then(function () {
return self.refresh(); return self.refresh();
}).then(function() { }).then(function () {
self.Loader.hide(); self.Loader.hide();
}).catch(function(err) { }).catch(function (err) {
console.error(err); console.error(err);
}); });
}, },
...@@ -1246,14 +1271,14 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1246,14 +1271,14 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
* *
* @return {Promise<void>} * @return {Promise<void>}
*/ */
linkTransaction: function(invoiceHash, txId) { linkTransaction: function (invoiceHash, txId) {
this.Loader.show(); this.Loader.show();
return Invoices.linkTransaction(invoiceHash, txId).then(() => { return Invoices.linkTransaction(invoiceHash, txId).then(() => {
return this.refresh(); return this.refresh();
}).then(() => { }).then(() => {
this.Loader.hide(); this.Loader.hide();
}).catch(function(err) { }).catch(function (err) {
console.error(err); console.error(err);
}); });
}, },
...@@ -1264,11 +1289,11 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1264,11 +1289,11 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
* @param {String|Number} invoiceId * @param {String|Number} invoiceId
* @return {Promise} * @return {Promise}
*/ */
openTemporaryInvoice: function(invoiceId) { openTemporaryInvoice: function (invoiceId) {
return new Promise(function(resolve) { return new Promise(function (resolve) {
require([ require([
'package/quiqqer/invoice/bin/backend/utils/Panels' 'package/quiqqer/invoice/bin/backend/utils/Panels'
], function(PanelUtils) { ], function (PanelUtils) {
PanelUtils.openTemporaryInvoice(invoiceId).then(resolve); PanelUtils.openTemporaryInvoice(invoiceId).then(resolve);
}); });
}); });
...@@ -1279,7 +1304,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1279,7 +1304,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
* *
* @return {Promise} * @return {Promise}
*/ */
toggleTotal: function() { toggleTotal: function () {
if (parseInt(this.$Total.getStyle('opacity')) === 1) { if (parseInt(this.$Total.getStyle('opacity')) === 1) {
return this.hideTotal(); return this.hideTotal();
} }
...@@ -1292,14 +1317,14 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1292,14 +1317,14 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
* *
* @return {Promise} * @return {Promise}
*/ */
showTotal: function() { showTotal: function () {
this.getButtons('total').setActive(); this.getButtons('total').setActive();
this.getContent().setStyle('overflow', 'hidden'); this.getContent().setStyle('overflow', 'hidden');
this.$totalsOpen = true; this.$totalsOpen = true;
this.refresh(); this.refresh();
return new Promise(function(resolve) { return new Promise(function (resolve) {
this.$Total.setStyles({ this.$Total.setStyles({
display: 'inline-block', display: 'inline-block',
opacity: 0 opacity: 0
...@@ -1322,14 +1347,14 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1322,14 +1347,14 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
* *
* @return {Promise} * @return {Promise}
*/ */
hideTotal: function() { hideTotal: function () {
const self = this; const self = this;
this.$totalsOpen = false; this.$totalsOpen = false;
this.getButtons('total').setNormal(); this.getButtons('total').setNormal();
return new Promise(function(resolve) { return new Promise(function (resolve) {
self.$Grid.setHeight(self.getContent().getSize().y - 20); self.$Grid.setHeight(self.getContent().getSize().y - 20);
moofx(self.$Total).animate({ moofx(self.$Total).animate({
...@@ -1337,7 +1362,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1337,7 +1362,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
opacity: 0 opacity: 0
}, { }, {
duration: 200, duration: 200,
callback: function() { callback: function () {
self.$Total.setStyles({ self.$Total.setStyles({
display: 'none' display: 'none'
}); });
...@@ -1351,7 +1376,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1351,7 +1376,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
/** /**
* Disable the filter * Disable the filter
*/ */
disableFilter: function() { disableFilter: function () {
this.$TimeFilter.disable(); this.$TimeFilter.disable();
this.$Status.disable(); this.$Status.disable();
}, },
...@@ -1359,12 +1384,12 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1359,12 +1384,12 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
/** /**
* Enable the filter * Enable the filter
*/ */
enableFilter: function() { enableFilter: function () {
this.$TimeFilter.enable(); this.$TimeFilter.enable();
this.$Status.enable(); this.$Status.enable();
}, },
search: function() { search: function () {
this.hideTotal().then(() => { this.hideTotal().then(() => {
this.refresh(); this.refresh();
}); });
...@@ -1375,7 +1400,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1375,7 +1400,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
* *
* @param {DOMEvent} event * @param {DOMEvent} event
*/ */
$onSearchKeyUp: function(event) { $onSearchKeyUp: function (event) {
if (event.key === 'up' || event.key === 'down' || event.key === 'left' || event.key === 'right') { if (event.key === 'up' || event.key === 'down' || event.key === 'left' || event.key === 'right') {
return; return;
} }
...@@ -1388,7 +1413,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1388,7 +1413,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
// workaround, cancel needs time to clear // workaround, cancel needs time to clear
(() => { (() => {
if (this.$currentSearch !== this.$Search.value) { if (this.$currentSearch !== this.$Search.value) {
this.$searchDelay = (function() { this.$searchDelay = (function () {
this.search(); this.search();
}).delay(250, this); }).delay(250, this);
} }
...@@ -1400,7 +1425,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [ ...@@ -1400,7 +1425,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/Journal', [
} }
if (event.key === 'enter') { if (event.key === 'enter') {
this.$searchDelay = (function() { this.$searchDelay = (function () {
this.search(); this.search();
}).delay(250, this); }).delay(250, this);
} }
......
...@@ -35,6 +35,10 @@ ...@@ -35,6 +35,10 @@
fire="\QUI\ERP\Accounting\Invoice\EventHandler::onQuiqqerErpOutputSendMail" fire="\QUI\ERP\Accounting\Invoice\EventHandler::onQuiqqerErpOutputSendMail"
/> />
<event on="onQuiqqerHtmlToPDFCreated"
fire="\QUI\ERP\Accounting\Invoice\EventHandler::onQuiqqerHtmlToPDFCreated"
/>
<event on="onQuiqqerMigrationV2" <event on="onQuiqqerMigrationV2"
fire="\QUI\ERP\Accounting\Invoice\EventHandler::onQuiqqerMigrationV2" fire="\QUI\ERP\Accounting\Invoice\EventHandler::onQuiqqerMigrationV2"
/> />
......
...@@ -325,7 +325,7 @@ public static function onQuiqqerErpOutputSendMailBefore( ...@@ -325,7 +325,7 @@ public static function onQuiqqerErpOutputSendMailBefore(
// extend pdf with e-invoice // extend pdf with e-invoice
$Config = QUI::getPackage('quiqqer/invoice')->getConfig(); $Config = QUI::getPackage('quiqqer/invoice')->getConfig();
if ($Config->getValue('invoice', 'xInvoiceAttachment')) { if (file_exists($mailFile) && $Config->getValue('invoice', 'xInvoiceAttachment')) {
$xmlFile = str_replace('.pdf', '.xml', $mailFile); $xmlFile = str_replace('.pdf', '.xml', $mailFile);
$document = QUI\ERP\Accounting\Invoice\Utils\Invoice::getElectronicInvoice( $document = QUI\ERP\Accounting\Invoice\Utils\Invoice::getElectronicInvoice(
$Invoice, $Invoice,
...@@ -336,15 +336,6 @@ public static function onQuiqqerErpOutputSendMailBefore( ...@@ -336,15 +336,6 @@ public static function onQuiqqerErpOutputSendMailBefore(
$Mailer->addAttachment($xmlFile); $Mailer->addAttachment($xmlFile);
} }
if (file_exists($mailFile) && $Config->getValue('invoice', 'zugferdInvoiceAttachment')) {
$document = QUI\ERP\Accounting\Invoice\Utils\Invoice::getElectronicInvoice(
$Invoice,
$Config->getValue('invoice', 'xInvoiceAttachmentType')
);
$pdfBuilder = new ZugferdDocumentPdfBuilder($document, $mailFile);
$pdfBuilder->generateDocument()->saveDocument($mailFile);
}
// @todo // @todo
$customerFiles = $Invoice->getCustomerFiles(); $customerFiles = $Invoice->getCustomerFiles();
...@@ -365,6 +356,27 @@ public static function onQuiqqerErpOutputSendMailBefore( ...@@ -365,6 +356,27 @@ public static function onQuiqqerErpOutputSendMailBefore(
} }
} }
public static function onQuiqqerHtmlToPDFCreated(QUI\HtmlToPdf\Document $Document, $filename): void
{
$Entity = $Document->getAttribute('Entity');
if (!($Entity instanceof Invoice)) {
return;
}
// extend pdf with e-invoice
$Config = QUI::getPackage('quiqqer/invoice')->getConfig();
if (file_exists($filename) && $Config->getValue('invoice', 'zugferdInvoiceAttachment')) {
$document = QUI\ERP\Accounting\Invoice\Utils\Invoice::getElectronicInvoice(
$Entity,
$Config->getValue('invoice', 'xInvoiceAttachmentType')
);
$pdfBuilder = new ZugferdDocumentPdfBuilder($document, $filename);
$pdfBuilder->generateDocument()->saveDocument($filename);
}
}
/** /**
* quiqqer/erp: onQuiqqerErpOutputSendMail * quiqqer/erp: onQuiqqerErpOutputSendMail
* *
......
...@@ -17,6 +17,14 @@ ...@@ -17,6 +17,14 @@
use IntlDateFormatter; use IntlDateFormatter;
use horstoeko\zugferd\ZugferdDocumentBuilder; use horstoeko\zugferd\ZugferdDocumentBuilder;
use horstoeko\zugferd\ZugferdProfiles; use horstoeko\zugferd\ZugferdProfiles;
use horstoeko\zugferd\codelists\ZugferdCountryCodes;
use horstoeko\zugferd\codelists\ZugferdCurrencyCodes;
use horstoeko\zugferd\codelists\ZugferdElectronicAddressScheme;
use horstoeko\zugferd\codelists\ZugferdInvoiceType;
use horstoeko\zugferd\codelists\ZugferdReferenceCodeQualifiers;
use horstoeko\zugferd\codelists\ZugferdUnitCodes;
use horstoeko\zugferd\codelists\ZugferdVatCategoryCodes;
use horstoeko\zugferd\codelists\ZugferdVatTypeCodes;
use function array_map; use function array_map;
use function array_merge; use function array_merge;
...@@ -450,7 +458,7 @@ protected static function verificateField( ...@@ -450,7 +458,7 @@ protected static function verificateField(
*/ */
public static function getInvoiceFilename( public static function getInvoiceFilename(
QUI\ERP\Accounting\Invoice\Invoice|InvoiceTemporary $Invoice, QUI\ERP\Accounting\Invoice\Invoice|InvoiceTemporary $Invoice,
QUI\Locale $Locale = null ?QUI\Locale $Locale = null
): string { ): string {
if ( if (
!($Invoice instanceof QUI\ERP\Accounting\Invoice\Invoice) && !($Invoice instanceof QUI\ERP\Accounting\Invoice\Invoice) &&
...@@ -517,7 +525,7 @@ public static function getInvoiceFilename( ...@@ -517,7 +525,7 @@ public static function getInvoiceFilename(
*/ */
public static function roundInvoiceSum( public static function roundInvoiceSum(
float|int $amount, float|int $amount,
QUI\ERP\Currency\Currency $Currency = null ?QUI\ERP\Currency\Currency $Currency = null
): float|int { ): float|int {
if ($Currency === null) { if ($Currency === null) {
$Currency = QUI\ERP\Defaults::getCurrency(); $Currency = QUI\ERP\Defaults::getCurrency();
...@@ -679,42 +687,95 @@ public static function getElectronicInvoice( ...@@ -679,42 +687,95 @@ public static function getElectronicInvoice(
$Invoice->getCurrency()->getCode() $Invoice->getCurrency()->getCode()
); );
// ids
$taxId = Defaults::conf('company', 'taxId');
$taxNumber = Defaults::conf('company', 'taxNumber');
// seller / owner // seller / owner
$document $document->setDocumentSeller(Defaults::conf('company', 'name'));
->setDocumentSeller(Defaults::conf('company', 'name'))
->addDocumentSellerGlobalId("4000001123452", "0088") // @todo global seller id
->addDocumentSellerTaxRegistration("FC", "201/113/40209") // ->addDocumentSellerGlobalId("4000001123452", "0088");
->addDocumentSellerTaxRegistration("VA", "DE123456789")
->setDocumentSellerAddress( if (!empty($taxNumber)) {
Defaults::conf('company', 'street'), $document->addDocumentSellerTaxRegistration("FC", $taxNumber);
"", }
"",
Defaults::conf('company', 'zip'), if (!empty($taxId)) {
Defaults::conf('company', 'city'), $document->addDocumentSellerTaxRegistration("VA", $taxId);
Defaults::conf('company', 'country') // @todo country ->code<- }
)
->setDocumentSellerCommunication( // address
'EM', $country = Defaults::conf('company', 'country');
Defaults::conf('company', 'email')
) if (strlen($country) !== 2) {
->setDocumentSellerContact( $DefaultLocale = QUI::getSystemLocale();
Defaults::conf('company', 'owner'), // @todo contact person
'', // @todo contact department foreach (QUI\Countries\Manager::getCompleteList() as $Country) {
Defaults::conf('company', 'phone'), // @todo contact phone if ($Country->getName($DefaultLocale) === $country) {
Defaults::conf('company', 'fax'), // @todo contact fax $country = $Country->getCode();
Defaults::conf('company', 'email') // @todo contact email break;
); }
}
}
if (strlen($country) !== 2) {
$country = '';
}
$document->setDocumentSellerAddress(
Defaults::conf('company', 'street'),
"",
"",
Defaults::conf('company', 'zipCode'),
Defaults::conf('company', 'city'),
$country
);
$document->setDocumentSellerCommunication(
'EM',
Defaults::conf('company', 'email')
);
$document->setDocumentSellerContact(
Defaults::conf('company', 'owner'), // @todo contact person
'', // @todo contact department
Defaults::conf('company', 'phone'), // @todo contact phone
Defaults::conf('company', 'fax'), // @todo contact fax
Defaults::conf('company', 'email') // @todo contact email
);
// bank stuff // bank stuff
$bankAccount = QUI\ERP\BankAccounts\Handler::getCompanyBankAccount(); $bankAccount = QUI\ERP\BankAccounts\Handler::getCompanyBankAccount();
if (!empty($bankAccount)) { if (!empty($bankAccount)) {
/* lastschrift
$document->addDocumentPaymentMeanToDirectDebit( $document->addDocumentPaymentMeanToDirectDebit(
$bankAccount['iban'], $bankAccount['iban'],
$Invoice->getPrefixedNumber() // @todo mandats nummer
);
*/
$document->addDocumentPaymentMean(
'42', // TypeCode für Überweisung
$bankAccount['iban'] ?? '',
$bankAccount['bic'] ?? ''
);
} else {
$document->addDocumentPaymentMean(
'42', // TypeCode für Überweisung
'',
''
); );
} }
$document->addDocumentPaymentMean(
'42', // TypeCode für Überweisung
$bankAccount['iban'] ?? '',
$bankAccount['bic'] ?? ''
);
// customer // customer
$Customer = $Invoice->getCustomer(); $Customer = $Invoice->getCustomer();
...@@ -730,9 +791,22 @@ public static function getElectronicInvoice( ...@@ -730,9 +791,22 @@ public static function getElectronicInvoice(
$Customer->getAddress()->getAttribute('zip'), $Customer->getAddress()->getAttribute('zip'),
$Customer->getAddress()->getAttribute('city'), $Customer->getAddress()->getAttribute('city'),
$Customer->getAddress()->getCountry()->getCode() $Customer->getAddress()->getCountry()->getCode()
) )->setDocumentBuyerReference($Customer->getUUID());
->setDocumentBuyerCommunication('EM', $Customer->getAddress()->getAttribute('email'))
->setDocumentBuyerReference($Customer->getUUID());
if ($Customer->getAddress()->getAttribute('email')) {
$document->setDocumentBuyerCommunication('EM', $Customer->getAddress()->getAttribute('email'));
} else {
try {
$User = QUI::getUsers()->get($Customer->getUUID());
$document->setDocumentBuyerCommunication('EM', $User->getAttribute('email'));
} catch (QUI\Exception) {
// requirement -> workaround -> placeholder
$document->setDocumentBuyerCommunication('EM', 'unknown@example.com');
}
}
//->setDocumentBuyerOrderReferencedDocument($Invoice->getUUID());
// total // total
$priceCalculation = $Invoice->getPriceCalculation(); $priceCalculation = $Invoice->getPriceCalculation();
...@@ -742,7 +816,7 @@ public static function getElectronicInvoice( ...@@ -742,7 +816,7 @@ public static function getElectronicInvoice(
$document->addDocumentTax( $document->addDocumentTax(
"S", "S",
"VAT", "VAT",
$priceCalculation->getSum()->value(), $priceCalculation->getNettoSum()->value(),
$vat->value(), $vat->value(),
$vat->getVat() $vat->getVat()
); );
...@@ -753,13 +827,13 @@ public static function getElectronicInvoice( ...@@ -753,13 +827,13 @@ public static function getElectronicInvoice(
$document->setDocumentSummation( $document->setDocumentSummation(
$priceCalculation->getSum()->value(), $priceCalculation->getSum()->value(),
$priceCalculation->getSum()->value(), $priceCalculation->getSum()->value(),
$priceCalculation->getSum()->value(), $priceCalculation->getNettoSum()->value(),
0.0, 0.0, // zuschläge
0.0, 0.0, // rabatte
$priceCalculation->getSum()->value(), $priceCalculation->getNettoSum()->value(), // Steuerbarer Betrag (BT-109)
$vatTotal, $vatTotal, // Steuerbetrag
null, null, // Rundungsbetrag
0.0 0.0 // Vorauszahlungen
); );
// products // products
...@@ -783,6 +857,25 @@ public static function getElectronicInvoice( ...@@ -783,6 +857,25 @@ public static function getElectronicInvoice(
->setDocumentPositionLineSummation($article['sum']); ->setDocumentPositionLineSummation($article['sum']);
} }
// payment stuff
$PaymentDate = null;
try {
$timeForPayment = $Invoice->getAttribute('time_for_payment');
$timeForPayment = strtotime($timeForPayment);
if ($timeForPayment) {
$PaymentDate = new DateTime();
$PaymentDate->setTimestamp($timeForPayment);
}
} catch (\Exception) {
}
$document->addDocumentPaymentTerm(
$Invoice->getAttribute('additional_invoice_text'),
$PaymentDate
);
return $document; return $document;
} }
} }