1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
| PROCEDURE REFRESH()
d1 est une Date = SAI_date_debut
d2 est une Date = SAI_date_fin
SI d1 <> "" ET d2 <> "" ALORS
ONG_onglets..Valeur = 1
nbjours est un entier = DateDifférence(d1, d2) + 1
extra est une chaîne = ""
SI LISTE_clients..Valeur = 0 OU LISTE_clients..Occurrence = 1 ALORS
extra = " AND clt_code LIKE '%" + SAI_filtre + "%'"
SINON
extra = " AND clt_id = " + LISTE_clients..Valeur
FIN
SI LISTE_articles..Valeur = 0 OU LISTE_articles..Occurrence = 1 ALORS
extra = extra + " AND art_reference LIKE '%" + SAI_filtre2 + "%'"
SINON
extra = extra + " AND art_id = " + LISTE_articles..Valeur
FIN
Sql est une chaîne
Rs est une Source de Données
qte est un réel
chiffre est un réel
etiquette est une chaîne
chiffre_max est un numérique
qte_max est un numérique
// RECHERCHE DES LIMITES DU GRAPHE
Sql = "SELECT max(chiffre) AS chiffre_max, max(qte) AS qte_max FROM " + ...
"(SELECT sum(bl_qte_livree * bl_prix) AS chiffre, sum(bl_qte_livree) AS qte FROM cc, clt, ccl, art, bl " + ...
"WHERE bl_date >= '" + DateVersChaîne(d1) + "' AND bl_date <= '" + DateVersChaîne(d2) + "' AND cc_id = ccl_cc_id AND cc_client = clt_id AND ccl_article_id = art_id AND bl_cc_id = cc_id AND bl_ccl = ccl_ligne " + ...
" AND bl_cc_id = ccl_cc_id " + extra + " GROUP BY bl_date) AS a"
TableSupprimeTout(TABLE_DATAS)
SI PAS HExécuteRequêteSQL(Rs,Cnx,hRequêteSansCorrection ,Sql) ALORS
Erreur("Erreur d'initialisation de la requête"+RC+HErreurInfo()+ RC + RC + Sql)
RETOUR
FIN
HLitPremier(Rs)
chiffre_max = Rs.chiffre_max * (100 / 95)
SI chiffre_max = 0 ALORS chiffre_max = 105000
qte_max = Rs.qte_max * (100 / 95)
SI qte_max = 0 ALORS qte_max = 1000
qte_max = qte_max * 2
IMG_image = ""
SI grExiste("MonGraphe") ALORS
grSupprimeTout("MonGraphe")
FIN
grCrée("MonGraphe", grAire)
grDestinationChamp("MonGraphe",IMG_image)
grSérieAxeSecondaire("MonGraphe", 1, Vrai)
grOrigine("MonGraphe", 1, nbjours, grAbscisse)
grOrigine("MonGraphe", 0, chiffre_max, grOrdonnée)
grOrigine("MonGraphe", 0, qte_max, grOrdonnéeSecondaire)
grEpaisseurTrait("MonGraphe",grToutesSéries, 2)
grEtiquetteSérie("MonGraphe", 1, "QTE")
grCouleurSérie("MonGraphe", 1, RVB(21,98,164))
grEtiquetteSérie("MonGraphe", 2, "CA")
grCouleurSérie("MonGraphe", 2, RVB(0,0,100))
i est un entier = 1
d1 = SAI_date_debut
TANTQUE d1 <= d2
Sql = "SELECT sum(bl_qte_livree) AS qte, sum(bl_qte_livree * bl_prix) AS chiffre FROM cc, clt, ccl, art, bl " + ...
"WHERE bl_date = '" + DateVersChaîne(d1) + "' AND cc_id = ccl_cc_id AND cc_client = clt_id AND ccl_article_id = art_id AND bl_cc_id = cc_id AND bl_ccl = ccl_ligne " + ...
" AND bl_cc_id = ccl_cc_id " + extra
SI PAS HExécuteRequêteSQL(Rs,Cnx,hRequêteSansCorrection ,Sql) ALORS
Erreur("Erreur d'initialisation de la requête"+RC+HErreurInfo()+ RC + RC + Sql)
RETOUR
FIN
HLitPremier(Rs)
qte = Rs.qte
chiffre = Rs.chiffre
etiquette = DateVersChaîne(d1, "JJ/MM/AA")
grAjouteDonnée("MonGraphe",1,i,qte)
grEtiquetteCatégorie("MonGraphe",i,etiquette)
grAjouteDonnée("MonGraphe",2,i,chiffre)
grEtiquetteCatégorie("MonGraphe",i,etiquette)
TableAjouteLigne(TABLE_DATAS, d1, qte,chiffre)
d1..Jour += 1
i += 1
FIN
Point_sur_serie("MonGraphe",1,"Carre",2,RougeClair, RougeClair,"")
//Info({"MonGraphe"}..NomComplet)
grDessine("MonGraphe")
dDébutDessin(IMG_image)
FIN |
Partager