updated history

This commit is contained in:
jstaerk
2025-05-27 17:33:50 +02:00
parent 4c8bd2b93f
commit 98a1293c23
4 changed files with 49 additions and 7 deletions

View File

@@ -1,3 +1,9 @@
#820/801/815
#822
#843
add getCalculation on calculatedInvoice
Transactioncalculator getTaxDetails to include correct percentage, calculated amounts
2.16.5 2.16.5
======= =======
2025-05-22 2025-05-22

View File

@@ -184,11 +184,11 @@ maybe not yet even existing new release version:
``` ```
cd validator/target cd validator/target
mvn install:install-file -Dfile=validator-2.12.0-SNAPSHOT-shaded.jar -Dclassifier=shaded -DgroupId=org.mustangproject -DartifactId=validator -Dversion=2.12.0 -Dpackaging=jar -DgeneratePom=true mvn install:install-file -Dfile=validator-2.17.0-SNAPSHOT-shaded.jar -Dclassifier=shaded -DgroupId="org.mustangproject" -DartifactId=validator -Dversion="2.17.0" -Dpackaging=jar -DgeneratePom=true
``` ```
In gradle you can use something like In gradle you can use something like
``` ```
implementation files('libs/validator-2.12.0-shaded.jar') implementation files('libs/validator-2.17.0-shaded.jar')
``` ```

View File

@@ -19,9 +19,10 @@ public class CalculatedInvoice extends Invoice implements Serializable {
protected BigDecimal duePayable=null; protected BigDecimal duePayable=null;
protected BigDecimal grandTotal=null; protected BigDecimal grandTotal=null;
protected BigDecimal taxBasis=null; protected BigDecimal taxBasis=null;
protected TransactionCalculator tc=null;
public void calculate() { public void calculate() {
TransactionCalculator tc=new TransactionCalculator(this); tc=new TransactionCalculator(this);
grandTotal=tc.getGrandTotal(); grandTotal=tc.getGrandTotal();
lineTotalAmount=tc.getValue(); lineTotalAmount=tc.getValue();
duePayable=tc.getDuePayable(); duePayable=tc.getDuePayable();
@@ -33,6 +34,13 @@ public class CalculatedInvoice extends Invoice implements Serializable {
} }
return grandTotal; return grandTotal;
} }
/***
* usually one would use calculate, use only if the invoice is parsed
* @param grand the gross total
* @return fluent setter
*/
public CalculatedInvoice setGrandTotal(BigDecimal grand) { public CalculatedInvoice setGrandTotal(BigDecimal grand) {
grandTotal=grand; grandTotal=grand;
return this; return this;
@@ -43,6 +51,13 @@ public class CalculatedInvoice extends Invoice implements Serializable {
} }
return taxBasis; return taxBasis;
} }
/***
* usually one would use calculate, use only if the invoice is parsed
* @param basis taxable net total
* @return fluent setter
*/
public CalculatedInvoice setTaxBasis(BigDecimal basis) { public CalculatedInvoice setTaxBasis(BigDecimal basis) {
taxBasis=basis; taxBasis=basis;
return this; return this;
@@ -54,6 +69,13 @@ public class CalculatedInvoice extends Invoice implements Serializable {
} }
return duePayable; return duePayable;
} }
/***
* usually one would use calculate, use only if the invoice is parsed
* @param due the gross total minus prepaid
* @return fluent setter
*/
public CalculatedInvoice setDuePayable(BigDecimal due) { public CalculatedInvoice setDuePayable(BigDecimal due) {
duePayable=due; duePayable=due;
return this; return this;
@@ -65,9 +87,24 @@ public class CalculatedInvoice extends Invoice implements Serializable {
} }
return lineTotalAmount; return lineTotalAmount;
} }
/***
* usually one would use calculate, use only if the invoice is parsed
* @param total the net total
* @return fluent setter
*/
public CalculatedInvoice setLineTotalAmount(BigDecimal total) { public CalculatedInvoice setLineTotalAmount(BigDecimal total) {
lineTotalAmount=total; lineTotalAmount=total;
return this; return this;
} }
/**
* this can be used to additionally e.g. access the VAT amounts
* @return a updated transactioncalulator
*/
public TransactionCalculator getCalculation() {
calculate();
return tc;
}
} }

View File

@@ -79,7 +79,7 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
entry.getValue().getBasis(), entry.getValue().getBasis(),
entry.getValue().getCalculated(), entry.getValue().getCalculated(),
entry.getValue().getCategoryCode() entry.getValue().getCategoryCode()
).setCalculated(entry.getKey()) ).setApplicablePercent(entry.getKey())
) )
.collect(Collectors.toSet()); .collect(Collectors.toSet());
} }
@@ -187,9 +187,8 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
for (IZUGFeRDExportableItem currentItem : trans.getZFItems()) { for (IZUGFeRDExportableItem currentItem : trans.getZFItems()) {
BigDecimal percent = null; BigDecimal percent = null;
if (currentItem.getProduct()!=null) if (currentItem.getProduct() != null) {
{ percent = currentItem.getProduct().getVATPercent();
percent=currentItem.getProduct().getVATPercent();
} }
if (percent != null) { if (percent != null) {
LineCalculator lc = new LineCalculator(currentItem); LineCalculator lc = new LineCalculator(currentItem);