コード例 #1
0
        public void EntityController_Update_WithOnlyLinkedEntityFieldsAltered_Succeeds()
        {
            var controllerMock = new ApiConnectionEntityControllerMock();
            var connector      = new ApiConnectorMock();
            var controllerList = new ControllerList(connector, "https://start.exactonline.nl/api/v1/");

            var invoice = new SalesInvoice {
                Description = "New Description"
            };
            var line = new SalesInvoiceLine {
                Description = "InvoiceLine"
            };

            invoice.SalesInvoiceLines = new List <SalesInvoiceLine> {
                line
            };

            var controller = (Controller <SalesInvoice>)controllerList.GetController <SalesInvoice>();
            var ec         = new EntityController(invoice, "ID", invoice.InvoiceID.ToString(), controllerMock, controller.GetEntityController);

            Assert.IsTrue(controller.AddEntityToManagedEntitiesCollection(invoice));

            // Change State
            line.Description = "InvoiceLine2";
            ec.Update(invoice);

            string       result   = controllerMock.Data;
            const string expected = "{\"SalesInvoiceLines\":[{\"Description\":\"InvoiceLine2\"}]}";

            Assert.AreEqual(expected, result);
        }
コード例 #2
0
 private void toevoegen_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(customerBox.GetItemText(customerBox.SelectedItem)) || !string.IsNullOrWhiteSpace(typeBox.GetItemText(typeBox.SelectedItem)) || !string.IsNullOrWhiteSpace(unitsBox.Text) || !string.IsNullOrWhiteSpace(currencyBox.GetItemText(currencyBox.SelectedItem)) || !string.IsNullOrWhiteSpace(quantityBox.Text) || !string.IsNullOrWhiteSpace(vatBox.GetItemText(vatBox.SelectedItem)) || !string.IsNullOrWhiteSpace(articleBox.GetItemText(articleBox.SelectedItem)) || !string.IsNullOrWhiteSpace(subarticleBox.GetItemText(subarticleBox.SelectedItem)))
     {
         this.SalesInvoice = new SalesInvoiceResponse
         {
             CustomerId        = customerBox.GetItemText(customerBox.SelectedItem),
             CustomerReference = customerBox.GetItemText(customerBox.SelectedItem),
             OrderType         = typeBox.GetItemText(typeBox.SelectedItem)
         };
         var sl = new SalesInvoiceLine
         {
             Amount     = decimal.Parse(unitsBox.Text),
             Currency   = currencyBox.GetItemText(currencyBox.SelectedItem),
             Quantity   = decimal.Parse(quantityBox.Text),
             VatType    = vatBox.GetItemText(vatBox.SelectedItem),
             Article    = articleBox.GetItemText(articleBox.SelectedItem),
             Subarticle = subarticleBox.GetItemText(subarticleBox.SelectedItem)
         };
         var sll = new List <SalesInvoiceLine>();
         sll.Add(sl);
         this.SalesInvoice.SalesInvoiceLines.SalesInvoiceLine = sll;
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     else
     {
         System.Windows.Forms.MessageBox.Show(@"Vul alle verplichte velden in");
     }
 }
        public void EntityConverter_ConvertExistingLinkedObjectToJson_Succeeds()
        {
            // Create Object
            var newInvoice = new SalesInvoice {
                InvoiceID = new Guid("4f68481a-7a2c-4fbc-a3a0-0c494df3fa0d")
            };
            var newInvoiceLine = new SalesInvoiceLine {
                Description = "NewInvoiceForEntityWithCollection"
            };

            newInvoice.SalesInvoiceLines = new List <SalesInvoiceLine> {
                newInvoiceLine
            };

            //ControllerSingleton.GetInstance(new MockObjects.MAPIConnector_Controller(), "www.dummy.com/");
            var entityController = new EntityController(newInvoice, "ID", "4f68481a-7a2c-4fbc-a3a0-0c494df3fa0d", new MockObjects.ApiConnectionMock(), null);

            newInvoiceLine.Description = "ChangedNewInvoiceForEntityWithCollection";

            var    entityConverter    = new EntityConverter();
            var    controllerDelegate = new GetEntityController(GetEntityController);
            string json = entityConverter.ConvertObjectToJson((SalesInvoice)entityController.OriginalEntity, newInvoice, controllerDelegate);

            const string expected = "{\"SalesInvoiceLines\": [{\"Description\": \"ChangedNewInvoiceForEntityWithCollection\"}]}";

            Assert.AreEqual(expected, json);

            throw new NotImplementedException();
        }
