Topic: Inserting item in a receipt from a list of items

Hello everyone
I'm trying to create an application to create receipts and unfortunately I got stuck with a problem. I studied the sample application found on the site "invoice" but after trying everything I ask for help.
Basically in the form "frmScontrino" I would like to insert the previously uploaded articles but I can not because it gives me an error when I go to insert the article via the form "frmListarticoli", this is where it gives me the error.
I politely ask you to help me understand. I obviously attach the project. Thank you very much!

Post's attachments

Attachment icon Moon.zip 337.65 kb, 310 downloads since 2020-09-08 

2 (edited by domebil 2020-09-08 14:46:03)

Re: Inserting item in a receipt from a list of items

now works

Post's attachments

Attachment icon MoonBuono.rar 302.41 kb, 392 downloads since 2020-09-08 

Domebil

Re: Inserting item in a receipt from a list of items

Hello,
thanks very much. What was wrong? Are you Italian?

4 (edited by domebil 2020-09-08 18:21:35)

Re: Inserting item in a receipt from a list of items

italiano. Di sbagliato era che le quantità andavano inserite nel database Scontrino

Domebil

Re: Inserting item in a receipt from a list of items

Bene, grazie mille. Fa piacere sapere che anche altri italiani utilizzano questo programma che reputo bellissimo. Mi rimangono una serie di problemi dove mi sono arenato e non riesco ad andare avanti, intanto comincio con uno e man mano aggiungerò gli altri. Scrivo in inglese anche per gli altri.


Goodmorning everyone,
by clicking on "Inserisci Articolo, Insert article in English (first form when the program starts) when the program is first opened the fields are empty but once "Salva", Save in English, has been clicked and by clicking again on the "Inserisci articolo" button the fields are already completed with the last save . Thank you!

I upload project again 'cause I made some modifications.

Post's attachments

Attachment icon Moon.zip 337.58 kb, 267 downloads since 2020-09-09 

6 (edited by domebil 2020-09-09 14:11:16)

Re: Inserting item in a receipt from a list of items

ora funziona

Post's attachments

Attachment icon Moonbuono2.rar 301.98 kb, 286 downloads since 2020-09-09 

Domebil

Re: Inserting item in a receipt from a list of items

Grazie di nuovo. Vedo però che i campi con i prezzi e le percentuali dell'iva sono già compitati anche al primo avvio.

Re: Inserting item in a receipt from a list of items

Devi togliere da default 22  del campo iva.
Se vuoi che che tenga in memoria la percentuale lavora con il file ini

Domebil

Re: Inserting item in a receipt from a list of items

Per i campi prezzo non sono compilati ma indicano semplicemente
che sono campi di valuta

Domebil

10 (edited by reteinformatica 2020-09-10 10:36:06)

Re: Inserting item in a receipt from a list of items

Ah ok, grazie, non so come ci sia finito quel 22 in default ma va bè.
Invece un altro problema che non riesco a risolvere è quando faccio un nuovo scontrino: intanto al primo inserimento, nel momento in cui inserisco un articolo me lo inserisce doppio e inserisce anche dei record vuoti tra i due doppioni oppure addirittura tutti i record se cancello i record e li reinserisco il problema non si pone solo la prima volta dopo l'apertura del programma, nella tabella "Scontrino" ho messo un campo calcolato (Totale), mi sembra di aver scritto bene ma in ogni caso non funziona.
Poi riaprendo la finestra per fare un nuovo scontrino mi ridà lo scontrino già compilato con l'ultimo fatto. Grazie ancora.


ENGLISH
On the other hand, another problem that I cannot solve is when I make a new receipt: in the meantime, at the first insertion (form frmScontrino, clicking on "Crea scontrino" in the first windows), when I insert an article, it inserts it double and also inserts empty records between the two duplicates or even all the records, if I delete the records and re-enter them, the problem does not arise only the first time after opening the program, in the "Scontrino" table I put a calculated field (Totale), it seems to me to have written well but in any case it does not work.
Then reopening the window to make a new receipt gives me the receipt already filled in with the last fact. Thanks again.

Re: Inserting item in a receipt from a list of items

Devi dare un'occhiata  a questo così ti sarà più facile proseguire nella realizzazione del tuo database
http://myvisualdatabase.com/doc_ru/Newtopic.html

Domebil

12 (edited by reteinformatica 2020-09-10 14:57:57)

Re: Inserting item in a receipt from a list of items

È scritto in russo smile In ogni caso la documentazione (in inglese) già l'ho letta tutta.

13 (edited by CDB 2020-09-11 09:01:46)

Re: Inserting item in a receipt from a list of items

reteinformatica wrote:

È scritto in russo smile In ogni caso la documentazione (in inglese) già l'ho letta tutta.

Use Google translate or if you are using Firefox enable the auto page translating add-on.



Here is what my browser translates the link to.


About the program
My Visual Database allows you to quickly develop a database application. It can be like a simple telephone directory, or a system for accounting in your business. This program simplifies the development of such applications as much as possible, hiding all the complexity of working with databases, while leaving the opportunity for direct interaction with data, if necessary.

After starting the program, you can immediately start developing your application. There is no need to install anything extra and configure it.

The result of your work will be a standalone application that does not require the installation of My Visual Database or any other components. Just transfer the entire folder with your application to any other computer and run.

By default, the application you create uses a fairly simple yet robust SQLite database. Typically, SQLite is designed for single-user work, but multi-user work on a local network through a shared folder is also allowed.

If necessary, your application can use the MySQL database. This database is multi-user and is perfect for working over the Internet.

For advanced users and programmers, scripts (Object Pascal) are provided, with many built-in functions and classes that will allow you to implement any functionality of your future application.

Post's attachments

Attachment icon russian_mvd_to_english.PNG 211.42 kb, 129 downloads since 2020-09-11 

On a clear disk you can seek forever

14 (edited by reteinformatica 2020-09-11 11:18:49)

Re: Inserting item in a receipt from a list of items

I have already read all the documentation and even translated it into Italian. I have tried to study the Invoice project but unfortunately neither of the two things helps me to understand some things that I cannot solve in my project.
In particular the last problem I wrote, which does not always happen but only at the first opening of the program.

15 (edited by derek 2020-09-12 17:58:43)

Re: Inserting item in a receipt from a list of items

