This commit is contained in:
LAPTOP-MS3A4HDC\Asim khan
2021-08-09 10:50:35 +02:00
parent a74421b050
commit c7093a20c1
5 changed files with 64 additions and 14 deletions

View File

@@ -14,6 +14,7 @@ public class Item implements IZUGFeRDExportableItem {
protected BigDecimal price, quantity, tax, grossPrice, lineTotalAmount;
protected Date detailedDeliveryPeriodFrom=null, detailedDeliveryPeriodTo=null;
protected String id;
protected String referencedLineID=null;
protected Product product;
protected ArrayList<String> notes = null;
protected ArrayList<IZUGFeRDAllowanceCharge> Allowances = new ArrayList<IZUGFeRDAllowanceCharge>(),
@@ -31,6 +32,21 @@ public class Item implements IZUGFeRDExportableItem {
this.product = product;
}
public Item addReferencedLineID(String s) {
referencedLineID=s;
return this;
}
/***
* BT 132 (issue https://github.com/ZUGFeRD/mustangproject/issues/247)
* @return
*/
@Override
public String getBuyerOrderReferencedDocumentLineID() {
return referencedLineID;
}
public BigDecimal getLineTotalAmount() {
return lineTotalAmount;
}

View File

@@ -50,6 +50,15 @@ public interface IZUGFeRDExportableItem extends IAbsoluteValueProvider{
}
/***
* BT 132 (issue https://github.com/ZUGFeRD/mustangproject/issues/247)
* @return
*/
default String getBuyerOrderReferencedDocumentLineID() {
return null;
}
/**
* The price of one item excl. taxes
*

View File

@@ -350,8 +350,14 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
+ "</ram:Description>\n"
+ " </ram:SpecifiedTradeProduct>\n"
+ " <ram:SpecifiedLineTradeAgreement>\n"
+ " <ram:GrossPriceProductTradePrice>\n"
+ " <ram:SpecifiedLineTradeAgreement>\n";
if (currentItem.getBuyerOrderReferencedDocumentLineID() != null) {
xml = xml + " <ram:BuyerOrderReferencedDocument> \n"
+ " <ram:LineID>"+XMLTools.encodeXML(currentItem.getBuyerOrderReferencedDocumentLineID())+"</ram:LineID>\n"
+ " </ram:BuyerOrderReferencedDocument>\n";
}
xml = xml + " <ram:GrossPriceProductTradePrice>\n"
+ " <ram:ChargeAmount>" + priceFormat(lc.getPriceGross())
+ "</ram:ChargeAmount>\n" //currencyID=\"EUR\"
+ "<ram:BasisQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit())
@@ -512,17 +518,17 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
for (final BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
final VATAmount amount = VATPercentAmountMap.get(currentTaxPercent);
if (amount != null) {
final String amountCategoryCode = amount.getCategoryCode();
final boolean displayExemptionReason = CATEGORY_CODES_WITH_EXEMPTION_REASON.contains(amountCategoryCode);
xml += " <ram:ApplicableTradeTax>\n"
+ " <ram:CalculatedAmount>" + currencyFormat(amount.getCalculated())
+ "</ram:CalculatedAmount>\n" //currencyID=\"EUR\"
+ " <ram:TypeCode>VAT</ram:TypeCode>\n"
+ (displayExemptionReason ? exemptionReason : "")
+ " <ram:BasisAmount>" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>\n" // currencyID=\"EUR\"
+ " <ram:CategoryCode>" + amountCategoryCode + "</ram:CategoryCode>\n"
+ " <ram:RateApplicablePercent>"
+ vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>\n" + " </ram:ApplicableTradeTax>\n" ;
final String amountCategoryCode = amount.getCategoryCode();
final boolean displayExemptionReason = CATEGORY_CODES_WITH_EXEMPTION_REASON.contains(amountCategoryCode);
xml += " <ram:ApplicableTradeTax>\n"
+ " <ram:CalculatedAmount>" + currencyFormat(amount.getCalculated())
+ "</ram:CalculatedAmount>\n" //currencyID=\"EUR\"
+ " <ram:TypeCode>VAT</ram:TypeCode>\n"
+ (displayExemptionReason ? exemptionReason : "")
+ " <ram:BasisAmount>" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>\n" // currencyID=\"EUR\"
+ " <ram:CategoryCode>" + amountCategoryCode + "</ram:CategoryCode>\n"
+ " <ram:RateApplicablePercent>"
+ vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>\n" + " </ram:ApplicableTradeTax>\n";
}
}
if ((trans.getDetailedDeliveryPeriodFrom() != null) || (trans.getDetailedDeliveryPeriodTo() != null)) {