コード例 #4
0
        public ActionResult GenerateBulkInvoice(Models.ViewModels.Administration.CreateBulkInvoice model)
        {
            var      day         = 15;
            var      month       = DateTime.Now.Month == 12 ? 1 : DateTime.Now.Month + 1;
            var      year        = DateTime.Now.Month == 12 ? DateTime.Now.Year + 1 : DateTime.Now.Year;
            DateTime invoiceDate = new DateTime(year, month, day);

            var query = from c in _salesService.GetCustomers()
                        select c;
            var customers = query.ToList();

            var itemAssociationDues = (from i in _inventoryService.GetAllItems().ToList()
                                       where (i != null &&
                                              i.SellDescription.ToLower().Contains("dues"))
                                       select i).FirstOrDefault();

            var invoices = new List <SalesInvoiceHeader>();

            foreach (var customer in customers)
            {
                var current = (from si in _salesService.GetSalesInvoices()
                               where si.CustomerId == customer.Id &&
                               si.Date.Year == invoiceDate.Year &&
                               si.Date.Month == invoiceDate.Month &&
                               si.Date.Day == invoiceDate.Day
                               select si).FirstOrDefault();
                if (current != null)
                {
                    return(RedirectToAction("BulkInvoice"));
                }

                var invoiceLine = new SalesInvoiceLine();
                invoiceLine.ItemId        = itemAssociationDues.Id;
                invoiceLine.Quantity      = 1;
                invoiceLine.Amount        = Convert.ToDecimal(itemAssociationDues.Price * invoiceLine.Quantity);
                invoiceLine.MeasurementId = itemAssociationDues.SmallestMeasurementId.Value;
                invoiceLine.CreatedBy     = User.Identity.Name;
                invoiceLine.CreatedOn     = DateTime.Now;
                invoiceLine.ModifiedBy    = User.Identity.Name;
                invoiceLine.ModifiedOn    = DateTime.Now;

                var invoice = new SalesInvoiceHeader();
                invoice.Date       = invoiceDate;
                invoice.CustomerId = customer.Id;
                invoice.CreatedBy  = User.Identity.Name;
                invoice.CreatedOn  = DateTime.Now;
                invoice.ModifiedBy = User.Identity.Name;
                invoice.ModifiedOn = DateTime.Now;
                invoice.SalesInvoiceLines.Add(invoiceLine);

                invoices.Add(invoice);
            }

            foreach (var invoice in invoices)
            {
                _salesService.AddSalesInvoice(invoice, null);
            }

            return(RedirectToAction("SalesInvoices", "Sales"));
        }
コード例 #5
0
        public void EntityController_Update_WithExistingLinkedEntity_Succeeds()
        {
            var controllerMock = new ApiConnectionEntityControllerMock();
            var connector      = new ApiConnectorMock();
            var controllerList = new ControllerList(connector, "https://start.exactonline.nl/api/v1/");

            var invoice = new SalesInvoice {
                Description = "New Description"
            };
            var line = new SalesInvoiceLine {
                Description = "InvoiceLine"
            };

            invoice.SalesInvoiceLines = new List <SalesInvoiceLine> {
                line
            };

            var controller       = (Controller <SalesInvoice>)controllerList.GetController <SalesInvoice>();
            var entityController = new EntityController(invoice, "ID", invoice.InvoiceID.ToString(), controllerMock, controller.GetEntityController);

            Assert.IsTrue(controller.AddEntityToManagedEntitiesCollection(invoice));

            // Change State
            invoice.Description = "Description2";
            line.Description    = "InvoiceLine2";

            entityController.Update(invoice);
            string data = controllerMock.Data;

            Assert.AreEqual(@"{""Description"":""Description2"",""SalesInvoiceLines"":[{""Description"":""InvoiceLine2""}]}", data);
        }
コード例 #6
0
        private static Guid CreateSalesInvoice(ExactOnlineClient client, int numberOfLines)
        {
            var item     = client.For <Item>().Top(1).Select("ID").Where("IsSalesItem+eq+true").Get().First();
            var customer = client.For <Account>().Top(1).Select("ID").Where("IsSales+eq+true").Get().First();

            var salesInvoice = new SalesInvoice
            {
                OrderedBy   = customer.ID,
                Description = "SDK User level test"
            };

            var salesInvoiceLines = new List <SalesInvoiceLine>();

            for (int iterator = 0; iterator < numberOfLines; iterator++)
            {
                var salesInvoiceLine = new SalesInvoiceLine
                {
                    Item        = item.ID,
                    Quantity    = 1,
                    Description = "Line " + iterator
                };

                salesInvoiceLines.Add(salesInvoiceLine);
            }
            salesInvoice.SalesInvoiceLines = salesInvoiceLines;
            client.For <SalesInvoice>().Insert(ref salesInvoice);

            return(salesInvoice.InvoiceID);
        }
コード例 #7
0
ファイル: SalesController.cs プロジェクト: jktieman/accountgo
        public ActionResult SaveSalesInvoice(Models.ViewModels.Sales.AddSalesInvoice model)
        {
            if (model.AddSalesInvoiceLines.Sum(i => i.Amount) == 0 || model.AddSalesInvoiceLines.Count < 1)
            {
                model.Customers    = Models.ModelViewHelper.Customers();
                model.Items        = Models.ModelViewHelper.Items();
                model.Measurements = Models.ModelViewHelper.Measurements();
                ModelState.AddModelError("Amount", "No invoice line");
                return(View(model));
            }
            var invoiceHeader = new SalesInvoiceHeader();
            var invoiceLines  = new List <SalesInvoiceLine>();

            foreach (var item in model.AddSalesInvoiceLines)
            {
                var Item          = _inventoryService.GetItemById(item.ItemId);
                var invoiceDetail = new SalesInvoiceLine();
                invoiceDetail.TaxId         = Item.ItemTaxGroupId;
                invoiceDetail.ItemId        = item.ItemId;
                invoiceDetail.MeasurementId = item.MeasurementId;
                invoiceDetail.Quantity      = item.Quantity;
                invoiceDetail.Discount      = item.Discount;
                invoiceDetail.Amount        = Convert.ToDecimal(item.Quantity * Item.Price);
                invoiceLines.Add(invoiceDetail);
            }
            invoiceHeader.SalesInvoiceLines = invoiceLines;
            invoiceHeader.CustomerId        = model.CustomerId;
            invoiceHeader.Date = model.Date;
            invoiceHeader.ShippingHandlingCharge = 4;// model.ShippingHandlingCharge;

            _salesService.AddSalesInvoice(invoiceHeader, model.SalesOrderId);
            return(RedirectToAction("SalesInvoices"));
        }
コード例 #8
0
        private static void CreateLinkedObjects()
        {
            for (int i = 0; i < 100; i++)
            {
                // Create Object
                var newInvoice = new SalesInvoice
                {
                    Currency    = "EUR",
                    OrderDate   = new DateTime(2012, 10, 26),
                    InvoiceTo   = new Guid("3734121e-1544-4b77-9ae2-7203e9bd6046"),
                    Journal     = "50",
                    OrderedBy   = new Guid("3734121e-1544-4b77-9ae2-7203e9bd6046"),
                    Description = "New invoice for Entity With Collection"
                };

                var newInvoiceLine = new SalesInvoiceLine
                {
                    Description = "New invoice line for Entity With Collection",
                    Item        = new Guid("4f68481a-7a2c-4fbc-a3a0-0c494df3fa0d")
                };

                var invoicelines = new List <SalesInvoiceLine> {
                    newInvoiceLine
                };
                newInvoice.SalesInvoiceLines = invoicelines;

                // Set Mock Connection and Create object
                var controllerMock = new ApiConnectionEntityControllerMock();
                var controller     = new Controller <SalesInvoice>(controllerMock);
                controller.Create(ref newInvoice, true);
            }
        }