Ciao Fabio,  Come stai?
I had a quick look at your project and there is one major issue - your table structure only allows for a single item to be stored against a receipt.  If you want to have multiple items against a receipt, you need to add an additional table (I've called it 'scontrinodetail' in my example).  You then need to move some of the fields from 'scontrino' to 'scontrinodetail'.
I messed around with your project a bit and I hope it is now closer to what you need.  I've done some basic testing and it seems okay.
On 'frmlistascontrino', you can search for anything  using 'Cerca Scontrini' and 'Cerca Articoli' (and you can click on a row in either grid to select relevant records in the other grid).
But when you want to add / edit / delete records, you use frmlistascontrino.tablegrid2;  this is because MVD works hierarchically so you access the 'scontrino' information before you access the 'scontrinodetail' information.  If you try it the other way around, it gets awkward!
There will be things that I've not included (for example, columns in tablegrids that you want to see, labels that are misspelt(!) etc) but the attached example should give you some ideas.
Regards,
Derek.

Post's attachments

Attachment icon moony.zip 355.76 kb, 300 downloads since 2020-09-12 

16 (edited by reteinformatica 2020-09-14 14:08:35)

Re: Inserting item in a receipt from a list of items

Hi Derek, despite the world period we all know I'm fine, thanks. I hope for you it is the same.
In Italy we all had to stay indoors for two months except for the possibility of going out for emergencies such as shopping or going to the doctor. Now we can go out but we must use all possible precautions also because the cases of covid are increasing again, let's hope for the best.
I don't know how to thank you, you solved most of the problems I would have asked in advance and I thank you very much also for the very useful explanations and scripts comments and also for the graphic corrections.
I tried to implement some features but couldn't:
In the form "frmScontrino" I would like to view the total sales price, that is the price of each item ("Articoli" table) for their quantity, all in all. The same thing if possible also in the form "frmListascontrini". The selling price is found in the "Articoli" table in the "PrezzoVendita" field. In order to know what the total of the receipt is and therefore the amount due. I tried with a calulated field that it would be perfect but I couldn't.
Thanks a lot derek !!!

17 (edited by domebil 2020-09-14 16:09:40)

Re: Inserting item in a receipt from a list of items

Progetto corretto

Post's attachments

Attachment icon moony corretto.rar 307.85 kb, 276 downloads since 2020-09-14 

Domebil

Re: Inserting item in a receipt from a list of items

Tante grazie domebil. Solo che si presenta un piccolo problema: quando seleziono uno scontrino nella finestra "Lista scontrini" a sinistra mi esce un errore con scritto "List index out of bounds (13)".

ENGLISH
Many thanks domebil. Only there is a small problem: when I select a receipt in the "List of receipts" window on the left I get an error saying "List index out of bounds (13)".

19 (edited by derek 2020-09-15 00:19:26)

Re: Inserting item in a receipt from a list of items

Hi Fabio, Domebil,
The two extra columns that you want (articoli.prezzovendita and scontrinodetail.totale) also need to be added to the grid for frmlistascontrini.button5.  Then you should be okay.
Please see attached.
Derek.

Post's attachments

Attachment icon moony corretto2.zip 356.51 kb, 288 downloads since 2020-09-15 

20 (edited by domebil 2020-09-15 06:45:51)

Re: Inserting item in a receipt from a list of items

nuova grafica e e funzioni

Post's attachments

Attachment icon moony nuova grafica e funzioni.rar 309.77 kb, 270 downloads since 2020-09-15 

Domebil

21 (edited by reteinformatica 2020-09-15 14:15:39)

Re: Inserting item in a receipt from a list of items

Good morning and thanks to both of you for the corrections.
I have only one last knot to untie and which, in my ignorance, I cannot resolve.
As you have seen in the "Articoli" table there is the "Quantità" field obviously in this field the quantity of available items is loaded (goods arrival). Well, now I don't understand if the structure of the tables is valid for this option which would be that of when a receipt is generated, the quantity of items in the receipt should be deducted from the stock which is in the "Quantità" field of the aforementioned "Articoli" table . I hope I have written clearly, the summary is if I have 10 in stock and I sell 2 there should be 8 left in the quantity available.
If, for any reason, I had to cancel the receipt or an item from a receipt, the quantity should be returned to stock.

Thanks and sorry for the somewhat confused speech.

22 (edited by domebil 2020-09-15 14:55:37)

Re: Inserting item in a receipt from a list of items

vedi ora

Post's attachments

Attachment icon moony caricati rimanenti e venduti.rar 335.84 kb, 288 downloads since 2020-09-15 

Domebil

Re: Inserting item in a receipt from a list of items

Grazie domebil per l'impegno. Non so se sbaglio qualcosa ma quando vado a fare uno scontrino non mi detrae la quantità degli articoli presenti nello scontrino dalla giacenza. Inoltre se provo a cancellare un articolo da "frmListaarticoli" mi da l'errore FOREIGN KEY constraint failed".

24 (edited by derek 2020-09-16 23:48:01)

Re: Inserting item in a receipt from a list of items

Ciao Fabio, Domebil,
The program is working okay - stock is reduced when you add a receipt, changed when you amend the quantity and added back to stock when a receipt is deleted. 
The issue is that the calculated fields in 'frmlistaarticoli.tablegrid1' are not automatically re-freshed.  This is fixed by adding a frmlistaarticoli.tablegrid1.dbupdate statement in the script (please see the attached).
The error 'foreign key constraint failed' is because you are trying to delete an item from the 'articoli' table that is being referenced in the 'scontrinodetail' table.
If an item is no longer needed in the 'articoli' table (for example, an item has been discontinued), then you could add an indicator to the 'articoli' table and then amend any relevant comboboxes to exclude discontinued items and prevent them from being used again.
Derek.

Post's attachments

Attachment icon moony caricati rimanenti e venduti2.zip 385.95 kb, 346 downloads since 2020-09-17 

Re: Inserting item in a receipt from a list of items

Hi derek,
yes now is working thank you very much. Please could you make me corrections in your graphic. Thank you so so so much!!!

domedil, ovviamente grazie anche a te, sei molto gentile. Di dove sei?