<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE chapter SYSTEM "gnc-docbookx.dtd">

<!--
      (Do not remove this comment block.)
  Version: 2.0.0
  Last modified: July 9th 2006
  Maintainers: 
               Chris Lyttle <chris@wilddev.net>
  Author:
  		Jon Lapham <lapham@extracta.com.br>
	updated Patrick Schweiger <pks@spiffykitty.com>
  Originally designed by Carol Champagne.
  Translators:
               (translators put your name and email here)
-->

<!--
A lot of the following text is duplicated in the GnuCash help. The text here in the guide should be 
corrected to be less describing of the interface and more tutorial oriented
-->

<chapter id="chapter_bus_ar">
  <title>Accounts Receivable</title>

  <para>Accounts Receivable (or A/R) refers to products or services provided
  by your company for which payment has not yet been received.</para>

  <sect1 id="bus-ar-setup1">
    <title>Initial Setup</title>

    <para>Perform set up tasks listed in <xref linkend="chapter_bus_setup" />.
    </para>

  </sect1>
  
  <sect1 id="bus-ar-components1">
    <title>System Components</title>

    <para><application>&app;</application> has an integrated accounts receivable system. The
    transactions generated by the A/R system are recorded within the Accounts
    Receivable account. You generally do not work directly with this account.
    You generally work with the four integrated <application>&app;</application> A/R application
    components available through the <menuchoice><guimenu>Business</guimenu>
    <guisubmenu>Customer</guisubmenu></menuchoice> sub-menu. These four components are:</para>

    <itemizedlist>
      <listitem>
        <para><guilabel>Customers</guilabel> are people or companies to whom
        you sell products or services on credit.</para>
      </listitem>

      <listitem>
        <para><guilabel>Invoices</guilabel> represent the physical invoice you
        send to a customer to request payment. This invoice contains an
        itemized list of things you sold.</para>
        <para>In addition, GnuCash also has support for <guilabel>Credit Notes</guilabel>
        which represent the inverse of Invoices. A credit note is usually handed to
        a customer to correct items that were incorrectly invoiced or returned.</para>
        <para>Both document types will be set up using the same menu items. Credit notes were introduced starting with
          <application>&app;</application> stable release 2.6.0.
        </para>
      </listitem>

      <listitem>
        <para><guilabel>Jobs</guilabel> (optional) is where you register
        Customer Jobs. Jobs are a mechanism by which you can group multiple
        invoices to a particular customer.</para>
      </listitem>

      <listitem>
        <para><guilabel>Process Payments</guilabel> is used to register
        payments you received from a customer.</para>
      </listitem>
    </itemizedlist>
  </sect1>

  <sect1 id="bus-ar-customers1">
    <title>Customers</title>

    <para>Customers are people or companies to whom you sell goods or
    services. They must be registered within the A/R system.</para>

    <sect2 id="bus-ar-custnew2">
      <title>New</title>

      <para>To register a new customer, enter the menu <menuchoice>
      <guimenu>Business</guimenu><guisubmenu>Customer</guisubmenu>
      <guimenuitem>New Customer</guimenuitem></menuchoice>. Fill in customer information, such as
      Company Name, Address, Phone, Fax, etc.</para>

      <screenshot id="bus-ar-custnew">
        <mediaobject>
          <imageobject>
            <imagedata fileref="figures/bus_ar_custnew.png" format="PNG"
                       srccredit="Patrick Schweiger" />
          </imageobject>

          <textobject>
            <phrase>New Customer Registration Window</phrase>
          </textobject>

          <caption><para>New Customer Registration Window</para></caption>
        </mediaobject>
      </screenshot>

    </sect2>

    <sect2 id="bus-ar-custfind2">
      <title>Find and Edit</title>

      <para>To search for an existing customer, use the <menuchoice>
      <guimenu>Business</guimenu><guisubmenu>Customer</guisubmenu>
      <guimenuitem>Find Customer</guimenuitem></menuchoice> window. You select a customer to
      <guilabel>View/Edit</guilabel> from the results of the search. This
      window is also used to look up customers when creating invoices and
      processing payments.</para>

      <screenshot id="bus-ar-custfind">
        <mediaobject>
          <imageobject>
            <imagedata fileref="figures/bus_ar_custfind.png" format="PNG"
                       srccredit="Patrick Schweiger" />
          </imageobject>

          <textobject>
            <phrase>Find Customer Window</phrase>
          </textobject>

          <caption><para>Find Customer Window </para></caption>
        </mediaobject>
      </screenshot>

      <para>If many customers match the search criteria you provide, the
      search can be refined by running an additional search within the current
      results. The current result set is searched when the <guilabel>Refine
      Current Search</guilabel> radio button is selected. In fact, <application>&app;</application>
      selects this option for you after you run the initial search.</para>

      <para>If the customer you are searching for does not match the supplied
      search criteria, change the search criteria, click the <guilabel>New
      Search</guilabel> radio button and then the <guilabel>Find</guilabel>
      button. The relevant step is the <guilabel>New Search</guilabel>
      selection. If the customer is not in the result of the original search,
      and you only search within this set, the customer cannot be found,
      regardless of new search criteria.</para>

      <note>
        <para>To return a list of all registered active customers, set the
        search criterion to <guilabel>matches regex</guilabel>, and place a
        single dot "." in the text field area. Make sure <guilabel>Search only
        active data</guilabel> is checked, then click
        <guibutton>Find</guibutton>. The regular expression "." means to match
        anything.</para>
      </note>
    </sect2>
  </sect1>

  <sect1 id="bus-ar-invoices1">
    <title>Invoices</title>

    <para>An invoice is the paperwork you send to a customer to request
    payment for products or services rendered. <application>&app;</application> can generate and track
    invoices.</para>

    <para>A credit note is the paperwork you send to a customer to correct
    products or services rendered that were incorrectly invoiced. <application>&app;</application> can generate and track
    credit notes via the same menu entries as invoices.</para>

    <note>
      <para>This section applies to both invoices and
      credit notes. In order to avoid repeating everything twice and to keep
      the text easier to read it will refer only to invoices. You can apply
      it equally to credit notes. Only where the behaviour of credit notes
      differs from invoices this will be explicitly mentioned.</para>
    </note>

    <sect2 id="bus-ar-invoicenew2">
      <title>New</title>

      <para>To send an invoice to a customer you must first create the new
      document. To create an invoice use <menuchoice><guimenu>Business</guimenu>
      <guisubmenu>Customer</guisubmenu><guimenuitem>New Invoice</guimenuitem></menuchoice>. The
      New Invoice window must be filled in appropriately.</para>

      <screenshot id="bus-ar-invoicenew">
        <mediaobject>
          <imageobject>
            <imagedata fileref="figures/bus_ar_invoicenew.png" format="PNG"
                       srccredit="Patrick Schweiger" />
          </imageobject>

          <textobject>
            <phrase>Creating a New Invoice</phrase>
          </textobject>

          <caption><para>Creating a New Invoice</para></caption>
        </mediaobject>
      </screenshot>

      <para>When you click the <guibutton>OK</guibutton> button, the
      <guilabel>Edit Invoice</guilabel> window opens.</para>
    </sect2>

    <sect2 id="bus-ar-invoiceedit2">
      <title>Edit</title>

      <para>From the Edit Invoice window you can enter an itemized list of
      goods and services you sold on this invoice in a manner similar to how the account
      register works. For credit notes you enter an itemized list of goods and
      services you refunded instead.</para>

      <screenshot id="bus-ar-invoiceedit">
        <mediaobject>
          <imageobject>
            <imagedata fileref="figures/bus_ar_invoiceedit.png" format="PNG"
                       srccredit="Patrick Schweiger" />
          </imageobject>

          <textobject>
            <phrase>Edit Invoice Window</phrase>
          </textobject>

          <caption><para>Edit Invoice Window </para></caption>
        </mediaobject>
      </screenshot>

      <para>When you have finished entering all the items, you can
      <guilabel>Post</guilabel> and print the invoice.</para>
    </sect2>

    <sect2 id="bus-ar-invoicepost2">
      <title>Post</title>

      <para>When you finish editing an invoice and are ready to print, you
      must <guilabel>Post</guilabel> the invoice. The invoice does not have to
      be posted immediately. In fact, you should only post an invoice when you
      are ready to print it. Posting an invoice places the transactions in an
      accounts receivable account.</para>

      <screenshot id="bus-ar-invoicepost">
        <mediaobject>
          <imageobject>
            <imagedata fileref="figures/bus_ar_invoicepost.png" format="PNG"
                       srccredit="Patrick Schweiger" />
          </imageobject>

          <textobject>
            <phrase>Post Invoice Window</phrase>
          </textobject>

          <caption><para>Post Invoice Window </para></caption>
        </mediaobject>
      </screenshot>

    </sect2>

    <sect2 id="bus-ar-invoicefind2">
      <title>Find</title>

      <para>To find an existing invoice, use the <menuchoice><guimenu>Business</guimenu>
      <guisubmenu>Customer</guisubmenu><guimenuitem>Find Invoice</guimenuitem></menuchoice>
      menu item. From the results of the search, you can select an invoice
      to edit or view.</para>

      <note>
        <para>Before you can edit a posted invoice, you will need to
        <guilabel>Unpost</guilabel> it.</para>
      </note>

      <para>One of the design goals in <application>&app;</application>&rsquo;s Account Receivable system was
      to allow different processes to get to the same state, so you can reach
      an invoice from different directions based on the way you think about
      the problem:</para>

      <itemizedlist>
        <listitem>
          <para>You can search for the customer first, then list their
          invoices.</para>
        </listitem>

        <listitem>
          <para>You can search for invoices by number or by company
          name.</para>
        </listitem>

        <listitem>
          <para>You can list invoices associated with a customer job.</para>
        </listitem>
      </itemizedlist>
    </sect2>

    <sect2 id="bus-ar-invoiceprint2">
      <title>Print</title>

      <para>After you post an invoice, you should print it and send it to your
      customer. To print an invoice use <menuchoice><guimenu>File</guimenu>
      <guimenuitem>Print Invoice</guimenuitem></menuchoice> menu item.</para>

      <screenshot id="bus-ar-invoiceprint">
        <mediaobject>
          <imageobject>
            <imagedata fileref="figures/bus_ar_invoiceprint.png" format="PNG"
                       srccredit="Patrick Schweiger" />
          </imageobject>

          <textobject>
            <phrase>Invoice Print Output</phrase>
          </textobject>

          <caption><para>Invoice Print Output </para></caption>
        </mediaobject>
      </screenshot>

      <note>
        <para>You can modify the appearance of the invoice, IE: add a company
        logo, etc. To do so, see the <xref
        linkend="bus-ar-invoicechange" />.</para>
      </note>

      <para>Invoices can also be printed from the main window by selecting
      <menuchoice><guimenu>Reports</guimenu><guisubmenu>Business Reports</guisubmenu>
      <guimenuitem>Printable Invoice</guimenuitem></menuchoice> from the main menu. The
      resulting report window states that no valid invoice is selected. To
      select the invoice to print:</para>

      <orderedlist>
        <listitem>
          <para>Use the <guibutton>Options</guibutton> <emphasis>Toolbar</emphasis> button or select
          <menuchoice><guimenu>Edit</guimenu><guimenuitem>Report Options</guimenuitem></menuchoice> from
          the main menu.</para>
        </listitem>

        <listitem>
          <para>Select the <guilabel>General</guilabel> tab of the report
          options dialog.</para>
        </listitem>

        <listitem>
          <para>Click the <guibutton>Select</guibutton> button next to the
          <guilabel>Invoice Number</guilabel> field.</para>
        </listitem>

        <listitem>
          <para>Search for the invoice as usual.</para>
        </listitem>
      </orderedlist>

      <para>You can also print invoices from within the Process Payment
      dialog. See the <xref linkend="bus-ar-payment1" /> for instructions on
      how to do so.</para>
    </sect2>

    <sect2 id="bus-ar-invoicestarting2">
      <title>Assign Starting Invoice Number</title>

      <para>By default, <application>&app;</application> starts with invoice number 1 and increments from there. You can
      manually type an invoice number into the text box each time you create
      an invoice, but this gets tiring and sooner or later leads to duplicate
      numbers.</para>

      <para>You can change the starting invoice number if it is important you.
      Use <menuchoice><guimenu>File</guimenu><guimenuitem>Properties</guimenuitem></menuchoice>, access
      the <guilabel>Counters</guilabel> tab, change the <guilabel>Invoice number</guilabel> value to be
      one less than your desired starting invoice number and click the <guibutton>OK</guibutton> button or the 
      <guibutton>Apply</guibutton> button.</para>
    </sect2>
  </sect1>

  <sect1 id="bus-ar-jobs1">
    <title>Customer Jobs</title>

    <para>Customer Jobs are used to group multiple invoices and credit notes to the same
    customer. Use of the Customer Jobs feature is optional. The feature is
    useful when you have multiple <guilabel>jobs</guilabel> for the same customer, and would like
    to view all the invoices and credit notes related to a single job.</para>

    <screenshot id="bus-ar-jobnew">
      <mediaobject>
        <imageobject>
          <imagedata fileref="figures/bus_ar_jobnew.png" format="PNG"
                     srccredit="Patrick Schweiger" />
        </imageobject>

        <textobject>
          <phrase>New Customer Job</phrase>
        </textobject>

        <caption><para>New Customer Job </para></caption>
      </mediaobject>
    </screenshot>

    <para>To use customer jobs, you must create them using the <menuchoice>
    <guimenu>Business</guimenu><guisubmenu>Customer</guisubmenu>
    <guimenuitem>New Job</guimenuitem></menuchoice> menu item. You will see the <guilabel>New
    Job</guilabel> window.</para>

    <para>To edit an existing customer job, use the <menuchoice>
    <guimenu>Business</guimenu><guisubmenu>Customer</guisubmenu>
    <guimenuitem>Find Job</guimenuitem></menuchoice> menu item. Select the desired job in the
    search results, and click the <guilabel>View/Edit Job</guilabel>
    button.</para>

    <para>To select from the invoices and credit notes associated with a given job, use <menuchoice>
    <guimenu>Business</guimenu><guisubmenu>Customer</guisubmenu><guimenuitem>Find
    Job</guimenuitem></menuchoice> menu item. Select the desired job in the
    search results and click the <guilabel>View Invoices</guilabel> button. A
    window listing invoices and credit notes associated with this job appears. Select an
    invoice or credit note and click the <guilabel>View Invoice</guilabel> button to open an
    invoice editor in the main application window.</para>
  </sect1>

  <sect1 id="bus-ar-payment1">
    <title>Process Payment</title>

    <para>Eventually, you will receive payment from your customers for
    outstanding invoices. To register these payments, use the Process Payment
    application found in <menuchoice><guimenu>Business</guimenu>
    <guisubmenu>Customer</guisubmenu><guimenuitem>Process
    Payment</guimenuitem></menuchoice>.</para>

    <screenshot id="bus-ar-payment">
      <mediaobject>
        <imageobject>
          <imagedata fileref="figures/bus_ar_payment.png" format="PNG"
                     srccredit="Patrick Schweiger" />
        </imageobject>

        <textobject>
          <phrase>Process Payment</phrase>
        </textobject>

        <caption><para>Process Payment Window </para></caption>
      </mediaobject>
    </screenshot>

  </sect1>

  <sect1 id="bus-ar-invoicechange">
    <title>Changing the Invoice Appearance</title>

    <para>The default Invoice style, as shown in <xref
    linkend="bus-ar-invoiceprint2" />, is fairly barren. The default invoice
    style leaves the top part of the form blank, so you can print on company
    letterhead paper. There are some things you can do to change invoice
    appearance.</para>

    <para>Use <menuchoice><guimenu>File</guimenu><guimenuitem>Properties</guimenuitem></menuchoice> to
    enter your Company informations in the <guilabel>Business</guilabel> tab of the <guilabel>Book Options</guilabel> window.
    Some of the entered informations are printed on the right side of invoices.</para>

    <para>To add a customized background, heading banner or logo to invoices,
    modify the invoice style sheets. To do this, go to <menuchoice><guimenu>Edit</guimenu>
    <guimenuitem>Style Sheets</guimenuitem></menuchoice> and select the <guibutton>New</guibutton>
    button in the <guilabel>Select HTML Style Sheet</guilabel> window that will appear.
    You will then see a window like this:</para>

    <screenshot id="bus-ar-invoicechange1">
      <mediaobject>
        <imageobject>
          <imagedata fileref="figures/bus_ar_invoicechange1.png" format="PNG"
                     srccredit="Cristian Marchi" />
        </imageobject>

        <textobject>
          <phrase>New Style Sheet Window</phrase>
        </textobject>

        <caption><para>The New Style Sheet window.</para></caption>
      </mediaobject>
    </screenshot>

    <para>Give a <guilabel>Name</guilabel> to the new style sheet (e.g. <guilabel>Custom Invoice</guilabel>) and select the 
    <guilabel>Fancy</guilabel> <guilabel>Template</guilabel>. When you click the
    <guibutton>OK</guibutton> button, the <guilabel>HTML Style Sheet Properties</guilabel> window is
    displayed. This window presents you five sections listed in the left pane: <guilabel>Colors</guilabel>, <guilabel>Fonts</guilabel>,
    <guilabel>General</guilabel>, <guilabel>Images</guilabel>, and <guilabel>Tables</guilabel>. The <guilabel>Colors</guilabel>
    section allows you to change the colors of various items of the invoice. The <guilabel>Fonts</guilabel> section lets you
    set fonts type and dimensions. The <guilabel>General</guilabel> section allows you to set the <guilabel>Preparer</guilabel> and
    <guilabel>Prepared for</guilabel> information, and to <guilabel>Enable Links</guilabel>. The <guilabel>Images</guilabel> section allows you
    to import graphics into the style sheet. The <guilabel>Tables</guilabel> section allows you to
    adjust the spacing around the tables which make up the invoice.</para>

    <para>To include a company logo, banner heading and background image, use
    your favorite graphics application such as <application>The Gimp</application> or <application>OpenOffice Draw</application> to
    save the images in either <acronym>GIF</acronym> or <acronym>PNG</acronym> format. Then import them into the
    style sheet using the <guilabel>Images</guilabel> section described above.</para>

    <para>Below is an example that imports all three types of images.</para>

    <screenshot id="bus-ar-invoicechange2">
      <mediaobject>
        <imageobject role="html">
          <imagedata fileref="figures/bus_ar_invoicechange2.png" format="PNG"
                     srccredit="Cristian Marchi" width="510"/>
        </imageobject>

        <imageobject role="fo">
          <imagedata fileref="figures/bus_ar_invoicechange2.png" format="PNG"
                     srccredit="Cristian Marchi"/>
        </imageobject>

        <textobject>
          <phrase>HTML Style Sheets example</phrase>
        </textobject>

        <caption><para>The <acronym>HTML</acronym> Style Sheets window with an example Background
        Tile, Heading Banner, and Logo.</para></caption>
      </mediaobject>
    </screenshot>
    
    <note>
      <para>The images are placed in the invoice as follows. The
      <guilabel>Background Tile</guilabel> is tiled to become the background
      image, the <guilabel>Heading Banner</guilabel> goes to above the invoice
      text, and the <guilabel>Logo</guilabel> is placed in the upper left corner
      of the invoice to the left of the Heading Banner. You will probably have
      to try a few different sized images until you get the invoices to print
      nicely. Some sizing suggestions are that the Logo should be 1 square cm
      (~0.5 inch), and the Heading Banner should be 15 cm (~6 inches) wide and 1
      cm (~0.5 inch) tall.</para>
    </note>

    <para>With the style sheet configured, when you print the invoice, you
    select the style sheet to use from the <guimenu>Options</guimenu> menu.
    Below is the resultant invoice after applying the style sheet demonstrated
    above.</para>

    <screenshot id="bus-ar-invoicechange3">
      <mediaobject>
        <imageobject>
          <imagedata fileref="figures/bus_ar_invoicechange3.png" format="PNG"
                     srccredit="Patrick Schweiger" />
        </imageobject>

        <textobject>
          <phrase>HTML Style Sheets example</phrase>
        </textobject>

        <caption><para>The hideous invoice which results from the graphics
        selected in the style sheet.</para></caption>
      </mediaobject>
    </screenshot>
  </sect1>
</chapter>