コード例 #9
0
ファイル: MiddlewareData.cs プロジェクト: RickSchoeman/Werk
        public List <SalesInvoiceResponse> GetSalesInvoiceData()
        {
            var salesinvoicelines = new List <SalesInvoiceLine>();
            var salesinvoiceline  = new SalesInvoiceLine
            {
                Amount      = 1,
                Currency    = "EUR",
                Description = "test",
                Quantity    = 2,
                VatPercent  = 0,
                VatType     = "sales",
                Article     = "FRUIT",
                Subarticle  = "BANAAN"
            };

            salesinvoicelines.Add(salesinvoiceline);

            var salesinvoiceresponse = new SalesInvoiceResponse
            {
                CustomerId        = "1002",
                Project           = "",
                CustomerReference = "1002",
                Name        = "test",
                OrderNummer = "10",
                OrderType   = "FACTUUR"
            };

            salesinvoiceresponse.SalesInvoiceLines.SalesInvoiceLine = salesinvoicelines;
            return(new List <SalesInvoiceResponse> {
                salesinvoiceresponse
            });
        }
コード例 #10
0
        public SalesInvoiceResponse ConvertSalesInvoice(SalesInvoice salesInvoice)
        {
            var lines = new List <SalesInvoiceLine>();

            foreach (var l in salesInvoice.Lines.Line)
            {
                var vats = (new VatOperations(session)).GetByName(l.Vatcode);
                var line = new SalesInvoiceLine
                {
                    Amount      = l.Units,
                    Currency    = salesInvoice.Header.Currency,
                    Description = l.Description,
                    Quantity    = l.Quantity,
                    VatPercent  = Decimal.Parse(vats[0].Percentages.Percentage[0].percentage),
                    VatType     = vats[0].Type,
                    Article     = l.Article,
                    Subarticle  = l.Subarticle
                };
                lines.Add(line);
            }

            var salesInvoiceResponse = new SalesInvoiceResponse
            {
                CustomerId        = salesInvoice.Header.Customer,
                CustomerReference = salesInvoice.Header.Customer,
                OrderNummer       = salesInvoice.Header.Invoicenumber.ToString(),
                OrderType         = salesInvoice.Header.Invoicetype
            };

            salesInvoiceResponse.SalesInvoiceLines.SalesInvoiceLine = lines;
            return(salesInvoiceResponse);
        }
コード例 #11
0
        public void EntityController_Update_WithNewLinkedEntity_Succeeds()
        {
            var controllerMock   = new ApiConnectionEntityControllerMock();
            var apiConnectorMock = new ApiConnectorMock();
            var controllerList   = new ControllerList(apiConnectorMock, "https://start.exactonline.nl/api/v1/");

            var controller = (Controller <SalesInvoice>)controllerList.GetController <SalesInvoice>();
            var invoice    = new SalesInvoice {
                Description = "New Description"
            };
            var entityController = new EntityController(invoice, "ID", invoice.InvoiceID.ToString(), controllerMock, controller.GetEntityController);

            // Change State
            invoice.Description = "Description2";
            var line = new SalesInvoiceLine {
                Description = "InvoiceLine2"
            };

            invoice.SalesInvoiceLines = new List <SalesInvoiceLine> {
                line
            };

            entityController.Update(invoice);

            string data = controllerMock.Data;

            Assert.IsTrue(data.Contains(@"""Description"":""Description2"""));
            Assert.IsTrue(data.Contains(@"""Description"":""InvoiceLine2"""));
        }
