# Das Kraft Handbuch

## Einführung

Kraft ist ein Qt- und KDE-Programm zum Organisieren von Bürodokumenten wie Angeboten und Rechnungen in kleinen Unternehmen. Es erleichtert die Erstellung der Dokument und vereinfacht wiederkehrende Aufgaben.

Mit Kraft wird kein Textbearbeitungsprogramm mehr benötigt. Rechnungs- und Angebotsdokumente werden mit ein paar Klicks erstellt und automatisch abgelegt. Kraft generiert hochqualitative PDF Dokumente.

Funktionen

  - Kundenverwaltung, durch die Verwendung von KAdressbuch tief in die KDE Infrastruktur integriert.

  - Unterstütztes Erstellen von Angeboten, Rechnungen und ähnlichen Dokumenten.

  - Vorlagen für Dokument-Kopf- und Fusstexte sowie Dokumentposten.

  - Kalkulation von einzelnen Posten.

  - Materialverwaltung.

  - Konfigurierbare Dokument-Erstellung im PDF Format zum Druck und Versenden per Email.

Kraft arbeitet mit den Adressdaten aus dem KDE Adressbuch, das ein Modul von KDE PIM, einer Informations-Management-Anwendung ist. Alle Adressen werden in der Anwendung KAdressBook gesammelt.

Der Quelltext zu Kraft ist open source and wird unter der Lizenz GNU General Public License veröffentlicht.

Note | Kraft wird durch eine Gemeinschaft von Benutzern, Entwicklern und anderen vorangetrieben. Dieses Benutzerhandbuch benötigt Ihre Hilfe zur Verbesserung. Lernen Sie mehr auf how to contribute!

## Erster Start und Grundkonfiguration

Während des initialen Setup wird der Datenbank-Typ und die Adresse der Firma abgefragt.

Die Adresse der eigenen Firma, die automatisch auf dem Ausgabedokument erscheint, kann auf zwei Arten eingegeben werden: In der Prozedur nach dem ersten Start im entsprechenden Tab, oder später über den Einstellungsdialog. Die Adresse kann entweder aus dem Adressbuch gewählt werden oder per Hand eingegeben werden. Dieser Schritt ist für die fehlerfreie Erstellung der Dokumente nötig.

Nach dem initialen Setup kann Kraft über das Menü Preferences[Settings] konfiguriert werden. Das erlaubt, Kraft für die eigenen Bedürfnisse anzupassen.

Im Einstellungsfenster befinden sich die Tabs:

    *Dokument Voreinstellungen
    *Steuern
    *Dokumenttypen
    *Stundensätze
    *Einheiten
    *die eigene Identität

Jeder der Tabs erlaub es, sinnvolle Werte für die spezielle Anforderung einzugeben.

### Dokumenttypen

Beim ersten Start finden sich folgende Dokumenttypen:

- Auftragsbestätigung

- Lieferschein

- Rechnung

- Angebot

Übersetze diese Typen in die eigene Sprache. Du kannst ebenso neue hinzufügen und Einträge entfernen, die Du nicht benutzen wirst.

#### Nummernkreise

Numbercycles are used to define the document number which is printed on every document. The document number is an important unique identifier of the document and often must follow regulations.

Different document types can use the same number cycle to generate ids from. Number cycles are identified by their name. User can create new number cycles and edit them clicking on the button Edit Number Cycles…​

Kraft supports a counter that is incremented for every new document of a certain type. In addition to the counter, more information can be added to form an useful number, such as constant text or parts of the date.

See the following table for available variables which can be used:

`%y` or `%yyyy` | the year of the document date.
`%yy` | the year of the document (two digits).
`%w` | the week number of the document date.
`%ww` | the week number of the document date with leading zero.
`%d` | the day number of the document date.
`%dd` | the day number of the document date with leading zero.
`%m` or `%M` | the month number of the document date.
`%MM` | the month number with leading zero.
`%c` | the customer id from kaddressbook
`%i` | the unique counter (mandatory)
`%type` | the localised doc type (offer, invoice etc.)
`%uid` | the contact id of the client.

### Taxes

In many countries there are two kinds of VAT-taxes for sold products.

A high level and a low level.

Fill here the appropriate amounts in for the high level and the low level. If the tax-level is changing, then you add here the start date with the new tax-levels.

### Wages

A list of wage costs is maintained in Kraft. The items are used in templates and during calculation.

