51 (edited by domebil 2020-10-07 18:16:31)

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

E solo questione di ordine di procedura

Post's attachments

Attachment icon moon6.rar 336.06 kb, 277 downloads since 2020-10-07 

Domebil

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

Hello to both of you and sorry for the delay but "fortunately" they put my son's class in quarantine and now I have it all day at home, together with the other and it is not easy to do something with both of them at home 24 hours .
I understand, I didn't think there should be an order in the instructions, now I know, thank you very much to both of you.

53 (edited by reteinformatica 2021-01-04 13:35:24)

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

Hi everyone,
I'm still involved with this project, it doesn't give me peace!
In the Inventory report, "TOTALE" button of the first form, I would like to be able to calculate the purchase prices of the items for their quantities and a large final account that shows me how much is the total spent on inventories. I tried to do all sorts of possible formulas in the report but couldn't get a spider out of the hole. I hope it can be done without adding fields to the database because by now the program is in production and is already very populated.
Can you give me a new hand please?

Ciao a tutti,
ancora sono in ballo con questo progetto, non mi da pace!
Nel report Inventario, tasto "Totale" del primo form, vorrei poter fare il conto dei prezzi d'acquisto degli articoli per le loro quantità e un grande conto finale che mi faccia vedere quanto è il totale speso delle rimanenze. Ho provato a fare ogni sorta di formula possile nel report ma non sono riuscito a tirar fuori un ragno dal buco. Spero che si possa fare senza aggiungere campi al data base perchè ormai il programma è in produzione ed è già molto popolato.
Mi date una nuova mano per favore?

Post's attachments

Attachment icon moon5.zip 374.79 kb, 254 downloads since 2021-01-04 

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

Caio Fabio,
There are a couple of ways to do this but for me, the easiest is to add another calculated field (cfinventoryvalue) and use that in your report.
Because 'calculated fields' are not saved in the database and only calculated when your program runs, it won't affect your existing data.
Regards,
Derek.

Post's attachments

Attachment icon moon5a.zip 392.66 kb, 270 downloads since 2021-01-04 

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

Hi Derek and thanks so much for the correction. The result is the right one. My doubt is, since articles have already been inserted in the "Articoli" table, having changed the structure of the table, I can import the data already entered without having to rewrite them all, it seems to me that this could not be done. Now I don't have the database in production at hand but in the past I used "DB Browser for SQLite" and it seems to me that if there are more or less fields in the table it doesn't allow you to import the data of the fields that still coincide with both databases.

56 (edited by derek 2021-01-04 18:16:01)

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

