private ModificationInvoice CreateModificationInvoice(InvoiceNumber originalDocumentNumber, Receiver receiver) { var nowUtc = DateTime.UtcNow.Date; var item1Amount = new Amount(net: new AmountValue(-1694.92m), gross: new AmountValue(-2000), tax: new AmountValue(-305.08m)); var item2Amount = new Amount(new AmountValue(-2362.20m), new AmountValue(-3000), new AmountValue(-637.8m)); var item3Amount = new Amount(new AmountValue(-952.38m), new AmountValue(-1000), new AmountValue(-47.62m)); var unitAmount1 = new ItemAmounts(item1Amount, item1Amount, 0.18m); var unitAmount2 = new ItemAmounts(item2Amount, item2Amount, 0.27m); var unitAmount3 = new ItemAmounts(item3Amount, item3Amount, 0.05m); var items = new[] { new InvoiceItem( consumptionDate: nowUtc, totalAmounts: new ItemAmounts(item1Amount, item1Amount, 0.18m), description: Description.Create("Item 1 description").Success.Get(), measurementUnit: MeasurementUnit.Night, quantity: -1, unitAmounts: unitAmount1, exchangeRate: ExchangeRate.Create(1).Success.Get() ), new InvoiceItem( consumptionDate: nowUtc, totalAmounts: new ItemAmounts(item2Amount, item2Amount, 0.27m), description: Description.Create("Item 2 description").Success.Get(), measurementUnit: MeasurementUnit.Night, quantity: -1, unitAmounts: unitAmount2, exchangeRate: ExchangeRate.Create(1).Success.Get() ), new InvoiceItem( consumptionDate: nowUtc, totalAmounts: new ItemAmounts(item3Amount, item3Amount, 0.05m), description: Description.Create("Item 3 description").Success.Get(), measurementUnit: MeasurementUnit.Night, quantity: -1, unitAmounts: unitAmount3, exchangeRate: ExchangeRate.Create(1).Success.Get() ) }; return(new ModificationInvoice( number: InvoiceNumber.Create($"REBATE-{Guid.NewGuid()}").Success.Get(), supplierInfo: CreateSupplierInfo(), receiver: receiver, items: Sequence.FromPreordered(items, startIndex: 1).Get(), currencyCode: CurrencyCode.Create("EUR").Success.Get(), issueDate: nowUtc, paymentDate: nowUtc, itemIndexOffset: 3, modificationIndex: 1, modifyWithoutMaster: false, originalDocumentNumber: originalDocumentNumber, paymentMethod: PaymentMethod.Cash )); }
private Invoice CreateInvoice(Receiver receiver, InvoiceNumber invoiceNumber = null) { var nowUtc = DateTime.UtcNow.Date; var item1Amount = new Amount(net: new AmountValue(1694.92m), gross: new AmountValue(2000), tax: new AmountValue(305.08m)); var item2Amount = new Amount(new AmountValue(2362.20m), new AmountValue(3000), new AmountValue(637.8m)); var item3Amount = new Amount(new AmountValue(952.38m), new AmountValue(1000), new AmountValue(47.62m)); var unitAmount1 = new ItemAmounts(item1Amount, item1Amount, 0.18m); var unitAmount2 = new ItemAmounts(item2Amount, item2Amount, 0.27m); var unitAmount3 = new ItemAmounts(item3Amount, item3Amount, 0.05m); var items = new[] { new InvoiceItem( consumptionDate: nowUtc, totalAmounts: new ItemAmounts(item1Amount, item1Amount, 0.18m), description: Description.Create("Item 1 description").Success.Get(), measurementUnit: MeasurementUnit.Night, quantity: 1, unitAmounts: unitAmount1, exchangeRate: ExchangeRate.Create(1).Success.Get() ), new InvoiceItem( consumptionDate: nowUtc, totalAmounts: new ItemAmounts(item2Amount, item2Amount, 0.27m), description: Description.Create("Item 2 description").Success.Get(), measurementUnit: MeasurementUnit.Night, quantity: 1, unitAmounts: unitAmount2, exchangeRate: ExchangeRate.Create(1).Success.Get() ), new InvoiceItem( consumptionDate: nowUtc, totalAmounts: new ItemAmounts(item3Amount, item3Amount, 0.05m), description: Description.Create("Item 3 description").Success.Get(), measurementUnit: MeasurementUnit.Night, quantity: 1, unitAmounts: unitAmount3, exchangeRate: ExchangeRate.Create(1).Success.Get() ) }; return(new Invoice( number: invoiceNumber ?? InvoiceNumber.Create($"INVOICE-{Guid.NewGuid()}").Success.Get(), issueDate: nowUtc, supplierInfo: CreateSupplierInfo(), receiver: receiver, items: Sequence.FromPreordered(items, startIndex: 1).Get(), paymentDate: nowUtc, currencyCode: CurrencyCode.Create("EUR").Success.Get(), paymentMethod: PaymentMethod.Card )); }
internal static InvoiceInfo CreateInvoiceInfo( string invoiceSerialNumber = "50020", string invoiceSeries = "0", string currencyCode = "EUR", string invoiceIdentifier = null, decimal?exchangeRate = null) { return(InvoiceInfo.Create( header: new InvoiceHeader( invoiceSeries: String1To50.CreateUnsafe(invoiceSeries), invoiceSerialNumber: String1To50.CreateUnsafe(invoiceSerialNumber), invoiceIssueDate: DateTime.Now, invoiceIdentifier: invoiceIdentifier, currencyCode: CurrencyCode.Create(currencyCode).Success.Get(), exchangeRate: exchangeRate.IsNotNull().Match(t => ExchangeRate.Create(exchangeRate.Value).Success.Get(), f => null) ), issuer: CreateInvoiceParty(Countries.Greece, UserVatNumber) ).Success.Get()); }
private ModificationInvoice GetModificationInvoice() { var amounts = GetItemAmounts(amount: 100, exchangeRate: 300); var unitAmounts = GetItemAmounts(amount: 100, exchangeRate: 300); var item = new InvoiceItem( consumptionDate: new DateTime(2020, 08, 30), totalAmounts: amounts, description: Description.Create("NIGHT 8/30/2020").Success.Get(), measurementUnit: MeasurementUnit.Night, quantity: -1, unitAmounts: unitAmounts, exchangeRate: ExchangeRate.Create(300).Success.Get() ); var amounts1 = GetItemAmounts(amount: 100, exchangeRate: 300); var unitAmounts1 = GetItemAmounts(amount: 100, exchangeRate: 300); var item1 = new InvoiceItem( consumptionDate: new DateTime(2020, 08, 31), totalAmounts: amounts1, description: Description.Create("NIGHT2 8/31/2020").Success.Get(), measurementUnit: MeasurementUnit.Night, quantity: 1, unitAmounts: unitAmounts1, exchangeRate: ExchangeRate.Create(300).Success.Get() ); return(new ModificationInvoice( number: InvoiceNumber.Create("ABC-18abfcefsaa").Success.Get(), supplierInfo: GetSupplierInfo(), customerInfo: GetCustomerInfo(), items: Sequence.FromPreordered(new[] { item, item1 }, startIndex: 1).Get(), currencyCode: CurrencyCode.Create("USD").Success.Get(), issueDate: new DateTime(2020, 08, 31), paymentDate: new DateTime(2020, 08, 31), itemIndexOffset: 4, modificationIndex: 4, modifyWithoutMaster: true, originalDocumentNumber: InvoiceNumber.Create("ABC-18afasadafa").Success.Get() )); }
private Invoice GetInvoice() { var item1Amount = new Amount(new AmountValue(1), new AmountValue(1), new AmountValue(0)); var item2Amount = new Amount(new AmountValue(20m), new AmountValue(16.81m), new AmountValue(3.19m)); var unitAmount1 = new ItemAmounts(item1Amount, item2Amount, 0.05m); var items = new[] { new InvoiceItem( consumptionDate: new DateTime(2020, 06, 30), totalAmounts: new ItemAmounts(item1Amount, item1Amount, 0.05m), description: Description.Create("Httt hzi serts (fl)").Success.Get(), measurementUnit: MeasurementUnit.Night, quantity: 15, unitAmounts: unitAmount1, exchangeRate: ExchangeRate.Create(1).Success.Get() ), new InvoiceItem( consumptionDate: new DateTime(2020, 06, 30), totalAmounts: new ItemAmounts(item2Amount, item2Amount, 0.05m), description: Description.Create("Httt hzi serts (fl)").Success.Get(), measurementUnit: MeasurementUnit.Night, quantity: -15, unitAmounts: unitAmount1, exchangeRate: ExchangeRate.Create(1).Success.Get() ), }; var address = GetAddress(); return(new Invoice( number: InvoiceNumber.Create("ABC-18a").Success.Get(), issueDate: new DateTime(2020, 06, 30), supplierInfo: GetSupplierInfo(), customerInfo: GetCustomerInfo(), items: Sequence.FromPreordered(items, startIndex: 1).Get(), paymentDate: new DateTime(2020, 06, 14), currencyCode: CurrencyCode.Create("EUR").Success.Get() )); }