Пример #1
0
            public static IncomingInvoice Create(string invoiceNumber, DateTime invoiceDate, decimal amount, decimal taxes, decimal totalPrice, string description, string paymentTerms, string purchaseOrderNumber, Guid supplierId, string supplierName)
            {
                var @event = new IncomingInvoiceRegisteredEvent(
                    Guid.NewGuid(),
                    invoiceNumber,
                    invoiceDate,
                    amount,
                    taxes,
                    totalPrice,
                    description,
                    paymentTerms,
                    purchaseOrderNumber,
                    supplierId,
                    supplierName,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty
                    );
                var invoice = new IncomingInvoice();

                invoice.RaiseEvent(@event);
                return(invoice);
            }
Пример #2
0
 public static IncomingInvoice Issue(string invoiceNumber, DateTime invoiceDate, decimal amount, decimal taxes, decimal totalPrice, string description, string paymentTerms, string purchaseOrderNumber, Guid supplierId, string supplierName)
 {
     var @event = new IncomingInvoiceRegisteredEvent(
         Guid.NewGuid(),
         invoiceNumber,
         invoiceDate,
         amount,
         taxes,
         totalPrice,
         description,
         paymentTerms,
         purchaseOrderNumber,
         supplierId,
         supplierName,
         string.Empty,
         string.Empty,
         string.Empty,
         string.Empty,
         string.Empty,
         string.Empty
         );
     var invoice = new IncomingInvoice();
     invoice.RaiseEvent(@event);
     return invoice;
 }
Пример #3
0
            //public static IncomingInvoice Import(Guid invoiceId, string invoiceNumber, DateTime invoiceDate, DateTime? dueDate, string currency, decimal amount, decimal taxes, decimal totalPrice, string description, string paymentTerms, string purchaseOrderNumber,
            // Guid customerId, string customerName, string customerAddress, string customerCity, string customerPostalCode, string customerCountry, string customerVatIndex, string customerNationalIdentificationNumber,
            // Guid supplierId, string supplierName, string supplierAddress, string supplierCity, string supplierPostalCode, string supplierCountry, string supplierVatIndex, string supplierNationalIdentificationNumber)
            public static IncomingInvoice Import(Guid invoiceId, string invoiceNumber, DateTime invoiceDate, DateTime?dueDate, string currency, decimal amount, decimal taxes, decimal totalPrice, decimal totalToPay, string description, string paymentTerms, string purchaseOrderNumber, Guid customerId, string customerName, string customerAddress, string customerCity, string customerPostalCode, string customerCountry, string customerVatIndex, string customerNationalIdentificationNumber, Guid supplierId, string supplierName, string supplierAddress, string supplierCity, string supplierPostalCode, string supplierCountry, string supplierVatIndex, string supplierNationalIdentificationNumber, IEnumerable <InvoiceLineItem> lineItems, bool pricesAreVatIncluded, IEnumerable <InvoicePriceByVat> pricesByVat, IEnumerable <NonTaxableItem> nonTaxableItems, string providenceFundDescription, decimal?providenceFundRate, decimal?providenceFundAmount, string withholdingTaxDescription, decimal?withholdingTaxRate, decimal?withholdingTaxTaxableAmountRate, decimal?withholdingTaxAmount, Guid userId)
            {
                var @event = new IncomingInvoiceRegisteredEvent(
                    invoiceId,
                    invoiceNumber,
                    invoiceDate,
                    dueDate,
                    currency,
                    amount,
                    taxes,
                    totalPrice,
                    totalPrice,
                    description,
                    paymentTerms,
                    purchaseOrderNumber,
                    customerId,
                    customerName,
                    customerAddress,
                    customerCity,
                    customerPostalCode,
                    customerCountry,
                    customerVatIndex,
                    customerNationalIdentificationNumber,
                    supplierId,
                    supplierName,
                    supplierAddress,
                    supplierCity,
                    supplierPostalCode,
                    supplierCountry,
                    supplierVatIndex,
                    supplierNationalIdentificationNumber,
                    lineItems
                    .Select(i => new IncomingInvoiceRegisteredEvent.InvoiceLineItem(i.Code, i.Description, i.Quantity, i.UnitPrice, i.TotalPrice, i.Vat, i.VatDescription))
                    .ToArray(),
                    pricesAreVatIncluded,
                    pricesByVat
                    .Select(i => new IncomingInvoiceRegisteredEvent.InvoicePriceByVat(i.TaxableAmount, i.VatRate, i.VatAmount, i.TotalPrice))
                    .ToArray(),
                    nonTaxableItems
                    .Select(i => new IncomingInvoiceRegisteredEvent.NonTaxableItem(i.Description, i.Amount))
                    .ToArray(),
                    providenceFundDescription,
                    providenceFundRate,
                    providenceFundAmount,
                    withholdingTaxDescription,
                    withholdingTaxRate,
                    withholdingTaxTaxableAmountRate,
                    withholdingTaxAmount,
                    userId
                    );
                var invoice = new IncomingInvoice();

                invoice.RaiseEvent(@event);
                return(invoice);
            }