Hi Fabio,
It's not a problem.
The structure of the tables hasn't changed - calculated fields are not 'proper fields' and NEVER get saved to the database.  I often think if they were simply called 'calculations' rather than 'calculated fields', it might be less confusing for people.
Have a look at the two screen shots (before I made the change and after I made the change - the structure hasn't changed). 
Also, have a look at either of the structures - you will not see any of the calculated fields because they are not fields, they are just temporary calculations.
Derek.

Post's attachments

Attachment icon fabio.zip 111.91 kb, 253 downloads since 2021-01-04 

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

Okay, Derek, thanks so much for the explanations. Tomorrow I will try to import the old database into the new one. What program do you use to manage databases?

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

Hi,
I used SQLiteStudio but I imagine that DB Browser for SQL does a very similar job.
Don't forget to backup your sqlite.db before you start anything - LOL!
Derek.

59 (edited by reteinformatica 2021-01-07 18:06:40)

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

I managed to get the database from the production program. I simply copied the database from the old project to the new one you corrected me. I tried to import the full database onto the new empty one, but it gave me various essences. Then I made a copy of the report you made for the inventory divided by summer and winter with the "ESTATE" and "INVERNO" buttons in the first form. The buttons I set them by inserting the fields as you did, I thought this was enough. But as you can see by clicking on the "ESTATE" and "INVERNO" buttons it gives an error and in addition opens the report twice, the first with the error and the second with the total inventory and not just winter or summer only.

Post's attachments

Attachment icon moon5a (2).zip 374.79 kb, 253 downloads since 2021-01-07 

60 (edited by derek 2021-01-07 23:34:12)

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

Caio Fabio,
There are a number of things to note;
1.  Frmprincipale.comInventarioestate has an associated action = REPORT.  But you are also calling the report from your script (Line 252).  This is why it is running twice.  Change it to action = 'No Action' (see screenshot1).
2.  You do not need separate versions of the inventory report for 'estate' and 'inverno';  you are already filtering the data to show just 'estate' or 'inverno' in your program before you run the report.  Report Inventario.fr3 uses the filtered data in the hidden tablegrid - ergo you only need the Inventario.fr3 report for all instances.   
3.  Your data is incorrect - if you look at the 'articoli' table, id_stagione is blank and this is why the 'estate' and the 'inverno' reports show all data.  See screenshot2.  If you correct the data (frminserimentoarticoli), this will fix the problem.
4.  I am not sure I understand the problem you had with copying the live database.  All you need to do is:
4.1  delete sqlite.db from the latest program that has your report changes
4.2  copy sqlite.db from your 'live' system.  As there have been only changes to the program and no changes to the data structure, you should not get any errors.  You don't need to do any 'importing' of data at all.
I have made changes (as per the comments above) and these are in the attachment (Moon5c) together with the screenshots.
I've also attached an alternative way of approaching it (attachment Moon5d) which lets you select any season, rather than using a script and hard coding the selected seasons.  Just a thought.
Hopefully this gets you moving forward,
Derek.

Post's attachments

Attachment icon moon5cd.zip 1.06 mb, 258 downloads since 2021-01-08 

61 (edited by reteinformatica 2021-01-08 17:26:38)

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

Hi derek,
I never know how to thank you. Thank you very much also for the explanations that always interest me.
I also really like the setting you gave the inventory. I hadn't thought that the same model could be used since the results were already filtered. Maybe I had explained myself wrong but yes I had simply replaced the database with the one already filled after trying to import it but since it couldn't I thought about replacing it.
Unfortunately I noticed an error that has always been there, a really strange error: in the VAT field it does not put the VAT calculation in reference to the purchase price or it does not calculate 22% on the purchase price but it puts 22 which is the percentage . The very strange thing is that it does not do this for all articles but only on some, on many but not on all. In some, it regularly calculates the percentage.
For example, the article with code 2831 "EMANUELA". I'm gonna crazy to understand why.

I insert the project with the database in production which shows the problem.

Post's attachments

Attachment icon moon5d.zip 464.9 kb, 246 downloads since 2021-01-08 

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

a me lo da bene

Domebil

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

alcuni sono sbagliati, sembra che tu li abbia importati in maniera sbagliata perchè i calcoli funzionano

Domebil

64 (edited by reteinformatica 2021-01-09 12:21:05)

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

Ciao Domenico,
buon anno! Il problema è persistente dalla prima edizione, me l'ha fatto notare la mia amica per cui ho fatto il programma. Hai visto nel database che è quello che ha riempito lei, che in molti c'è 22 a prescindere dal costo di acquisto inserito?
Ad esempio fai l'inventario Inverno e prendi l'ottavo, il prezzo di acquisto è 19,90 e l'IVA 22 e ce ne sono molti così. Gli articoli che non hanno 22 hanno la cifra corretta o almeno credo, quelli di cui ho fatto il calcolo erano corretti ma ovviamente non l'ho fatto di tutti.
La cosa spiazzante è che non lo fa con tutti.
È pieno!!!

663055 SCARPA DONNA 28,90 € 22,00
663045 SCARPA DONNA 26,90 € 22,00
641025 SCARPA DONNA 28,50 € 22,00
643325 SCARPA DONNA 24,90 € 22,00
650255 SCARPA DONNA 24,90 € 22,00
650175 SCARPA DONNA 24,50 € 22,00
650185 SCARPA DONNA 24,50 € 22,00
451111 SCARPA DONNA 24,50 € 22,00
421060 SCARPA DONNA 24,90 € 22,00
643196 SCARPA DONNA 24,50 € 22,00
451097 SCARPA DONNA 26,90 € 22,00

65 (edited by derek 2021-01-09 02:05:38)

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

Ciao Fabio, Domenico,
In table articoli, articoli.aliquotaivaacquisto is 'null'  (see screenshot1).  This is what is causing VAT values to show as '22'.  This will correct itself if the record is edited (which is why some of them are showing correctly and some not).
The problem is because you have selected the wrong field for frminserimentoarticoli.edaliquotaivaacquisto;  it is using articoli.ivaacquisto and I think it should be articoli.aliquotaivaacquisto (see screenshot2).
To force all the VAT values to be correct, I have added a temporary button ('Fix VAT problem - see screenshot3) which runs a small script (see screenshot4).
I have assumed that the purchase VAT rate is 22% as that is the default value you specify in the form.
I have run this code to a) update all of the aliquotaivaacquisto values to be 22% and then recalculated all the ivaacquisto values.
If the data you send with your attachment hasn't changed, then this should be okay now and you don't need to do anything else. 
But if the data has changed, you will need to replace the old sqlite.db with the latest sqlite.db and then run the 'Fix VAT problem' button again (Run Step 1 first and then Step 2).
Once you are satisfied that your data is correct, you can remove the 'Fix VAT problem' button and delete the relevant code from the script.
Hope all of that makes sense.
Derek.

Post's attachments

Attachment icon moon5d fixed.zip 1.42 mb, 266 downloads since 2021-01-09 

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

Grazie Derek
Infatti ora funziona

Thanks Derek
In fact now it works

Domebil

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

Thank you very very very much Derek!!! For the explainations too!

68 (edited by reteinformatica 2021-01-11 17:37:15)

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

Hello everyone
I'm here smile I overwritten the database with the one containing the data and this other problem came up: in all the items disappeared on the 22nd in the "Aliquota Iva Acquisto" field. Nevertheless if I make an inventory the vat is calculated but on many items returns 22, which is the percentage and not the exact calculation, as from previous post.
I also tried with the "Fix VAT problem" button which, if I have understood correctly from the instructions, should update the field to 22.
Thank you and excuse this umpteenth disturbance.
As always, I re-enter the project with the database completed.

Post's attachments

Attachment icon moon5d fixed2.zip 488.28 kb, 246 downloads since 2021-01-11 

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

Screenshot

Post's attachments

Attachment icon Immagine.jpg 95.98 kb, 120 downloads since 2021-01-11 

70 (edited by domebil 2021-01-11 18:49:48)

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

Ora è ok, praticamente il campo era CURRENCY è invece deve essere INTEGER dato che non e un campo di valuta

Post's attachments

Attachment icon moon5d buono.rar 451.91 kb, 257 downloads since 2021-01-11 

Domebil

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

Ciao Domenico,
non vedo nessuna modifica nel database sul campo "AliquotaIvaAcquisto". Lo vedo sempre Currency e vedo sempre il campo vuoto aprendo il form degli articoli. Purtroppo vedo anche un sacco di 22 al posto del calcolo dell'IVA facendo l'inventario.

72 (edited by derek 2021-01-12 13:55:10)

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

Ciao Fabio, Domenico,
It sounds as if 2 things may have happened.
1)  you might have clicked the 'Fix VAT Problem' button but the relevant lines in the script (Line 4 and Line 6) were still commented out.  Remove the '//' from the start of Line 4 and Line 6 before running the 'Fix VAT Problem'.  In the attachment, the comment marks ('//') have now been removed.
2)  you might have changed the definition of VAT from 'CURRENCY' to 'INTEGER' (personally, I use 'REAL' but here in England, VAT is 17.5% so 'INTEGER' wouldn't work).  Whenever you change the definition, it will lose whatever values were previously in there, in which case you need to run the 'Fix VAT Problem' again.
What I often do is add a simple form to my project when I'm still developing it so that I can see what values are actually in the relevant tables.  I've added this to your project (frmdatabasecheck) but you can then remove it once you have checked everything is okay).
Derek.

