Topic: help with my app
when i make new invoice from order and save that invoice in table invoice some fields are empty? what i do wrong ?
My Visual Database → General → help with my app
when i make new invoice from order and save that invoice in table invoice some fields are empty? what i do wrong ?
Please show a screenshot where it is happening (I did not find the "Invoice" and "Order" tables). If this is a new feature, then to create a new record based on records in another table, you will need a script with an SQL query. And an explanation of where in the interface you want to add this and which tables to use.
Hi,
sorry, here are some pics
picture 2
picture 3
Hello Igor, Konstantin,
Although you have created relationships in your Data Schema between the tables Racuni / Nalozi and Racuni / Kupci, you are not actually populating values for these relationships on FormNoviRacun.
Depending on your process flow / logic, MVD normally populates these relationships for you (I think Kupci > Nalozi > Racuni would be the expected process flow). But because your processing logic is not like this, you need to populate values for the relationships yourself by using a small script (see the attachment).
If you use a utility like SQLiteStudio, you would be able to see where various relationships were not being populated. Alternatively (and just while you are developing your application), you could create a form with tablegrids that show all the fields in every table; this would also show you where the problems could be.
On FormNoviRacun, I have added Combobox1 and Combobox2 and these are filled with relevant IDs to the Kupci and Nalozi tables; the relevant columns on FormRacuni should now be populated and showing in the tablegrid. There may well be other parts of your project where you are having similar issues.
As mentioned in an earlier post, I would suggest you review the whole processing logic of your project as the flow from form to form seems (at least to me) to be overly complicated and disjointed. This, in turn, will likely lead to more problems as you further develop your project.
Regards,
Derek.
Thank you for advice
When i make
Kupci>Nalozi>Računi relationship i got error on screenshot and all Kupci(Customers) are on same Račun(Invoice).
Can you give me example how should i make relationship correctly?
I appreciate any help
Thank you
Hi
I am unable to replicate your error.
You need to attach the latest version of your project and explain the exact actions you take up to the point that you get the error.
Also, was it working before and you changed something or has it always given this error.
The more information you can give, the better any help that you receive will be - otherwise it's not much more that guessing.
Derek.
Hi,
i try, like you say, remake relationship but when i try to save Invoice i get error.
Can you please try my app and advice me what i do wrong.
now relationship is Customer>Order>Invoice
Thank you
Hi Igor,
The error message is because you have not created a relationship between the 'customer' and 'invoice' tables.
You also need to populate 'FormUnosNovogNaloga.ComboBox1' (line 11 in the script).
This will fix the error that you are getting.
However, there are a lot of other things that are not correct with your project.
As I understand it, your project should, at its most basic
1. add / edit / delete customers
2. add / edit / delete an order for a customer; this order can have one or more order line
3. add / edit / delete an invoice for one or more order lines that have been delivered to a customer.
As I have mentioned before in earlier posts, until you have this basic functionality working correctly, you should forget about features like coloring grid lines, product images, messages, database backups etc etc; they can all be added later.
I would also strongly suggest you rewrite - at the very least - FormUnosNovogNaloga and use two separate forms instead (one for orders and one for invoices).
Derek.
Hi,
thx for reply, i will try to go from start and make it simply,.But i got stuck again in start of making simply app.
Why on TableGridOrderItems shows all items instead of selected?
Igor
Hi Igor,
Have a look at the attachment which, I believe, does the basics of what you need your application to do. As mentioned earlier, if this is working, then you can add extra features later on.
The example allows
1. clients can have multiple orders
2. clients can have multiple invoices
3. orders / invoices can have multiple order / invoice lines
4. orders / invoices can initially be created with no lines if that is a requirement
5. order lines can be partially invoiced
6. order lines from different orders can appear on the same invoice
If your requirement was only for one order line = one invoice line, the data schema would be more straightforward but I don't know if that's the case.
Regards,
Derek.
Hi,
thank you, ill try to build my app over your example.
Ill go try it and reply if it will works for me.
Thank you
Hi Derek,
i cannot delete order, can you try it if it works for you?
Thank you
Hi,
found it, cascade was off
Hi,
i have one more question, how to make invoice from order?do you have some example?
in your example when i go make invoice i have to do double job, first i have to make order then again i have to make invoice.
it will be easier if i have order to make invoice from that order instead of making invoice from start.
thank you
The program works that way because
1. it allows for the possibility of more than 1 invoice per order (for example, if you have an order with 20 lines, 10 lines might be on Invoice 1, 6 lines on Invoice 2 and 4 lines on Invoice 3.
2. it allows for the possibility of more than 1 order appearing on the same invoices (for example, Invoice 4 can refer to parts (or all) of Orders A, B and C.
Are you saying that there each entire order is only ever invoiced on a single invoice (and that each invoice is only ever for a single order)?
If so, the whole approach can be simplified.
Derek.
yup,1 order for 1 invoice.
i must make order first so i can make invoice to customer.
All lines from order go to invoice
thank you
Hi Igor,
Thanks for your example project - it helps to understand what you are trying to do.
Since you explained that, for your requirement, you always make one order which then becomes one invoice (a strict 'one for one'), I wonder if you even need to have separate tables for orders and invoices - I think it can be simplified much more.
In the attached example, I suggest the following.
1. You have a table for 'transactions' (don't think in terms of an 'orders' table or an 'invoices' table at all).
2. The 'transaction' is given an automatically generated reference (record_count)
3. Each 'transaction' simply moves from one stage to another - it starts off as an 'order', it then moves to a 'delivery', it then moves to an 'invoice' and finally it moves to a 'payment'.
4. You indicate that the 'transaction' has moved from one stage to the next stage simply by ticking the relevant datetimepicker (order date, delivery date etc etc). It's very quick and involves no additional input.
5. As it moves from one stage to the next, a reference is automatically generated (based on the 'transaction reference') to indicate the stage that it has reached (for example O-00012 for an Order, D-00012 for a delivery, I-00012 for an invoice etc).
6. Additionally a 'status' flag is added ('Ordered', 'Delivered' etc) and this 'status' flag can be used in searches.
I appreciate that your requirement has many more features that you want to add later on but I wonder if this could be the basis from which you can start and build upon.
Apologies for using my own application template (it just means I can create something very easily and quickly) but if the approach in the attachment is useful, you can just copy over the ideas / code etc)
Regards,
Derek.
Thank you Derek,
ill go try it
Hi,
ok, so your advice is to make 1 table with all data (except for customers and for items/services) and then just to filter it?
Wont be to much data when i will have 10 000 work orders or more in 1 table?
I read somewhere that is better to have more tables then 1 (dont know it is true?).
Igor
Hi Igor,
10,000 records is not too many (although the PC you run it on will obviously be a factor).
You have previously stated that each order will produce an invoice (one for one); therefore if you have separate tables for orders and invoices, then you will ultimately have 2 tables, each with 10,000 records which has to be less efficient than holding all your transactions in a single table with 10,000 records.
Obviously you will be adding more tables as you develop your application further but these will be for related data rather than to hold actual transactions.
What can affect the performance is using a lot of calculated fields (very useful depending on the requirement but will probably slow your application down).
So I would look to replace calculated fields where possible (see attachment which is a re-working of an earlier example with the calculated fields removed).
Regards,
Derek.
Hi,
can you try to delete service/item?
i cannot delete but when i make cascade delete then deletes all services from orders to
Thank you,
Igor
Hi Igor,
This is the correct behaviour.
If you try to delete a record that is being used elsewhere, it will compromise the integrity of the database and created ''orphan'' records.
And if you select ''cascade/delete'', then the database will attempt to remove all the records where the record you are trying to delete is being used after which it can perform the deletion.
Referring to your project, I wonder if what you are trying to do is prevent records in the 'services' table being used once the 'pricedate' has expired? If this is the case, there are other ways to achieve this.
Have a look at the attachment for a couple of options - I have simply added a 'flag' to indicate when a service/item is no longer current and then added a filter to various comboboxes to prevent that record from being used in the future (I also set the price in the 'services' table to 0.00). Doing it this way means that you can still re-create old orders, old invoices etc that refer to services/items that have expired in the meantime.
Another way (not in the attachment) would be to validate the selection (using a script) and display appropriate error messages (but I think it's better to try and prevent it from happening in the first place).
Regards,
Derek.
Hi,
another problem i got and i dont know what i do wrong
My Visual Database → General → help with my app
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi