1. Fabrik 3.8 has been released. As usual, we strongly recommend that you backup your site (using Akeeba) before upgrading. Report any issues in the forums, we will answer promptly.

How to create an invoice system with fabrik?

Discussion in 'Community' started by tutux, Dec 7, 2013.

  1. tutux

    tutux Member

    Level: Community
    Hi the community,

    all is in the title :)

    I would like to create a invoice system with fabrik... not so easy for me :)

    I explain, i need a "contact" list, an "articles" list and a "invoice list"

    When i create a new invoice, (a new record in my "invoice" list), i would like to choice my contact in the "contact" list through a dropdown.

    When the contact is selected, i would like to find with the same way the article or the articles to make the invoices..
    The articles have previously recorded in the "articles" list.

    example
    "contact " list, with 4 fields : Name - Adress - CP - Country
    "articles" list with 3 fields : Table - brown - 100 €
    Bed - white - 200€

    I create a new "envoice" list record :
    I select Name, and all the fields from "contact" list are selected
    I select Bed, and all the fields from "Articles" list are selected
    I can select more than 1 article.... for exemple 5 articles


    When all is filled out , i have a list with 7 differents fields (4 from contact and 3 from articles)
    After that, i create my custom CSS to show all field in an invoice CSS (i know just how to do this )

    ... any idea?

    I tried a lot of ways but never found it :(

    thank you in advance

    Best regards
     
    Mlakar and kinnorvi like this.
  2. Tirso

    Tirso New Member

    Level: Community
    Hello.

    I've done something similar to what you want.

    I. - First you have to create three tables:
    One for bills, one for catalog customers and one for your pructos.
    - The main table is that of your bills.
    -I recommend this table divided into 4 groups of fields to an array and give different treatment to each group. I'll explain:
    1) The group primier add two fields: date and page (two columns)
    2) In the second group insert fields concerning customer data, ie: name, address, Tax Number (in Mexico called RFC). Indicate that this group can be divided into three columns.
    3) The third group is for your products: SKU, Quantity, Description, Unit Price, Amount. (This group would be a repeat in tabular form)
    4) The fourth group is for the sums: Subtotal, Tax, Total. (You may indicate that this group is divided into three columns)

    II. - Now the second part is to link and calculate.
    1) In your first group there is so much trouble, they are two separate fields type date and incremental number (could be the ID field of the table)
    2) In the second group (clients) is where you begin to build links with other tables. In your catalog customers and you must have created at least the same fields that you will use on the bill. In the bill the name field (which may be individual or company name) must be a search field databasejoin data hosted in the name field of the Customers table. The rest of the fields in this group would be an CascadingDropdown which observes the changes you make in the name field and search the catalog table corresponding to customers that same row, so the rest of the fields in the same group.
    3) The third group (products) is somewhat similar to the above but as this is a repeating group, you can add more than one row as the number of products you will incuir ls same invoice. (eye, the amount would field a calculated field (calc) which multiplies the quantities of product for the price.
    4) The last group is used for the final calculations of the subtotal (sum of the amounts of products) the value of taxes (in Mexico is 16% of subtotal) and total, that is, the sum of subtotal more taxes . Ejemplo.PNG
     
    AlainR and kinnorvi like this.
  3. Tirso

    Tirso New Member

    Level: Community
    Forgot let you know that, bill printing is better if you use the detail view, you determine that what the options form.

    Good luck, I hope this will serve you, any question, just ask.
     
    kinnorvi likes this.
  4. tutux

    tutux Member

    Level: Community
    hi,

    I see your reply just now... thank you for your help Tirso :)
     
  5. kinnorvi

    kinnorvi Jorge Castro

    Level: Community
    hi everybody, please I need to make a field to increase the invoice number, example: from 1976 next invoice 1977 next invoice 1978... thenkyou
    :)
     
  6. nusilmar

    nusilmar Member

    Level: Community
    you have several options :

    You may use a calc field, you may use the id field or even an autofill plugin on the form. It all depend on what you have ( elements ) and what you want. Can you please be more specific ?
     
  7. kinnorvi

    kinnorvi Jorge Castro

    Level: Community

    Thenk you nusilmar, I am using the id field and works perfect.
     
  8. kinnorvi

    kinnorvi Jorge Castro

    Level: Community
    Hi everybody, naw I have a question:
    According with Tirso, in this foro line (II. - Now the second part is to link and calculate.)...
    Please, how can I get the calculation of subtotal + %16 to get the total? cool if somebody share a php code.

    Thenk your for all Fabrik comunity.
     
  9. Tessa

    Tessa Member

    Level: Professional
    Hi Kinnorvi, for the total, you can do this in a calc plugin:

    Code (Text):
    $subtotal = "{tblFoo___elementname}";
     
    $total = $subtotal * .016;
     
    return $total;
     
    kinnorvi likes this.
  10. kinnorvi

    kinnorvi Jorge Castro

    Level: Community

    Tessa, thekyou it works perfect, i will applay to my project. :)
     
  11. Tessa

    Tessa Member

    Level: Professional
    You are very welcome :)
     
    kinnorvi likes this.
  12. kinnorvi

    kinnorvi Jorge Castro

    Level: Community
    Hi, now i get a "css" problem, in all site the css don´t load, i was looking for a post in the forum but nothing.... can i post here???

    Thenkyou!!
     
  13. Tessa

    Tessa Member

    Level: Professional
    Create a new thread to avoid confusion, so others can go back to this thread within the topic that they are looking for to help them too.
     
    kinnorvi likes this.
  14. kinnorvi

    kinnorvi Jorge Castro

    Level: Community

    Thenkyou:D
     
  15. kinnorvi

    kinnorvi Jorge Castro

    Level: Community
  16. kinnorvi

    kinnorvi Jorge Castro

    Level: Community
    Hi everyone, hi Tessa.
    New question: I need to take an id from another table, please, could you share a php code´s example?

    Thenk you!

    :)
     
  17. nusilmar

    nusilmar Member

    Level: Community
    what do you mean by that ? can you explain ? do you need to get an value from a table based on a value from your current table ? If so you can use the autofill plugin on your form. Check the wiki on that ( and remember to make that element as read only, to avoid editing) : http://fabrikar.com/forums/index.php?wiki/autofill-form-plugin/

     
  18. hangnail

    hangnail New Member

    Level: Community
    Great post, the only issue I'm having is getting a grand total.
    2 groups, "1 repeating" "1 not repeating for sums"
    In the repeating I have
    I have a "dbjoin element - item | a ccdropdown - price | field - quantity | calc - subtotal.
    "Seems to work perfectly."
    However, the non repeating with only 1 element "Total" I can only get the first entry of the repeating group to calculate, can anyone suggest or point me in the right direction?
     
  19. mkainz

    mkainz Member

    Level: Community
    Any solution for the Grand Subtotal with calc?
     
  20. thermike

    thermike New Member

    Level: Community
    I am having the same issue here.
    Two groups, 1 repeating 2 grand totals.
    How do i sum the repeated amounts and show the sum, while processing the form before saving to mysql, in the the second group?
    How do i reference each repeated element to sum them up?
    Thanks.
     
    Last edited: Oct 8, 2017

Share This Page