public void CreateSupplierInvoice() { var supplierId = 0; var itemId = 0; var taxTypeId = 0; SupplierInvoice po = new SupplierInvoice(); var supplier = Api.SupplierRequest.Get(supplierId); po.SupplierId = supplierId; po.SupplierName = supplier.Name; po.Date = DateTime.Now; po.DueDate = DateTime.Now.AddDays(7); po.Lines = new List<CommercialDocumentLine>(); var line1 = new CommercialDocumentLine { SelectionId = itemId, // This must be an item or account id TaxTypeId = taxTypeId, // Use TaxTypeRequest to get list of Tax Types LineType = 0, // 0=Item/1=Account -> See Enums.CommercialDocumentLineType Quantity = 1, UnitPriceExclusive = 390, UnitPriceInclusive = 390, DiscountPercentage = 0 }; po.Lines.Add(line1); var newSupplierInvoice = supplierInvoiceRequest.Save(po); Assert.IsTrue(supplierInvoiceRequest.StatusCode == HttpStatusCode.Created); }
public void CreateTaxInvoice() { var customerId = 0; var salesRepId = 0; var itemId = 0; var taxTypeId = 0; TaxInvoice invoice = new TaxInvoice(); var customer = Api.CustomerRequest.Get(customerId); var salesRep = Api.SalesRepresentativeRequest.Get(salesRepId); // Must set both CustomerId and Customer in order to work invoice.CustomerId = customerId; invoice.Customer = customer; // Must set both SalesRepresentativeId and SalesRepresentative in order to work invoice.SalesRepresentativeId = salesRepId; invoice.SalesRepresentative = salesRep; invoice.Date = DateTime.Now; invoice.DueDate = new DateTime(2015, 12, 12); invoice.Lines = new List<CommercialDocumentLine>(); var line1 = new CommercialDocumentLine { SelectionId = itemId, // This must be an item or account id TaxTypeId = taxTypeId, // Use TaxTypeRequest to get list of Tax Types LineType = 0, // 0=Item/1=Account Quantity = 1, UnitPriceExclusive = 390, UnitPriceInclusive = 390, DiscountPercentage = 0 }; invoice.Lines.Add(line1); var newTaxInvoice = taxInvoiceRequest.Save(invoice); Assert.IsTrue(taxInvoiceRequest.StatusCode == HttpStatusCode.Created); }