0

Transfert estimate record to invoice

Hello all,

I have a table named estimates with a sub-table estimate items who are linked to customer and I have a table named invoices with a sub-table invoice items who are also linked to customer.

What I want to do, if it's possible, is to transfert the estimate with estimate items to my table invoices and invoice items with a button.

I don't find howto do thats event in the forum.

Thanks

25 replies

null
    • Laurent
    • 5 yrs ago
    • Reported - view

    i'm looking after exactly the same thing

    • Thierry_Grosjean
    • 5 yrs ago
    • Reported - view

    May be with loop function but don't know how to do that!

    • Laurent
    • 5 yrs ago
    • Reported - view

    birger gave me a first answer yesterday but it is not exactly what i asked

    here is the code he gave me to setup a button :

    let myA := this;
    let myB := (create TableB);
    myB.(Text := myA.Text)

    it copies a field of table A (text) to the same field in a new record of table B

    table A would be estimates for me
    table B would be invoices for me

    BUT

    i was asking how to copy the sub table (estimates items) of table A to the same (invoices items) of table B

    i'm not sure it's the same process ? a sub table is different than a field i guess ?

    i'm waiting for a new answer from birger

    by the way, what would you do with the estimate ? would you erase it after transfer to invoice ?

    i'm also waiting for a solution to send the pdf of the invoice with macos mail

    i know how to create the pdf attachment to the record but i don't know how to tranfer it to mail ?

    if i understood well, a solution is being in development right now and should be updated soon…

    i guess we're all waiting !!

    i hope the demo template (invoices) will be updated with all this : estimates / invoices / sending estimates and invoices with a simple button to the customer…

    • Nick
    • 5 yrs ago
    • Reported - view

    I post the same question a few days back and I had an answer from 'support'.

    But I never manage to make it work. 

    Let's unite our forces :-)

    Here is the post

    https://ninoxdb.de/en/forum/technical-help-5ab8fe445fe2b42b7dd39ee7/convert-so-to-invoice-5b5703ab0eb4ca611f2e2440

     

    Nick

    • Laurent
    • 5 yrs ago
    • Reported - view

    thanks nick

    i think i get the idea but it is not obvious because the answer is a bit telegraphic

    i think the answer would be clearer if the variables would be more explicite

    in fact it would be quite nice if a pro user would take time to give us a demo template

    i think it would help plenty of us…

    • Nick
    • 5 yrs ago
    • Reported - view

    +1000

    • Thierry_Grosjean
    • 5 yrs ago
    • Reported - view

    Thanks all for your help.

    I'm already trying to find a solution, something work but not all.

    I can transfert my estimate to a new invoice but only with one estimate-item, not all!

    Then I can't define the estimate customer to the new invoice directly from the script...

    Wait and see

    • Thierry_Grosjean
    • 5 yrs ago
    • Reported - view

    Hi,

    I try this: http:// veloroule.ch/Loop test.ninox

    • Thierry_Grosjean
    • 5 yrs ago
    • Reported - view

    <a href:http://veloroule.ch/Loop test.ninox</a>

    • Thierry_Grosjean
    • 5 yrs ago
    • Reported - view

    Sorry, how can I join a .ninox file?

    • Laurent
    • 5 yrs ago
    • Reported - view

    i don't think you can with the forum tool

    but you can send it to me, my mail is shown up

    thanks

    • Nick
    • 5 yrs ago
    • Reported - view

    The link is wrong (has a space character) -http:// veloroule.ch/Loop test.ninox-

     

    Download the file from here 

    http://veloroule.ch/Loop test.ninox

     

    Nick

    • Laurent
    • 5 yrs ago
    • Reported - view

    thanks nick i missed it

    • Laurent
    • 5 yrs ago
    • Reported - view

    thanks nick i missed it

    • Laurent
    • 5 yrs ago
    • Reported - view

    looking at your code (veloroute), i'm too new to ninox to find the problem but i did find one thing (i think ?) : in the first line of the button, there shoud be ":=" and not only "="

     

    also, i think…

    let ilt := (create 'Invoices items');
    ilt.(Invoices := c.ID)

    just creates one empty item line, then you might have to set all the details you want (define the columns you want to take from the estimates item lines to the invoices item lines) ?

     

    the thing i don't understand is why there is only one empty line ?

    the loop isn't working ? in your case, i≠1 but i=3 in your demo estimate

     

    i'm not pro enough with ninox… i'm still just "guessing" plenty of things… for example the "create" function or the "for in select" one… but, hey, one day i'll make it !!

     

    i wish the pros could answer faster to all of our questions since the manual of ninox = this forum… !!

    • Laurent
    • 5 yrs ago
    • Reported - view

    i noticed something else

    you have customers, estimates and invoices but where is products ???

    maybe that loop would work better with a product table ?

    • Thierry_Grosjean
    • 5 yrs ago
    • Reported - view

    @laurentstmont

    I have working on and corrected the loop, I Will update the ninox file on m'y server this evening. In this file I dont use products table but I can insert in for the next update tonight.

    Thanks for your comments

    • Thierry_Grosjean
    • 5 yrs ago
    • Reported - view

    Hi all,

     

    I have updated the .ninox file, it's avaliable here: http://veloroule.ch/Loop test.ninox

    The loop work now but I can populate the invoice items with the right product.

    My script button:

    "Define estimate ID in variable";
    let myId := ID;
    "Get customer name";
    let cli := Customers;
    "Create new invoice";
    let c := (create Invoices);
    "Give link to customer in the new invoice";
    c.(Customer := cli);
    "Select estimate items correspond to the good estimate";
    for i in select 'Estimate items' where Estimates.ID = myId do
    "Create invoice items";
    let ilt := (create 'Invoices items');
    "Give the ID of the new invoice to invoice items";
    ilt.(Invoices := c.ID);
    "*Try to* Get ref field item in estimate";
    let item := 'Estimate items'.Products;
    "*Try to* Give ref field item in new invoice";
    "ilt.(Products := item)"
    end;
    "Line 18 dont work?"

    The line 18 return me an error in script editor?

    Any help?

    Thierry

    • Birger_H
    • 5 yrs ago
    • Reported - view

    Here is the correct code:

    –––
    "Define estimate ID in variable";
    let myId := Id;
    "Get customer name";
    let cli := Customers;
    "Create new invoice";
    let c := (create Invoices);
    "Give link to customer in the new invoice";
    c.(Customer := cli);
    "Select estimate items correspond to the good estimate";
    for i in select 'Estimate items' where Estimates.Id = myId do
    "Create invoice items";
    let ilt := (create 'Invoices items');
    "Give the ID of the new invoice to invoice items";
    ilt.(Invoices := c.Id);
    "*Try to* Get ref field item in estimate";
    let item := i.Products;
    "*Try to* Give ref field item in new invoice";
    ilt.(Products := item);
    "get whe quantity";
    let myQ := i.Qte;
    ilt.(Qte := myQ)
    end
    –––

    Birger

    • Nick
    • 5 yrs ago
    • Reported - view

    Finally works!!!!

    Thank you Birger and, of course, Thierry...

     

    Nick

    • Laurent
    • 5 yrs ago
    • Reported - view

    thanks birger, we're gonna dive into our solutions !!!

    • Thierry_Grosjean
    • 5 yrs ago
    • Reported - view

    Many Thanks to all  :) 

    Could you maybe create a new template with this file and introduce to ninox app?

    I can aldo l'épave this file on my host.

    Thierry 

    • Thierry_Grosjean
    • 5 yrs ago
    • Reported - view

    I can also leave this file on my host.

    Thierry 

    • Laurent
    • 5 yrs ago
    • Reported - view

    nice idea to update the invoice demo template, with, if possible, an item table and the possibility to send by email to the customer the estimate or the invoice (with the hit of a button…) ?

    lol, am i asking too too much… ??? that new demo template would answer to 75% of the needs…

    • Thierry_Grosjean
    • 5 yrs ago
    • Reported - view

    We are here to share us knowledge. 

Content aside

  • 5 yrs agoLast active
  • 25Replies
  • 7063Views