Skip to content

Commit

Permalink
no e-invoice creation for specific invoice types (e.g. offer). issue #…
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Oct 13, 2024
1 parent 5c95a69 commit 8ccd382
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2483,26 +2483,35 @@ private void cmdCreateInvoiceDocumentActionPerformed(java.awt.event.ActionEvent
JOptionPane.showMessageDialog(this, "Es ist kein Rechnungssender definiert, E-Rechnung kann nicht erstellt werden.", com.jdimension.jlawyer.client.utils.DesktopUtils.POPUP_TITLE_WARNING, JOptionPane.WARNING_MESSAGE);
return;
}

// Options to display
String[] options = {"Elektronische Rechnung (an Unternehmen)", "XRechnung (an öffentliche Auftraggeber)"};

// Show option dialog
int choice = JOptionPane.showOptionDialog(
this, // Parent component (null for no parent)
"Rechnung erstellen als:", // Message to display
"Rechnungsdokument erstellen", // Title of the dialog
JOptionPane.DEFAULT_OPTION, // Option type (default for custom buttons)
JOptionPane.QUESTION_MESSAGE, // Message type (question icon)
null, // Icon (null for default icon)
options, // Options array
options[0] // Initial value (default selection)
);

if (choice < 0) {
return;


// by default, create document from document template
int choice=0;

// if the invoice type indicates a real invoice where there is a turnover, we need to create an electronic invoice
if(this.currentEntry.getInvoiceType().isTurnOver()) {
// Options to display
String[] options = {"Elektronische Rechnung (an Unternehmen)", "XRechnung (an öffentliche Auftraggeber)"};

// Show option dialog
choice = JOptionPane.showOptionDialog(
this, // Parent component (null for no parent)
"Rechnung erstellen als:", // Message to display
"Rechnungsdokument erstellen", // Title of the dialog
JOptionPane.DEFAULT_OPTION, // Option type (default for custom buttons)
JOptionPane.QUESTION_MESSAGE, // Message type (question icon)
null, // Icon (null for default icon)
options, // Options array
options[0] // Initial value (default selection)
);

if (choice < 0) {
return;
}
}



AppUserBean senderUser = null;
try {
JLawyerServiceLocator locator = JLawyerServiceLocator.getInstance(ClientSettings.getInstance().getLookupProperties());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,8 @@ public String convertToPDF(String file, ArchiveFileDocumentsBean doc) throws Exc
throw new Exception("Diesem Dokument ist mit mehreren Rechnungen verknüpft, elektronische Rechnung kann nicht erstellt werden.");
}

if (invoices.size() == 1) {
// only create e-invoice if the invoice type indicates a turnover / flow of money
if (invoices.size() == 1 && invoices.get(0).getInvoiceType()!=null && invoices.get(0).getInvoiceType().isTurnOver()) {
// generate electronic invoice
Invoice sourceInvoice = invoices.get(0);
if (StringUtils.isEmpty(sourceInvoice.getSender())) {
Expand Down

0 comments on commit 8ccd382

Please sign in to comment.