some charges/allowance changes

This commit is contained in:
Jochen Stärk
2020-09-08 10:19:56 +02:00
parent c1fa8ec608
commit f8dbfd7eb6
9 changed files with 1511 additions and 186 deletions

View File

@@ -0,0 +1,16 @@
package org.mustangproject;
import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge;
import java.math.BigDecimal;
public class Allowance extends Charge implements IZUGFeRDAllowanceCharge {
public Allowance() {
}
public Allowance(BigDecimal totalAmount, BigDecimal taxPercent, String reason, String categoryCode) {
super(totalAmount, taxPercent, reason, categoryCode);
}
}

View File

@@ -0,0 +1,74 @@
package org.mustangproject;
import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge;
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableProduct;
import java.math.BigDecimal;
public class Charge implements IZUGFeRDAllowanceCharge {
protected BigDecimal percent;
protected BigDecimal totalAmount;
protected BigDecimal taxPercent;
protected String reason;
protected String categoryCode;
public Charge() {
}
public Charge(BigDecimal totalAmount, BigDecimal taxPercent, String reason, String categoryCode) {
this.totalAmount = totalAmount;
this.taxPercent = taxPercent;
this.reason = reason;
this.categoryCode = categoryCode;
}
public Charge setTotalAmount(BigDecimal totalAmount) {
this.totalAmount = totalAmount;
return this;
}
public Charge setPercent(BigDecimal percent) {
this.percent = percent;
return this;
}
public Charge setTaxPercent(BigDecimal taxPercent) {
this.taxPercent = taxPercent;
return this;
}
public Charge setReason(String reason) {
this.reason = reason;
return this;
}
public Charge setCategoryCode(String categoryCode) {
this.categoryCode = categoryCode;
return this;
}
@Override
public BigDecimal getTotalAmount() {
return totalAmount;
}
@Override
public String getReason() {
return reason;
}
@Override
public BigDecimal getTaxPercent() {
return taxPercent;
}
@Override
public String getCategoryCode() {
return categoryCode;
}
}

View File

@@ -402,6 +402,22 @@ public class Invoice implements IExportableTransaction {
}
public Invoice addCharge(IZUGFeRDAllowanceCharge charge) {
//@todo
return this;
}
public Invoice addAllowance(IZUGFeRDAllowanceCharge allowance) {
//@todo
return this;
}
/***
* checks if all required items are set in order to be able to export it
* @return
*/
public boolean isValid() {
return (dueDate != null) && (ownZIP != null) && (ownStreet != null) && (ownLocation != null) && (ownCountry != null) && (ownTaxID != null) && (ownVATID != null) && (recipient != null);
//contact

View File

@@ -25,6 +25,16 @@ public class Item implements IZUGFeRDExportableItem {
return this;
}
public Item addCharge(IZUGFeRDAllowanceCharge charge) {
//@todo
return this;
}
public Item addAllowance(IZUGFeRDAllowanceCharge allowance) {
//@todo
return this;
}
public BigDecimal getGrossPrice() {
return grossPrice;
}