コード例 #12
0
        public void EntityController_Update_WithNoFieldsAltered_Succeeds()
        {
            var controllerMock = new ApiConnectionEntityControllerMock();
            var connector      = new ApiConnectorMock();
            var controllerList = new ControllerList(connector, "https://start.exactonline.nl/api/v1/");

            var invoice = new SalesInvoice {
                Description = "New Description"
            };
            var line = new SalesInvoiceLine {
                Description = "Invoice Line"
            };

            invoice.SalesInvoiceLines = new List <SalesInvoiceLine> {
                line
            };

            var controller       = (Controller <SalesInvoice>)controllerList.GetController <SalesInvoice>();
            var entityController = new EntityController(invoice, "ID", invoice.InvoiceID.ToString(), controllerMock, controller.GetEntityController);
            var returnValue      = controller.AddEntityToManagedEntitiesCollection(invoice);

            Assert.IsTrue(returnValue);

            entityController.Update(invoice);
            string data = controllerMock.Data;

            Assert.AreEqual("", data);
        }
コード例 #13
0
        public ActionResult SaveInvoice(Models.ViewModels.Sales.SalesHeaderViewModel model)
        {
            SalesInvoiceHeader invoice = null;

            if (model.Id == 0)
            {
                invoice           = new SalesInvoiceHeader();
                invoice.CreatedBy = User.Identity.Name;
                invoice.CreatedOn = DateTime.Now;
            }
            else
            {
                invoice = _salesService.GetSalesInvoiceById(model.Id);
            }

            invoice.ModifiedBy             = User.Identity.Name;
            invoice.ModifiedOn             = DateTime.Now;
            invoice.CustomerId             = model.CustomerId.Value;
            invoice.Date                   = model.Date;
            invoice.ShippingHandlingCharge = model.ShippingHandlingCharges;

            foreach (var line in model.SalesLine.SalesLineItems)
            {
                SalesInvoiceLine lineItem = null;
                var item = _inventoryService.GetItemByNo(line.ItemNo);
                if (!line.Id.HasValue)
                {
                    lineItem           = new SalesInvoiceLine();
                    lineItem.CreatedBy = User.Identity.Name;
                    lineItem.CreatedOn = DateTime.Now;
                    invoice.SalesInvoiceLines.Add(lineItem);
                }
                else
                {
                    lineItem = invoice.SalesInvoiceLines.Where(i => i.Id == line.Id).FirstOrDefault();
                }

                lineItem.ModifiedBy    = User.Identity.Name;
                lineItem.ModifiedOn    = DateTime.Now;
                lineItem.ItemId        = line.ItemId;
                lineItem.MeasurementId = item.SellMeasurementId.Value;
                lineItem.Quantity      = line.Quantity;
                lineItem.Discount      = line.Discount;
                lineItem.Amount        = line.Price;
            }

            if (model.Id == 0)
            {
                _salesService.AddSalesInvoice(invoice, null);
            }
            else
            {
                _salesService.UpdateSalesInvoice(invoice);
            }

            return(RedirectToAction("SalesInvoices"));
        }
コード例 #14
0
        public void Controller_Test_ManagedEntities_WithLinkedEntities_Succeeds()
        {
            // Test if controller registrates linked entities
            IApiConnector conn           = new ApiConnectorControllerMock();
            var           controllerList = new ControllerList(conn, string.Empty);

            var salesinvoicecontroller = (Controller <SalesInvoice>)controllerList.GetController <SalesInvoice>();
            var invoicelines           = (Controller <SalesInvoiceLine>)controllerList.GetController <SalesInvoiceLine>();

            salesinvoicecontroller.GetManagerForEntity = controllerList.GetEntityManager;

            // Verify if sales invoice lines are registrated entities
            var invoice           = salesinvoicecontroller.Get("")[0];
            SalesInvoiceLine line = ((List <SalesInvoiceLine>)invoice.SalesInvoiceLines)[0];

            Assert.IsTrue(invoicelines.IsManagedEntity(line), "SalesInvoiceLine isn't a managed entity");
        }
        private static EntityController GetEntityController(object o)
        {
            // Create Object
            var newInvoice = new SalesInvoice {
                InvoiceID = new Guid("4f68481a-7a2c-4fbc-a3a0-0c494df3fa0d")
            };
            var newInvoiceLine = new SalesInvoiceLine {
                Description = "NewInvoiceForEntityWithCollection"
            };

            newInvoice.SalesInvoiceLines = new List <SalesInvoiceLine> {
                newInvoiceLine
            };

            var entityController = new EntityController(newInvoice, "ID", "4f68481a-7a2c-4fbc-a3a0-0c494df3fa0d", new MockObjects.ApiConnectionMock(), null);

            return(entityController);
        }