All data can be edited, customized and new items can be added in the Kraft Configuration Dialog reachable through the Settings menu.

Remember that these units are later used in the documents, it is therefor important that you translate them to your own language and to fill in the correct prices.

### Units of measurement

A list of units of measurement is maintained in Kraft. In Kraft Configuration Dialog reachable through the Settings menu can you edit and customize items already in the list, and also can you add new items to the list.

Remember that these units are later used in the documents, it is therefor important that you translate them to your own language.

### Own identity

Check here if the information that you have given during the initial setup is correct for the use in the documents.

> Warning | If you made the choice to use the information from KaddressBook then is the information from a later manual entry ignored.

After we have made some corrections to the configuration, we go back to the main window.Here we see three tabs:

- Documents

- Timeline

- Catalogs

We go first to catalogs.

### Catalog

In the tab catalog are two different catalogs:

`Material`

A catalog of material that are sold, with their purchase prices, the profit and the sell-price.

and `Standard Templates`

A catalog of standard recipes of work like planting trees.

Both catalogs can have chapters and sub-chapters for to organize your templates. First we are going to fill in the

#### Material-catalog

A catalog of material that are sold, with their purchase prices, the profit and the sell-price. First we are going to add new chapters and subchapters.

##### New chapters

Select with the mouse the column-name `material`, select now in the context-menu [Add a sub chapter]

and add an extra chapter like `Trees`

##### New sub chapters

We are going to ad sub chapters in the map `Trees`. Select with the mouse the name of the chapter where you like to add a subchapter, select now in the context-menu [Add a sub chapter] and ad an extra subchapters like `Loaf trees` and `needle trees`. After adding the extra chapters and subchapters for dividing the material, we are going to add the material themself.

##### New template

Select with the mouse the name of the sub-chapter or chapter where you like to add a material. Select the sub map Loaf trees and select now in the context-menu

Add the extra materials `coconut tree`, `apple tree` and `pine-apple tree`.

Fill in the price that we have paid.

Fill in the profit that we want to have on the material

And fill in how much is in a packet.

Now we are going to:

#### Standard Templates

This is a catalog of standard recipes of work like:

- planting trees

- cutting grass

- transport costs

- planting grass

- sowing grass-seed

We add here the standard work of planting a tree.

Select with the mouse the name of the chapter [Work] where you like to add the new template,

select now the context-menu [New template]

and the extra templates `Plant tree` and `cut grass`.

After we made the new template, a window opens with 4 tabs:

- Template

- Time calculation

- Fix costs

- Material

First we go to the tab:

##### Template

We give here the name of the new standard template like `Plant tree`

> Warning | be careful, this name is later used in the invoice

we select that this is per piece and that the margin is 8% and that the full VAT is applicable.

##### Time calculation

We fill here in a number of work with the time:

Table 1. Spent time
Dig hole | 32 min. | worker
Place tree | 12 min. | worker
Fill hole | 17 min. | worker
give water | 5 min. | worker

The cost for worker which we have earlier filled in is now used.

> Note | in the invoice we see later only Plant tree, we will not see the parts dig hole,place tree,fill hole,give water

Now we go to the tab

##### Fixed costs

and fill in:

Table 2. Fixed item
Transportcost | 35 euro | 1 pcs.

After this we go to the tab:

##### Material

Here we fill in:

Table 3. Used materials
1 | support pole | 3,5 euro

We go now back to the first tab template

On the first tab [template], we can now see the overall cost per one unit

Click on [OK] for saving the result or on [cancel] for discarding the result.

We make a second template `cut grass`

we fill in `cut grass`, as unit we choose sm (square meter), on the second tab we fill in that we need 3 min per square meter.

Click on [OK] for saving the result or on [Cancel] for discarding the result.

We are now ready for the first invoice.

## Creating Documents

### The first Invoice

Open the tab documents

Click on create document

The window document [creation wizard opens].

Select in document type `invoice`.

Fill in on the whiteboard content a short text about what the invoice is, like: `cut grass and planted tree for mister Jonson`

Click on next

Select on the new window the name and address from the client.

(if the name and address is not there, click then on new contact or on edit contact if you want to edit the contact)

Click on OK.

Now opens the window document [items].

this window has 2 tabs and the 3 buttons on the top:

- Add item…​,

- Add discount item,

- Show templates.

