Le Canada est sans doute l'un des pays ou les taxes de vente sur les produits et services sont les plus compliqués à appliquer. Et pour cause : Elle varie d'une province ou territoire à l'autre, elle est parfois composé ou séparé. Voici leur représentation en date du mois septembre de l'année 2006 :
Province/Territoire | Taxe 1 | Taxe 2 | Taux |
---|---|---|---|
Alberta | TVH: 6% | Aucune | 6% |
Colombie-Britannique | TVH: 6% | TVP: 7% | 13% |
Ile-du-Prince-Édouard | TPS: 6% | TVP: 10% | 16.6% |
Manitoba | TPS: 6% | TVP: 7% | 13% |
Nouveau-Brunswick | TVH: 14% | Aucune | 14% |
Nouvelle-Écosse | TVH: 14% | Aucune | 14% |
Nunavut | TVH: 6% | Aucune | 6% |
Ontario | TPS: 6% | TVP: 8% | 14% |
Québec | TPS: 6% | TVQ: 7.5% | 13.95% |
Saskatchewan | TPS: 6% | TVP: 7% | 13% |
Terre-Neuve/Labrador | TVH: 14% | Aucune | 14% |
Territoire du Nord Ouest | TVH: 6% | Aucune | 6% |
Territoire du Yukon | TVH: 6% | Aucune | 6% |
Tout d'abord, voici un premier exemple permet d'afficher des données complètes sur les taxes en QuickBASIC :
- DECLARE FUNCTION Empattement$ (Chaine AS STRING, Espace!)
-
- DIM Compute(12) AS STRING
- DIM TaxName1(12) AS STRING
- DIM TaxRate1(12) AS DOUBLE
- DIM TaxName2(12) AS STRING
- DIM TaxRate2(12) AS DOUBLE
- DIM RegionMID(12) AS STRING
- DIM RegionNameEN(12) AS STRING
- DIM RegionNameFR(12) AS STRING
- Compute(0) = "C"
- Compute(1) = "C"
- Compute(2) = "C"
- Compute(3) = "C"
- Compute(4) = "S"
- Compute(5) = "C"
- Compute(6) = "S"
- Compute(7) = "S"
- Compute(8) = "S"
- Compute(9) = "S"
- Compute(10) = "C"
- Compute(11) = "S"
- Compute(12) = "S"
- TaxName1(0) = "TPS"
- TaxName1(1) = "TVH"
- TaxName1(2) = "TVH"
- TaxName1(3) = "TVH"
- TaxName1(4) = "TPS"
- TaxName1(5) = "TVH"
- TaxName1(6) = "TPS"
- TaxName1(7) = "TVH"
- TaxName1(8) = "TVH"
- TaxName1(9) = "TPS"
- TaxName1(10) = "TPS"
- TaxName1(11) = "TPS"
- TaxName1(12) = "TVH"
- TaxRate1(0) = 6!
- TaxRate1(1) = 14!
- TaxRate1(2) = 14!
- TaxRate1(3) = 14!
- TaxRate1(4) = 6!
- TaxRate1(5) = 6!
- TaxRate1(6) = 6!
- TaxRate1(7) = 6!
- TaxRate1(8) = 6!
- TaxRate1(9) = 6!
- TaxRate1(10) = 6!
- TaxRate1(11) = 6!
- TaxRate1(12) = 6!
- TaxName2(0) = "TVQ"
- TaxName2(1) = ""
- TaxName2(2) = ""
- TaxName2(3) = ""
- TaxName2(4) = "TVP"
- TaxName2(5) = ""
- TaxName2(6) = "TVP"
- TaxName2(7) = ""
- TaxName2(8) = ""
- TaxName2(9) = "TVP"
- TaxName2(10) = "TVP"
- TaxName2(11) = "TVP"
- TaxName2(12) = ""
- TaxRate2(0) = 7.5
- TaxRate2(1) = 0!
- TaxRate2(2) = 0!
- TaxRate2(3) = 0!
- TaxRate2(4) = 7!
- TaxRate2(5) = 0!
- TaxRate2(6) = 7!
- TaxRate2(7) = 0!
- TaxRate2(8) = 0!
- TaxRate2(9) = 8!
- TaxRate2(10) = 10!
- TaxRate2(11) = 7!
- TaxRate2(12) = 0!
- RegionMID(0) = "QC"
- RegionMID(1) = "NS"
- RegionMID(2) = "NB"
- RegionMID(3) = "NF"
- RegionMID(4) = "BC"
- RegionMID(5) = "AB"
- RegionMID(6) = "MB"
- RegionMID(7) = "NT"
- RegionMID(8) = "NU"
- RegionMID(9) = "ON"
- RegionMID(10) = "PE"
- RegionMID(11) = "SK"
- RegionMID(12) = "YT"
- RegionNameEN(0) = "Quebec"
- RegionNameEN(1) = "Nova Scotia"
- RegionNameEN(2) = "New Brunswick"
- RegionNameEN(3) = "Newfoundland"
- RegionNameEN(4) = "British Columbia"
- RegionNameEN(5) = "Alberta"
- RegionNameEN(6) = "Manitoba"
- RegionNameEN(7) = "Northwest Territories"
- RegionNameEN(8) = "Nunavut"
- RegionNameEN(9) = "Ontario"
- RegionNameEN(10) = "Prince Edward Island"
- RegionNameEN(11) = "Saskatchewan"
- RegionNameEN(12) = "Yukon Territory"
- RegionNameFR(0) = "Québec"
- RegionNameFR(1) = "Nouvelle-Écosse"
- RegionNameFR(2) = "Nouveau-Brunswick"
- RegionNameFR(3) = "Terre-Neuve/Labrador"
- RegionNameFR(4) = "Colombie-Britanique"
- RegionNameFR(5) = "Alberta"
- RegionNameFR(6) = "Manitoba"
- RegionNameFR(7) = "Territoire du Nord Ouest"
- RegionNameFR(8) = "Nunavut"
- RegionNameFR(9) = "Ontario"
- RegionNameFR(10) = "Ile-du-Prince-Édouard"
- RegionNameFR(11) = "Saskatchewan"
- RegionNameFR(12) = "Territoire du Yukon"
- PRINT "Nom de la province/territoire MID Taxe 1 Taxe 2 Taux"
- FOR I = LBOUND(Compute) TO UBOUND(Compute)
- PRINT Empattement(RegionNameFR(I), 31);
- PRINT Empattement(RegionMID(I), 5);
- PRINT TaxName1(I); ":"; TaxRate1(I); "%"; " ";
- IF TaxName2(I) = "" THEN
- PRINT SPC(10);
- ELSE
- PRINT Empattement(TaxName2(I) + ":" + STR$(TaxRate2(I)) + "%", 10);
- END IF
- SELECT CASE Compute(I)
- CASE "S" 'Séparé
- PRINT TaxRate1(I) + TaxRate2(I); "%"; " "
- CASE "C" 'Composé
- PRINT TaxRate1(I) + ((TaxRate2(I) * (100 + TaxRate1(I))) / 100); "%"; " "
- END SELECT
- NEXT
-
- FUNCTION Empattement$ (Chaine AS STRING, Espace)
- Empattement$ = Chaine + SPACE$(Espace - LEN(Chaine$))
- END FUNCTION
on obtiendra le résultat suivant :
Nom de la province/territoire | MID | Taxe 1 | Taxe 2 | Taux |
Québec | QC | TPS:6% | TVQ:7.5% | 13.95% |
Nouvelle-Écosse | NS | TVH:14% | 14% | |
Nouveau-Brunswick | NB | TVH:14% | 14% | |
Terre-Neuve/Labrador | NF | TVH:14% | 14% | |
Colombie-Britanique | BC | TPS:6% | TVP:7% | 13% |
Alberta | AB | TVH:6% | 6% | |
Manitoba | MB | TPS:6% | TVP:7% | 13% |
Territoire du Nord Ouest | NT | TVH:6% | 6% | |
Nunavut | NU | TVH:6% | 6% | |
Ontario | ON | TPS:6% | TVP:8% | 14% |
Ile-du-Prince-Édouard | PE | TPS:6% | TVP:10% | 16.6% |
Saskatchewan | SK | TPS:6% | TVP:7% | 13% |
Territoire du Yukon | YT | TVH:6% | 6% |
Ensuite, voici un deuxième exemple permet de calculer la taxe de vente d'un produit ou service en fonction des provinces ou territoires en QuickBASIC :
- DECLARE FUNCTION Empattement$ (Chaine AS STRING, Espace!)
-
- DIM Compute(12) AS STRING
- DIM TaxName1(12) AS STRING
- DIM TaxRate1(12) AS DOUBLE
- DIM TaxName2(12) AS STRING
- DIM TaxRate2(12) AS DOUBLE
- DIM RegionMID(12) AS STRING
- DIM RegionNameEN(12) AS STRING
- DIM RegionNameFR(12) AS STRING
- DIM I AS INTEGER
- Compute(0) = "C"
- Compute(1) = "C"
- Compute(2) = "C"
- Compute(3) = "C"
- Compute(4) = "S"
- Compute(5) = "C"
- Compute(6) = "S"
- Compute(7) = "S"
- Compute(8) = "S"
- Compute(9) = "S"
- Compute(10) = "C"
- Compute(11) = "S"
- Compute(12) = "S"
- TaxName1(0) = "TPS"
- TaxName1(1) = "TVH"
- TaxName1(2) = "TVH"
- TaxName1(3) = "TVH"
- TaxName1(4) = "TPS"
- TaxName1(5) = "TVH"
- TaxName1(6) = "TPS"
- TaxName1(7) = "TVH"
- TaxName1(8) = "TVH"
- TaxName1(9) = "TPS"
- TaxName1(10) = "TPS"
- TaxName1(11) = "TPS"
- TaxName1(12) = "TVH"
- TaxRate1(0) = 6!
- TaxRate1(1) = 14!
- TaxRate1(2) = 14!
- TaxRate1(3) = 14!
- TaxRate1(4) = 6!
- TaxRate1(5) = 6!
- TaxRate1(6) = 6!
- TaxRate1(7) = 6!
- TaxRate1(8) = 6!
- TaxRate1(9) = 6!
- TaxRate1(10) = 6!
- TaxRate1(11) = 6!
- TaxRate1(12) = 6!
- TaxName2(0) = "TVQ"
- TaxName2(1) = ""
- TaxName2(2) = ""
- TaxName2(3) = ""
- TaxName2(4) = "TVP"
- TaxName2(5) = ""
- TaxName2(6) = "TVP"
- TaxName2(7) = ""
- TaxName2(8) = ""
- TaxName2(9) = "TVP"
- TaxName2(10) = "TVP"
- TaxName2(11) = "TVP"
- TaxName2(12) = ""
- TaxRate2(0) = 7.5
- TaxRate2(1) = 0!
- TaxRate2(2) = 0!
- TaxRate2(3) = 0!
- TaxRate2(4) = 7!
- TaxRate2(5) = 0!
- TaxRate2(6) = 7!
- TaxRate2(7) = 0!
- TaxRate2(8) = 0!
- TaxRate2(9) = 8!
- TaxRate2(10) = 10!
- TaxRate2(11) = 7!
- TaxRate2(12) = 0!
- RegionMID(0) = "QC"
- RegionMID(1) = "NS"
- RegionMID(2) = "NB"
- RegionMID(3) = "NF"
- RegionMID(4) = "BC"
- RegionMID(5) = "AB"
- RegionMID(6) = "MB"
- RegionMID(7) = "NT"
- RegionMID(8) = "NU"
- RegionMID(9) = "ON"
- RegionMID(10) = "PE"
- RegionMID(11) = "SK"
- RegionMID(12) = "YT"
- RegionNameEN(0) = "Quebec"
- RegionNameEN(1) = "Nova Scotia"
- RegionNameEN(2) = "New Brunswick"
- RegionNameEN(3) = "Newfoundland"
- RegionNameEN(4) = "British Columbia"
- RegionNameEN(5) = "Alberta"
- RegionNameEN(6) = "Manitoba"
- RegionNameEN(7) = "Northwest Territories"
- RegionNameEN(8) = "Nunavut"
- RegionNameEN(9) = "Ontario"
- RegionNameEN(10) = "Prince Edward Island"
- RegionNameEN(11) = "Saskatchewan"
- RegionNameEN(12) = "Yukon Territory"
- RegionNameFR(0) = "Québec"
- RegionNameFR(1) = "Nouvelle-Écosse"
- RegionNameFR(2) = "Nouveau-Brunswick"
- RegionNameFR(3) = "Terre-Neuve/Labrador"
- RegionNameFR(4) = "Colombie-Britanique"
- RegionNameFR(5) = "Alberta"
- RegionNameFR(6) = "Manitoba"
- RegionNameFR(7) = "Territoire du Nord Ouest"
- RegionNameFR(8) = "Nunavut"
- RegionNameFR(9) = "Ontario"
- RegionNameFR(10) = "Ile-du-Prince-Édouard"
- RegionNameFR(11) = "Saskatchewan"
- RegionNameFR(12) = "Territoire du Yukon"
-
- PRINT "Nom de la province/territoire Taxe 1 Taxe 2 Taux 1$ 15$ 44,95$ 100$"
- FOR I = LBOUND(Compute) TO UBOUND(Compute)
- DIM Tax AS DOUBLE
- Tax = 0
- PRINT Empattement(RegionNameFR(I), 25);
- PRINT TaxName1(I); ":"; TaxRate1(I); "%"; " ";
- IF TaxName2(I) = "" THEN
- PRINT SPC(10);
- ELSE
- PRINT Empattement(TaxName2(I) + ":" + STR$(TaxRate2(I)), 10);
- END IF
- SELECT CASE Compute(I)
- CASE "S" 'Séparé
- Tax = TaxRate1(I) + TaxRate2(I)
- CASE "C" 'Composé
- Tax = TaxRate1(I) + ((TaxRate2(I) * (100 + TaxRate1(I))) / 100)
- END SELECT
- PRINT USING "##.##% "; Tax;
- PRINT USING "#.##$ "; (1 * (1 + (Tax / 100)));
- PRINT USING "##.##$ "; (15 * (1 + (Tax / 100)));
- PRINT USING "##.##$ "; (44.95 * (1 + (Tax / 100)));
- PRINT USING "###.##$ "; (100 * (1 + (Tax / 100)))
- NEXT
-
- FUNCTION Empattement$ (Chaine AS STRING, Espace)
- Empattement$ = Chaine + SPACE$(Espace - LEN(Chaine$))
- END FUNCTION
on obtiendra le résultat suivant :
Nom de la province/territoire | Taxe 1 | Taxe 2 | Taux | 1$ | 15$ | 44,95$ | 100$ |
Québec | TPS:6% | TVQ:7.5% | 13.95% | 1.1395$ | 17.0925$ | 51.220525$ | 113.95$ |
Nouvelle-Écosse | TVH:14% | 14% | 1.14$ | 17.1$ | 51.243$ | 114$ | |
Nouveau-Brunswick | TVH:14% | 14% | 1.14$ | 17.1$ | 51.243$ | 114$ | |
Terre-Neuve/Labrador | TVH:14% | 14% | 1.14$ | 17.1$ | 51.243$ | 114$ | |
Colombie-Britanique | TPS:6% | TVP:7% | 13% | 1.13$ | 16.95$ | 50.7935$ | 113$ |
Alberta | TVH:6% | 6% | 1.06$ | 15.9$ | 47.647$ | 106$ | |
Manitoba | TPS:6% | TVP:7% | 13% | 1.13$ | 16.95$ | 50.7935$ | 113$ |
Territoire du Nord Ouest | TVH:6% | 6% | 1.06$ | 15.9$ | 47.647$ | 106$ | |
Nunavut | TVH:6% | 6% | 1.06$ | 15.9$ | 47.647$ | 106$ | |
Ontario | TPS:6% | TVP:8% | 14% | 1.14$ | 17.1$ | 51.243$ | 114$ |
Ile-du-Prince-Édouard | TPS:6% | TVP:10% | 16.6% | 1.166$ | 17.49$ | 52.4117$ | 116.6$ |
Saskatchewan | TPS:6% | TVP:7% | 13% | 1.13$ | 16.95$ | 50.7935$ | 113$ |
Territoire du Yukon | TVH:6% | 6% | 1.06$ | 15.9$ | 47.647$ | 106$ |
Dernière mise à jour : Mercredi, le 14 septembre 2016