Skip to content

Commit

Permalink
Merge pull request #573 from tobitege/tradelineitem-xml-docs
Browse files Browse the repository at this point in the history
(chore) TradeLineItem: XML comments reviewed/added
  • Loading branch information
stephanstapel authored Jan 11, 2025
2 parents 03f255a + 2a93d6f commit dfb1e23
Showing 1 changed file with 83 additions and 9 deletions.
92 changes: 83 additions & 9 deletions ZUGFeRD/TradeLineItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,27 @@ public class TradeLineItem
///
/// The global identifier of the article is a globally unique identifier of the product being assigned to it by its
/// producer, bases on the rules of a global standardisation body.
///
/// BT-157
/// </summary>
public GlobalID GlobalID { get; set; } = new GlobalID();

/// <summary>
/// An identification of the item assigned by the seller.
///
/// BT-155
/// </summary>
public string SellerAssignedID { get; set; }

/// <summary>
/// An identification of the item assigned by the buyer.
///
/// BT-156
/// </summary>
public string BuyerAssignedID { get; set; }

/// <summary>
/// An article’s name
/// An item’s name
///
/// BT-153
/// </summary>
Expand Down Expand Up @@ -86,6 +90,7 @@ public class TradeLineItem

/// <summary>
/// Invoice line net amount including (!) trade allowance charges for the line item
///
/// BT-131
/// </summary>
public decimal? LineTotalAmount { get; set; }
Expand All @@ -94,25 +99,31 @@ public class TradeLineItem
/// Detailed information about the invoicing period
///
/// Invoicing period start date
///
/// BT-134
/// </summary>
public DateTime? BillingPeriodStart { get; set; }

/// <summary>
/// Detailed information about the invoicing period
///
/// Invoicing period end date
///
/// BT-135
/// </summary>
public DateTime? BillingPeriodEnd { get; set; }

/// <summary>
/// he code valid for the invoiced goods sales tax category
/// The code valid for the invoiced goods sales tax category
///
/// BT-151
/// </summary>
public TaxCategoryCodes TaxCategoryCode { get; set; }

/// <summary>
/// Tax rate
///
/// BT-152
/// </summary>
public decimal TaxPercent { get; set; }

Expand All @@ -124,14 +135,14 @@ public class TradeLineItem
public TaxTypes TaxType { get; set; } = TaxTypes.VAT;

/// <summary>
/// net unit price of the item
/// Net unit price of the item
///
/// BT-146
/// </summary>
public decimal? NetUnitPrice { get; set; }

/// <summary>
/// gross unit price of the item
/// Gross unit price of the item
///
/// BT-148
/// </summary>
Expand All @@ -153,21 +164,29 @@ public class TradeLineItem

/// <summary>
/// Detailed information about the actual Delivery
///
/// BT-72
/// </summary>
public DateTime? ActualDeliveryDate { get; set; }

/// <summary>
/// Details of the associated order
///
/// BT-132
/// </summary>
public BuyerOrderReferencedDocument BuyerOrderReferencedDocument { get; set; }

/// <summary>
/// Detailed information about the corresponding delivery note
///
/// BG-X-83
/// </summary>
public DeliveryNoteReferencedDocument DeliveryNoteReferencedDocument { get; set; }

/// <summary>
/// Details of the associated contract
///
/// BG-X-2
/// </summary>
public ContractReferencedDocument ContractReferencedDocument { get; set; }

Expand All @@ -189,11 +208,15 @@ public class TradeLineItem
/// A group of business terms providing information about the applicable surcharges or discounts on the total amount of the invoice item
///
/// Now private. Please use GetSpecifiedTradeAllowanceCharges() instead
///
/// BG-27 / BG-28
/// </summary>
private List<TradeAllowanceCharge> SpecifiedTradeAllowanceCharges { get; set; } = new List<TradeAllowanceCharge>();