In the left tab you can see all the items that we want to place on the invoice, on the right tab we see the text from the header, the total price and the footer.

If you click on the text of the header or the footer on the right side then the window changes in such a way that you can edit the header or the footer.

Adapt the header and the footer to your situation, on the footer you can place a text: `We make your garden-dream come to reality.`.

Click on the button Show templates.

The right tab changes and show now the earlier made templates, we select in the group Work, the subgroup Plant tree and click then on the button with the to the left pointing arrow on the bottom side.

A new window [Create Item from Template] opens.

Because we have planted 2 trees, we go to the field [insert] and change this to 2 pcs.

Click on OK for saving the result or on cancel for discarding the result.

The window close and we go back to the main window.

We click again on Show templates and select this time `cut grass`, we click again on the button with the arrow, in the opened window we select that the grass-field was 24 square meter.

Click on OK for saving the result or on Cancel for discarding the result.

We add now manually an item by clicking on the button Add item… and the window [create new item] opens.

Because we have delivered a special tree, we fill here in the name of the special tree `liguster`, at the field insert we fill in the number of the special trees that we have delivered and the price of them.

> Warning | Remind that in the catalog we can add a profit on the price of the material, in the invoice and in the offer we can not add a profit on the price of the material.

We have now an invoice with 3 items.

Click on OK for saving the invoice or on Cancel for discarding the invoice.

We click on OK and save the result.

Your first invoice is now ready for sending.

In the window documents we see our first invoice, notice that this document has a document number which we can see on the left side.

On top of the window with all the invoices we see the button [Print Document], on which we click.

From the invoice will now a PDF be made which we can print on paper or send by email to the client.

After this we are going to create a offer for some work in a garden.

### Creating an Offer

The client has asked to plant a tree, we will offer 3 different trees which we can plant.

Beside this, we have seen that there is a lifeless three, which we will offer to remove as extra work.

For the total price we do not want to show the price of the removal of the lifeless tree and we want for the total price only to show the price of one tree and not three.

Open again the tab documents.

Click on create document

The window Document Creation Wizard opens.

select in document type > Offer.

Fill in on the whiteboard content a short text about what the offer is, like: `plant one tree and removal of lifeless tree`

Click on next

Select on the new window the name and address from the client.

(if the name and address is not there, click then on new contact or on edit contact if you want to edit the contact)

Click on OK.

Now the window [edit document] opens.

This window has 2 tabs and the 3 buttons on the top:

- Add item…​,

- Add discount item,

- Show templates.

Click on the button Show templates.

The right tab changes and show now the earlier made templates, we select in the group `Work`, the subgroup `Plant tree` and click then on the button with the to the left pointing arrow on the bottom side.

A new window [Create Item from Template] opens.

Because we want to plant 1 tree, we go to the field [insert] and keep this on 1 pcs.

Click on OK for saving the result or on Cancel for discarding the result.

The window close and we go back to the main window.

We click on the button Show templates and this time we select in catalog Material

The material-catalog opens, and we can select in the chapter `trees` the subchapter `loaf trees` in which we select the `apple tree` which we made earlier.

Click on we OK for saving the result or on cancel for discarding the result.

The window close and we go back to the main window.

We add now manually an item by clicking on the button `Add item…`.

the window [create new item] opens.

We want that the client can make a choice from an apple, a pear tree and the liguster.

Therefor we are going to add also a pear tree manually.

We click on the button Add item… and the window [create new item] opens.

We fill here in the name of the tree `Pear tree`, at the field insert we fill in the number of the special trees that we have delivered and the price of them.

We want add this to the material catalog for future use, therefor we select also [select this item as template for future documents] and we select in `trees`.

Click on OK for saving the result or on Cancel for discarding the result.

We does this again but then for the liguster.

We have now 3 items with trees in the offer.

As last item we add an item with `remove tree` with 0,5 hour for 32 euro.

On the left side of an item we can see 2 buttons:

a button with a flag and a button with what looks like a page.

We select the upper button with the page after which opens a context-menu with the items:

    [Item kind]->[Normal]
    [Item kind]>[Alternative]
    [Item kind]>[On demand]
    [Tax]
    [Move up]
    [Move down]
    [Lock item]
    [Unlock item]
    [Delete item]

We choose here [Item kind] and change for `pear tree` from [normal] to [alternative].

We do this also for [liguster] and for [remove tree] we change this from [normal] to [on demand].

