API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

InvoiceLine

0
Im trying to extract all Invoicelines.

1) From the documentation i should be able to use Session.InvoiceLine.FindbyInvoiceNumber, but only FindbyProducts seems to be available. Can somebody help me as to what i am doing wrong ?

2) Is the only way to extract Invoicelines, to go by product og Invoicenumber ? (it seems i will end up doing an awfull lot of roundtrips)
created Dec 6, 2010 by Claus Aaberg
0% Accept Rate
Q 10 A 10 C 0

4 Answers

0
Im also trying to extract all Invoicelines but have the same problem.

Do anybody have a code snippet ?  
answered Jan 23, 2011 by Leif Mønniche
0
Im also trying to extract all Invoicelines - but can't find a way to do it.

Do anybody have a code snippet ?
answered Jan 23, 2011 by Leif Mønniche
0
Im trying to extract all Invoicelines.

1) From the documentation i should be able to use Session.InvoiceLine.FindbyInvoiceNumber, but only FindbyProducts seems to be available. Can somebody help me as to what i am doing wrong ?

2) Is the only way to extract Invoicelines, to go by product og Invoicenumber ? (it seems i will end up doing an awfull lot of roundtrips)
answered Jan 23, 2011 by Leif Mønniche
0
Carsten from e-conomic hotline inspired me to make this code snippet for a win32 app
The procedure writes output to textBox1 in a Form.

private void button9_Click(object sender, EventArgs e)
        {
            //------------------
            try
            {
                //connect
                string connectMessage = Connect();

                //Get all invoices
                IInvoice[] invoices = _session.Invoice.GetAll();
                if (invoices.Length == 0) throw new Exception(No Invoice found);

                foreach (IInvoice invoice in invoices)
                {
                    listBox1.Items.Add(invoice.Number +   + invoice.Debtor +   + invoice.NetAmount);
                    //--------------
                    IInvoiceLine[] lines = invoice.GetLines();
                    if (lines.Length == 0) throw new Exception(Lines exist on this CurrentInvoice);
                    listBox1.Items.Add( Number of lines:  + lines.Length.ToString());
                    
                    int i;
                    for (i = 0; i = lines.Length - 1; i++)
                    {
                        IInvoiceLine line = lines[i];
                        IInvoiceLineData lineData = _session.InvoiceLineData.GetData(line);
                        listBox1.Items.Add(i +   + lineData.Product +   + lineData.Description +   +            lineData.Quantity);
                    }
                    //--------------
                }
                
            }
            catch (Exception ex)
            {
                listBox1.Items.Add(ex.Message);
            }
            finally
            {
                //always disconnect after we are finished.
                Disconnect();
            }
            //------------------
        }

Thanks Carsten
answered Jan 24, 2011 by Leif Mønniche
Visma e-conomic A/S
...