Post's attachments

Attachment icon moon5e fixed.zip 602.76 kb, 247 downloads since 2021-01-12 

73 (edited by reteinformatica 2021-01-12 14:15:52)

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

Hi Derek and thank you again. I didn't notice that the commands were commented sad

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

Ciao di nuovo Fabio,
I made a small change to the 'Fix VAT Problem' button so that the script should update a bit faster.
Hope everything is working okay now.
Derek.

Post's attachments

Attachment icon moon5e fixed(1).zip 604.34 kb, 301 downloads since 2021-01-12 

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

Hi everyone, I hope everyone is fine. I have to go back to this project, I did some attempts but ninth I managed to find a solution. I should delete some products but being these inserted in invoices (receipts) I don't allow it. I imagine for the links that there are in the tables. Is there a way to eliminate the products even if they are inserted in invoices? No problem if the invoices are also deleted where the products are inserted, indeed on the contrary it would also be better than in one shot it could be eliminated product and invoice. Thanks!

Ciao a tutti, spero che stiate tutti bene. Devo tornare su questo progetto, ho fatto un po' di tentativi ma nono sono riuscito a trovare una soluzione. Dovrei cancellare alcuni prodotti ma essendo questi inseriti nelle fatture (Scontrini) non me lo permette. Immagino per i legami che ci siano nelle tabelle. C'è un modo per eliminare i prodotti anche se sono inseriti nelle fatture? Nessun problema se vengono eliminate anche le fatture dove i prodotti sono inseriti, anzi al contrario sarebbe anche meglio che in un colpo solo si potesse eliminare prodotto e fattura. Grazie!