Click on OK for saving the result or on Cancel for discarding the result.

We want to see the result and therefor we click on the button [show document].

We see now that the prize of the pear tree, the liguster and the removal of the tree is not used for the total prize. When we are happy with the result, we can click on the button close after which we click on the button Print Document for making a PDF what we can print out or send to the client.

After your first invoice is now your first offer now also ready for sending.

## Customization

Kraft can be customized in most of the graphical user interface and in particular in the output it generates.

### Output Document Customization

To create PDF output documents, the document data that was edited in the Kraft app is filled into a template. The template defines how the output document looks like, ie. through font settings, placing of elements etc.

The file that is assembled from data and the template is converted to PDF using a special document creation script. All that is started automatically by Kraft if a document should be printed.

Each document type in Kraft can have it’s own template that is used to create a PDF. Which one can be set in the Settings dialog for document types.

#### WeasyPrint Documents

With WeasyPrint Kraft uses a very powerful HTML and CSS based generator that makes it very easy to create highly customized documents which fit the users expectations. The general idea is that Weasyprint loads html output that is processed to PDF. Usually it is considering a Cascading Stylesheet file which has a huge impact on how the PDF document looks in the end.

To use a WeasyPrint based template for a document simply create a template file and save it with the extension .gtmpl. With that file extension Kraft automatically uses WeasyPrint and also the Grantlee templating for rendering.

An example for a WeasyPrint document can be found in the Kraft package in the reports directory and is called invoice.gtmpl.

To use a WeasyPrint template with one of the Kraft document types just select the template file name (with the right extension `*.gtml`) in the Kraft Settings Dialog.

From version 0.95 on Kraft ships with an example document in the Grantlee- and WeasyPrint format. It can be found at `/usr/share/kraft/reports/invoice.gtmpl` or online on Github.

To effectively change the look of the document `kraft.css` (on Github) needs to be considered. It defines most of the look.

#### Template Variables

To generate the PDF, Kraft has to transfer data from the document you have been working on in Kraft to the input document that is processed to an PDF utilising WeasyPrint. For that, Kraft uses a text template. In that, Kraft replaces variables with the actual values.

The syntax is based on the Django syntax for templates described in the the docs.

## Menus and Shortcuts

### Main Application Menu

#### The File Menu

    [File]>[Quit]
    [Ctrl]+[Q]
    Quits the application.

#### The Document Menu

    [Document]>[Show Document]
    [Ctrl]+[R]
    Opens a window with the selected document for showing it.

    [Document]>[Edit Document]
    [Ctrl+O]
    Opens a window with the selected document for editing it.

    [Document]>[Open Archived document]
    [Ctrl]+[A]
    Opens an archived document.

    [Document]>[Create Document]
    Opens a window with a wizard for creating a new client-document.

    [Document]>[Copy Document]
    Makes a copy of the selected client-document to a new client-document
    which can belong to an other client or an other documenttype.

    [Document]>[Follow Document]
    Opens the selected client-document for editing.

    [Document]>[Print document]
    Makes a PDf from the selected client-document for to be mailed or
    printed.

    [Document]>[Mail document]
    [Ctrl]+[M]
    Mails a document.

#### The Settings menu

    [Settings]>[Edit Tag Templates]
    [Ctrl]+[E]
    Opens a window where you add, edit or translate the tags (like work,
    material, plants or discounts).

    [Settings]>[Redo initial setup]
    [Ctrl+R]
    Redoes the initial setup. After this, a restart of Kraft is required.

    [Settings]>[Showed toolbars]
    Here you can decide if the `main toolbar` and the toolbar `Document Actions`
    are shown.

    [Settings]>[Configure Kraft]
    [Ctrl]+[Shft]+[,]
    Here you can configure Kraft.

### Document Edit Window

#### The context Menu

     [Context]>[Item kind]
     change the status from this item between
    * Normal
    * Alternative
    * On demand

    [Context]>[Tax]
    Seems not working.

    [Context]>[Move up]
    Moves this item a place up in document.

    [Context]>[Move down]
    Moves this item a place down in document.

    [Context]>[Lock item]
    It is not clear what is does.

    [Context]>[Unlock item]
    It is not clear what is does.

    [Context]>[Delete item]
    Removes this item from document.

## Credits and License

Program copyright 2004–2020 Klaas Freitag

Documentation copyright 2020 Ronald Stroethoff