/// <summary>
/// Detailed information on the accounting reference
///
/// BT-19-00
/// </summary>
public List<ReceivableSpecifiedTradeAccountingAccount> ReceivableSpecifiedTradeAccountingAccounts { get; set; } = new List<ReceivableSpecifiedTradeAccountingAccount>();

Expand All @@ -211,19 +234,35 @@ public class TradeLineItem
/// </summary>
public List<ApplicableProductCharacteristic> ApplicableProductCharacteristics { get; set; } = new List<ApplicableProductCharacteristic>();

private List<DesignatedProductClassification> DesignedProductClassifications { get; set; } = new List<DesignatedProductClassification>();

/// <summary>
/// Detailed information on the item classification
///
/// BG-158
/// </summary>
private List<DesignatedProductClassification> DesignatedProductClassifications { get; set; } = new List<DesignatedProductClassification>();


/// <summary>
/// Recipient of the delivered goods. This party is optional and is written in Extended profile only
///
/// BG-X-7
/// </summary>
public Party ShipTo { get; set; }


/// <summary>
/// Detailed information on the deviating final recipient. This party is optional and only relevant for Extended profile
///
/// BG-X-10
/// </summary>
public Party UltimateShipTo { get; set; }


/// <summary>
/// Creates a new trade line item with the specified line identifier
/// </summary>
/// <param name="lineId">The unique identifier for this trade line item</param>
public TradeLineItem(string lineId)
{
this.AssociatedDocument = new AssociatedDocument(lineId);
Expand Down Expand Up @@ -283,6 +322,7 @@ public IList<TradeAllowanceCharge> GetTradeAllowanceCharges()
return this._TradeAllowanceCharges;
} // !GetTradeAllowanceCharges()


/// <summary>
/// As an allowance or charge on total item price, attaching it to the corresponding item.
/// </summary>
Expand Down Expand Up @@ -326,6 +366,7 @@ public void AddSpecifiedTradeAllowanceCharge(bool isDiscount, CurrencyCodes curr
});
} // !AddSpecifiedTradeAllowanceCharge()


/// <summary>
/// Returns all specified trade allowance charges for the trade line item
/// </summary>
Expand All @@ -335,6 +376,7 @@ public IList<TradeAllowanceCharge> GetSpecifiedTradeAllowanceCharges()
return this.SpecifiedTradeAllowanceCharges;
} // !GetSpecifiedTradeAllowanceCharges()


/// <summary>
/// The value given here refers to the superior line. In this way, a hierarchy tree of invoice items can be mapped.
/// </summary>
Expand All @@ -343,12 +385,22 @@ public void SetParentLineId(string parentLineId)
this.AssociatedDocument.ParentLineID = parentLineId;
}

/// <summary>
/// Sets the status code and reason code for this trade line item
/// </summary>
/// <param name="lineStatusCode">The status code for this line</param>
/// <param name="lineStatusReasonCode">The reason code explaining the status</param>
public void SetLineStatus(LineStatusCodes lineStatusCode, LineStatusReasonCodes lineStatusReasonCode)
{
this.AssociatedDocument.LineStatusCode = lineStatusCode;
this.AssociatedDocument.LineStatusReasonCode = lineStatusReasonCode;
}

