Re: Receipts on sales mandate

Hi Derek,
Here I am again asking for your help. The project is always this. I tried to figure out how to do it but I couldn't. I would need that the receipt is printed the total of the price of the items and the total price refunded. No matter that this data ends up in a field, the important thing is that it is printed in the report.
I make a small summary: At the start of the program you have to go to "Ricevuta", the button opens "frmRicevuta" from which you enter the receipts.
In the form "frmArticoli" you insert the articles, the price of the item and the quantities and percentage of the commission of the seller. In practice, the client of my client, to whom the receipt must be made, is a person who sells used things. My client, who serves the program, is a second-hand flea market, my client sells the item for this person and holds a percentage as a refund.
In the form there are fields where all these things are calculated automatically and it works well.
My problem is, in case the customer sells more goods for the same person, to make the total of the sale price (table articlecomplete, totcommission field) of all the goods and the total of the Commission (table Articiricevuta, field totrefunded), which is the Percentage, of all goods sold.
I hope I've been able to explain myself.
Thank you very much.

Post's attachments

Attachment icon Gestione Contratti e Ricevute.zip 489.2 kb, 291 downloads since 2019-06-04 

Re: Receipts on sales mandate

Ciao Fabio,
I hope I have understood your question correctly.
I have changed the report so that the total cost, the total commission and the total refund is shown.  The layout is probably not what you want but that can always be changed.  But you can see the calculation and that is the main thing.
I have also commented out some of your script - specifically, the places where you are hiding forms.  I'm not sure why you are doing it that way and the main problem is that when you quit your program, it leaves processes running in the background.
Regards,
Derek.

Post's attachments

Attachment icon Gestione Contratti e Ricevute.zip 511.21 kb, 304 downloads since 2019-06-05 

28 (edited by reteinformatica 2019-06-05 11:08:38)

Re: Receipts on sales mandate

Hi Derek,
You're always the best. You understand my need and you have solved the problem. Even the layout is perfect, I really like it.
I realized that hiding the forms then remained the processes hung, it would be a later change, this I was able alone but I was pressing first to solve what I could not. The goal was not to have too many windows open.
Thank you very immensely.

Re: Receipts on sales mandate

derek wrote:

Hi,
There are a couple of things to understand when using calculated fields.
Calculated fields only exist while your program is running - as soon as the program closes, the calculated fields are gone.  For example, you would save someone's date of birth but you wouldn't save their age - that would be data redundancy.  Instead, you calculate their age every time the program runs using a calculated field so it is always up to date, but as soon as the program closes, their 'age' is gone.
So you are correct when you say that there are no instructions DIRECTLY relating to calculated fields in the script.  But what the script does is
1)  run a search when the program starts so that all the columns in the tablegrid are populated - including calculating the calculated fields.
2)  when any data is saved, the calculated fields need to be 're-calculated' - this is what the 'dbupdate' statements are doing in the script.
So when you removed the script, the calculated fields didn't appear because you removed the instruction to calculate / re-calculate them.
I hope I've explained that okay.
I've attached the project again with some comments in the script that may help.
Regards,
Derek.



Please help me by multiplying detailqty by detailprice and add the column to a new column called total.
Thank you in advance for the help

Re: Receipts on sales mandate

humblelion,
See attached for a simple example on creating a calculated field for the multiplication of qty and price for a total to be displayed on a tablegrid. Also, the calculation is scripted on the update form upon entry of qty and price.

Post's attachments

Attachment icon Calc Qty and Price Total.zip 336.74 kb, 278 downloads since 2019-09-18