Good day! I hope someone can help me. Below I wrote down my structure and question. I have this invoice details table: Invoice Details Table
Invoice | Detail | Product | Price | VAT % | VAT € | TOTAL |
------- | -------|---------|-------|-------|-------|-------|
0001 | 1 | X | € 100 | 21 | € 21 | € 121 |
0001 | 2 | X | € 200 | 21 | € 42 | € 242 |
0001 | 3 | X | € 100 | 6 | € 6 | € 106 |
Now I want to make a select query to get the following values:
Desired query result:
Invoice | SumofVAT 6% | SumofVAT 21% |
------- | ------------|--------------|
0001 | €6 | € 63 |
After this query I can use an update query to write this Data to my invoice table:
Invoice | Client | Date | Price | VAT 6% | VAT 21% |
------- | -------|---------|-------|--------|---------|
0001 | B10 |01-01-01 | € 469 | € 6 | € 63 |
I have tried many things. The problem I run into is that when a particular only has one or more products with 1 type of VAT in %. Then the query returns Null.
I think I should have:
1) a query to calculate total VAT 6% in € for invoice xxxx ( return invoice number and total vat of 6%)
2) a query to calculate total VAT 21% in € for invoice xxxx ( return invoice number and total vat of 21%)
3) If one of these queries returns Null it should return invoice number and total number of VAT € 0,00
Hope someone can help me with this.
Aucun commentaire:
Enregistrer un commentaire