Re: Table fields

Hi Derek,


Thank you very much. Great, now it doesn't save when inv header tgrid is empty.


However, it still saves inv with zero amounts when inv item added and deleted on cancel. It seems that save is initiated on inv items save button. I don't know if I'm correct in thinking of Inv Item form save button should be changed to Insert with use of SQL query.. I tried but getting error.


In same fashion Form1/Customers tabpage "Add Invoice to Selected Customer" button action may be SQL Query too so that when user clicks on it without selecting record from tgrid it produces error message like in Delete/Edit buttons.

Post's attachments

Attachment icon Tables and Fields 5.zip 17.6 kb, 388 downloads since 2016-10-16 

Adam
God... please help me become the person my dog thinks I am.

Re: Table fields

Hi Adam,
So can't you simply add a 'pre-delete' button using the same logic as the 'pre-save' button (or am I missing something?).  Please see attached.
Of greater concern is that the form currently lets you save an invoice with no customer and no invoice number.
A more general point -  with most invoicing systems I've worked on, it is a valid scenario to have invoice headers with no invoice lines;  just a thought.
Derek.

Post's attachments

Attachment icon Tables and Fields 4 with zero lines check.zip 352.14 kb, 370 downloads since 2016-10-16 

Re: Table fields

Hi Derek,


Unless, I'm doing something wrong, delete button doesn't actually delete inv item from the inv header tgrid. On cancel still saves the record.


Is changing save button on inv item form to insert with SQL query not viable as suggested on my previous post?

Adam
God... please help me become the person my dog thinks I am.

Re: Table fields

Hi Again Adam,
I think I understand the scenario you're trying to trap so I've added a simple test for an invoiceheader record with no associated invoiceitems records and, where this is the case, automatically delete the invoiceheader record to get everything straight again.
Remember that the invoiceheader record is actually saved when you click 'add an item' and not when you click 'save header'.  I can see why it is confusing but it is logical - it is done this way otherwise the invoiceitem record would have no 'parent' at the point when it gets saved.
Derek.

Post's attachments

Attachment icon Tables and Fields 6.zip 352.33 kb, 399 downloads since 2016-10-16 

30 (edited by AD1408 2016-10-17 00:34:07)

Re: Table fields

Hi Derek,


Just Inv header data save after clicking on add new item on cancel is gone. However, after adding an inv item to inv header, when I want to delete the added item it doesn't delete it and on cancel still saves the record with inv item data.


- User may add an inv item to inv header but wants to delete after realizing wrong item added. If selected item is deleted (which cannot be in current version 6) then on cancel inv header, there shouldn't be any inv record saved. Since you have done blank grid cannot be saved, only other options left for user after deleting inv items (assuming delete is enabled) he can either add new inv item/s and save or cancel. Again, on cancel inv header, there shouldn't be any inv record saved.



- User may add an inv item to inv header but decides to abourt by clicking on cancel button after adding inv header inv item/s then  there shouldn't be any inv record saved.


I hope I'm not causing you a headache with all these. Please know that I really appreciate your help and your presence in here.


ps/. I was checking MVD Example "Students". Same issue is present there too. But there again no script used in that example. I was hoping we could overcome this issue with scripts.

Adam
God... please help me become the person my dog thinks I am.