Пример #4
0
            public static IncomingInvoice Import(Guid invoiceId, string invoiceNumber, DateTime invoiceDate, DateTime?dueDate, string currency, decimal amount, decimal taxes, decimal totalPrice, string description, string paymentTerms, string purchaseOrderNumber,
                                                 Guid customerId, string customerName, string customerAddress, string customerCity, string customerPostalCode, string customerCountry, string customerVatIndex, string customerNationalIdentificationNumber,
                                                 Guid supplierId, string supplierName, string supplierAddress, string supplierCity, string supplierPostalCode, string supplierCountry, string supplierVatIndex, string supplierNationalIdentificationNumber)
            {
                var @event = new IncomingInvoiceRegisteredEvent(
                    invoiceId,
                    invoiceNumber,
                    invoiceDate,
                    dueDate,
                    currency,
                    amount,
                    taxes,
                    totalPrice,
                    description,
                    paymentTerms,
                    purchaseOrderNumber,
                    customerId,
                    customerName,
                    customerAddress,
                    customerCity,
                    customerPostalCode,
                    customerCountry,
                    customerVatIndex,
                    customerNationalIdentificationNumber,
                    supplierId,
                    supplierName,
                    supplierAddress,
                    supplierCity,
                    supplierPostalCode,
                    supplierCountry,
                    supplierVatIndex,
                    supplierNationalIdentificationNumber,
                    null,
                    false,
                    null,
                    null,
                    Guid.Empty
                    );
                var invoice = new IncomingInvoice();

                invoice.RaiseEvent(@event);
                return(invoice);
            }
Пример #5
0
            public static IncomingInvoice Issue(string invoiceNumber, DateTime invoiceDate, decimal amount, decimal taxes, decimal totalPrice, string description, string paymentTerms, string purchaseOrderNumber, Guid customerId, string customerName)
            {
                var invoice = new IncomingInvoice()
                {
                    Id                  = Guid.NewGuid(),
                    Number              = invoiceNumber,
                    Date                = invoiceDate,
                    Amount              = amount,
                    Taxes               = taxes,
                    TotalPrice          = totalPrice,
                    Description         = description,
                    PaymentTerms        = paymentTerms,
                    PurchaseOrderNumber = purchaseOrderNumber,
                    Customer            = new PartyInfo(customerId, customerName, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty)
                };
                var @event = new IncomingInvoiceRegisteredEvent(
                    invoice.Id,
                    invoice.Number,
                    invoice.Date,
                    invoice.Amount,
                    invoice.Taxes,
                    invoice.TotalPrice,
                    invoice.Description,
                    invoice.PaymentTerms,
                    invoice.PurchaseOrderNumber,
                    invoice.Customer.Id,
                    invoice.Customer.Name,
                    invoice.Customer.StreetName,
                    invoice.Customer.City,
                    invoice.Customer.PostalCode,
                    invoice.Customer.Country,
                    invoice.Customer.VatIndex,
                    invoice.Customer.NationalIdentificationNumber
                    );

                invoice.RaiseEvent(@event);
                return(invoice);
            }