コード例 #16
0
        public void CreateSalesInvoiceWithLine()
        {
            var toc        = new TestObjectsCreator();
            var client     = new ExactOnlineClient(toc.EndPoint, toc.GetOAuthAuthenticationToken);
            var customerId = GetCustomerId(client);
            var itemId     = GetItemId(client);

            var newInvoice = new SalesInvoice
            {
                Currency    = "EUR",
                OrderDate   = new DateTime(2012, 10, 26),
                InvoiceTo   = customerId,
                Journal     = "70",
                OrderedBy   = customerId,
                Description = "New invoice for Entity With Collection"
            };

            var newInvoiceLine = new SalesInvoiceLine
            {
                Description = "New invoice line for Entity With Collection",
                Item        = itemId
            };

            var invoicelines = new List <SalesInvoiceLine> {
                newInvoiceLine
            };

            newInvoice.SalesInvoiceLines = invoicelines;

            // Add SalesInvoice to Database
            Assert.IsTrue(client.For <SalesInvoice>().Insert(ref newInvoice));

            // Get SalesInvoice and check if contains collections of InvoiceLines
            SalesInvoice salesInvoice = client.For <SalesInvoice>()
                                        .Expand("SalesInvoiceLines")
                                        .GetEntity(newInvoice.InvoiceID.ToString());

            Assert.IsNotNull(salesInvoice);
            Assert.AreEqual(1, salesInvoice.SalesInvoiceLines.Count());
        }
コード例 #17
0
        public void CreateLinkedEntities()
        {
            var toc    = new TestObjectsCreator();
            var client = new ExactOnlineClient(toc.EndPoint, toc.GetOAuthAuthenticationToken);

            // Fetch sales invoice
            var salesInvoiceId = CreateSalesInvoice(client, 1);
            var salesinvoice   = client.For <SalesInvoice>().GetEntity(salesInvoiceId);

            // Fetch item
            var item = client.For <Item>().Top(1).Select("ID").Where("IsSalesItem+eq+true").Get().First();

            // add line
            var invoiceline = new SalesInvoiceLine
            {
                Description = "New Sales Invoice Line",
                InvoiceID   = salesinvoice.InvoiceID,
                Item        = item.ID
            };

            Assert.IsTrue(client.For <SalesInvoiceLine>().Insert(ref invoiceline));
        }
コード例 #18
0
 public SalesInvoiceBuilder WithLine(SalesInvoiceLine line)
 {
     lines.Add(line);
     return(this);
 }