/// <summary>
/// Sets the delivery note reference information for this trade line item
/// </summary>
/// <param name="deliveryNoteId">The identifier of the delivery note</param>
/// <param name="deliveryNoteDate">The date of the delivery note</param>
public void SetDeliveryNoteReferencedDocument(string deliveryNoteId, DateTime? deliveryNoteDate)
{
this.DeliveryNoteReferencedDocument = new DeliveryNoteReferencedDocument()
Expand All @@ -359,6 +411,13 @@ public void SetDeliveryNoteReferencedDocument(string deliveryNoteId, DateTime? d
} // !SetDeliveryNoteReferencedDocument()


/// <summary>
/// Adds an additional reference document with basic information
/// </summary>
/// <param name="id">Document identifier</param>
/// <param name="typeCode">Type of the document</param>
/// <param name="code">Reference type code</param>
/// <param name="issueDateTime">Issue date and time of the document</param>
public void AddAdditionalReferencedDocument(string id, AdditionalReferencedDocumentTypeCode typeCode, ReferenceTypeCodes code = ReferenceTypeCodes.Unknown, DateTime? issueDateTime = null)
{
this._AdditionalReferencedDocuments.Add(new AdditionalReferencedDocument()
Expand All @@ -370,6 +429,12 @@ public void AddAdditionalReferencedDocument(string id, AdditionalReferencedDocum
});
} // !AddAdditionalReferencedDocument()

/// <summary>
/// Adds a referenced product that is included in this trade line item
/// </summary>
/// <param name="name">Name of the included product</param>
/// <param name="unitQuantity">Quantity of the included product</param>
/// <param name="quantityCodes">Unit code for the quantity</param>
public void AddIncludedReferencedProduct(string name, decimal? unitQuantity = null, QuantityCodes? quantityCodes = null)
{
this.IncludedReferencedProducts.Add(new IncludedReferencedProduct()
Expand Down Expand Up @@ -415,7 +480,6 @@ public IList<AdditionalReferencedDocument> GetAdditionalReferencedDocuments()
} // !GetAdditionalReferencedDocuments()



/// <summary>
/// Sets a purchase order line reference. BT-132
/// Please note that XRechnung/ FacturX allows a maximum of one such reference and will only output the referenced order line id
Expand All @@ -432,6 +496,11 @@ public void SetOrderReferencedDocument(string orderReferencedId, DateTime? order
} // !SetOrderReferencedDocument()


/// <summary>
/// Sets the contract reference information for this trade line item
/// </summary>
/// <param name="contractReferencedId">The identifier of the contract</param>
/// <param name="contractReferencedDate">The date of the contract</param>
public void SetContractReferencedDocument(string contractReferencedId, DateTime? contractReferencedDate)
{
this.ContractReferencedDocument = new ContractReferencedDocument()
Expand All @@ -441,6 +510,11 @@ public void SetContractReferencedDocument(string contractReferencedId, DateTime?
};
} // !SetContractReferencedDocument()


/// <summary>
/// Adds an invoice line Buyer accounting reference with default Unknown account type
/// </summary>
/// <param name="AccountID">The accounting reference identifier</param>
public void AddReceivableSpecifiedTradeAccountingAccount(string AccountID)
{
AddReceivableSpecifiedTradeAccountingAccount(AccountID, AccountingAccountTypeCodes.Unknown);
Expand Down Expand Up @@ -470,7 +544,7 @@ public void AddReceivableSpecifiedTradeAccountingAccount(string AccountID, Accou
/// <param name="listVersionID">Version of product classification (optional)</param>
public void AddDesignatedProductClassification(DesignatedProductClassificationClassCodes listID, string listVersionID = null, string classCode = null, string className = null)
{
this.DesignedProductClassifications.Add(new DesignatedProductClassification()
this.DesignatedProductClassifications.Add(new DesignatedProductClassification()
{
ClassCode = classCode,
ClassName = className,
Expand All @@ -486,7 +560,7 @@ public void AddDesignatedProductClassification(DesignatedProductClassificationCl
/// <returns></returns>
public List<DesignatedProductClassification> GetDesignatedProductClassifications()
{
return this.DesignedProductClassifications;
return this.DesignatedProductClassifications;
} // !GetDesignatedProductClassifications()


Expand All @@ -496,7 +570,7 @@ public List<DesignatedProductClassification> GetDesignatedProductClassifications
/// <returns></returns>
public List<DesignatedProductClassification> GetDesignatedProductClassificationsByClassCode(string classCode)
{
return this.DesignedProductClassifications.Where(c => c.ClassCode.Equals(classCode)).ToList();
return this.DesignatedProductClassifications.Where(c => c.ClassCode.Equals(classCode)).ToList();
} // !GetDesignatedProductClassificationsByClassCode()
}
}

0 comments on commit dfb1e23

Please sign in to comment.