Follow

API code example: Getting invoice

Requirements

  • Visual Studio 2010 (any edition).
  • This is a command-line application and will run on any Windows.

Code

Download the source code .zip package, which can be found as an attachment in this article.

The program will display an existing invoice on the screen:

Invoice is fetched using the API key and invoice number given in command line arguments.

Instructions how to add arguments are in this article: https://support.severa.com/entries/24872548

Invoice data and attachment, if data is grouped, is gone through and printed on the screen, example below:

Getting invoice number: 1120
Topmost Ltd
19 Olympia Road
W1W 8RRLondon
United Kingdom

Invoice number      : 1120
Invoice date        : 3.8.2011
Your reference      :
Our reference       :
Account contact     : Mrs. Gillian Eriksson
Payment terms       : 20 days
Overdue interest    : 10,0 %
Billing contact     : Mark Stanley

Description                                     Qty     Unit price Total price
Design                                            4 h     140,00   560,00
Production                                        8 h     200,00  1600,00
Senior specialist                                 5 h     120,00   600,00
Business Consulting Day                           5 Day  1000,00  5000,00
Software                                          5 pc    100,00   500,00
Mark Stanley,8/3/2011,Plannig: consultant day    25 day  1000,00 25000,00
                                       Total excluding VAT       33260,00
                                       Total excluding 0,0% VAT  30500,00
                                       Total excluding 17,5% VAT  2760,00
                                       17,5% VAT                   483,00
                                       TOTAL                     33743,00

Attachment
Invoice number      : 1120
Invoice date        : 3.8.2011
Description                                                    Quantity h
Mark Stanley, 8/3/2011, Design,                                     4,0 h
Mark Stanley, 8/3/2011, Production,                                 8,0 h
Mark Stanley, 8/3/2011, Senior specialist,                          5,0 h

The program will also download invoice file attachment (PDF), if invoice has attachment.

For the attachment download to work, it is needed to modify the app.config file to have in Severa.API.IInvoice binding:

<binding name="Severa.API.IInvoice" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2097152" maxBufferPoolSize="524288" maxReceivedMessageSize="2097152" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="2097152" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>

Otherwise the PDF file size will exceed the default limits.

PDF is saved to the ...\InvoiceLoader\bin\Debug folder.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Powered by Zendesk