Пример #6
0
            public static IncomingInvoice Register(string invoiceNumber, DateTime invoiceDate, DateTime?dueDate, string currency, decimal amount, decimal taxes, decimal totalPrice, string description, string paymentTerms, string purchaseOrderNumber,
                                                   Guid customerId, string customerName, string customerAddress, string customerCity, string customerPostalCode, string customerCountry, string customerVatIndex, string customerNationalIdentificationNumber,
                                                   Guid supplierId, string supplierName, string supplierAddress, string supplierCity, string supplierPostalCode, string supplierCountry, string supplierVatIndex, string supplierNationalIdentificationNumber, IEnumerable <InvoiceLineItem> lineItems, bool pricesAreVatIncluded, IEnumerable <InvoicePriceByVat> pricesByVat, IEnumerable <NonTaxableItem> nonTaxableItems, Guid userId)
            {
                if (string.IsNullOrWhiteSpace(invoiceNumber))
                {
                    throw new ArgumentException("value cannot be empty", nameof(invoiceNumber));
                }

                if (lineItems == null)
                {
                    throw new ArgumentNullException(nameof(lineItems));
                }

                if (pricesByVat == null)
                {
                    throw new ArgumentNullException(nameof(pricesByVat));
                }

                var _invoiceLineItems = new IncomingInvoiceRegisteredEvent.InvoiceLineItem[0];

                if (lineItems != null && lineItems.Count() > 0)
                {
                    _invoiceLineItems = lineItems.Select(i => new IncomingInvoiceRegisteredEvent.InvoiceLineItem(
                                                             i.Code,
                                                             i.Description,
                                                             i.Quantity,
                                                             i.UnitPrice,
                                                             i.TotalPrice,
                                                             i.Vat)).ToArray();
                }

                var _invoicePricesByVat = new IncomingInvoiceRegisteredEvent.InvoicePriceByVat[0];

                if (pricesByVat != null && pricesByVat.Count() > 0)
                {
                    _invoicePricesByVat = pricesByVat.Select(p => new IncomingInvoiceRegisteredEvent.InvoicePriceByVat(
                                                                 p.TaxableAmount,
                                                                 p.VatRate,
                                                                 p.VatAmount,
                                                                 p.TotalPrice)).ToArray();
                }

                var _nonTaxableItems = new IncomingInvoiceRegisteredEvent.NonTaxableItem[0];

                if (nonTaxableItems != null && nonTaxableItems.Count() > 0)
                {
                    _nonTaxableItems = nonTaxableItems.Select(t => new IncomingInvoiceRegisteredEvent.NonTaxableItem(t.Description, t.Amount)).ToArray();
                }

                var @event = new IncomingInvoiceRegisteredEvent(
                    Guid.NewGuid(),
                    invoiceNumber,
                    invoiceDate,
                    dueDate,
                    currency,
                    amount,
                    taxes,
                    totalPrice,
                    description,
                    paymentTerms,
                    purchaseOrderNumber,
                    customerId,
                    customerName,
                    customerAddress,
                    customerCity,
                    customerPostalCode,
                    customerCountry,
                    customerVatIndex,
                    customerNationalIdentificationNumber,
                    supplierId,
                    supplierName,
                    supplierAddress,
                    supplierCity,
                    supplierPostalCode,
                    supplierCountry,
                    supplierVatIndex,
                    supplierNationalIdentificationNumber,
                    _invoiceLineItems,
                    pricesAreVatIncluded,
                    _invoicePricesByVat,
                    _nonTaxableItems,
                    userId
                    );
                var invoice = new IncomingInvoice();

                invoice.RaiseEvent(@event);
                return(invoice);
            }