コード例 #19
0
            /// <summary>
            /// Converts the transaction service result XML into the SaleInvoice object.
            /// </summary>
            /// <param name="xmlInvoice">The XML representing the SaleInvoice.</param>
            /// <returns>SaleInvoice array.</returns>
            /// <exception cref="XmlException">Thrown when xmlInvoice does not represent a valid XML text.</exception>
            private static List <SalesInvoice> ConvertXmlToSaleInvoice(string xmlInvoice)
            {
                List <SalesInvoice> invoices    = new List <SalesInvoice>();
                SalesInvoice        invoice     = null;
                SalesInvoiceLine    invoiceLine = null;
                XDocument           doc         = null;

                if (!string.IsNullOrWhiteSpace(xmlInvoice))
                {
                    doc = XDocument.Parse(xmlInvoice);

                    if (doc != null && doc.Root != null)
                    {
                        foreach (XElement header in doc.Descendants("CustInvoiceJour"))
                        {
                            invoice                  = new SalesInvoice();
                            invoice.RecordId         = long.Parse(header.Attribute("RecId").Value);
                            invoice.Id               = header.Attribute("InvoiceId").Value;
                            invoice.SalesId          = header.Attribute("SalesId").Value;
                            invoice.SalesType        = (SalesInvoiceType)int.Parse(header.Attribute("SalesType").Value);
                            invoice.InvoiceDate      = Utilities.ParseDateString(header.Attribute("InvoiceDate").Value, DateTime.UtcNow, DateTimeStyles.AssumeUniversal);
                            invoice.CurrencyCode     = header.Attribute("CurrencyCode").Value;
                            invoice.Amount           = decimal.Parse(header.Attribute("InvoiceAmount").Value);
                            invoice.Account          = header.Attribute("InvoiceAccount").Value;
                            invoice.Name             = header.Attribute("InvoicingName").Value;
                            invoice.SalesInvoiceLine = new List <SalesInvoiceLine>();
                            foreach (XElement detail in header.Elements("CustInvoiceTrans"))
                            {
                                invoiceLine                     = new SalesInvoiceLine();
                                invoiceLine.RecordId            = long.Parse(detail.Attribute("RecId").Value);
                                invoiceLine.ItemId              = detail.Attribute("ItemId").Value;
                                invoiceLine.ProductName         = detail.Attribute("EcoResProductName").Value;
                                invoiceLine.InventDimensionId   = detail.Attribute("InventDimId").Value;
                                invoiceLine.InventTransactionId = detail.Attribute("InventTransId").Value;
                                invoiceLine.Quantity            = decimal.Parse(detail.Attribute("Qty").Value);
                                invoiceLine.Price               = decimal.Parse(detail.Attribute("SalesPrice").Value);
                                invoiceLine.DiscountPercent     = decimal.Parse(detail.Attribute("DiscPercent").Value);
                                invoiceLine.DiscountAmount      = decimal.Parse(detail.Attribute("DiscAmount").Value);
                                invoiceLine.NetAmount           = decimal.Parse(detail.Attribute("LineAmount").Value);
                                invoiceLine.SalesMarkup         = decimal.Parse(detail.Attribute("SalesMarkup").Value);
                                invoiceLine.SalesTaxGroup       = detail.Attribute("TaxGroup").Value;
                                invoiceLine.ItemTaxGroup        = detail.Attribute("TaxItemGroup").Value;
                                invoiceLine.BatchId             = detail.Attribute("InventBatchId").Value;
                                invoiceLine.Site                = detail.Attribute("InventSiteId").Value;
                                invoiceLine.Warehouse           = detail.Attribute("InventLocationId").Value;
                                invoiceLine.SerialId            = detail.Attribute("InventSerialId").Value;

                                // Dimension details
                                invoiceLine.ColorId    = InvoiceHelper.GetAttribute(detail, "InventColorId");
                                invoiceLine.ColorName  = InvoiceHelper.GetAttribute(detail, "InventColorName");
                                invoiceLine.SizeId     = InvoiceHelper.GetAttribute(detail, "InventSizeId");
                                invoiceLine.SizeName   = InvoiceHelper.GetAttribute(detail, "InventSizeName");
                                invoiceLine.StyleId    = InvoiceHelper.GetAttribute(detail, "InventStyleId");
                                invoiceLine.StyleName  = InvoiceHelper.GetAttribute(detail, "InventStyleName");
                                invoiceLine.ConfigId   = InvoiceHelper.GetAttribute(detail, "ConfigId");
                                invoiceLine.ConfigName = InvoiceHelper.GetAttribute(detail, "ConfigName");
                                invoice.SalesInvoiceLine.Add(invoiceLine);
                            }

                            invoices.Add(invoice);
                        }
                    }
                }

                return(invoices);
            }