/*
** Verwaltung der Rechnungsliste
**
** Copyright (C) 1996 by Stefan Scherer.
**
** Permission to use, copy, modify, and distribute this software and its
** documentation for non-commerical use and without fee is hereby granted,
** provided that the above copyright notice appear in all copies and that
** both that copyright notice and this permission notice appear in
** supporting documentation.  This software is provided "as is" without
** express or implied warranty.
*/

#ifndef RECHNUNGSLISTE_H
#define RECHNUNGSLISTE_H

#include <exec/types.h>
#include "Rechnungen.h"

/* o-functions */

int ConstructInvoiceList (void);
void DestructInvoiceList (void);

int IL_SetYear (UWORD year);

int IL_NewInvoice (struct MinInvoice *item);
int IL_DelInvoice (void);
int IL_ChangeInvoice (struct MinInvoice *item);
int IL_SetCurrentInvoiceNumber (UWORD number);

int IL_LoadInvoice (struct MinInvoice *mininvoice, BOOL);
int IL_SaveInvoice (struct MinInvoice *mininvoice, BOOL);

void IL_ResetLastLoaded (void);


/* v-functions */

UWORD IL_GetInvoiceCount (void);
int IL_GetCurrentInvoiceNumber (void);
int IL_GetInvoice (UWORD number, struct MinInvoice *item);
int IL_GetCurrentInvoice (struct MinInvoice *item);

int IL_GetYear (UWORD num, UWORD * year);
UWORD IL_GetCurrentYear (void);
UWORD IL_GetCurrentYearNumber (void);
UWORD IL_GetYearCount (void);
UWORD IL_GetNextInvoiceNumber (void);
STRPTR IL_GetErrorMsg (void);

int IL_CorrectArticleCount (void);


/* Fehlermeldungen */

enum
  {
    ERR_IL_OK,			/* alles in Ordnung */
    ERR_IL_YEAR,		/* Jahresnummer außerhalb der Grenzen */
    ERR_IL_LISTEMPTY,		/* Liste ist leer */
    ERR_IL_NOITEM,		/* Eintrag nicht in Liste vorhanden */
    ERR_IL_NOMEM,		/* kein Speicher */
    ERR_IL_NOPOOL,		/* kein Memory-Pool */
    ERR_IL_NOPATH,		/* Fehler bei Verzeichnispfad */
    ERR_IL_EXALL,		/* Fehler bei ExAll() */
    ERR_IL_INVOICE,		/* Fehler bei Rechnung -> I_GetErrorMsg() */
    ERR_IL_CANTCREATEFILE,	/* konnte File nicht erzeugen */
    ERR_IL_SAVE,		/* Fehler beim speichern */
  };

#endif /* RECHNUNGSLISTE_H */
