NetTalk Central

Author Topic: How to manage new invoice with items  (Read 4289 times)

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
How to manage new invoice with items
« on: October 24, 2012, 12:36:29 AM »
Hallo,


1.) User insert new invoice, and on the same form has the items browse. After insert all invoice details he begin to add items.
After he add couple of items decided to abandon the invoice and press another menu or home page..
Now the invoice was not saved but the items yes. They are orphaned now. The FM doesn't know he abandon the form to delete the child's... How can I solve this in a easy way.


2.) The relation between Invoice and Items are made by a GUID. Now if user insert a new invoice a new guid is generated. Add details to invoice and then begin to add items. After he add couple of items decided to refresh the page (press F5 or from menu) the page refresh and form initialized again and all embeds are called again... this way a new GUID is generated. Now all items are gone because we have new guid.
How can I prevent this?

In desktop mode is easy to prevent this kind of problems but in web... is different :o)

Also this is a multi user platform.
 
Thank you for any suggestions or new idea!

Regards,
Robert

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: How to manage new invoice with items
« Reply #1 on: October 24, 2012, 04:10:15 AM »
Firstly, there have been a few posts like this in the past so it may be help to do a search on this forum.

1.) User insert new invoice, and on the same form has the items browse. After insert all invoice details he begin to add items.
After he add couple of items decided to abandon the invoice and press another menu or home page..
Now the invoice was not saved but the items yes. They are orphaned now. The FM doesn't know he abandon the form to delete the child's... How can I solve this in a easy way.

> write the details to a temp file and only on save, copy them to perm file. I use this technique on one table where I only want the details updated if the user actually clicks the save button.


2.) The relation between Invoice and Items are made by a GUID. Now if user insert a new invoice a new guid is generated. Add details to invoice and then begin to add items. After he add couple of items decided to refresh the page (press F5 or from menu) the page refresh and form initialized again and all embeds are called again... this way a new GUID is generated. Now all items are gone because we have new guid.
How can I prevent this?

> you could save the invoice after prime insert and change the form to change mode. I actually use this method so users don't loose details they have entered and it also might work for your prob.

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Re: How to manage new invoice with items
« Reply #2 on: October 24, 2012, 05:02:11 AM »
Hallo Kevin,

> write the details to a temp file and only on save, copy them to perm file. I use this technique on one table where I only want the details updated if the user actually clicks the save button.
Nice trick. Thank you!

> you could save the invoice after prime insert and change the form to change mode. I actually use this method so users don't loose details they have entered and it also might work for your prob.
How can I change the action mode in code?

Thank you,
Robert

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: How to manage new invoice with items
« Reply #3 on: October 24, 2012, 03:05:40 PM »
How can I change the action mode in code?

> Preinsert priorty 5000

        Access:POTRN.UseFile()
        If Access:POTRN.Insert()     
          Message('Unable to Insert POTRN')
        End
        p_web.filetosessionqueue(potrn,net:alsovaluequeue)
        ans = net:ChangeRecord
        p_web.SetSessionValue('FormNewDraftPO:Primed',1)
 

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Re: How to manage new invoice with items
« Reply #4 on: October 24, 2012, 11:13:04 PM »
Hallo Kevin,

The code it's not working for me... After open the form and press F5 the form is in insert mode.
Is that all I have to set?

Thanks,
Robert

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: How to manage new invoice with items
« Reply #5 on: October 25, 2012, 12:42:11 AM »
um, not to be picky but;

>>  After he add couple of items decided to refresh the page (press F5 or from menu

Pressing F5 repeats the last (non ajax) request from the browser to the server.
If you press F5 halfway through entering any form on the internet it's likely to "start again".
Why on earth would they be pressing F5?

>> the page refresh and form initialized again and all embeds are called again... this way a new GUID is generated.

of course. That would be expected - and indeed desired. If they abandoned the form and then returned to it later by doing an Insert, you'd want it to start from scratch.

>> Now all items are gone because we have new guid. How can I prevent this?

Don't press F5 while half-way through entering the form.
I'm thinking that a popup-form is probably better if you are getting this effect because it's not a "page" so wouldn't encourage users to press F5. But if they do then the browser will repeat the last request.

In essence - F5 means "repeat last request" not "refresh page, preserving my current state" if you get what I'm saying.

cheers
Bruce

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Re: How to manage new invoice with items
« Reply #6 on: October 25, 2012, 01:36:10 AM »
Hallo Bruce,

>Why on earth would they be pressing F5?
I just want to protect if they will do this (just in case) , If they will press to know what to do...

>Don't press F5 while half-way through entering the form.
:o)

>I'm thinking that a popup-form is probably better if you are getting this effect because it's not a "page" so wouldn't >encourage users to press F5. But if they do then the browser will repeat the last request.
I will try this.

>In essence - F5 means "repeat last request" not "refresh page, preserving my current state" if you get what I'm saying.
Yes, I understand! :o)

Noted and thanks for help,
Regards,
Robert