public CreditnoteLine(InvoiceLine InvoiceLine) { this._id = Guid.NewGuid (); this._sort = SNDK.Date.CurrentDateTimeToTimestamp (); this._no = InvoiceLine.No; this._itemid = InvoiceLine.ItemId; this._text = InvoiceLine.Text; this._amount = InvoiceLine.Amount; this._amount += InvoiceLine.CommissionFee; this._vat = InvoiceLine.VatTotal; }
public static InvoiceLine FromXmlDocument(XmlDocument xmlDocument) { Hashtable item; InvoiceLine result = new InvoiceLine (); try { item = (Hashtable)SNDK.Convert.FromXmlDocument (SNDK.Convert.XmlNodeToXmlDocument (xmlDocument.SelectSingleNode ("(//didius.invoiceline)[1]"))); } catch { item = (Hashtable)SNDK.Convert.FromXmlDocument (xmlDocument); } if (item.ContainsKey ("id")) { result._id = new Guid ((string)item["id"]); } else { throw new Exception (string.Format (Strings.Exception.InvoiceLineFromXmlDocument, "ID")); } if (item.ContainsKey ("no")) { result._no = (string)item["no"]; } if (item.ContainsKey ("sort")) { result._sort = int.Parse ((string)item["sort"]); } if (item.ContainsKey ("itemid")) { result._itemid = new Guid ((string)item["itemid"]); } else { throw new Exception (string.Format (Strings.Exception.InvoiceLineFromXmlDocument, "ITEMID")); } if (item.ContainsKey ("no")) { result._no = (string)item["no"]; } if (item.ContainsKey ("text")) { result._text = (string)item["text"]; } if (item.ContainsKey ("commissionfee")) { result._commissionfee = decimal.Parse ((string)item["commissionfee"], System.Globalization.CultureInfo.InvariantCulture); } if (item.ContainsKey ("amount")) { result._amount = decimal.Parse ((string)item["amount"], System.Globalization.CultureInfo.InvariantCulture); } if (item.ContainsKey ("vatamount")) { result._vatamount = decimal.Parse ((string)item["vatamount"], System.Globalization.CultureInfo.InvariantCulture); } if (item.ContainsKey ("vatcommissionfee")) { result._vatcommissionfee = decimal.Parse ((string)item["vatcommissionfee"], System.Globalization.CultureInfo.InvariantCulture); } return result; }