Novembre 2024 | Lun | Mar | Mer | Jeu | Ven | Sam | Dim |
---|
| | | | 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 | | Calendrier |
|
|
| Quelques lignes de code plus tard.... | |
|
+4Nardo26 Jean Claude Klaus Yannick 8 participants | |
Auteur | Message |
---|
Yannick
Nombre de messages : 8635 Age : 53 Localisation : Bretagne Date d'inscription : 15/02/2010
| Sujet: Quelques lignes de code plus tard.... Mer 27 Juin 2012 - 0:05 | |
| Voilà le code , certainement perfectionnable , d'un petit utilitaire que j'ai fait pour ma belle mère. Elle est chez Suez ,et se bat contre des moulins à vent. je lui ai fait ce petit code pour suivre ses consos. Ps : il faut YGF.dll qui est téléchargeable sur le site de Klaus , dans Tri de grid par date ( une occasion de visiter pour ceux qui ne l'ont pas déjà fait ) - Code:
-
rem ' les variables d'affichages dim x,L%,L$,C1$,C2$,C3$,C4$,sep%,m,F7%,F8% dim Dossier$,Inf%,Option% rem ' Les variables de calcul rem ' Les variables fixes dim G_ht,Ehc_ht,Ehp_ht,Tx_Tva1,Tx_Tva2,G_CTA,E_CTA,TDC,TMC,CoefG,CSPE rem ' Les variables de facturation dim D1$,D2$,D3$,D4$,DebG%,FinG%,DebE_hc%,FinE_hc%,DebE_hp%,FinE_hp% rem ' Les variables de relevé dim D5$,RG%,RE_hc%,RE_hp% rem ' Les variables calculés dim D1%,D2%,D3%,D4%,D5%,J%,M%,A% dim Njfg%,Njfe%,Njrg%,Njre% dim ConsoG,ConsoE_hc,ConsoE_hp dim ConsoG2,ConsoE_hc2,ConsoE_hp2 dim NbreJ1,NbreJ2,NbreJ3,NbreJ4 dim ConsoG3,ConsoE_hc3,ConsoE_hp3 dim MFG,MFE_hc,MFE_hp dim MRG,MRE_hc,MRE_hp dim DiffG,DiffE_hc,DiffE_hp dim a$,b$,c%,c$,d%,e%,z$ rem ' les fonctions du menu label init, Nouveau,Visu,Quitter,Compar,Param_Voir,Param_Modif,APP rem ' les fonctions du container 100 label Enrgt_R,Annul_R rem ' les fonctions du container 200 label Remp_Grid,Graph,Dessin,Dessin1,Dessin2,Q_Graph rem ' les fonctions de container 300 label Compar_2 rem ' les fonctions de container 350 label Calcul,Cache700,Charge rem ' les fonctions du container 500 label Init_Var rem ' fenetre principale Application_title "GDF Suez" caption 0,"GDF Suez" width 0,500 : height 0,300 :left 0,(screen_x-500)/2 : top 0,(screen_y-300)/2
main_menu 1 sub_menu 2 :parent 2,1 :caption 2,"Fichiers" sub_menu 3 :parent 3,2 :caption 3,"Nouveau relevé" :on_click 3,Nouveau sub_menu 4 :parent 4,2 :caption 4,"Visualiser un relevé" :on_click 4,Visu sub_menu 5 :parent 5,2 :caption 5,"--------------------" sub_menu 6 :parent 6,2 :caption 6,"" sub_menu 7 :parent 7,2 :caption 7,"Quitter" :on_click 7,Quitter sub_menu 8 :parent 8,1 :caption 8,"Outils" sub_menu 9 :parent 9,8 :caption 9,"Comparateur" :on_click 9,Compar sub_menu 10:parent 10,1 :caption 10,"Paramètres" sub_menu 11:parent 11,10:caption 11,"Voir" :on_click 11,Param_Voir sub_menu 12:parent 12,10:caption 12,"Modifier" :on_click 12,Param_Modif sub_menu 13:parent 13,1 :caption 13,"A Propos..." :on_click 13,APP
Container 100:caption 100," Nouveau relevé " :hide 100 top 100,10 :left 100,10 :width 100,465 :height 100,220 :font_name 100,"Times new roman":font_size 100,10 Alpha 101:parent 101,100:top 101,25 :left 101,25 :caption 101,"Date" Alpha 102:parent 102,100:top 102,90 :left 102,25 :caption 102,"Compteur Gaz" Alpha 103:parent 103,100:top 103,90 :left 103,135 :caption 103,"Compteur EDF Hc" Alpha 104:parent 104,100:top 104,90 :left 104,260 :caption 104,"Compteur EDF Hp" Edit 105 :parent 105,100:top 105,45 :left 105,25 :width 105,80 Edit 106 :parent 106,100:top 106,110:left 106,25 :width 106,90 Edit 107 :parent 107,100:top 107,110:left 107,135 :width 107,90 Edit 108 :parent 108,100:top 108,110:left 108,260 :width 108,90 Button 109:parent 109,100:top 109,190:left 109,300:caption 109,"Enregistrer":cursor_point 109:on_click 109,Enrgt_R Button 110:parent 110,100:top 110,190:left 110,380:caption 110,"Annuler" :cursor_point 110:on_click 110,Annul_R
Container 200:caption 200," Mes relevés " :hide 200 top 200,10 :left 200,10 :width 200,465 :height 200,220 :font_name 200,"Times new roman":font_size 200,10 Grid 201:parent 201,200:top 201,25:left 201,5:width 201,450:height 201,150:grid_column 201,7:grid_row 201,2 Grid_column_width 201,60 grid_write 201,1,1,"Date" :grid_write 201,1,2,"Gaz" :grid_write 201,1,3,"Elec. Hc":grid_write 201,1,4,"Elec. Hp" grid_write 201,1,5,"C.Gaz":grid_write 201,1,6,"C. Elec hc":grid_write 201,1,7,"C. Elec hp" grid_row_height 201,20 Button 202:parent 202,200:top 202,190:left 202,380:caption 202,"Graphique" :cursor_point 202:on_click 202,Graph
Container 300:caption 300," Comparateur - La Facture " :hide 300 top 300,10 :left 300,10 :width 300,465 :height 300,220 :font_name 300,"Times new roman":font_size 300,10 alpha 301:parent 301,300:top 301,25:left 301,10:caption 301,"Facture :":font_color 301,125,25,7 alpha 302:parent 302,300:top 302,55:left 302,50:caption 302,"Dates début Dates fin" alpha 303:parent 303,300:top 303,55:left 303,250:caption 303,"Index début" alpha 304:parent 304,300:top 304,55:left 304,350:caption 304,"Index fin" alpha 305:parent 305,300:top 305,75:left 305,10:caption 305,"Gaz" alpha 306:parent 306,300:top 306,105:left 306,10:caption 306,"Elec." edit 307:parent 307,300:top 307,72:left 307,50:width 307,65 edit 308:parent 308,300:top 308,72:left 308,130:width 308,65 edit 309:parent 309,300:top 309,72:left 309,250:width 309,90 edit 310:parent 310,300:top 310,72:left 310,350:width 310,90 edit 311:parent 311,300:top 311,103:left 311,50:width 311,65 edit 312:parent 312,300:top 312,103:left 312,130:width 312,65 edit 313:parent 313,300:top 313,103:left 313,250:width 313,90 edit 314:parent 314,300:top 314,103:left 314,350:width 314,90 edit 315:parent 315,300:top 315,134:left 315,250:width 315,90 edit 316:parent 316,300:top 316,134:left 316,350:width 316,90 alpha 317:parent 317,300:top 317,105:left 317,230:caption 317,"Hc":font_italic 317 alpha 318:parent 318,300:top 318,134:left 318,230:caption 318,"Hp":font_italic 318 Button 349:parent 349,300:top 349,190:left 349,380:caption 349,"Mon relevé" :cursor_point 349:on_click 349,Compar_2
Container 350:caption 350," Comparateur - Mon relevé " :hide 350 top 350,10 :left 350,10 :width 350,465 :height 350,220 :font_name 350,"Times new roman":font_size 350,10 alpha 351:parent 351,350:top 351,25:left 351,10:caption 351,"Mon relevé :":font_color 351,125,25,7 alpha 352:parent 352,350:top 352,55:left 352,50:caption 352,"Date" alpha 353:parent 353,350:top 353,55:left 353,250:caption 353,"Relevé" edit 354:parent 354,350:top 354,72:left 354,50:width 354,65 edit 355:parent 355,350:top 355,72:left 355,250:width 355,90 edit 356:parent 356,350:top 356,103:left 356,250:width 356,90 edit 357:parent 357,350:top 357,134:left 357,250:width 357,90 alpha 358:parent 358,350:top 358,105:left 358,230:caption 358,"Hc":font_italic 358 alpha 359:parent 359,350:top 359,134:left 359,230:caption 359,"Hp":font_italic 359 Button 398:parent 398,350:top 398,190:left 398,260:caption 398,"Charger" :cursor_point 398:on_click 398,Charge hint 398,"Charge le dernier relevé enregistré" Button 399:parent 399,350:top 399,190:left 399,380:caption 399,"Calculer" :cursor_point 399:on_click 399,Calcul
Container 400:caption 400," Mes Paramètres " :hide 400 top 400,10 :left 400,10 :width 400,465 :height 400,220 :font_name 400,"Times new roman":font_size 400,10 alpha 401:parent 401,400:top 401,35:left 401,10:caption 401,"Tarif Gaz Kwh Ht :" alpha 402:parent 402,400:top 402,65:left 402,10:caption 402,"Tarif Elec.(Hc) Kwh Ht :" alpha 403:parent 403,400:top 403,95:left 403,10:caption 403,"Tarif Elec.(Hp) Kwh Ht :" alpha 404:parent 404,400:top 404,125:left 404,10:caption 404,"Tx TVA 1 :" alpha 405:parent 405,400:top 405,155:left 405,10:caption 405,"Tx TVA 2 :" alpha 406:parent 406,400:top 406,35:left 406,250:caption 406,"CTA Gaz Ht :" alpha 407:parent 407,400:top 407,65:left 407,250:caption 407,"CTA Elec. Ht :" alpha 408:parent 408,400:top 408,95:left 408,250:caption 408,"TDC Ht :" alpha 409:parent 409,400:top 409,125:left 409,250:caption 409,"TMC Ht :" alpha 421:parent 421,400:top 421,155:left 421,250:caption 421,"Coef Gaz :" alpha 422:parent 422,400:top 422,185:left 422,250:caption 422,"CSPE :" alpha 410:parent 410,400:top 410,35:left 410,150 :font_color 410,188,5,11 alpha 411:parent 411,400:top 411,65:left 411,150 :font_color 411,188,5,11 alpha 412:parent 412,400:top 412,95:left 412,150 :font_color 412,188,5,11 alpha 413:parent 413,400:top 413,125:left 413,150:font_color 413,188,5,11 alpha 414:parent 414,400:top 414,155:left 414,150:font_color 414,188,5,11 alpha 415:parent 415,400:top 415,35:left 415,350 :font_color 415,188,5,11 alpha 416:parent 416,400:top 416,65:left 416,350 :font_color 416,188,5,11 alpha 417:parent 417,400:top 417,95:left 417,350 :font_color 417,188,5,11 alpha 418:parent 418,400:top 418,125:left 418,350:font_color 418,188,5,11 alpha 419:parent 419,400:top 419,155:left 419,350:font_color 419,188,5,11 alpha 420:parent 420,400:top 420,185:left 420,350:font_color 420,188,5,11
Container 500:caption 500," Modifier les Paramètres ":hide 500 top 500,10 :left 500,10 :width 500,465 :height 500,220 :font_name 500,"Times new roman":font_size 500,10 alpha 501:parent 501,500:top 501,35:left 501,10:caption 501,"Tarif Gaz Kwh Ht :" alpha 502:parent 502,500:top 502,65:left 502,10:caption 502,"Tarif Elec.(Hc) Kwh Ht :" alpha 503:parent 503,500:top 503,95:left 503,10:caption 503,"Tarif Elec.(Hp) Kwh Ht :" alpha 504:parent 504,500:top 504,125:left 504,10:caption 504,"Tx TVA 1 :" alpha 505:parent 505,500:top 505,155:left 505,10:caption 505,"Tx TVA 2 :" alpha 506:parent 506,500:top 506,35:left 506,250:caption 506,"CTA Gaz Ht :" alpha 507:parent 507,500:top 507,65:left 507,250:caption 507,"CTA Elec. Ht :" alpha 508:parent 508,500:top 508,95:left 508,250:caption 508,"TDC Ht :" alpha 509:parent 509,500:top 509,125:left 509,250:caption 509,"TMC Ht :" alpha 521:parent 521,500:top 521,155:left 521,250:caption 521,"Coef Gaz :" alpha 522:parent 522,500:top 522,185:left 522,10:caption 522,"CSPE :" edit 510:parent 510,500:top 510,32:left 510,150:width 510,80 edit 511:parent 511,500:top 511,62:left 511,150:width 511,80 edit 512:parent 512,500:top 512,92:left 512,150:width 512,80 edit 513:parent 513,500:top 513,122:left 513,150:width 513,80 edit 514:parent 514,500:top 514,152:left 514,150:width 514,80 edit 515:parent 515,500:top 515,32:left 515,350:width 515,80 edit 516:parent 516,500:top 516,62:left 516,350:width 516,80 edit 517:parent 517,500:top 517,92:left 517,350:width 517,80 edit 518:parent 518,500:top 518,122:left 518,350:width 518,80 edit 519:parent 519,500:top 519,152:left 519,350:width 519,80 edit 520:parent 520,500:top 520,182:left 520,150:width 520,80 Button 599:parent 599,500:top 599,190:left 599,380:caption 599,"Enregistrer" :cursor_point 599:on_click 599,Init_Var
Container 600:caption 600," A Propos... ":hide 600 top 600,10 :left 600,10 :width 600,465 :height 600,220 :font_name 600,"Times new roman":font_size 600,10
dlist 98 dlist 99
gosub init end
init: Dossier$=dir_current$ if file_exists(Dossier$+"\Suez.inf")=1 file_load 99,Dossier$+"\Suez.inf" G_ht=val(item_read$(99,1)) Ehc_ht=val(item_read$(99,2)) Ehp_ht=val(item_read$(99,3)) Tx_Tva1=val(item_read$(99,4)) Tx_Tva2=val(item_read$(99,5)) G_CTA=val(item_read$(99,6)) E_CTA=val(item_read$(99,7)) TDC=val(item_read$(99,8)) TMC=val(item_read$(99,9)) CoefG=val(item_read$(99,10)) CSPE=val(item_read$(99,11)) else file_open_write 97,Dossier$+"\Suez.inf" file_close 97 if message_information_ok("Vous Utilisez cette application pour la première fois"+chr$(13)+"Vous devez modifier le fichier .inf")=1 then gosub Param_Modif end_if if file_exists(Dossier$+"\user\Releves.txt")=1 then file_load 98,Dossier$+"\user\Releves.txt" gosub Remp_grid
return
Nouveau: show 100:hide 200:hide 300:hide 400:hide 500:hide 600:hide 350 set_focus 105 return
Enrgt_R: item_add 98,text$(105)+";"+text$(106)+";"+text$(107)+";"+text$(108) file_save 98,Dossier$+"\user\Releves.txt" for x=105 to 108 text x,"" next x hide 100 gosub Remp_Grid return
Annul_R: for x=105 to 108 text x,"" next x hide 100 return
Visu: show 200:hide 100:hide 300:hide 400:hide 500:hide 600:hide 350 return
Remp_Grid: if count(98)<2 then grid_row 201,2 if file_exists(Dossier$+"\user\Releves.txt")=1 L%=1 for x=1 to count(98) L%=L%+1 grid_row 201,L% L$=item_read$(98,x) sep%=instr(L$,";") C1$=Left$(L$,sep%-1) grid_write 201,L%,1,C1$ L$=right$(L$,len(L$)-sep%) sep%=instr(L$,";") C2$=Left$(L$,sep%-1) grid_write 201,L%,2,C2$ L$=right$(L$,len(L$)-sep%) sep%=instr(L$,";") C3$=Left$(L$,sep%-1) grid_write 201,L%,3,C3$ C4$=right$(L$,len(L$)-sep%) grid_write 201,L%,4,C4$ if L%>2 grid_write 201,L%,5,str$(val(C2$)-val(grid_read$(201,L%-1,2))) grid_write 201,L%,6,str$(val(C3$)-val(grid_read$(201,L%-1,3))) grid_write 201,L%,7,str$(val(C4$)-val(grid_read$(201,L%-1,4))) else grid_write 201,L%,5,"0" grid_write 201,L%,6,"0" grid_write 201,L%,7,"0" end_if next x end_if return
Graph: if F8%=1 top 0,0:left 0,0 Show 800 gosub Dessin gosub Dessin1 gosub Dessin2 else F8%=1 top 0,0:left 0,0 Form 800:height 800,500:width 800,750:top 800,(screen_y-500)/2:left 800,(screen_x-750)/2:caption 800,"Evolution des consommations de gaz et d'électricité" command_target_is 800 alpha 801:top 801,405:left 801,35:caption 801,"Gaz" alpha 802:top 802,425:left 802,35:caption 802,"Elec. hc" alpha 803:top 803,445:left 803,35:caption 803,"Elec. hp" button 899:top 899,430:left 899,650:caption 899,"Quitter":cursor_point 899:font_name 899,"Times new roman":font_size 899,10:on_click 899,Q_Graph gosub Dessin gosub Dessin1 gosub Dessin2 end_if return
Dessin: 2d_target_is 800 2d_pen_color 0,0,0 rem ' ligne des abscisses 2d_line 90,400,465,400 rem ' ligne des ordonnées 2d_line 100,0,100,400 rem ' lignes de graduation for x=1 to 39 2d_pen_color 0,0,0 2d_line 90,x*10,100,x*10 2d_pen_color 225,225,225 2d_line 101,x*10,465,x*10 next x a$=grid_read$(201,2,1) a$=right$(a$,4) a$="01/01/"+a$ c$=grid_read$(201,2,1) dll_on "YGF.dll" J%=left$(a$,2) M%=mid$(a$,4,2) A%=right$(a$,4) c%=dll_call3("NbJours",J%,M%,A%) J%=left$(c$,2) M%=mid$(c$,4,2) A%=right$(c$,4) d%=dll_call3("NbJours",J%,M%,A%) dll_off z$=grid_read$(201,2,5) 2d_poly_from 100+(d%-c%),int(400-(val(z$)/10)) for x=1 to count(98) a$=grid_read$(201,x+1,1) b$=a$ a$=right$(a$,4) a$="01/01/"+a$ c$=grid_read$(201,x+1,5) dll_on "YGF.dll" J%=left$(a$,2) M%=mid$(a$,4,2) A%=right$(a$,4) c%=dll_call3("NbJours",J%,M%,A%) J%=left$(b$,2) M%=mid$(b$,4,2) A%=right$(b$,4) d%=dll_call3("NbJours",J%,M%,A%) dll_off e%=val(c$) 2d_pen_color 250,10,10 2d_poly_to (100+(d%-c%)),int(400-(e% /10)) next x 2d_line 10,415,30,415 2d_pen_color 112,10,168 2d_line 10,435,30,435 2d_pen_color 3,74,214 2d_line 10,455,30,455 return
Dessin1: a$=grid_read$(201,2,1) a$=right$(a$,4) a$="01/01/"+a$ c$=grid_read$(201,2,1) dll_on "YGF.dll" J%=left$(a$,2) M%=mid$(a$,4,2) A%=right$(a$,4) c%=dll_call3("NbJours",J%,M%,A%) J%=left$(c$,2) M%=mid$(c$,4,2) A%=right$(c$,4) d%=dll_call3("NbJours",J%,M%,A%) dll_off z$=grid_read$(201,2,6) 2d_poly_from 100+(d%-c%),int(400-(val(z$)/10)) for x=1 to count(98) a$=grid_read$(201,x+1,1) b$=a$ a$=right$(a$,4) a$="01/01/"+a$ c$=grid_read$(201,x+1,6) dll_on "YGF.dll" J%=left$(a$,2) M%=mid$(a$,4,2) A%=right$(a$,4) c%=dll_call3("NbJours",J%,M%,A%) J%=left$(b$,2) M%=mid$(b$,4,2) A%=right$(b$,4) d%=dll_call3("NbJours",J%,M%,A%) dll_off e%=val(c$) 2d_pen_color 112,10,168 2d_poly_to (100+(d%-c%)),int(400-(e% /10)) next x return
Dessin2: a$=grid_read$(201,2,1) a$=right$(a$,4) a$="01/01/"+a$ c$=grid_read$(201,2,1) dll_on "YGF.dll" J%=left$(a$,2) M%=mid$(a$,4,2) A%=right$(a$,4) c%=dll_call3("NbJours",J%,M%,A%) J%=left$(c$,2) M%=mid$(c$,4,2) A%=right$(c$,4) d%=dll_call3("NbJours",J%,M%,A%) dll_off z$=grid_read$(201,2,7) 2d_poly_from 100+(d%-c%),int(400-(val(z$)/10)) for x=1 to count(98) a$=grid_read$(201,x+1,1) b$=a$ a$=right$(a$,4) a$="01/01/"+a$ c$=grid_read$(201,x+1,7) dll_on "YGF.dll" J%=left$(a$,2) M%=mid$(a$,4,2) A%=right$(a$,4) c%=dll_call3("NbJours",J%,M%,A%) J%=left$(b$,2) M%=mid$(b$,4,2) A%=right$(b$,4) d%=dll_call3("NbJours",J%,M%,A%) dll_off e%=val(c$) 2d_pen_color 3,74,214 2d_poly_to (100+(d%-c%)),int(400-(e% /10)) next x return
Q_Graph: hide 800 left 0,(screen_x-500)/2 : top 0,(screen_y-300)/2 return
Compar: show 300:hide 100:hide 200:hide 400:hide 500:hide 600:hide 350 set_focus 307 return
Compar_2: show 350:hide 100:hide 200:hide 400:hide 500:hide 600:hide 300 for x= 307 to 316 if text$(x)="" if message_error_ok("Vous avez oubliez de remplir une case...")=1 show 300:hide 100:hide 200:hide 400:hide 500:hide 600:hide 350 exit_for end_if end_if next x if show(350)=1 D1$=text$(307) D2$=text$(308) D3$=text$(311) D4$=text$(312) DebG%= val(text$(309)) FinG%= val(text$(310)) DebE_hc%= val(text$(313)) FinE_hc%= val(text$(314)) DebE_hp%= val(text$(315)) FinE_hp%= val(text$(316)) end_if for x= 307 to 316 text x,"" next x set_focus 354 return
Calcul: for x= 354 to 357 if text$(x)="" if message_error_ok("Vous avez oubliez de remplir une case...")=1 m=1 exit_for else m=0 end_if end_if next x if m=0 D5$=text$(354) RG%=val(text$(355)) RE_hc%=val(text$(356)) RE_hp%=val(text$(357))
J%=left$(D1$,2) M%=mid$(D1$,4,2) A%=right$(D1$,4) dll_on "YGF.dll" D1%=dll_call3("NbJours",J%,M%,A%) dll_off
J%=left$(D2$,2) M%=mid$(D2$,4,2) A%=right$(D2$,4) dll_on "YGF.dll" D2%=dll_call3("NbJours",J%,M%,A%) dll_off
J%=left$(D3$,2) M%=mid$(D3$,4,2) A%=right$(D3$,4) dll_on "YGF.dll" D3%=dll_call3("NbJours",J%,M%,A%) dll_off
J%=left$(D4$,2) M%=mid$(D4$,4,2) A%=right$(D4$,4) dll_on "YGF.dll" D4%=dll_call3("NbJours",J%,M%,A%) dll_off
J%=left$(D5$,2) M%=mid$(D5$,4,2) A%=right$(D5$,4) dll_on "YGF.dll" D5%=dll_call3("NbJours",J%,M%,A%) dll_off
Njfg%=D2%-D1% Njfe%=D4%-D3% Njrg%=D5%-D1% Njre%=D5%-D1% rem ' conso sur facture ConsoG=int((FinG%-DebG%)*CoefG) ConsoE_hc=int((FinE_hc%-DebE_hc%)*100)/100 ConsoE_hp=int((FinE_hp%-DebE_hp%)*100)/100 rem ' conso sur relevé ConsoG2=int((RG%-DebG%)*CoefG) ConsoE_hc2=int((RE_hc%-DebE_hc%)*100)/100 ConsoE_hp2=int((RE_hp%-DebE_hp%)*100)/100 rem ' conso estimée ConsoG3=int((ConsoG2/Njrg%)*Njfg% ) ConsoE_hc3=int(((ConsoE_hc2/Njre%)*Njfe%)*100)/100 ConsoE_hp3=int(((ConsoE_hp2/Njre%)*Njfe%)*100)/100 rem ' facture ttc MFG=(int((ConsoG*G_ht*Tx_Tva2)*100)/100)+(int((G_CTA*Tx_Tva1)*100)/100) MFE_hc=(int((ConsoE_hc*Ehc_ht*Tx_Tva2)*100)/100)+(int((E_CTA*Tx_Tva1)*100)/100)+(int((ConsoE_hc*TDC*Tx_Tva2)*100)/100)+(int((ConsoE_hc*TMC*Tx_Tva2)*100)/100)+(int((ConsoE_hc*CSPE*Tx_Tva2)*100)/100) MFE_hp=(int((ConsoE_hp*Ehc_ht*Tx_Tva2)*100)/100)+(int((E_CTA*Tx_Tva1)*100)/100)+(int((ConsoE_hp*TDC*Tx_Tva2)*100)/100)+(int((ConsoE_hp*TMC*Tx_Tva2)*100)/100)+(int((ConsoE_hp*CSPE*Tx_Tva2)*100)/100) rem ' Evaluation MRG=(int((ConsoG3*G_ht*Tx_Tva2)*100)/100)+(int((G_CTA*Tx_Tva1)*100)/100) MRE_hc=(int((ConsoE_hc3*Ehc_ht*Tx_Tva2)*100)/100)+(int((E_CTA*Tx_Tva1)*100)/100)+(int((ConsoE_hc3*TDC*Tx_Tva2)*100)/100)+(int((ConsoE_hc3*TMC*Tx_Tva2)*100)/100)+(int((ConsoE_hc3*CSPE*Tx_Tva2)*100)/100) MRE_hp=(int((ConsoE_hp3*Ehc_ht*Tx_Tva2)*100)/100)+(int((E_CTA*Tx_Tva1)*100)/100)+(int((ConsoE_hp3*TDC*Tx_Tva2)*100)/100)+(int((ConsoE_hp3*TMC*Tx_Tva2)*100)/100)+(int((ConsoE_hp3*CSPE*Tx_Tva2)*100)/100) rem ' Differences DiffG=int((ConsoG-ConsoG3)*100)/100 DiffE_hc=int((ConsoE_hc-ConsoE_hc3)*100)/100 DiffE_hp=int((ConsoE_hp-ConsoE_hp3)*100)/100 rem ' Fenetre de communication des résultats if F7%=1 top 0,0:left 0,0 show 700 else F7%=1 top 0,0:left 0,0 Form 700:caption 700,"Résultat de la comparaison":width 700,700:height 700,600:top 700,(screen_y-600)/2 :left 700,(screen_x-700)/2 command_target_is 700
container 701:top 701,10:left 701,10:height 701,300:width 701,320:caption 701," Votre Facture ":font_name 701,"Times new roman":font_bold 701:font_size 701,10 alpha 702:parent 702,701:top 702,40:left 702,20 :caption 702,"Consommation Gaz en kWh : " alpha 703:parent 703,701:top 703,65:left 703,20 :caption 703,"Montant facturé TTC : " alpha 704:parent 704,701:top 704,105:left 704,20 :caption 704,"Consommation Elec. HC en kWh : " alpha 705:parent 705,701:top 705,130:left 705,20:caption 705,"Montant facturé TTC : " alpha 706:parent 706,701:top 706,180:left 706,20:caption 706,"Consommation Elec. HP en kWh : " alpha 707:parent 707,701:top 707,205:left 707,20:caption 707,"Montant facturé TTC : " alpha 708:parent 708,701:top 708,40:left 708,210 :caption 708,str$(ConsoG) :font_color 708,140,2,4 alpha 709:parent 709,701:top 709,65:left 709,210 :caption 709,str$(MFG) :font_color 709,140,2,4 alpha 710:parent 710,701:top 710,105:left 710,210 :caption 710,str$(ConsoE_hc):font_color 710,140,2,4 alpha 711:parent 711,701:top 711,130:left 711,210:caption 711,str$(MFE_hc) :font_color 711,140,2,4 alpha 712:parent 712,701:top 712,180:left 712,210:caption 712,str$(ConsoE_hp):font_color 712,140,2,4 alpha 713:parent 713,701:top 713,205:left 713,210:caption 713,str$(MFE_hp):font_color 713,140,2,4
container 720:top 720,10:left 720,340:height 720,300:width 720,320:caption 720," Estimation ":font_name 720,"Times new roman":font_bold 720:font_size 720,10 alpha 722:parent 722,720:top 722,40:left 722,20 :caption 722,"Consommation Gaz en kWh : " alpha 723:parent 723,720:top 723,65:left 723,20 :caption 723,"Montant Estimé TTC : " alpha 724:parent 724,720:top 724,105:left 724,20 :caption 724,"Consommation Elec. HC en kWh : " alpha 725:parent 725,720:top 725,130:left 725,20:caption 725,"Montant Estimé TTC : " alpha 726:parent 726,720:top 726,180:left 726,20:caption 726,"Consommation Elec. HP en kWh : " alpha 727:parent 727,720:top 727,205:left 727,20:caption 727,"Montant Estimé TTC : " alpha 728:parent 728,720:top 728,40:left 728,210 :caption 728,str$(ConsoG3) :font_color 728,7,142,4 alpha 729:parent 729,720:top 729,65:left 729,210 :caption 729,str$(MRG) :font_color 729,7,142,4 alpha 730:parent 730,720:top 730,105:left 730,210 :caption 730,str$(ConsoE_hc3):font_color 730,7,142,4 alpha 731:parent 731,720:top 731,130:left 731,210:caption 731,str$(MRE_hc) :font_color 731,7,142,4 alpha 732:parent 732,720:top 732,180:left 732,210:caption 732,str$(ConsoE_hp3):font_color 732,7,142,4 alpha 733:parent 733,720:top 733,205:left 733,210:caption 733,str$(MRE_hp):font_color 733,7,142,4
container 740:top 740,320:left 740,10:height 740,200:width 740,650:caption 740," Comparaison ":font_name 740,"Times new roman":font_bold 740:font_size 740,10 if MFG > MRG alpha 742:parent 742,740:top 742,40:left 742,20 :caption 742,"Vous avez été surfacturé de : "+str$(MFG-MRG)+" Euro" end_if if MFE_hc > MRE_hc alpha 743:parent 743,740:top 743,70:left 743,20 :caption 743,"Vous avez été surfacturé de : "+str$(MFE_hc-MRE_hc)+" Euro" end_if if MFE_hp > MRE_hp alpha 744:parent 744,740:top 744,100:left 744,20 :caption 744,"Vous avez été surfacturé de : "+str$(MFE_hp-MRE_hp)+" Euro" end_if Button 798:top 798,530 :left 798,490:caption 798,"Imprimer":cursor_point 798 Button 799:top 799,530 :left 799,590:caption 799,"Quitter" :cursor_point 799:on_click 799,Cache700 end_if end_if return
Cache700: hide 700:left 0,(screen_x-500)/2 : top 0,(screen_y-300)/2 command_target_is 0 for x=354 to 357 text x,"" next x hide 350 return
Charge: if count(98)>0 x =count(98) L$=item_read$(98,x) sep%=instr(L$,";") C1$=Left$(L$,sep%-1) text 354,C1$ L$=right$(L$,len(L$)-sep%) sep%=instr(L$,";") C2$=Left$(L$,sep%-1) text 355,C2$ L$=right$(L$,len(L$)-sep%) sep%=instr(L$,";") C3$=Left$(L$,sep%-1) text 356,C3$ C4$=right$(L$,len(L$)-sep%) text 357,C4$ end_if return
Param_Voir: show 400:hide 100:hide 200:hide 300:hide 500:hide 600:hide 350 for x=410 to 420 caption x,item_read$(99,(x-409)) next x return
Param_Modif: show 500:hide 100:hide 200:hide 300:hide 400:hide 600:hide 350 if count(99)>0 for x=510 to 520 text x,item_read$(99,x-509) next x end_if return
Init_Var: clear 99 for x=1 to 11 if text$(509+x)<>"" item_add 99,text$(509+x) else item_add 99,"0" end_if next x file_save 99,Dossier$+"\Suez.inf" G_ht= val(item_read$(99,1)) Ehc_ht= val(item_read$(99,2)) Ehp_ht= val(item_read$(99,3)) Tx_Tva1= val(item_read$(99,4)) Tx_Tva2= val(item_read$(99,5)) G_CTA= val(item_read$(99,6)) E_CTA= val(item_read$(99,7)) TDC= val(item_read$(99,8)) TMC= val(item_read$(99,9)) CoefG= val(item_read$(99,10)) CSPE= val(item_read$(99,11)) hide 500 return
APP: show 600:hide 100:hide 200:hide 300:hide 400:hide 500:hide 350 return
Quitter: Terminate
| |
| | | Klaus
Nombre de messages : 12331 Age : 75 Localisation : Ile de France Date d'inscription : 29/12/2009
| Sujet: Re: Quelques lignes de code plus tard.... Mer 27 Juin 2012 - 0:19 | |
| Euh... ce ne serait pas KGF.dll, par hasard ? Tu as dû le renommer, chez toi, non ? | |
| | | Yannick
Nombre de messages : 8635 Age : 53 Localisation : Bretagne Date d'inscription : 15/02/2010
| Sujet: re Mer 27 Juin 2012 - 0:30 | |
| Non , désolé Klaus, je me suis servis de la YGF.dll qui est avec le "Tri de grid par date" que tu avais publié pour moi sur ton site. elle est dans le zip. Suite à une explosion de ma cle usb où j' archivais mes sources en Panoramic j'ai tout perdu du coup je pioche de partout où j'ai publié pour me remettre dans ma mémoire de poisson rouge les astuces. PS: Je laisse à César ce qui est à César, je ne me permettrai pas et jamais de renommer le travail de quelqu'un. | |
| | | Klaus
Nombre de messages : 12331 Age : 75 Localisation : Ile de France Date d'inscription : 29/12/2009
| Sujet: Re: Quelques lignes de code plus tard.... Mer 27 Juin 2012 - 0:49 | |
| Autant pour moi. Ca m'est sorti de la tête. Merci à toi. | |
| | | Jean Claude
Nombre de messages : 5950 Age : 70 Localisation : 83 Var Date d'inscription : 07/05/2009
| Sujet: Re: Quelques lignes de code plus tard.... Mer 27 Juin 2012 - 12:17 | |
| Salut à vous,
intéressant pour calculer ses consommations d’électricité...
J'ai lancer le code une première fois et je n'ai rien rempli. Quand j'ai voulu le relancer (index off bound). Normal vu qu'il y a création du fichier suez et qu'il est vide.
tu devrais insérer: if count(99)=0 then pour traiter ce problème
Bravo A+
| |
| | | Yannick
Nombre de messages : 8635 Age : 53 Localisation : Bretagne Date d'inscription : 15/02/2010
| Sujet: re Mer 27 Juin 2012 - 12:47 | |
| Merci Jean Claude, Je regarde ce petit bug , ma longue absence m'a fait fait oublier les fondamentaux ( autoverification ) | |
| | | Yannick
Nombre de messages : 8635 Age : 53 Localisation : Bretagne Date d'inscription : 15/02/2010
| Sujet: re Jeu 28 Juin 2012 - 2:47 | |
| Le code avec quelques bugs en moins Tel qu'il est, on peut partir seulement avec le fichier .bas ou exe et la dll "YGF.dll" Je n'ai pas encore utilisé la dll "format.dll" mais ca va venir.... Et je dois voir pour les limites d'affichage du graphique qui risque de poser un problèmes si les relevés sont sur plusieurs années. Je rappelle que cet utilitaire est fait au départ pour ma belle mère qui est chez GDF Suez Dolcevita pour le gaz et l'électricité. et que les modes de calculs ne sont pas les mêmes pour d'autres fournisseurs. Dans le cas présent, il est aussi important de vérifier les paramètres avant chaque comparaison le coeff gaz ( tx de change M3 / kwh ) change selon sa provenance. L' envie de le faire est venue d'une de ses factures , dite "Estimée" , où les index de relevé n'étaient toujours pas atteint 4 mois après la facture.... - Code:
-
rem ' les variables d'affichages dim x,L%,L$,C1$,C2$,C3$,C4$,sep%,m,F7%,F8% dim Dossier$,Inf%,Option% rem ' Les variables de calcul rem ' Les variables fixes dim G_ht,Ehc_ht,Ehp_ht,Tx_Tva1,Tx_Tva2,G_CTA,E_CTA,TDC,TMC,CoefG,CSPE rem ' Les variables de facturation dim D1$,D2$,D3$,D4$,DebG%,FinG%,DebE_hc%,FinE_hc%,DebE_hp%,FinE_hp% rem ' Les variables de relevé dim D5$,RG%,RE_hc%,RE_hp% rem ' Les variables calculés dim D1%,D2%,D3%,D4%,D5%,J%,M%,A% dim Njfg%,Njfe%,Njrg%,Njre% dim ConsoG,ConsoE_hc,ConsoE_hp dim ConsoG2,ConsoE_hc2,ConsoE_hp2 dim NbreJ1,NbreJ2,NbreJ3,NbreJ4 dim ConsoG3,ConsoE_hc3,ConsoE_hp3 dim MFG,MFE_hc,MFE_hp dim MRG,MRE_hc,MRE_hp dim DiffG,DiffE_hc,DiffE_hp dim a$,b$,c%,c$,d%,e%,z$ rem ' les fonctions du menu label init, Nouveau,Visu,Quitter,Compar,Param_Voir,Param_Modif,APP rem ' les fonctions du container 100 label Enrgt_R,Annul_R rem ' les fonctions du container 200 label Remp_Grid,Graph,Dessin,Dessin1,Dessin2,Q_Graph rem ' les fonctions de container 300 label Compar_2 rem ' les fonctions de container 350 label Calcul,Cache700,Charge rem ' les fonctions du container 500 label Init_Var rem ' fenetre principale Application_title "GDF Suez" caption 0,"GDF Suez" width 0,500 : height 0,300 :left 0,(screen_x-500)/2 : top 0,(screen_y-300)/2
main_menu 1 sub_menu 2 :parent 2,1 :caption 2,"Fichiers" sub_menu 3 :parent 3,2 :caption 3,"Nouveau relevé" :on_click 3,Nouveau sub_menu 4 :parent 4,2 :caption 4,"Visualiser un relevé" :on_click 4,Visu sub_menu 5 :parent 5,2 :caption 5,"--------------------" sub_menu 6 :parent 6,2 :caption 6,"" sub_menu 7 :parent 7,2 :caption 7,"Quitter" :on_click 7,Quitter sub_menu 8 :parent 8,1 :caption 8,"Outils" sub_menu 9 :parent 9,8 :caption 9,"Comparateur" :on_click 9,Compar sub_menu 10:parent 10,1 :caption 10,"Paramètres" sub_menu 11:parent 11,10:caption 11,"Voir" :on_click 11,Param_Voir sub_menu 12:parent 12,10:caption 12,"Modifier" :on_click 12,Param_Modif sub_menu 13:parent 13,1 :caption 13,"A Propos..." :on_click 13,APP
Container 100:caption 100," Nouveau relevé " :hide 100 top 100,10 :left 100,10 :width 100,465 :height 100,220 :font_name 100,"Times new roman":font_size 100,10 Alpha 101:parent 101,100:top 101,25 :left 101,25 :caption 101,"Date" Alpha 102:parent 102,100:top 102,90 :left 102,25 :caption 102,"Compteur Gaz" Alpha 103:parent 103,100:top 103,90 :left 103,135 :caption 103,"Compteur EDF Hc" Alpha 104:parent 104,100:top 104,90 :left 104,260 :caption 104,"Compteur EDF Hp" Edit 105 :parent 105,100:top 105,45 :left 105,25 :width 105,80 Edit 106 :parent 106,100:top 106,110:left 106,25 :width 106,90 Edit 107 :parent 107,100:top 107,110:left 107,135 :width 107,90 Edit 108 :parent 108,100:top 108,110:left 108,260 :width 108,90 Button 109:parent 109,100:top 109,190:left 109,300:caption 109,"Enregistrer":cursor_point 109:on_click 109,Enrgt_R Button 110:parent 110,100:top 110,190:left 110,380:caption 110,"Annuler" :cursor_point 110:on_click 110,Annul_R
Container 200:caption 200," Mes relevés " :hide 200 top 200,10 :left 200,10 :width 200,465 :height 200,220 :font_name 200,"Times new roman":font_size 200,10 Grid 201:parent 201,200:top 201,25:left 201,5:width 201,450:height 201,150:grid_column 201,7:grid_row 201,2 Grid_column_width 201,60 grid_write 201,1,1,"Date" :grid_write 201,1,2,"Gaz" :grid_write 201,1,3,"Elec. Hc":grid_write 201,1,4,"Elec. Hp" grid_write 201,1,5,"C.Gaz":grid_write 201,1,6,"C. Elec hc":grid_write 201,1,7,"C. Elec hp" grid_row_height 201,20 Button 202:parent 202,200:top 202,190:left 202,380:caption 202,"Graphique" :cursor_point 202:on_click 202,Graph
Container 300:caption 300," Comparateur - La Facture " :hide 300 top 300,10 :left 300,10 :width 300,465 :height 300,220 :font_name 300,"Times new roman":font_size 300,10 alpha 301:parent 301,300:top 301,25:left 301,10:caption 301,"Facture :":font_color 301,125,25,7 alpha 302:parent 302,300:top 302,55:left 302,50:caption 302,"Dates début Dates fin" alpha 303:parent 303,300:top 303,55:left 303,250:caption 303,"Index début" alpha 304:parent 304,300:top 304,55:left 304,350:caption 304,"Index fin" alpha 305:parent 305,300:top 305,75:left 305,10:caption 305,"Gaz" alpha 306:parent 306,300:top 306,105:left 306,10:caption 306,"Elec." edit 307:parent 307,300:top 307,72:left 307,50:width 307,65 edit 308:parent 308,300:top 308,72:left 308,130:width 308,65 edit 309:parent 309,300:top 309,72:left 309,250:width 309,90 edit 310:parent 310,300:top 310,72:left 310,350:width 310,90 edit 311:parent 311,300:top 311,103:left 311,50:width 311,65 edit 312:parent 312,300:top 312,103:left 312,130:width 312,65 edit 313:parent 313,300:top 313,103:left 313,250:width 313,90 edit 314:parent 314,300:top 314,103:left 314,350:width 314,90 edit 315:parent 315,300:top 315,134:left 315,250:width 315,90 edit 316:parent 316,300:top 316,134:left 316,350:width 316,90 alpha 317:parent 317,300:top 317,105:left 317,230:caption 317,"Hc":font_italic 317 alpha 318:parent 318,300:top 318,134:left 318,230:caption 318,"Hp":font_italic 318 Button 349:parent 349,300:top 349,190:left 349,380:caption 349,"Mon relevé" :cursor_point 349:on_click 349,Compar_2
Container 350:caption 350," Comparateur - Mon relevé " :hide 350 top 350,10 :left 350,10 :width 350,465 :height 350,220 :font_name 350,"Times new roman":font_size 350,10 alpha 351:parent 351,350:top 351,25:left 351,10:caption 351,"Mon relevé :":font_color 351,125,25,7 alpha 352:parent 352,350:top 352,55:left 352,50:caption 352,"Date" alpha 353:parent 353,350:top 353,55:left 353,250:caption 353,"Relevé" edit 354:parent 354,350:top 354,72:left 354,50:width 354,65 edit 355:parent 355,350:top 355,72:left 355,250:width 355,90 edit 356:parent 356,350:top 356,103:left 356,250:width 356,90 edit 357:parent 357,350:top 357,134:left 357,250:width 357,90 alpha 358:parent 358,350:top 358,105:left 358,230:caption 358,"Hc":font_italic 358 alpha 359:parent 359,350:top 359,134:left 359,230:caption 359,"Hp":font_italic 359 Button 398:parent 398,350:top 398,190:left 398,260:caption 398,"Charger" :cursor_point 398:on_click 398,Charge hint 398,"Charge le dernier relevé enregistré" Button 399:parent 399,350:top 399,190:left 399,380:caption 399,"Calculer" :cursor_point 399:on_click 399,Calcul
Container 400:caption 400," Mes Paramètres " :hide 400 top 400,10 :left 400,10 :width 400,465 :height 400,220 :font_name 400,"Times new roman":font_size 400,10 alpha 401:parent 401,400:top 401,35:left 401,10:caption 401,"Tarif Gaz Kwh Ht :" alpha 402:parent 402,400:top 402,65:left 402,10:caption 402,"Tarif Elec.(Hc) Kwh Ht :" alpha 403:parent 403,400:top 403,95:left 403,10:caption 403,"Tarif Elec.(Hp) Kwh Ht :" alpha 404:parent 404,400:top 404,125:left 404,10:caption 404,"Tx TVA 1 :" alpha 405:parent 405,400:top 405,155:left 405,10:caption 405,"Tx TVA 2 :" alpha 406:parent 406,400:top 406,35:left 406,250:caption 406,"CTA Gaz Ht :" alpha 407:parent 407,400:top 407,65:left 407,250:caption 407,"CTA Elec. Ht :" alpha 408:parent 408,400:top 408,95:left 408,250:caption 408,"TDC Ht :" alpha 409:parent 409,400:top 409,125:left 409,250:caption 409,"TMC Ht :" alpha 421:parent 421,400:top 421,155:left 421,250:caption 421,"Coef Gaz :" alpha 422:parent 422,400:top 422,185:left 422,250:caption 422,"CSPE :" alpha 410:parent 410,400:top 410,35:left 410,150 :font_color 410,188,5,11 alpha 411:parent 411,400:top 411,65:left 411,150 :font_color 411,188,5,11 alpha 412:parent 412,400:top 412,95:left 412,150 :font_color 412,188,5,11 alpha 413:parent 413,400:top 413,125:left 413,150:font_color 413,188,5,11 alpha 414:parent 414,400:top 414,155:left 414,150:font_color 414,188,5,11 alpha 415:parent 415,400:top 415,35:left 415,350 :font_color 415,188,5,11 alpha 416:parent 416,400:top 416,65:left 416,350 :font_color 416,188,5,11 alpha 417:parent 417,400:top 417,95:left 417,350 :font_color 417,188,5,11 alpha 418:parent 418,400:top 418,125:left 418,350:font_color 418,188,5,11 alpha 419:parent 419,400:top 419,155:left 419,350:font_color 419,188,5,11 alpha 420:parent 420,400:top 420,185:left 420,350:font_color 420,188,5,11 alpha 423:parent 423,400:top 423,125:left 423,180:caption 423,"%" alpha 424:parent 424,400:top 424,155:left 424,180:caption 424,"%"
Container 500:caption 500," Modifier les Paramètres ":hide 500 top 500,10 :left 500,10 :width 500,465 :height 500,220 :font_name 500,"Times new roman":font_size 500,10 alpha 501:parent 501,500:top 501,35:left 501,10:caption 501,"Tarif Gaz Kwh Ht :" alpha 502:parent 502,500:top 502,65:left 502,10:caption 502,"Tarif Elec.(Hc) Kwh Ht :" alpha 503:parent 503,500:top 503,95:left 503,10:caption 503,"Tarif Elec.(Hp) Kwh Ht :" alpha 504:parent 504,500:top 504,125:left 504,10:caption 504,"Tx TVA 1 :" alpha 505:parent 505,500:top 505,155:left 505,10:caption 505,"Tx TVA 2 :" alpha 506:parent 506,500:top 506,35:left 506,250:caption 506,"CTA Gaz Ht :" alpha 507:parent 507,500:top 507,65:left 507,250:caption 507,"CTA Elec. Ht :" alpha 508:parent 508,500:top 508,95:left 508,250:caption 508,"TDC Ht :" alpha 509:parent 509,500:top 509,125:left 509,250:caption 509,"TMC Ht :" alpha 521:parent 521,500:top 521,155:left 521,250:caption 521,"Coef Gaz :" alpha 522:parent 522,500:top 522,185:left 522,10:caption 522,"CSPE :" edit 510:parent 510,500:top 510,32:left 510,150:width 510,80 edit 511:parent 511,500:top 511,62:left 511,150:width 511,80 edit 512:parent 512,500:top 512,92:left 512,150:width 512,80 edit 513:parent 513,500:top 513,122:left 513,150:width 513,50 edit 514:parent 514,500:top 514,152:left 514,150:width 514,50 edit 515:parent 515,500:top 515,32:left 515,350:width 515,80 edit 516:parent 516,500:top 516,62:left 516,350:width 516,80 edit 517:parent 517,500:top 517,92:left 517,350:width 517,80 edit 518:parent 518,500:top 518,122:left 518,350:width 518,80 edit 519:parent 519,500:top 519,152:left 519,350:width 519,80 edit 520:parent 520,500:top 520,182:left 520,150:width 520,80 alpha 523:parent 523,500:top 523,125:left 523,205:caption 523,"%" alpha 524:parent 524,500:top 524,155:left 524,205:caption 524,"%"
Button 599:parent 599,500:top 599,190:left 599,380:caption 599,"Enregistrer" :cursor_point 599:on_click 599,Init_Var
Container 600:caption 600," A Propos... ":hide 600 top 600,10 :left 600,10 :width 600,465 :height 600,220 :font_name 600,"Times new roman":font_size 600,10
dlist 98 dlist 99
gosub init end
init: Dossier$=dir_current$ if file_exists(Dossier$+"\Suez.inf")=1 file_load 99,Dossier$+"\Suez.inf" if count(99)>0 G_ht=val(item_read$(99,1)) Ehc_ht=val(item_read$(99,2)) Ehp_ht=val(item_read$(99,3)) Tx_Tva1=val(item_read$(99,4)) Tx_Tva2=val(item_read$(99,5)) G_CTA=val(item_read$(99,6)) E_CTA=val(item_read$(99,7)) TDC=val(item_read$(99,8)) TMC=val(item_read$(99,9)) CoefG=val(item_read$(99,10)) CSPE=val(item_read$(99,11)) else if message_information_yes_no("Le fichier des paramètres de calcul est vide"+chr$(10)+"Voulez vous entrez les paramètres maintenant ?")=1 gosub Param_Modif else Inactive 9 inactive 11 end_if end_if else file_open_write 97,Dossier$+"\Suez.inf" file_close 97 if message_information_yes_no("Vous Utilisez cette application pour la première fois"+chr$(13)+"Voulez vous enregistrer vos paramètres ?")=1 gosub Param_Modif else Inactive 9 inactive 11 end_if end_if if file_exists(Dossier$+"\user\Releves.txt")=1 then file_load 98,Dossier$+"\user\Releves.txt" gosub Remp_grid
return
Nouveau: show 100:hide 200:hide 300:hide 400:hide 500:hide 600:hide 350 set_focus 105 return
Enrgt_R: item_add 98,text$(105)+";"+text$(106)+";"+text$(107)+";"+text$(108) if dir_exists(Dossier$+"\user")=0 then dir_make Dossier$+"\user" file_save 98,Dossier$+"\user\Releves.txt" for x=105 to 108 text x,"" next x hide 100 gosub Remp_Grid return
Annul_R: for x=105 to 108 text x,"" next x hide 100 return
Visu: show 200:hide 100:hide 300:hide 400:hide 500:hide 600:hide 350 return
Remp_Grid: if count(98)<2 then grid_row 201,2 if file_exists(Dossier$+"\user\Releves.txt")=1 L%=1 for x=1 to count(98) L%=L%+1 grid_row 201,L% L$=item_read$(98,x) sep%=instr(L$,";") C1$=Left$(L$,sep%-1) grid_write 201,L%,1,C1$ L$=right$(L$,len(L$)-sep%) sep%=instr(L$,";") C2$=Left$(L$,sep%-1) grid_write 201,L%,2,C2$ L$=right$(L$,len(L$)-sep%) sep%=instr(L$,";") C3$=Left$(L$,sep%-1) grid_write 201,L%,3,C3$ C4$=right$(L$,len(L$)-sep%) grid_write 201,L%,4,C4$ if L%>2 grid_write 201,L%,5,str$(val(C2$)-val(grid_read$(201,L%-1,2))) grid_write 201,L%,6,str$(val(C3$)-val(grid_read$(201,L%-1,3))) grid_write 201,L%,7,str$(val(C4$)-val(grid_read$(201,L%-1,4))) else grid_write 201,L%,5,"0" grid_write 201,L%,6,"0" grid_write 201,L%,7,"0" end_if next x end_if return
Graph: if F8%=1 top 0,0:left 0,0 Show 800 gosub Dessin gosub Dessin1 gosub Dessin2 else F8%=1 top 0,0:left 0,0 Form 800:height 800,500:width 800,750:top 800,(screen_y-500)/2:left 800,(screen_x-750)/2:caption 800,"Evolution des consommations de gaz et d'électricité" command_target_is 800 alpha 801:top 801,405:left 801,35:caption 801,"Gaz" alpha 802:top 802,425:left 802,35:caption 802,"Elec. hc" alpha 803:top 803,445:left 803,35:caption 803,"Elec. hp" button 899:top 899,430:left 899,650:caption 899,"Quitter":cursor_point 899:font_name 899,"Times new roman":font_size 899,10:on_click 899,Q_Graph gosub Dessin gosub Dessin1 gosub Dessin2 end_if return
Dessin: 2d_target_is 800 2d_pen_color 0,0,0 rem ' ligne des abscisses 2d_line 90,400,465,400 rem ' ligne des ordonnées 2d_line 100,0,100,400 rem ' lignes de graduation for x=1 to 39 2d_pen_color 0,0,0 2d_line 90,x*10,100,x*10 2d_pen_color 225,225,225 2d_line 101,x*10,465,x*10 next x rem ' ligne de consommation gaz if count(98)>1 a$=grid_read$(201,2,1) a$=right$(a$,4) a$="01/01/"+a$ c$=grid_read$(201,2,1) dll_on "YGF.dll" J%=left$(a$,2) M%=mid$(a$,4,2) A%=right$(a$,4) c%=dll_call3("NbJours",J%,M%,A%) J%=left$(c$,2) M%=mid$(c$,4,2) A%=right$(c$,4) d%=dll_call3("NbJours",J%,M%,A%) dll_off z$=grid_read$(201,2,5) 2d_poly_from 100+(d%-c%),int(400-(val(z$)/10)) for x=1 to count(98) a$=grid_read$(201,x+1,1) b$=a$ a$=right$(a$,4) a$="01/01/"+a$ c$=grid_read$(201,x+1,5) dll_on "YGF.dll" J%=left$(a$,2) M%=mid$(a$,4,2) A%=right$(a$,4) c%=dll_call3("NbJours",J%,M%,A%) J%=left$(b$,2) M%=mid$(b$,4,2) A%=right$(b$,4) d%=dll_call3("NbJours",J%,M%,A%) dll_off e%=val(c$) 2d_pen_color 250,10,10 2d_poly_to (100+(d%-c%)),int(400-(e% /10)) next x else message "Pas assez de données pour créer un graphique" end_if 2d_line 10,415,30,415 2d_pen_color 112,10,168 2d_line 10,435,30,435 2d_pen_color 3,74,214 2d_line 10,455,30,455 return
Dessin1: if count(98)>1 a$=grid_read$(201,2,1) a$=right$(a$,4) a$="01/01/"+a$ c$=grid_read$(201,2,1) dll_on "YGF.dll" J%=left$(a$,2) M%=mid$(a$,4,2) A%=right$(a$,4) c%=dll_call3("NbJours",J%,M%,A%) J%=left$(c$,2) M%=mid$(c$,4,2) A%=right$(c$,4) d%=dll_call3("NbJours",J%,M%,A%) dll_off z$=grid_read$(201,2,6) 2d_poly_from 100+(d%-c%),int(400-(val(z$)/10)) for x=1 to count(98) a$=grid_read$(201,x+1,1) b$=a$ a$=right$(a$,4) a$="01/01/"+a$ c$=grid_read$(201,x+1,6) dll_on "YGF.dll" J%=left$(a$,2) M%=mid$(a$,4,2) A%=right$(a$,4) c%=dll_call3("NbJours",J%,M%,A%) J%=left$(b$,2) M%=mid$(b$,4,2) A%=right$(b$,4) d%=dll_call3("NbJours",J%,M%,A%) dll_off e%=val(c$) 2d_pen_color 112,10,168 2d_poly_to (100+(d%-c%)),int(400-(e% /10)) next x end_if return
Dessin2: if count(98)>1 a$=grid_read$(201,2,1) a$=right$(a$,4) a$="01/01/"+a$ c$=grid_read$(201,2,1) dll_on "YGF.dll" J%=left$(a$,2) M%=mid$(a$,4,2) A%=right$(a$,4) c%=dll_call3("NbJours",J%,M%,A%) J%=left$(c$,2) M%=mid$(c$,4,2) A%=right$(c$,4) d%=dll_call3("NbJours",J%,M%,A%) dll_off z$=grid_read$(201,2,7) 2d_poly_from 100+(d%-c%),int(400-(val(z$)/10)) for x=1 to count(98) a$=grid_read$(201,x+1,1) b$=a$ a$=right$(a$,4) a$="01/01/"+a$ c$=grid_read$(201,x+1,7) dll_on "YGF.dll" J%=left$(a$,2) M%=mid$(a$,4,2) A%=right$(a$,4) c%=dll_call3("NbJours",J%,M%,A%) J%=left$(b$,2) M%=mid$(b$,4,2) A%=right$(b$,4) d%=dll_call3("NbJours",J%,M%,A%) dll_off e%=val(c$) 2d_pen_color 3,74,214 2d_poly_to (100+(d%-c%)),int(400-(e% /10)) next x end_if return
Q_Graph: hide 800 left 0,(screen_x-500)/2 : top 0,(screen_y-300)/2 return
Compar: show 300:hide 100:hide 200:hide 400:hide 500:hide 600:hide 350 set_focus 307 return
Compar_2: show 350:hide 100:hide 200:hide 400:hide 500:hide 600:hide 300 for x= 307 to 316 if text$(x)="" if message_error_ok("Vous avez oubliez de remplir une case...")=1 show 300:hide 100:hide 200:hide 400:hide 500:hide 600:hide 350 exit_for end_if end_if next x if show(350)=1 D1$=text$(307) D2$=text$(308) D3$=text$(311) D4$=text$(312) DebG%= val(text$(309)) FinG%= val(text$(310)) DebE_hc%= val(text$(313)) FinE_hc%= val(text$(314)) DebE_hp%= val(text$(315)) FinE_hp%= val(text$(316)) end_if for x= 307 to 316 text x,"" next x set_focus 354 return
Calcul: for x= 354 to 357 if text$(x)="" if message_error_ok("Vous avez oubliez de remplir une case...")=1 m=1 exit_for else m=0 end_if end_if next x if m=0 D5$=text$(354) RG%=val(text$(355)) RE_hc%=val(text$(356)) RE_hp%=val(text$(357))
J%=left$(D1$,2) M%=mid$(D1$,4,2) A%=right$(D1$,4) dll_on "YGF.dll" D1%=dll_call3("NbJours",J%,M%,A%) dll_off
J%=left$(D2$,2) M%=mid$(D2$,4,2) A%=right$(D2$,4) dll_on "YGF.dll" D2%=dll_call3("NbJours",J%,M%,A%) dll_off
J%=left$(D3$,2) M%=mid$(D3$,4,2) A%=right$(D3$,4) dll_on "YGF.dll" D3%=dll_call3("NbJours",J%,M%,A%) dll_off
J%=left$(D4$,2) M%=mid$(D4$,4,2) A%=right$(D4$,4) dll_on "YGF.dll" D4%=dll_call3("NbJours",J%,M%,A%) dll_off
J%=left$(D5$,2) M%=mid$(D5$,4,2) A%=right$(D5$,4) dll_on "YGF.dll" D5%=dll_call3("NbJours",J%,M%,A%) dll_off
Njfg%=D2%-D1% Njfe%=D4%-D3% Njrg%=D5%-D1% Njre%=D5%-D1% rem ' conso sur facture ConsoG=int((FinG%-DebG%)*CoefG) ConsoE_hc=int((FinE_hc%-DebE_hc%)*100)/100 ConsoE_hp=int((FinE_hp%-DebE_hp%)*100)/100 rem ' conso sur relevé ConsoG2=int((RG%-DebG%)*CoefG) ConsoE_hc2=int((RE_hc%-DebE_hc%)*100)/100 ConsoE_hp2=int((RE_hp%-DebE_hp%)*100)/100 rem ' conso estimée ConsoG3=int((ConsoG2/Njrg%)*Njfg% ) ConsoE_hc3=int(((ConsoE_hc2/Njre%)*Njfe%)*100)/100 ConsoE_hp3=int(((ConsoE_hp2/Njre%)*Njfe%)*100)/100 rem ' facture ttc MFG=(int((ConsoG*G_ht*Tx_Tva2)*100)/100)+(int((G_CTA*Tx_Tva1)*100)/100) MFE_hc=(int((ConsoE_hc*Ehc_ht*Tx_Tva2)*100)/100)+(int((E_CTA*Tx_Tva1)*100)/100)+(int((ConsoE_hc*TDC*Tx_Tva2)*100)/100)+(int((ConsoE_hc*TMC*Tx_Tva2)*100)/100)+(int((ConsoE_hc*CSPE*Tx_Tva2)*100)/100) MFE_hp=(int((ConsoE_hp*Ehc_ht*Tx_Tva2)*100)/100)+(int((E_CTA*Tx_Tva1)*100)/100)+(int((ConsoE_hp*TDC*Tx_Tva2)*100)/100)+(int((ConsoE_hp*TMC*Tx_Tva2)*100)/100)+(int((ConsoE_hp*CSPE*Tx_Tva2)*100)/100) rem ' Evaluation MRG=(int((ConsoG3*G_ht*Tx_Tva2)*100)/100)+(int((G_CTA*Tx_Tva1)*100)/100) MRE_hc=(int((ConsoE_hc3*Ehc_ht*Tx_Tva2)*100)/100)+(int((E_CTA*Tx_Tva1)*100)/100)+(int((ConsoE_hc3*TDC*Tx_Tva2)*100)/100)+(int((ConsoE_hc3*TMC*Tx_Tva2)*100)/100)+(int((ConsoE_hc3*CSPE*Tx_Tva2)*100)/100) MRE_hp=(int((ConsoE_hp3*Ehc_ht*Tx_Tva2)*100)/100)+(int((E_CTA*Tx_Tva1)*100)/100)+(int((ConsoE_hp3*TDC*Tx_Tva2)*100)/100)+(int((ConsoE_hp3*TMC*Tx_Tva2)*100)/100)+(int((ConsoE_hp3*CSPE*Tx_Tva2)*100)/100) rem ' Differences DiffG=int((ConsoG-ConsoG3)*100)/100 DiffE_hc=int((ConsoE_hc-ConsoE_hc3)*100)/100 DiffE_hp=int((ConsoE_hp-ConsoE_hp3)*100)/100 rem ' Fenetre de communication des résultats if F7%=1 top 0,0:left 0,0 show 700 else F7%=1 top 0,0:left 0,0 Form 700:caption 700,"Résultat de la comparaison":width 700,700:height 700,600:top 700,(screen_y-600)/2 :left 700,(screen_x-700)/2 command_target_is 700
container 701:top 701,10:left 701,10:height 701,300:width 701,320:caption 701," Votre Facture ":font_name 701,"Times new roman":font_bold 701:font_size 701,10 alpha 702:parent 702,701:top 702,40:left 702,20 :caption 702,"Consommation Gaz en kWh : " alpha 703:parent 703,701:top 703,65:left 703,20 :caption 703,"Montant facturé TTC : " alpha 704:parent 704,701:top 704,105:left 704,20 :caption 704,"Consommation Elec. HC en kWh : " alpha 705:parent 705,701:top 705,130:left 705,20:caption 705,"Montant facturé TTC : " alpha 706:parent 706,701:top 706,180:left 706,20:caption 706,"Consommation Elec. HP en kWh : " alpha 707:parent 707,701:top 707,205:left 707,20:caption 707,"Montant facturé TTC : " alpha 708:parent 708,701:top 708,40:left 708,210 :caption 708,str$(ConsoG) :font_color 708,140,2,4 alpha 709:parent 709,701:top 709,65:left 709,210 :caption 709,str$(MFG) :font_color 709,140,2,4 alpha 710:parent 710,701:top 710,105:left 710,210 :caption 710,str$(ConsoE_hc):font_color 710,140,2,4 alpha 711:parent 711,701:top 711,130:left 711,210:caption 711,str$(MFE_hc) :font_color 711,140,2,4 alpha 712:parent 712,701:top 712,180:left 712,210:caption 712,str$(ConsoE_hp):font_color 712,140,2,4 alpha 713:parent 713,701:top 713,205:left 713,210:caption 713,str$(MFE_hp):font_color 713,140,2,4
container 720:top 720,10:left 720,340:height 720,300:width 720,320:caption 720," Estimation ":font_name 720,"Times new roman":font_bold 720:font_size 720,10 alpha 722:parent 722,720:top 722,40:left 722,20 :caption 722,"Consommation Gaz en kWh : " alpha 723:parent 723,720:top 723,65:left 723,20 :caption 723,"Montant Estimé TTC : " alpha 724:parent 724,720:top 724,105:left 724,20 :caption 724,"Consommation Elec. HC en kWh : " alpha 725:parent 725,720:top 725,130:left 725,20:caption 725,"Montant Estimé TTC : " alpha 726:parent 726,720:top 726,180:left 726,20:caption 726,"Consommation Elec. HP en kWh : " alpha 727:parent 727,720:top 727,205:left 727,20:caption 727,"Montant Estimé TTC : " alpha 728:parent 728,720:top 728,40:left 728,210 :caption 728,str$(ConsoG3) :font_color 728,7,142,4 alpha 729:parent 729,720:top 729,65:left 729,210 :caption 729,str$(MRG) :font_color 729,7,142,4 alpha 730:parent 730,720:top 730,105:left 730,210 :caption 730,str$(ConsoE_hc3):font_color 730,7,142,4 alpha 731:parent 731,720:top 731,130:left 731,210:caption 731,str$(MRE_hc) :font_color 731,7,142,4 alpha 732:parent 732,720:top 732,180:left 732,210:caption 732,str$(ConsoE_hp3):font_color 732,7,142,4 alpha 733:parent 733,720:top 733,205:left 733,210:caption 733,str$(MRE_hp):font_color 733,7,142,4
container 740:top 740,320:left 740,10:height 740,200:width 740,650:caption 740," Comparaison ":font_name 740,"Times new roman":font_bold 740:font_size 740,10 if MFG > MRG alpha 742:parent 742,740:top 742,40:left 742,20 :caption 742,"Vous avez été surfacturé de : "+str$(MFG-MRG)+" Euro" end_if if MFE_hc > MRE_hc alpha 743:parent 743,740:top 743,70:left 743,20 :caption 743,"Vous avez été surfacturé de : "+str$(MFE_hc-MRE_hc)+" Euro" end_if if MFE_hp > MRE_hp alpha 744:parent 744,740:top 744,100:left 744,20 :caption 744,"Vous avez été surfacturé de : "+str$(MFE_hp-MRE_hp)+" Euro" end_if Button 798:top 798,530 :left 798,490:caption 798,"Imprimer":cursor_point 798 Button 799:top 799,530 :left 799,590:caption 799,"Quitter" :cursor_point 799:on_click 799,Cache700 end_if end_if return
Cache700: hide 700:left 0,(screen_x-500)/2 : top 0,(screen_y-300)/2 command_target_is 0 for x=354 to 357 text x,"" next x hide 350 return
Charge: if count(98)>0 x =count(98) L$=item_read$(98,x) sep%=instr(L$,";") C1$=Left$(L$,sep%-1) text 354,C1$ L$=right$(L$,len(L$)-sep%) sep%=instr(L$,";") C2$=Left$(L$,sep%-1) text 355,C2$ L$=right$(L$,len(L$)-sep%) sep%=instr(L$,";") C3$=Left$(L$,sep%-1) text 356,C3$ C4$=right$(L$,len(L$)-sep%) text 357,C4$ end_if return
Param_Voir: show 400:hide 100:hide 200:hide 300:hide 500:hide 600:hide 350 for x=410 to 420 caption x,item_read$(99,(x-409)) next x return
Param_Modif: show 500:hide 100:hide 200:hide 300:hide 400:hide 600:hide 350 if count(99)>0 for x=510 to 520 text x,item_read$(99,x-509) next x end_if return
Init_Var: if inactive(9)=1 and inactive(11)=1 active 9 active 11 end_if clear 99 for x=1 to 11 if text$(509+x)<>"" item_add 99,text$(509+x) else item_add 99,"0" end_if next x file_save 99,Dossier$+"\Suez.inf" G_ht= val(item_read$(99,1)) Ehc_ht= val(item_read$(99,2)) Ehp_ht= val(item_read$(99,3)) Tx_Tva1= (val(item_read$(99,4))/100)+1 Tx_Tva2= (val(item_read$(99,5))/100)+1 G_CTA= val(item_read$(99,6)) E_CTA= val(item_read$(99,7)) TDC= val(item_read$(99,8)) TMC= val(item_read$(99,9)) CoefG= val(item_read$(99,10)) CSPE= val(item_read$(99,11)) hide 500 return
APP: show 600:hide 100:hide 200:hide 300:hide 400:hide 500:hide 350 alpha 601:parent 601,600:top 601,100:left 601,20:caption 601,"En cours d'élaboration..." return
Quitter: Terminate
| |
| | | Nardo26
Nombre de messages : 2294 Age : 56 Localisation : Valence Date d'inscription : 02/07/2010
| Sujet: Re: Quelques lignes de code plus tard.... Jeu 28 Juin 2012 - 9:19 | |
| Bonjour ygeronimi, En regardant le code de la procédure Calcul, je comprend mieux ton problème d'arrondi... Je me permet de te donner quelques conseils... Tu n'es pas obligé de faire x fois DLL_ON / DLL_OFF de la DLL YGF à chaque fois que tu en as besoin... par exemple pour Calcul: - Code:
-
Calcul:
FOR x=354 TO 357 IF TEXT$(x)="" IF MESSAGE_ERROR_OK("Vous avez oubliez de remplir une case...")=1 m=1 EXIT_FOR ELSE m=0 END_IF END_IF NEXT x IF m = 0 DLL_ON "YGF.dll" D5$ = TEXT$(354) RG% = VAL(TEXT$(355)) RE_hc% = VAL(TEXT$(356)) RE_hp% = VAL(TEXT$(357)) J% = LEFT$(D1$, 2) M% = MID$(D1$, 4, 2) A% = RIGHT$(D1$, 4) D1%= DLL_CALL3("NbJours" , J%, M%, A%)
J% = LEFT$(D2$, 2) M% = MID$(D2$, 4, 2) A% = RIGHT$(D2$, 4) D2%= DLL_CALL3("NbJours" , J%, M%, A%)
J% = LEFT$(D3$, 2) M% = MID$(D3$, 4, 2) A% = RIGHT$(D3$, 4) D3%= DLL_CALL3("NbJours" , J%, M%, A%)
J% = LEFT$(D4$, 2) M% = MID$(D4$, 4, 2) A% = RIGHT$(D4$, 4) D4%= DLL_CALL3("NbJours" , J%, M%, A%)
J%= LEFT$(D5$, 2) M%= MID$(D5$, 4, 2) A%= RIGHT$(D5$, 4) D5%= DLL_CALL3("NbJours" , J%, M%, A%) DLL_OFF ....
Autre chose, pour le calcul de D1%,D2%,D3%,D4% et D5%, il y a exactement les même lignes de code... Lorsque tu as plusieurs variables du même type, de même nature, qui vont subir le même traitement, il est plus judicieux de regrouper toutes ces variables dans un tableau. C'est plus simple par la suite de les traiter dans une boucle FOR. Par Exemple : - Code:
-
DLL_ON "YGF.DLL" FOR m = 1 TO 5 J% = LEFT$(Date$(m), 2) M% = MID$(Date$(m), 4, 2) A% = RIGHT$(Date$(m), 4) NbJours%(m) = DLL_CALL3("NbJours", J%, M%, A%) NEXT m DLL_OFF
De même, il est bon de préciser sous quel format doit être saisi les dates. Toi tu le sais mais la personne qui l'utilise ne le sait par forcement... Par exemple pour le caption de 101 je rajouterai ceci: CAPTION 101,"Date (JJMMAAAA)" La dessus, je rajouterai un contrôle (du LEN dans un 1er temps) pour m'assurer que la date est correcte... | |
| | | Yannick
Nombre de messages : 8635 Age : 53 Localisation : Bretagne Date d'inscription : 15/02/2010
| Sujet: re Jeu 28 Juin 2012 - 13:15 | |
| Salut Nardo, - Pour la dll: je voulais utiliser deux dll dans le prog et quand "format.dll" sera au point , si je fais comme tu dis les deux dll vont être imbriqués et le dll_off de l'un risque de creer un bug avec celui de l'autre en le fermant. - Pour les varibles D Ce sont des dates et je les ai ajouter une a une en fonction des affichages et non d'un tableau connu dès le départ....mais c vrai c pas bô... - Pour le format d'entrée des dates tu as raison , c'est un oubli de ma part mais je plutot passer par un "hint" Donc...je corrige la version 125 et je vous renvoie çà ..... | |
| | | Jicehel
Nombre de messages : 5947 Age : 52 Localisation : 77500 Date d'inscription : 18/04/2011
| Sujet: Re: Quelques lignes de code plus tard.... Jeu 28 Juin 2012 - 13:39 | |
| Sinon tu as la DLL de Klaus qui te permet de faire cohabiter plusieurs DLL en même temps ... | |
| | | Yannick
Nombre de messages : 8635 Age : 53 Localisation : Bretagne Date d'inscription : 15/02/2010
| Sujet: re Jeu 28 Juin 2012 - 13:52 | |
| heuuuu....laquelle ? j'ai du en raté au moins une bonne cinquantaine depuis le temps..... | |
| | | Jicehel
Nombre de messages : 5947 Age : 52 Localisation : 77500 Date d'inscription : 18/04/2011
| Sujet: Re: Quelques lignes de code plus tard.... Jeu 28 Juin 2012 - 14:03 | |
| DynamicallyLoadDLL Cette DLL permet de charger dynamiquement plusieurs DLL's pour un usage simulané avec Panoramic. La seule DLL gérée par Panoramic est alors DynamicallyLoadDLL, et c'est cette DLL qui s'occupe de tout. On peut ajouter dynamiquement n'imprte quelle DLL parmi celles que je propose, mais aussi des DLL d'autres provenances y compris des DLL système comme User32.dll... | |
| | | Yannick
Nombre de messages : 8635 Age : 53 Localisation : Bretagne Date d'inscription : 15/02/2010
| Sujet: re Jeu 28 Juin 2012 - 14:06 | |
| Merci Jicehel Le code qui fonctionne correctemment : (nécessite le .bas ou .exe , format.dll , YGF.dll) - Code:
-
rem ' les variables d'affichages dim x,L%,L$,C1$,C2$,C3$,C4$,sep%,m,F7%,F8% dim Dossier$,Inf%,Option% rem ' Les variables de calcul rem ' Les variables fixes dim G_ht,Ehc_ht,Ehp_ht,Tx_Tva1,Tx_Tva2,G_CTA,E_CTA,TDC,TMC,CoefG,CSPE rem ' Les variables de facturation dim D$(5),DebG%,FinG%,DebE_hc%,FinE_hc%,DebE_hp%,FinE_hp% rem ' Les variables de relevé dim RG%,RE_hc%,RE_hp% rem ' Les variables calculés dim format$,xstr$,result% dim D%(5),J%,M%,A% dim Njfg%,Njfe%,Njrg%,Njre% dim ConsoG,ConsoE_hc,ConsoE_hp dim ConsoG2,ConsoE_hc2,ConsoE_hp2 dim NbreJ1,NbreJ2,NbreJ3,NbreJ4 dim ConsoG3,ConsoE_hc3,ConsoE_hp3 dim MFG,MFE_hc,MFE_hp dim MRG,MRE_hc,MRE_hp dim DiffG,DiffE_hc,DiffE_hp dim a$,b$,c%,c$,f%,e%,z$ rem ' les fonctions du menu label init, Nouveau,Visu,Quitter,Compar,Param_Voir,Param_Modif,APP rem ' les fonctions du container 100 label Enrgt_R,Annul_R rem ' les fonctions du container 200 label Remp_Grid,Graph,Dessin,Dessin1,Dessin2,Q_Graph rem ' les fonctions de container 300 label Compar_2 rem ' les fonctions de container 350 label Calcul,Cache700,Charge rem ' les fonctions du container 500 label Init_Var rem ' fenetre principale Application_title "GDF Suez" caption 0,"GDF Suez" width 0,500 : height 0,300 :left 0,(screen_x-500)/2 : top 0,(screen_y-300)/2
main_menu 1 sub_menu 2 :parent 2,1 :caption 2,"Fichiers" sub_menu 3 :parent 3,2 :caption 3,"Nouveau relevé" :on_click 3,Nouveau sub_menu 4 :parent 4,2 :caption 4,"Visualiser un relevé" :on_click 4,Visu sub_menu 5 :parent 5,2 :caption 5,"--------------------" sub_menu 6 :parent 6,2 :caption 6,"" sub_menu 7 :parent 7,2 :caption 7,"Quitter" :on_click 7,Quitter sub_menu 8 :parent 8,1 :caption 8,"Outils" sub_menu 9 :parent 9,8 :caption 9,"Comparateur" :on_click 9,Compar sub_menu 10:parent 10,1 :caption 10,"Paramètres" sub_menu 11:parent 11,10:caption 11,"Voir" :on_click 11,Param_Voir sub_menu 12:parent 12,10:caption 12,"Modifier" :on_click 12,Param_Modif sub_menu 13:parent 13,1 :caption 13,"A Propos..." :on_click 13,APP
Container 100:caption 100," Nouveau relevé " :hide 100 top 100,10 :left 100,10 :width 100,465 :height 100,220 :font_name 100,"Times new roman":font_size 100,10 Alpha 101:parent 101,100:top 101,25 :left 101,25 :caption 101,"Date" Alpha 102:parent 102,100:top 102,90 :left 102,25 :caption 102,"Compteur Gaz" Alpha 103:parent 103,100:top 103,90 :left 103,135 :caption 103,"Compteur EDF Hc" Alpha 104:parent 104,100:top 104,90 :left 104,260 :caption 104,"Compteur EDF Hp" Edit 105 :parent 105,100:top 105,45 :left 105,25 :width 105,80 hint 105,"format jj/mm/aaaa" Edit 106 :parent 106,100:top 106,110:left 106,25 :width 106,90 Edit 107 :parent 107,100:top 107,110:left 107,135 :width 107,90 Edit 108 :parent 108,100:top 108,110:left 108,260 :width 108,90 Button 109:parent 109,100:top 109,190:left 109,300:caption 109,"Enregistrer":cursor_point 109:on_click 109,Enrgt_R Button 110:parent 110,100:top 110,190:left 110,380:caption 110,"Annuler" :cursor_point 110:on_click 110,Annul_R
Container 200:caption 200," Mes relevés " :hide 200 top 200,10 :left 200,10 :width 200,465 :height 200,220 :font_name 200,"Times new roman":font_size 200,10 Grid 201:parent 201,200:top 201,25:left 201,5:width 201,450:height 201,150:grid_column 201,7:grid_row 201,2 Grid_column_width 201,60 grid_write 201,1,1,"Date" :grid_write 201,1,2,"Gaz" :grid_write 201,1,3,"Elec. Hc":grid_write 201,1,4,"Elec. Hp" grid_write 201,1,5,"C.Gaz":grid_write 201,1,6,"C. Elec hc":grid_write 201,1,7,"C. Elec hp" grid_row_height 201,20 Button 202:parent 202,200:top 202,190:left 202,380:caption 202,"Graphique" :cursor_point 202:on_click 202,Graph
Container 300:caption 300," Comparateur - La Facture " :hide 300 top 300,10 :left 300,10 :width 300,465 :height 300,220 :font_name 300,"Times new roman":font_size 300,10 alpha 301:parent 301,300:top 301,25:left 301,10:caption 301,"Facture :":font_color 301,125,25,7 alpha 302:parent 302,300:top 302,55:left 302,50:caption 302,"Dates début Dates fin" alpha 303:parent 303,300:top 303,55:left 303,250:caption 303,"Index début" alpha 304:parent 304,300:top 304,55:left 304,350:caption 304,"Index fin" alpha 305:parent 305,300:top 305,75:left 305,10:caption 305,"Gaz" alpha 306:parent 306,300:top 306,105:left 306,10:caption 306,"Elec." edit 307:parent 307,300:top 307,72:left 307,50:width 307,65 hint 307,"format jj/mm/aaaa" edit 308:parent 308,300:top 308,72:left 308,130:width 308,65 hint 308,"format jj/mm/aaaa" edit 309:parent 309,300:top 309,72:left 309,250:width 309,90 edit 310:parent 310,300:top 310,72:left 310,350:width 310,90 edit 311:parent 311,300:top 311,103:left 311,50:width 311,65 hint 311,"format jj/mm/aaaa" edit 312:parent 312,300:top 312,103:left 312,130:width 312,65 hint 312,"format jj/mm/aaaa" edit 313:parent 313,300:top 313,103:left 313,250:width 313,90 edit 314:parent 314,300:top 314,103:left 314,350:width 314,90 edit 315:parent 315,300:top 315,134:left 315,250:width 315,90 edit 316:parent 316,300:top 316,134:left 316,350:width 316,90 alpha 317:parent 317,300:top 317,105:left 317,230:caption 317,"Hc":font_italic 317 alpha 318:parent 318,300:top 318,134:left 318,230:caption 318,"Hp":font_italic 318 Button 349:parent 349,300:top 349,190:left 349,380:caption 349,"Mon relevé" :cursor_point 349:on_click 349,Compar_2
Container 350:caption 350," Comparateur - Mon relevé " :hide 350 top 350,10 :left 350,10 :width 350,465 :height 350,220 :font_name 350,"Times new roman":font_size 350,10 alpha 351:parent 351,350:top 351,25:left 351,10:caption 351,"Mon relevé :":font_color 351,125,25,7 alpha 352:parent 352,350:top 352,55:left 352,50:caption 352,"Date" alpha 353:parent 353,350:top 353,55:left 353,250:caption 353,"Relevé" edit 354:parent 354,350:top 354,72:left 354,50:width 354,65 hint 354,"format jj/mm/aaaa" edit 355:parent 355,350:top 355,72:left 355,250:width 355,90 edit 356:parent 356,350:top 356,103:left 356,250:width 356,90 edit 357:parent 357,350:top 357,134:left 357,250:width 357,90 alpha 358:parent 358,350:top 358,105:left 358,230:caption 358,"Hc":font_italic 358 alpha 359:parent 359,350:top 359,134:left 359,230:caption 359,"Hp":font_italic 359 Button 398:parent 398,350:top 398,190:left 398,260:caption 398,"Charger" :cursor_point 398:on_click 398,Charge hint 398,"Charge le dernier relevé enregistré" Button 399:parent 399,350:top 399,190:left 399,380:caption 399,"Calculer" :cursor_point 399:on_click 399,Calcul
Container 400:caption 400," Mes Paramètres " :hide 400 top 400,10 :left 400,10 :width 400,465 :height 400,220 :font_name 400,"Times new roman":font_size 400,10 alpha 401:parent 401,400:top 401,35:left 401,10:caption 401,"Tarif Gaz Kwh Ht :" alpha 402:parent 402,400:top 402,65:left 402,10:caption 402,"Tarif Elec.(Hc) Kwh Ht :" alpha 403:parent 403,400:top 403,95:left 403,10:caption 403,"Tarif Elec.(Hp) Kwh Ht :" alpha 404:parent 404,400:top 404,125:left 404,10:caption 404,"Tx TVA 1 :" alpha 405:parent 405,400:top 405,155:left 405,10:caption 405,"Tx TVA 2 :" alpha 406:parent 406,400:top 406,35:left 406,250:caption 406,"CTA Gaz Ht :" alpha 407:parent 407,400:top 407,65:left 407,250:caption 407,"CTA Elec. Ht :" alpha 408:parent 408,400:top 408,95:left 408,250:caption 408,"TDC Ht :" alpha 409:parent 409,400:top 409,125:left 409,250:caption 409,"TMC Ht :" alpha 421:parent 421,400:top 421,155:left 421,250:caption 421,"Coef Gaz :" alpha 422:parent 422,400:top 422,185:left 422,250:caption 422,"CSPE :" alpha 410:parent 410,400:top 410,35:left 410,150 :font_color 410,188,5,11 alpha 411:parent 411,400:top 411,65:left 411,150 :font_color 411,188,5,11 alpha 412:parent 412,400:top 412,95:left 412,150 :font_color 412,188,5,11 alpha 413:parent 413,400:top 413,125:left 413,150:font_color 413,188,5,11 alpha 414:parent 414,400:top 414,155:left 414,150:font_color 414,188,5,11 alpha 415:parent 415,400:top 415,35:left 415,350 :font_color 415,188,5,11 alpha 416:parent 416,400:top 416,65:left 416,350 :font_color 416,188,5,11 alpha 417:parent 417,400:top 417,95:left 417,350 :font_color 417,188,5,11 alpha 418:parent 418,400:top 418,125:left 418,350:font_color 418,188,5,11 alpha 419:parent 419,400:top 419,155:left 419,350:font_color 419,188,5,11 alpha 420:parent 420,400:top 420,185:left 420,350:font_color 420,188,5,11 alpha 423:parent 423,400:top 423,125:left 423,180:caption 423,"%" alpha 424:parent 424,400:top 424,155:left 424,180:caption 424,"%"
Container 500:caption 500," Modifier les Paramètres ":hide 500 top 500,10 :left 500,10 :width 500,465 :height 500,220 :font_name 500,"Times new roman":font_size 500,10 alpha 501:parent 501,500:top 501,35:left 501,10:caption 501,"Tarif Gaz Kwh Ht :" alpha 502:parent 502,500:top 502,65:left 502,10:caption 502,"Tarif Elec.(Hc) Kwh Ht :" alpha 503:parent 503,500:top 503,95:left 503,10:caption 503,"Tarif Elec.(Hp) Kwh Ht :" alpha 504:parent 504,500:top 504,125:left 504,10:caption 504,"Tx TVA 1 :" alpha 505:parent 505,500:top 505,155:left 505,10:caption 505,"Tx TVA 2 :" alpha 506:parent 506,500:top 506,35:left 506,250:caption 506,"CTA Gaz Ht :" alpha 507:parent 507,500:top 507,65:left 507,250:caption 507,"CTA Elec. Ht :" alpha 508:parent 508,500:top 508,95:left 508,250:caption 508,"TDC Ht :" alpha 509:parent 509,500:top 509,125:left 509,250:caption 509,"TMC Ht :" alpha 521:parent 521,500:top 521,155:left 521,250:caption 521,"Coef Gaz :" alpha 522:parent 522,500:top 522,185:left 522,10:caption 522,"CSPE :" edit 510:parent 510,500:top 510,32:left 510,150:width 510,80 edit 511:parent 511,500:top 511,62:left 511,150:width 511,80 edit 512:parent 512,500:top 512,92:left 512,150:width 512,80 edit 513:parent 513,500:top 513,122:left 513,150:width 513,50 edit 514:parent 514,500:top 514,152:left 514,150:width 514,50 edit 515:parent 515,500:top 515,32:left 515,350:width 515,80 edit 516:parent 516,500:top 516,62:left 516,350:width 516,80 edit 517:parent 517,500:top 517,92:left 517,350:width 517,80 edit 518:parent 518,500:top 518,122:left 518,350:width 518,80 edit 519:parent 519,500:top 519,152:left 519,350:width 519,80 edit 520:parent 520,500:top 520,182:left 520,150:width 520,80 alpha 523:parent 523,500:top 523,125:left 523,205:caption 523,"%" alpha 524:parent 524,500:top 524,155:left 524,205:caption 524,"%"
Button 599:parent 599,500:top 599,190:left 599,380:caption 599,"Enregistrer" :cursor_point 599:on_click 599,Init_Var
Container 600:caption 600," A Propos... ":hide 600 top 600,10 :left 600,10 :width 600,465 :height 600,220 :font_name 600,"Times new roman":font_size 600,10
dlist 98 dlist 99
gosub init end
init: Dossier$=dir_current$ if file_exists(Dossier$+"\Suez.inf")=1 file_load 99,Dossier$+"\Suez.inf" if count(99)>0 G_ht=val(item_read$(99,1)) Ehc_ht=val(item_read$(99,2)) Ehp_ht=val(item_read$(99,3)) Tx_Tva1=val(item_read$(99,4)) Tx_Tva2=val(item_read$(99,5)) G_CTA=val(item_read$(99,6)) E_CTA=val(item_read$(99,7)) TDC=val(item_read$(99,8)) TMC=val(item_read$(99,9)) CoefG=val(item_read$(99,10)) CSPE=val(item_read$(99,11)) else if message_information_yes_no("Le fichier des paramètres de calcul est vide"+chr$(10)+"Voulez vous entrez les paramètres maintenant ?")=1 gosub Param_Modif else Inactive 9 inactive 11 end_if end_if else file_open_write 97,Dossier$+"\Suez.inf" file_close 97 if message_information_yes_no("Vous Utilisez cette application pour la première fois"+chr$(13)+"Voulez vous enregistrer vos paramètres ?")=1 gosub Param_Modif else Inactive 9 inactive 11 end_if end_if if file_exists(Dossier$+"\user\Releves.txt")=1 then file_load 98,Dossier$+"\user\Releves.txt" gosub Remp_grid
return
Nouveau: show 100:hide 200:hide 300:hide 400:hide 500:hide 600:hide 350 set_focus 105 return
Enrgt_R: item_add 98,text$(105)+";"+text$(106)+";"+text$(107)+";"+text$(108) if dir_exists(Dossier$+"\user")=0 then dir_make Dossier$+"\user" file_save 98,Dossier$+"\user\Releves.txt" for x=105 to 108 text x,"" next x hide 100 gosub Remp_Grid return
Annul_R: for x=105 to 108 text x,"" next x hide 100 return
Visu: show 200:hide 100:hide 300:hide 400:hide 500:hide 600:hide 350 return
Remp_Grid: if count(98)<2 then grid_row 201,2 if file_exists(Dossier$+"\user\Releves.txt")=1 L%=1 for x=1 to count(98) L%=L%+1 grid_row 201,L% L$=item_read$(98,x) sep%=instr(L$,";") C1$=Left$(L$,sep%-1) grid_write 201,L%,1,C1$ L$=right$(L$,len(L$)-sep%) sep%=instr(L$,";") C2$=Left$(L$,sep%-1) grid_write 201,L%,2,C2$ L$=right$(L$,len(L$)-sep%) sep%=instr(L$,";") C3$=Left$(L$,sep%-1) grid_write 201,L%,3,C3$ C4$=right$(L$,len(L$)-sep%) grid_write 201,L%,4,C4$ if L%>2 grid_write 201,L%,5,str$(val(C2$)-val(grid_read$(201,L%-1,2))) grid_write 201,L%,6,str$(val(C3$)-val(grid_read$(201,L%-1,3))) grid_write 201,L%,7,str$(val(C4$)-val(grid_read$(201,L%-1,4))) else grid_write 201,L%,5,"0" grid_write 201,L%,6,"0" grid_write 201,L%,7,"0" end_if next x end_if return
Graph: if F8%=1 top 0,0:left 0,0 Show 800 gosub Dessin gosub Dessin1 gosub Dessin2 else F8%=1 top 0,0:left 0,0 Form 800:height 800,500:width 800,750:top 800,(screen_y-500)/2:left 800,(screen_x-750)/2:caption 800,"Evolution des consommations de gaz et d'électricité" command_target_is 800 alpha 801:top 801,405:left 801,35:caption 801,"Gaz" alpha 802:top 802,425:left 802,35:caption 802,"Elec. hc" alpha 803:top 803,445:left 803,35:caption 803,"Elec. hp" button 899:top 899,430:left 899,650:caption 899,"Quitter":cursor_point 899:font_name 899,"Times new roman":font_size 899,10:on_click 899,Q_Graph gosub Dessin gosub Dessin1 gosub Dessin2 end_if return
Dessin: 2d_target_is 800 2d_pen_color 0,0,0 rem ' ligne des abscisses 2d_line 90,400,465,400 rem ' ligne des ordonnées 2d_line 100,0,100,400 rem ' lignes de graduation for x=1 to 39 2d_pen_color 0,0,0 2d_line 90,x*10,100,x*10 2d_pen_color 225,225,225 2d_line 101,x*10,465,x*10 next x rem ' lignes échantillons 2d_pen_color 250,10,10 2d_line 10,415,30,415 2d_pen_color 112,10,168 2d_line 10,435,30,435 2d_pen_color 3,74,214 2d_line 10,455,30,455 rem ' ligne de consommation gaz if count(98)>1 a$=grid_read$(201,2,1) a$=right$(a$,4) a$="01/01/"+a$ c$=grid_read$(201,2,1) dll_on "YGF.dll" J%=left$(a$,2) M%=mid$(a$,4,2) A%=right$(a$,4) c%=dll_call3("NbJours",J%,M%,A%) J%=left$(c$,2) M%=mid$(c$,4,2) A%=right$(c$,4) f%=dll_call3("NbJours",J%,M%,A%) dll_off z$=grid_read$(201,2,5) 2d_poly_from 100+(f%-c%),int(400-(val(z$)/10)) for x=1 to count(98) a$=grid_read$(201,x+1,1) b$=a$ a$=right$(a$,4) a$="01/01/"+a$ c$=grid_read$(201,x+1,5) dll_on "YGF.dll" J%=left$(a$,2) M%=mid$(a$,4,2) A%=right$(a$,4) c%=dll_call3("NbJours",J%,M%,A%) J%=left$(b$,2) M%=mid$(b$,4,2) A%=right$(b$,4) f%=dll_call3("NbJours",J%,M%,A%) dll_off e%=val(c$) 2d_pen_color 250,10,10 2d_poly_to (100+(f%-c%)),int(400-(e% /10)) next x else message "Pas assez de données pour créer un graphique" end_if return
Dessin1: if count(98)>1 a$=grid_read$(201,2,1) a$=right$(a$,4) a$="01/01/"+a$ c$=grid_read$(201,2,1) dll_on "YGF.dll" J%=left$(a$,2) M%=mid$(a$,4,2) A%=right$(a$,4) c%=dll_call3("NbJours",J%,M%,A%) J%=left$(c$,2) M%=mid$(c$,4,2) A%=right$(c$,4) f%=dll_call3("NbJours",J%,M%,A%) dll_off z$=grid_read$(201,2,6) 2d_poly_from 100+(f%-c%),int(400-(val(z$)/10)) for x=1 to count(98) a$=grid_read$(201,x+1,1) b$=a$ a$=right$(a$,4) a$="01/01/"+a$ c$=grid_read$(201,x+1,6) dll_on "YGF.dll" J%=left$(a$,2) M%=mid$(a$,4,2) A%=right$(a$,4) c%=dll_call3("NbJours",J%,M%,A%) J%=left$(b$,2) M%=mid$(b$,4,2) A%=right$(b$,4) f%=dll_call3("NbJours",J%,M%,A%) dll_off e%=val(c$) 2d_pen_color 112,10,168 2d_poly_to (100+(f%-c%)),int(400-(e% /10)) next x end_if return
Dessin2: if count(98)>1 a$=grid_read$(201,2,1) a$=right$(a$,4) a$="01/01/"+a$ c$=grid_read$(201,2,1) dll_on "YGF.dll" J%=left$(a$,2) M%=mid$(a$,4,2) A%=right$(a$,4) c%=dll_call3("NbJours",J%,M%,A%) J%=left$(c$,2) M%=mid$(c$,4,2) A%=right$(c$,4) f%=dll_call3("NbJours",J%,M%,A%) dll_off z$=grid_read$(201,2,7) 2d_poly_from 100+(f%-c%),int(400-(val(z$)/10)) for x=1 to count(98) a$=grid_read$(201,x+1,1) b$=a$ a$=right$(a$,4) a$="01/01/"+a$ c$=grid_read$(201,x+1,7) dll_on "YGF.dll" J%=left$(a$,2) M%=mid$(a$,4,2) A%=right$(a$,4) c%=dll_call3("NbJours",J%,M%,A%) J%=left$(b$,2) M%=mid$(b$,4,2) A%=right$(b$,4) f%=dll_call3("NbJours",J%,M%,A%) dll_off e%=val(c$) 2d_pen_color 3,74,214 2d_poly_to (100+(f%-c%)),int(400-(e% /10)) next x end_if return
Q_Graph: hide 800 left 0,(screen_x-500)/2 : top 0,(screen_y-300)/2 return
Compar: show 300:hide 100:hide 200:hide 400:hide 500:hide 600:hide 350 set_focus 307 return
Compar_2: show 350:hide 100:hide 200:hide 400:hide 500:hide 600:hide 300 for x= 307 to 316 if text$(x)="" if message_error_ok("Vous avez oubliez de remplir une case...")=1 show 300:hide 100:hide 200:hide 400:hide 500:hide 600:hide 350 exit_for end_if end_if next x if show(350)=1 D$(1)=text$(307) D$(2)=text$(308) D$(3)=text$(311) D$(4)=text$(312) DebG%= val(text$(309)) FinG%= val(text$(310)) DebE_hc%= val(text$(313)) FinE_hc%= val(text$(314)) DebE_hp%= val(text$(315)) FinE_hp%= val(text$(316)) end_if for x= 307 to 316 text x,"" next x set_focus 354 return
Calcul: for x= 354 to 357 if text$(x)="" if message_error_ok("Vous avez oubliez de remplir une case...")=1 m=1 exit_for else m=0 end_if end_if next x if m=0
D$(5)=text$(354) RG%=val(text$(355)) RE_hc%=val(text$(356)) RE_hp%=val(text$(357))
dll_on "YGF.dll" for x=1 to 5 J%=left$(D$(x),2) M%=mid$(D$(x),4,2) A%=right$(D$(x),4) D%(x)=dll_call3("NbJours",J%,M%,A%) next x dll_off Njfg%=D%(2)-D%(1) Njfe%=D%(4)-D%(3) Njrg%=D%(5)-D%(1) Njre%=D%(5)-D%(1) dll_on "format.dll" rem ' conso sur facture ConsoG=int((FinG%-DebG%)*CoefG) ConsoE_hc=FinE_hc%-DebE_hc% format$="0000000.00" xstr$=format$ result%=dll_call3("print_format",adr(ConsoE_hc),adr(format$),adr(xstr$)) ConsoE_hc=val(xstr$) ConsoE_hp=FinE_hp%-DebE_hp% format$="0000000.00" xstr$=format$ result%=dll_call3("print_format",adr(ConsoE_hp),adr(format$),adr(xstr$)) ConsoE_hp=val(xstr$) rem ' conso sur relevé ConsoG2=int((RG%-DebG%)*CoefG) ConsoE_hc2=RE_hc%-DebE_hc% format$="0000000.00" xstr$=format$ result%=dll_call3("print_format",adr(ConsoE_hc2),adr(format$),adr(xstr$)) ConsoE_hc2=val(xstr$) ConsoE_hp2=RE_hp%-DebE_hp% format$="0000000.00" xstr$=format$ result%=dll_call3("print_format",adr(ConsoE_hp2),adr(format$),adr(xstr$)) ConsoE_hp2=val(xstr$) rem ' conso estimée ConsoG3=int((ConsoG2/Njrg%)*Njfg% ) ConsoE_hc3=(ConsoE_hc2/Njre%)*Njfe% format$="0000000.00" xstr$=format$ result%=dll_call3("print_format",adr(ConsoE_hc3),adr(format$),adr(xstr$)) ConsoE_hc3=val(xstr$)
ConsoE_hp3=(ConsoE_hp2/Njre%)*Njfe% format$="0000000.00" xstr$=format$ result%=dll_call3("print_format",adr(ConsoE_hp3),adr(format$),adr(xstr$)) ConsoE_hp3=val(xstr$)
dll_off
rem ' facture ttc MFG=(int((ConsoG*G_ht*Tx_Tva2)*100)/100)+(int((G_CTA*Tx_Tva1)*100)/100) MFE_hc=(int((ConsoE_hc*Ehc_ht*Tx_Tva2)*100)/100)+(int((E_CTA*Tx_Tva1)*100)/100)+(int((ConsoE_hc*TDC*Tx_Tva2)*100)/100)+(int((ConsoE_hc*TMC*Tx_Tva2)*100)/100)+(int((ConsoE_hc*CSPE*Tx_Tva2)*100)/100) MFE_hp=(int((ConsoE_hp*Ehc_ht*Tx_Tva2)*100)/100)+(int((E_CTA*Tx_Tva1)*100)/100)+(int((ConsoE_hp*TDC*Tx_Tva2)*100)/100)+(int((ConsoE_hp*TMC*Tx_Tva2)*100)/100)+(int((ConsoE_hp*CSPE*Tx_Tva2)*100)/100)
rem ' Evaluation MRG=(int((ConsoG3*G_ht*Tx_Tva2)*100)/100)+(int((G_CTA*Tx_Tva1)*100)/100) MRE_hc=(int((ConsoE_hc3*Ehc_ht*Tx_Tva2)*100)/100)+(int((E_CTA*Tx_Tva1)*100)/100)+(int((ConsoE_hc3*TDC*Tx_Tva2)*100)/100)+(int((ConsoE_hc3*TMC*Tx_Tva2)*100)/100)+(int((ConsoE_hc3*CSPE*Tx_Tva2)*100)/100) MRE_hp=(int((ConsoE_hp3*Ehc_ht*Tx_Tva2)*100)/100)+(int((E_CTA*Tx_Tva1)*100)/100)+(int((ConsoE_hp3*TDC*Tx_Tva2)*100)/100)+(int((ConsoE_hp3*TMC*Tx_Tva2)*100)/100)+(int((ConsoE_hp3*CSPE*Tx_Tva2)*100)/100) rem ' Differences DiffG=int((ConsoG-ConsoG3)*100)/100 DiffE_hc=int((ConsoE_hc-ConsoE_hc3)*100)/100 DiffE_hp=int((ConsoE_hp-ConsoE_hp3)*100)/100
rem ' Fenetre de communication des résultats if F7%=1 top 0,0:left 0,0 show 700 else F7%=1 top 0,0:left 0,0 Form 700:caption 700,"Résultat de la comparaison":width 700,700:height 700,600:top 700,(screen_y-600)/2 :left 700,(screen_x-700)/2 command_target_is 700
container 701:top 701,10:left 701,10:height 701,300:width 701,320:caption 701," Votre Facture ":font_name 701,"Times new roman":font_bold 701:font_size 701,10 alpha 702:parent 702,701:top 702,40:left 702,20 :caption 702,"Consommation Gaz en kWh : " alpha 703:parent 703,701:top 703,65:left 703,20 :caption 703,"Montant facturé TTC : " alpha 704:parent 704,701:top 704,105:left 704,20 :caption 704,"Consommation Elec. HC en kWh : " alpha 705:parent 705,701:top 705,130:left 705,20:caption 705,"Montant facturé TTC : " alpha 706:parent 706,701:top 706,180:left 706,20:caption 706,"Consommation Elec. HP en kWh : " alpha 707:parent 707,701:top 707,205:left 707,20:caption 707,"Montant facturé TTC : " alpha 708:parent 708,701:top 708,40:left 708,210 :caption 708,str$(ConsoG) :font_color 708,140,2,4 alpha 709:parent 709,701:top 709,65:left 709,210 :caption 709,str$(MFG) :font_color 709,140,2,4 alpha 710:parent 710,701:top 710,105:left 710,210 :caption 710,str$(ConsoE_hc):font_color 710,140,2,4 alpha 711:parent 711,701:top 711,130:left 711,210:caption 711,str$(MFE_hc) :font_color 711,140,2,4 alpha 712:parent 712,701:top 712,180:left 712,210:caption 712,str$(ConsoE_hp):font_color 712,140,2,4 alpha 713:parent 713,701:top 713,205:left 713,210:caption 713,str$(MFE_hp):font_color 713,140,2,4
container 720:top 720,10:left 720,340:height 720,300:width 720,320:caption 720," Estimation ":font_name 720,"Times new roman":font_bold 720:font_size 720,10 alpha 722:parent 722,720:top 722,40:left 722,20 :caption 722,"Consommation Gaz en kWh : " alpha 723:parent 723,720:top 723,65:left 723,20 :caption 723,"Montant Estimé TTC : " alpha 724:parent 724,720:top 724,105:left 724,20 :caption 724,"Consommation Elec. HC en kWh : " alpha 725:parent 725,720:top 725,130:left 725,20:caption 725,"Montant Estimé TTC : " alpha 726:parent 726,720:top 726,180:left 726,20:caption 726,"Consommation Elec. HP en kWh : " alpha 727:parent 727,720:top 727,205:left 727,20:caption 727,"Montant Estimé TTC : " alpha 728:parent 728,720:top 728,40:left 728,210 :caption 728,str$(ConsoG3) :font_color 728,7,142,4 alpha 729:parent 729,720:top 729,65:left 729,210 :caption 729,str$(MRG) :font_color 729,7,142,4 alpha 730:parent 730,720:top 730,105:left 730,210 :caption 730,str$(ConsoE_hc3):font_color 730,7,142,4 alpha 731:parent 731,720:top 731,130:left 731,210:caption 731,str$(MRE_hc) :font_color 731,7,142,4 alpha 732:parent 732,720:top 732,180:left 732,210:caption 732,str$(ConsoE_hp3):font_color 732,7,142,4 alpha 733:parent 733,720:top 733,205:left 733,210:caption 733,str$(MRE_hp):font_color 733,7,142,4
container 740:top 740,320:left 740,10:height 740,200:width 740,650:caption 740," Comparaison ":font_name 740,"Times new roman":font_bold 740:font_size 740,10 if MFG > MRG alpha 742:parent 742,740:top 742,40:left 742,20 :caption 742,"Vous avez été surfacturé de : "+str$(MFG-MRG)+" Euro" end_if if MFE_hc > MRE_hc alpha 743:parent 743,740:top 743,70:left 743,20 :caption 743,"Vous avez été surfacturé de : "+str$(MFE_hc-MRE_hc)+" Euro" end_if if MFE_hp > MRE_hp alpha 744:parent 744,740:top 744,100:left 744,20 :caption 744,"Vous avez été surfacturé de : "+str$(MFE_hp-MRE_hp)+" Euro" end_if Button 798:top 798,530 :left 798,490:caption 798,"Imprimer":cursor_point 798 Button 799:top 799,530 :left 799,590:caption 799,"Quitter" :cursor_point 799:on_click 799,Cache700 end_if end_if return
Cache700: hide 700:left 0,(screen_x-500)/2 : top 0,(screen_y-300)/2 command_target_is 0 for x=354 to 357 text x,"" next x hide 350 return
Charge: if count(98)>0 x =count(98) L$=item_read$(98,x) sep%=instr(L$,";") C1$=Left$(L$,sep%-1) text 354,C1$ L$=right$(L$,len(L$)-sep%) sep%=instr(L$,";") C2$=Left$(L$,sep%-1) text 355,C2$ L$=right$(L$,len(L$)-sep%) sep%=instr(L$,";") C3$=Left$(L$,sep%-1) text 356,C3$ C4$=right$(L$,len(L$)-sep%) text 357,C4$ end_if return
Param_Voir: show 400:hide 100:hide 200:hide 300:hide 500:hide 600:hide 350 for x=410 to 420 caption x,item_read$(99,(x-409)) next x return
Param_Modif: show 500:hide 100:hide 200:hide 300:hide 400:hide 600:hide 350 if count(99)>0 for x=510 to 520 text x,item_read$(99,x-509) next x end_if return
Init_Var: if inactive(9)=1 and inactive(11)=1 active 9 active 11 end_if clear 99 for x=1 to 11 if text$(509+x)<>"" item_add 99,text$(509+x) else item_add 99,"0" end_if next x file_save 99,Dossier$+"\Suez.inf" G_ht= val(item_read$(99,1)) Ehc_ht= val(item_read$(99,2)) Ehp_ht= val(item_read$(99,3)) Tx_Tva1= (val(item_read$(99,4))/100)+1 Tx_Tva2= (val(item_read$(99,5))/100)+1 G_CTA= val(item_read$(99,6)) E_CTA= val(item_read$(99,7)) TDC= val(item_read$(99,8)) TMC= val(item_read$(99,9)) CoefG= val(item_read$(99,10)) CSPE= val(item_read$(99,11)) hide 500 return
APP: show 600:hide 100:hide 200:hide 300:hide 400:hide 500:hide 350 alpha 601:parent 601,600:top 601,100:left 601,20:caption 601,"En cours d'élaboration..." return
Quitter: Terminate
| |
| | | Yannick
Nombre de messages : 8635 Age : 53 Localisation : Bretagne Date d'inscription : 15/02/2010
| Sujet: re Ven 29 Juin 2012 - 6:05 | |
| Voici une version avec histo.dll de notre ami Klaus.... Nécessite : source.bas ou .exe histo.dll YGF.dll format.dll et que vous ayez le fameux CFX32.ocx d'installé.... cette version est surement la meilleur pour l'affichage du graphique, la précedente , tout Panoramic, attendra une bar_horizontale sur le scene2d - Code:
-
rem ' les variables d'affichages dim x,L%,L$,C1$,C2$,C3$,C4$,sep%,m,F7%,F8% dim Dossier$,Inf%,Option% rem ' Les variables de calcul rem ' Les variables fixes dim G_ht,Ehc_ht,Ehp_ht,Tx_Tva1,Tx_Tva2,G_CTA,E_CTA,TDC,TMC,CoefG,CSPE rem ' Les variables de facturation dim D$(5),DebG%,FinG%,DebE_hc%,FinE_hc%,DebE_hp%,FinE_hp% rem ' Les variables de relevé dim RG%,RE_hc%,RE_hp% rem ' Les variables calculés dim fichier$,Conf%,res% dim format$,xstr$,result% dim D%(5),J%,M%,A% dim Njfg%,Njfe%,Njrg%,Njre% dim ConsoG,ConsoE_hc,ConsoE_hp dim ConsoG2,ConsoE_hc2,ConsoE_hp2 dim NbreJ1,NbreJ2,NbreJ3,NbreJ4 dim ConsoG3,ConsoE_hc3,ConsoE_hp3 dim MFG,MFE_hc,MFE_hp dim MRG,MRE_hc,MRE_hp dim DiffG,DiffE_hc,DiffE_hp dim a$,b$,c%,c$,f%,e%,z$ rem ' les fonctions du menu label init, Nouveau,Visu,Quitter,Compar,Param_Voir,Param_Modif,APP rem ' les fonctions du container 100 label Enrgt_R,Annul_R rem ' les fonctions du container 200 label Remp_Grid,Graph,Dessin rem ' les fonctions de container 300 label Compar_2 rem ' les fonctions de container 350 label Calcul,Cache700,Charge rem ' les fonctions du container 500 label Init_Var rem ' fenetre principale Application_title "GDF Suez" caption 0,"GDF Suez" width 0,500 : height 0,300 :left 0,(screen_x-500)/2 : top 0,(screen_y-300)/2
main_menu 1 sub_menu 2 :parent 2,1 :caption 2,"Fichiers" sub_menu 3 :parent 3,2 :caption 3,"Nouveau relevé" :on_click 3,Nouveau sub_menu 4 :parent 4,2 :caption 4,"Visualiser un relevé" :on_click 4,Visu sub_menu 5 :parent 5,2 :caption 5,"--------------------" sub_menu 6 :parent 6,2 :caption 6,"" sub_menu 7 :parent 7,2 :caption 7,"Quitter" :on_click 7,Quitter sub_menu 8 :parent 8,1 :caption 8,"Outils" sub_menu 9 :parent 9,8 :caption 9,"Comparateur" :on_click 9,Compar sub_menu 10:parent 10,1 :caption 10,"Paramètres" sub_menu 11:parent 11,10:caption 11,"Voir" :on_click 11,Param_Voir sub_menu 12:parent 12,10:caption 12,"Modifier" :on_click 12,Param_Modif sub_menu 13:parent 13,1 :caption 13,"A Propos..." :on_click 13,APP
Container 100:caption 100," Nouveau relevé " :hide 100 top 100,10 :left 100,10 :width 100,465 :height 100,220 :font_name 100,"Times new roman":font_size 100,10 Alpha 101:parent 101,100:top 101,25 :left 101,25 :caption 101,"Date" Alpha 102:parent 102,100:top 102,90 :left 102,25 :caption 102,"Compteur Gaz" Alpha 103:parent 103,100:top 103,90 :left 103,135 :caption 103,"Compteur EDF Hc" Alpha 104:parent 104,100:top 104,90 :left 104,260 :caption 104,"Compteur EDF Hp" Edit 105 :parent 105,100:top 105,45 :left 105,25 :width 105,80 hint 105,"format jj/mm/aaaa" Edit 106 :parent 106,100:top 106,110:left 106,25 :width 106,90 Edit 107 :parent 107,100:top 107,110:left 107,135 :width 107,90 Edit 108 :parent 108,100:top 108,110:left 108,260 :width 108,90 Button 109:parent 109,100:top 109,190:left 109,300:caption 109,"Enregistrer":cursor_point 109:on_click 109,Enrgt_R Button 110:parent 110,100:top 110,190:left 110,380:caption 110,"Annuler" :cursor_point 110:on_click 110,Annul_R
Container 200:caption 200," Mes relevés " :hide 200 top 200,10 :left 200,10 :width 200,465 :height 200,220 :font_name 200,"Times new roman":font_size 200,10 Grid 201:parent 201,200:top 201,25:left 201,5:width 201,450:height 201,150:grid_column 201,7:grid_row 201,2 Grid_column_width 201,60 grid_write 201,1,1,"Date" :grid_write 201,1,2,"Gaz" :grid_write 201,1,3,"Elec. Hc":grid_write 201,1,4,"Elec. Hp" grid_write 201,1,5,"C.Gaz":grid_write 201,1,6,"C. Elec hc":grid_write 201,1,7,"C. Elec hp" grid_row_height 201,20 Button 202:parent 202,200:top 202,190:left 202,380:caption 202,"Graphique" :cursor_point 202:on_click 202,Graph
Container 300:caption 300," Comparateur - La Facture " :hide 300 top 300,10 :left 300,10 :width 300,465 :height 300,220 :font_name 300,"Times new roman":font_size 300,10 alpha 301:parent 301,300:top 301,25:left 301,10:caption 301,"Facture :":font_color 301,125,25,7 alpha 302:parent 302,300:top 302,55:left 302,50:caption 302,"Dates début Dates fin" alpha 303:parent 303,300:top 303,55:left 303,250:caption 303,"Index début" alpha 304:parent 304,300:top 304,55:left 304,350:caption 304,"Index fin" alpha 305:parent 305,300:top 305,75:left 305,10:caption 305,"Gaz" alpha 306:parent 306,300:top 306,105:left 306,10:caption 306,"Elec." edit 307:parent 307,300:top 307,72:left 307,50:width 307,65 hint 307,"format jj/mm/aaaa" edit 308:parent 308,300:top 308,72:left 308,130:width 308,65 hint 308,"format jj/mm/aaaa" edit 309:parent 309,300:top 309,72:left 309,250:width 309,90 edit 310:parent 310,300:top 310,72:left 310,350:width 310,90 edit 311:parent 311,300:top 311,103:left 311,50:width 311,65 hint 311,"format jj/mm/aaaa" edit 312:parent 312,300:top 312,103:left 312,130:width 312,65 hint 312,"format jj/mm/aaaa" edit 313:parent 313,300:top 313,103:left 313,250:width 313,90 edit 314:parent 314,300:top 314,103:left 314,350:width 314,90 edit 315:parent 315,300:top 315,134:left 315,250:width 315,90 edit 316:parent 316,300:top 316,134:left 316,350:width 316,90 alpha 317:parent 317,300:top 317,105:left 317,230:caption 317,"Hc":font_italic 317 alpha 318:parent 318,300:top 318,134:left 318,230:caption 318,"Hp":font_italic 318 Button 349:parent 349,300:top 349,190:left 349,380:caption 349,"Mon relevé" :cursor_point 349:on_click 349,Compar_2
Container 350:caption 350," Comparateur - Mon relevé " :hide 350 top 350,10 :left 350,10 :width 350,465 :height 350,220 :font_name 350,"Times new roman":font_size 350,10 alpha 351:parent 351,350:top 351,25:left 351,10:caption 351,"Mon relevé :":font_color 351,125,25,7 alpha 352:parent 352,350:top 352,55:left 352,50:caption 352,"Date" alpha 353:parent 353,350:top 353,55:left 353,250:caption 353,"Relevé" edit 354:parent 354,350:top 354,72:left 354,50:width 354,65 hint 354,"format jj/mm/aaaa" edit 355:parent 355,350:top 355,72:left 355,250:width 355,90 edit 356:parent 356,350:top 356,103:left 356,250:width 356,90 edit 357:parent 357,350:top 357,134:left 357,250:width 357,90 alpha 358:parent 358,350:top 358,105:left 358,230:caption 358,"Hc":font_italic 358 alpha 359:parent 359,350:top 359,134:left 359,230:caption 359,"Hp":font_italic 359 Button 398:parent 398,350:top 398,190:left 398,260:caption 398,"Charger" :cursor_point 398:on_click 398,Charge hint 398,"Charge le dernier relevé enregistré" Button 399:parent 399,350:top 399,190:left 399,380:caption 399,"Calculer" :cursor_point 399:on_click 399,Calcul
Container 400:caption 400," Mes Paramètres " :hide 400 top 400,10 :left 400,10 :width 400,465 :height 400,220 :font_name 400,"Times new roman":font_size 400,10 alpha 401:parent 401,400:top 401,35:left 401,10:caption 401,"Tarif Gaz Kwh Ht :" alpha 402:parent 402,400:top 402,65:left 402,10:caption 402,"Tarif Elec.(Hc) Kwh Ht :" alpha 403:parent 403,400:top 403,95:left 403,10:caption 403,"Tarif Elec.(Hp) Kwh Ht :" alpha 404:parent 404,400:top 404,125:left 404,10:caption 404,"Tx TVA 1 :" alpha 405:parent 405,400:top 405,155:left 405,10:caption 405,"Tx TVA 2 :" alpha 406:parent 406,400:top 406,35:left 406,250:caption 406,"CTA Gaz Ht :" alpha 407:parent 407,400:top 407,65:left 407,250:caption 407,"CTA Elec. Ht :" alpha 408:parent 408,400:top 408,95:left 408,250:caption 408,"TDC Ht :" alpha 409:parent 409,400:top 409,125:left 409,250:caption 409,"TMC Ht :" alpha 421:parent 421,400:top 421,155:left 421,250:caption 421,"Coef Gaz :" alpha 422:parent 422,400:top 422,185:left 422,250:caption 422,"CSPE :" alpha 410:parent 410,400:top 410,35:left 410,150 :font_color 410,188,5,11 alpha 411:parent 411,400:top 411,65:left 411,150 :font_color 411,188,5,11 alpha 412:parent 412,400:top 412,95:left 412,150 :font_color 412,188,5,11 alpha 413:parent 413,400:top 413,125:left 413,150:font_color 413,188,5,11 alpha 414:parent 414,400:top 414,155:left 414,150:font_color 414,188,5,11 alpha 415:parent 415,400:top 415,35:left 415,350 :font_color 415,188,5,11 alpha 416:parent 416,400:top 416,65:left 416,350 :font_color 416,188,5,11 alpha 417:parent 417,400:top 417,95:left 417,350 :font_color 417,188,5,11 alpha 418:parent 418,400:top 418,125:left 418,350:font_color 418,188,5,11 alpha 419:parent 419,400:top 419,155:left 419,350:font_color 419,188,5,11 alpha 420:parent 420,400:top 420,185:left 420,350:font_color 420,188,5,11 alpha 423:parent 423,400:top 423,125:left 423,180:caption 423,"%" alpha 424:parent 424,400:top 424,155:left 424,180:caption 424,"%"
Container 500:caption 500," Modifier les Paramètres ":hide 500 top 500,10 :left 500,10 :width 500,465 :height 500,220 :font_name 500,"Times new roman":font_size 500,10 alpha 501:parent 501,500:top 501,35:left 501,10:caption 501,"Tarif Gaz Kwh Ht :" alpha 502:parent 502,500:top 502,65:left 502,10:caption 502,"Tarif Elec.(Hc) Kwh Ht :" alpha 503:parent 503,500:top 503,95:left 503,10:caption 503,"Tarif Elec.(Hp) Kwh Ht :" alpha 504:parent 504,500:top 504,125:left 504,10:caption 504,"Tx TVA 1 :" alpha 505:parent 505,500:top 505,155:left 505,10:caption 505,"Tx TVA 2 :" alpha 506:parent 506,500:top 506,35:left 506,250:caption 506,"CTA Gaz Ht :" alpha 507:parent 507,500:top 507,65:left 507,250:caption 507,"CTA Elec. Ht :" alpha 508:parent 508,500:top 508,95:left 508,250:caption 508,"TDC Ht :" alpha 509:parent 509,500:top 509,125:left 509,250:caption 509,"TMC Ht :" alpha 521:parent 521,500:top 521,155:left 521,250:caption 521,"Coef Gaz :" alpha 522:parent 522,500:top 522,185:left 522,10:caption 522,"CSPE :" edit 510:parent 510,500:top 510,32:left 510,150:width 510,80 edit 511:parent 511,500:top 511,62:left 511,150:width 511,80 edit 512:parent 512,500:top 512,92:left 512,150:width 512,80 edit 513:parent 513,500:top 513,122:left 513,150:width 513,50 edit 514:parent 514,500:top 514,152:left 514,150:width 514,50 edit 515:parent 515,500:top 515,32:left 515,350:width 515,80 edit 516:parent 516,500:top 516,62:left 516,350:width 516,80 edit 517:parent 517,500:top 517,92:left 517,350:width 517,80 edit 518:parent 518,500:top 518,122:left 518,350:width 518,80 edit 519:parent 519,500:top 519,152:left 519,350:width 519,80 edit 520:parent 520,500:top 520,182:left 520,150:width 520,80 alpha 523:parent 523,500:top 523,125:left 523,205:caption 523,"%" alpha 524:parent 524,500:top 524,155:left 524,205:caption 524,"%"
Button 599:parent 599,500:top 599,190:left 599,380:caption 599,"Enregistrer" :cursor_point 599:on_click 599,Init_Var
Container 600:caption 600," A Propos... ":hide 600 top 600,10 :left 600,10 :width 600,465 :height 600,220 :font_name 600,"Times new roman":font_size 600,10
dlist 98 dlist 99
gosub init end
init: Dossier$=dir_current$ if file_exists(Dossier$+"\Suez.inf")=1 file_load 99,Dossier$+"\Suez.inf" if count(99)>0 G_ht=val(item_read$(99,1)) Ehc_ht=val(item_read$(99,2)) Ehp_ht=val(item_read$(99,3)) Tx_Tva1=val(item_read$(99,4)) Tx_Tva2=val(item_read$(99,5)) G_CTA=val(item_read$(99,6)) E_CTA=val(item_read$(99,7)) TDC=val(item_read$(99,8)) TMC=val(item_read$(99,9)) CoefG=val(item_read$(99,10)) CSPE=val(item_read$(99,11)) else if message_information_yes_no("Le fichier des paramètres de calcul est vide"+chr$(10)+"Voulez vous entrez les paramètres maintenant ?")=1 gosub Param_Modif else Inactive 9 inactive 11 end_if end_if else file_open_write 97,Dossier$+"\Suez.inf" file_close 97 if message_information_yes_no("Vous Utilisez cette application pour la première fois"+chr$(13)+"Voulez vous enregistrer vos paramètres ?")=1 gosub Param_Modif else Inactive 9 inactive 11 end_if end_if if file_exists(Dossier$+"\user\Releves.txt")=1 then file_load 98,Dossier$+"\user\Releves.txt" gosub Remp_grid
return
Nouveau: show 100:hide 200:hide 300:hide 400:hide 500:hide 600:hide 350 set_focus 105 return
Enrgt_R: item_add 98,text$(105)+";"+text$(106)+";"+text$(107)+";"+text$(108) if dir_exists(Dossier$+"\user")=0 then dir_make Dossier$+"\user" file_save 98,Dossier$+"\user\Releves.txt" for x=105 to 108 text x,"" next x hide 100 rem ' Pour que l'application recrée un nouveau fichier tenant compte de l'ajout pour le graphique if file_exists(Dossier$+"\Graph.txt")=1 file_delete Dossier$+"\Graph.txt" end_if gosub Remp_Grid return
Annul_R: for x=105 to 108 text x,"" next x hide 100 return
Visu: show 200:hide 100:hide 300:hide 400:hide 500:hide 600:hide 350 return
Remp_Grid: if count(98)<2 then grid_row 201,2 if file_exists(Dossier$+"\user\Releves.txt")=1 L%=1 for x=1 to count(98) L%=L%+1 grid_row 201,L% L$=item_read$(98,x) sep%=instr(L$,";") C1$=Left$(L$,sep%-1) grid_write 201,L%,1,C1$ L$=right$(L$,len(L$)-sep%) sep%=instr(L$,";") C2$=Left$(L$,sep%-1) grid_write 201,L%,2,C2$ L$=right$(L$,len(L$)-sep%) sep%=instr(L$,";") C3$=Left$(L$,sep%-1) grid_write 201,L%,3,C3$ C4$=right$(L$,len(L$)-sep%) grid_write 201,L%,4,C4$ if L%>2 grid_write 201,L%,5,str$(val(C2$)-val(grid_read$(201,L%-1,2))) grid_write 201,L%,6,str$(val(C3$)-val(grid_read$(201,L%-1,3))) grid_write 201,L%,7,str$(val(C4$)-val(grid_read$(201,L%-1,4))) else grid_write 201,L%,5,"0" grid_write 201,L%,6,"0" grid_write 201,L%,7,"0" end_if next x end_if return
Graph: if count(98)>2 file_open_write 97,"Graph.txt" file_writeln 97,"#Type=BAR" file_writeln 97,"#Largeur=2" file_writeln 97,"#Séries=3" file_writeln 97,"#Valeurs="+str$(count(98)-1) file_writeln 97,"#Données=1" for x=3 to count(98)+1 file_writeln 97,grid_read$(201,x,5) next x file_writeln 97,"#Données=2" for x=3 to count(98)+1 file_writeln 97,grid_read$(201,x,6) next x file_writeln 97,"#Données=3" for x=3 to count(98)+1 file_writeln 97,grid_read$(201,x,7) next x file_writeln 97,"#Titres" file_writeln 97,"Haut=Evolution des consommations" file_writeln 97,"Gauche=Conso. en kWh" file_writeln 97,"Bas=Relevés" file_writeln 97,"Droite=Divers" file_writeln 97,"#Légendes séries" file_writeln 97,"Gaz" file_writeln 97,"Electricité hc" file_writeln 97,"Electricité hp" file_writeln 97,"#Légendes valeurs" for x=3 to count(98)+1 file_writeln 97,grid_read$(201,x,1) next x file_writeln 97,"#Fin" file_close 97 gosub Dessin else message "Données insuffisantes pour créer un graphique" end_if return
Dessin: Fichier$=Dossier$+"\Graph.txt" Conf%=4 dll_on "histo.dll" res%=dll_call2("HistogrammeEX",adr(Fichier$),Conf%) dll_off return
Compar: show 300:hide 100:hide 200:hide 400:hide 500:hide 600:hide 350 set_focus 307 return
Compar_2: show 350:hide 100:hide 200:hide 400:hide 500:hide 600:hide 300 for x= 307 to 316 if text$(x)="" if message_error_ok("Vous avez oubliez de remplir une case...")=1 show 300:hide 100:hide 200:hide 400:hide 500:hide 600:hide 350 exit_for end_if end_if next x if show(350)=1 D$(1)=text$(307) D$(2)=text$(308) D$(3)=text$(311) D$(4)=text$(312) DebG%= val(text$(309)) FinG%= val(text$(310)) DebE_hc%= val(text$(313)) FinE_hc%= val(text$(314)) DebE_hp%= val(text$(315)) FinE_hp%= val(text$(316)) end_if for x= 307 to 316 text x,"" next x set_focus 354 return
Calcul: for x= 354 to 357 if text$(x)="" if message_error_ok("Vous avez oubliez de remplir une case...")=1 m=1 exit_for else m=0 end_if end_if next x if m=0
D$(5)=text$(354) RG%=val(text$(355)) RE_hc%=val(text$(356)) RE_hp%=val(text$(357))
dll_on "YGF.dll" for x=1 to 5 J%=left$(D$(x),2) M%=mid$(D$(x),4,2) A%=right$(D$(x),4) D%(x)=dll_call3("NbJours",J%,M%,A%) next x dll_off Njfg%=D%(2)-D%(1) Njfe%=D%(4)-D%(3) Njrg%=D%(5)-D%(1) Njre%=D%(5)-D%(1) dll_on "format.dll" rem ' conso sur facture ConsoG=int((FinG%-DebG%)*CoefG) ConsoE_hc=FinE_hc%-DebE_hc% format$="0000000.00" xstr$=format$ result%=dll_call3("print_format",adr(ConsoE_hc),adr(format$),adr(xstr$)) ConsoE_hc=val(xstr$) ConsoE_hp=FinE_hp%-DebE_hp% format$="0000000.00" xstr$=format$ result%=dll_call3("print_format",adr(ConsoE_hp),adr(format$),adr(xstr$)) ConsoE_hp=val(xstr$) rem ' conso sur relevé ConsoG2=int((RG%-DebG%)*CoefG) ConsoE_hc2=RE_hc%-DebE_hc% format$="0000000.00" xstr$=format$ result%=dll_call3("print_format",adr(ConsoE_hc2),adr(format$),adr(xstr$)) ConsoE_hc2=val(xstr$) ConsoE_hp2=RE_hp%-DebE_hp% format$="0000000.00" xstr$=format$ result%=dll_call3("print_format",adr(ConsoE_hp2),adr(format$),adr(xstr$)) ConsoE_hp2=val(xstr$) rem ' conso estimée ConsoG3=int((ConsoG2/Njrg%)*Njfg% ) ConsoE_hc3=(ConsoE_hc2/Njre%)*Njfe% format$="0000000.00" xstr$=format$ result%=dll_call3("print_format",adr(ConsoE_hc3),adr(format$),adr(xstr$)) ConsoE_hc3=val(xstr$)
ConsoE_hp3=(ConsoE_hp2/Njre%)*Njfe% format$="0000000.00" xstr$=format$ result%=dll_call3("print_format",adr(ConsoE_hp3),adr(format$),adr(xstr$)) ConsoE_hp3=val(xstr$)
dll_off
rem ' facture ttc MFG=(int((ConsoG*G_ht*Tx_Tva2)*100)/100)+(int((G_CTA*Tx_Tva1)*100)/100) MFE_hc=(int((ConsoE_hc*Ehc_ht*Tx_Tva2)*100)/100)+(int((E_CTA*Tx_Tva1)*100)/100)+(int((ConsoE_hc*TDC*Tx_Tva2)*100)/100)+(int((ConsoE_hc*TMC*Tx_Tva2)*100)/100)+(int((ConsoE_hc*CSPE*Tx_Tva2)*100)/100) MFE_hp=(int((ConsoE_hp*Ehc_ht*Tx_Tva2)*100)/100)+(int((E_CTA*Tx_Tva1)*100)/100)+(int((ConsoE_hp*TDC*Tx_Tva2)*100)/100)+(int((ConsoE_hp*TMC*Tx_Tva2)*100)/100)+(int((ConsoE_hp*CSPE*Tx_Tva2)*100)/100)
rem ' Evaluation MRG=(int((ConsoG3*G_ht*Tx_Tva2)*100)/100)+(int((G_CTA*Tx_Tva1)*100)/100) MRE_hc=(int((ConsoE_hc3*Ehc_ht*Tx_Tva2)*100)/100)+(int((E_CTA*Tx_Tva1)*100)/100)+(int((ConsoE_hc3*TDC*Tx_Tva2)*100)/100)+(int((ConsoE_hc3*TMC*Tx_Tva2)*100)/100)+(int((ConsoE_hc3*CSPE*Tx_Tva2)*100)/100) MRE_hp=(int((ConsoE_hp3*Ehc_ht*Tx_Tva2)*100)/100)+(int((E_CTA*Tx_Tva1)*100)/100)+(int((ConsoE_hp3*TDC*Tx_Tva2)*100)/100)+(int((ConsoE_hp3*TMC*Tx_Tva2)*100)/100)+(int((ConsoE_hp3*CSPE*Tx_Tva2)*100)/100) rem ' Differences DiffG=int((ConsoG-ConsoG3)*100)/100 DiffE_hc=int((ConsoE_hc-ConsoE_hc3)*100)/100 DiffE_hp=int((ConsoE_hp-ConsoE_hp3)*100)/100
rem ' Fenetre de communication des résultats if F7%=1 top 0,0:left 0,0 show 700 else F7%=1 top 0,0:left 0,0 Form 700:caption 700,"Résultat de la comparaison":width 700,700:height 700,600:top 700,(screen_y-600)/2 :left 700,(screen_x-700)/2 command_target_is 700
container 701:top 701,10:left 701,10:height 701,300:width 701,320:caption 701," Votre Facture ":font_name 701,"Times new roman":font_bold 701:font_size 701,10 alpha 702:parent 702,701:top 702,40:left 702,20 :caption 702,"Consommation Gaz en kWh : " alpha 703:parent 703,701:top 703,65:left 703,20 :caption 703,"Montant facturé TTC : " alpha 704:parent 704,701:top 704,105:left 704,20 :caption 704,"Consommation Elec. HC en kWh : " alpha 705:parent 705,701:top 705,130:left 705,20:caption 705,"Montant facturé TTC : " alpha 706:parent 706,701:top 706,180:left 706,20:caption 706,"Consommation Elec. HP en kWh : " alpha 707:parent 707,701:top 707,205:left 707,20:caption 707,"Montant facturé TTC : " alpha 708:parent 708,701:top 708,40:left 708,210 :caption 708,str$(ConsoG) :font_color 708,140,2,4 alpha 709:parent 709,701:top 709,65:left 709,210 :caption 709,str$(MFG) :font_color 709,140,2,4 alpha 710:parent 710,701:top 710,105:left 710,210 :caption 710,str$(ConsoE_hc):font_color 710,140,2,4 alpha 711:parent 711,701:top 711,130:left 711,210:caption 711,str$(MFE_hc) :font_color 711,140,2,4 alpha 712:parent 712,701:top 712,180:left 712,210:caption 712,str$(ConsoE_hp):font_color 712,140,2,4 alpha 713:parent 713,701:top 713,205:left 713,210:caption 713,str$(MFE_hp):font_color 713,140,2,4
container 720:top 720,10:left 720,340:height 720,300:width 720,320:caption 720," Estimation ":font_name 720,"Times new roman":font_bold 720:font_size 720,10 alpha 722:parent 722,720:top 722,40:left 722,20 :caption 722,"Consommation Gaz en kWh : " alpha 723:parent 723,720:top 723,65:left 723,20 :caption 723,"Montant Estimé TTC : " alpha 724:parent 724,720:top 724,105:left 724,20 :caption 724,"Consommation Elec. HC en kWh : " alpha 725:parent 725,720:top 725,130:left 725,20:caption 725,"Montant Estimé TTC : " alpha 726:parent 726,720:top 726,180:left 726,20:caption 726,"Consommation Elec. HP en kWh : " alpha 727:parent 727,720:top 727,205:left 727,20:caption 727,"Montant Estimé TTC : " alpha 728:parent 728,720:top 728,40:left 728,210 :caption 728,str$(ConsoG3) :font_color 728,7,142,4 alpha 729:parent 729,720:top 729,65:left 729,210 :caption 729,str$(MRG) :font_color 729,7,142,4 alpha 730:parent 730,720:top 730,105:left 730,210 :caption 730,str$(ConsoE_hc3):font_color 730,7,142,4 alpha 731:parent 731,720:top 731,130:left 731,210:caption 731,str$(MRE_hc) :font_color 731,7,142,4 alpha 732:parent 732,720:top 732,180:left 732,210:caption 732,str$(ConsoE_hp3):font_color 732,7,142,4 alpha 733:parent 733,720:top 733,205:left 733,210:caption 733,str$(MRE_hp):font_color 733,7,142,4
container 740:top 740,320:left 740,10:height 740,200:width 740,650:caption 740," Comparaison ":font_name 740,"Times new roman":font_bold 740:font_size 740,10 if MFG > MRG alpha 742:parent 742,740:top 742,40:left 742,20 :caption 742,"Vous avez été surfacturé de : "+str$(MFG-MRG)+" Euro" end_if if MFE_hc > MRE_hc alpha 743:parent 743,740:top 743,70:left 743,20 :caption 743,"Vous avez été surfacturé de : "+str$(MFE_hc-MRE_hc)+" Euro" end_if if MFE_hp > MRE_hp alpha 744:parent 744,740:top 744,100:left 744,20 :caption 744,"Vous avez été surfacturé de : "+str$(MFE_hp-MRE_hp)+" Euro" end_if Button 798:top 798,530 :left 798,490:caption 798,"Imprimer":cursor_point 798 Button 799:top 799,530 :left 799,590:caption 799,"Quitter" :cursor_point 799:on_click 799,Cache700 end_if end_if return
Cache700: hide 700:left 0,(screen_x-500)/2 : top 0,(screen_y-300)/2 command_target_is 0 for x=354 to 357 text x,"" next x hide 350 return
Charge: if count(98)>0 x =count(98) L$=item_read$(98,x) sep%=instr(L$,";") C1$=Left$(L$,sep%-1) text 354,C1$ L$=right$(L$,len(L$)-sep%) sep%=instr(L$,";") C2$=Left$(L$,sep%-1) text 355,C2$ L$=right$(L$,len(L$)-sep%) sep%=instr(L$,";") C3$=Left$(L$,sep%-1) text 356,C3$ C4$=right$(L$,len(L$)-sep%) text 357,C4$ end_if return
Param_Voir: show 400:hide 100:hide 200:hide 300:hide 500:hide 600:hide 350 for x=410 to 420 caption x,item_read$(99,(x-409)) next x return
Param_Modif: show 500:hide 100:hide 200:hide 300:hide 400:hide 600:hide 350 if count(99)>0 for x=510 to 520 text x,item_read$(99,x-509) next x end_if return
Init_Var: if inactive(9)=1 and inactive(11)=1 active 9 active 11 end_if clear 99 for x=1 to 11 if text$(509+x)<>"" item_add 99,text$(509+x) else item_add 99,"0" end_if next x file_save 99,Dossier$+"\Suez.inf" G_ht= val(item_read$(99,1)) Ehc_ht= val(item_read$(99,2)) Ehp_ht= val(item_read$(99,3)) Tx_Tva1= (val(item_read$(99,4))/100)+1 Tx_Tva2= (val(item_read$(99,5))/100)+1 G_CTA= val(item_read$(99,6)) E_CTA= val(item_read$(99,7)) TDC= val(item_read$(99,8)) TMC= val(item_read$(99,9)) CoefG= val(item_read$(99,10)) CSPE= val(item_read$(99,11)) hide 500 return
APP: show 600:hide 100:hide 200:hide 300:hide 400:hide 500:hide 350 alpha 601:parent 601,600:top 601,100:left 601,20:caption 601,"En cours d'élaboration..." return
Quitter: Terminate
NB Actuellement la seule dll dont j'aurai pu me passer est format.dll qui peut être remplacé par une formule. | |
| | | Nardo26
Nombre de messages : 2294 Age : 56 Localisation : Valence Date d'inscription : 02/07/2010
| Sujet: Re: Quelques lignes de code plus tard.... Ven 29 Juin 2012 - 7:20 | |
| Bonjour ygeronimi ! Y'a du mieux !!! c'est cool !... Concernant ton formulaire d'affichage des résultats (700), il y a un petit problème: le 1er affichage va bien se passer mais si tu modifies par la suite tes données, celles-ci ne seront pas réactualisées puisque tu ne fait qu'un SHOW 700. Il existe la commande OBJECT_EXISTS() qui te permettra de savoir si tu dois construire/déclarer le formulaire. dans tous les cas (et pas seulement lorsque F7% est à 0) il faut penser à réactualiser les caption... EDIT : un petit plus que tu peux rajouter dans ton prog : Lorsque tu affiches le formulaire de saisie, tu peux remplir par défaut, le champ "Date" avec la date du jour en cours. C'est une aide à la saisie qui est sympa et ta belle-mère t'en remerciera ! | |
| | | bignono
Nombre de messages : 1127 Age : 67 Localisation : Val de Marne Date d'inscription : 13/11/2011
| Sujet: Re: Quelques lignes de code plus tard.... Ven 29 Juin 2012 - 9:21 | |
| Bonjour à tous, Excusez mon ignorance, mais je cherche partout le fichier "format.dll" qui va avec le programme de ygeronimi, mais je ne le trouve pas! Ou alors, j'ai du mal comprendre quelque chose. Serait-il possible pour les comme moi, de nous donner les liens pour avoir accès aux fichiers histo.dll, format.dll, ygf.dll et cfx32.ocx. Déjà que les dll c'est pas simple à comprendre! Moi j'ai bien histo.dll et ygf.dll, mais le reste??? je patauge dans la semoule! Par avance, je vous remercie de votre aide A+ | |
| | | Nardo26
Nombre de messages : 2294 Age : 56 Localisation : Valence Date d'inscription : 02/07/2010
| Sujet: Re: Quelques lignes de code plus tard.... Ven 29 Juin 2012 - 9:36 | |
| Bonjour Bignono, La DLL format.dll vient de ce topic d'après le source fourni par Jean debord. Merci à lui ! Tu trouveras cette DLL sur mon compte mydrive.ch, dans le répertoire Panoramic\Dll user name : panoramic@nardo26 password : panoramic123 Quand aux autres DLL, voir certainement sur le compte de Klaus... | |
| | | Nardo26
Nombre de messages : 2294 Age : 56 Localisation : Valence Date d'inscription : 02/07/2010
| Sujet: Re: Quelques lignes de code plus tard.... Ven 29 Juin 2012 - 9:51 | |
| Pour en revenir à la procédure calcul et le formulaire 700... - Code:
-
REM ' Fenetre de communication des résultats IF OBJECT_EXISTS(700)=0 FORM 700 : CAPTION 700, "Résultat de la comparaison" : WIDTH 700, 700 : HEIGHT 700, 600 : TOP 700, (SCREEN_Y-600)/2 : LEFT 700, (SCREEN_X-700)/2 COMMAND_TARGET_IS 700
CONTAINER 701 : TOP 701, 10 : LEFT 701, 10 : HEIGHT 701, 300 : WIDTH 701, 320 : CAPTION 701, " Votre Facture " : FONT_NAME 701, "Times new roman" : FONT_BOLD 701 : FONT_SIZE 701, 10 ALPHA 702 : TOP 702, 40 : CAPTION 702, "Consommation Gaz en kWh : " : ALPHA 708 : TOP 708, 40 ALPHA 703 : TOP 703, 65 : CAPTION 703, "Montant facturé TTC : " : ALPHA 709 : TOP 709, 65 ALPHA 704 : TOP 704, 105 : CAPTION 704, "Consommation Elec. HC en kWh : " : ALPHA 710 : TOP 710, 105 ALPHA 705 : TOP 705, 130 : CAPTION 705, "Montant facturé TTC : " : ALPHA 711 : TOP 711, 130 ALPHA 706 : TOP 706, 180 : CAPTION 706, "Consommation Elec. HP en kWh : " : ALPHA 712 : TOP 712, 180 ALPHA 707 : TOP 707, 205 : CAPTION 707, "Montant facturé TTC : " : ALPHA 713 : TOP 713, 205
FOR x=0 TO 5 LEFT 702+x, 20:PARENT 702+x,701 LEFT 708+x,210:PARENT 708+x,701 : FONT_COLOR 708+x, 140, 2, 4 NEXT x CONTAINER 720 : TOP 720, 10 : LEFT 720, 340 : HEIGHT 720, 300 : WIDTH 720, 320 : CAPTION 720, " Estimation " : FONT_NAME 720, "Times new roman" : FONT_BOLD 720 : FONT_SIZE 720, 10 ALPHA 722 : TOP 722, 40 : CAPTION 722, "Consommation Gaz en kWh : " : ALPHA 728 : TOP 728, 40 ALPHA 723 : TOP 723, 65 : CAPTION 723, "Montant Estimé TTC : " : ALPHA 729 : TOP 729, 65 ALPHA 724 : TOP 724, 105 : CAPTION 724, "Consommation Elec. HC en kWh : " : ALPHA 730 : TOP 730, 105 ALPHA 725 : TOP 725, 130 : CAPTION 725, "Montant Estimé TTC : " : ALPHA 731 : TOP 731, 130 ALPHA 726 : TOP 726, 180 : CAPTION 726, "Consommation Elec. HP en kWh : " : ALPHA 732 : TOP 732, 180 ALPHA 727 : TOP 727, 205 : CAPTION 727, "Montant Estimé TTC : " : ALPHA 733 : TOP 733, 205
FOR x=0 TO 5 LEFT 722 + x, 20 : PARENT 722 + x, 720 LEFT 728 + x,210 : PARENT 728 + x, 720 : FONT_COLOR 728 + x, 7, 142, 4 NEXT x
CONTAINER 740 : TOP 740, 320 : LEFT 740, 10 : HEIGHT 740, 200 : WIDTH 740, 650 : CAPTION 740, " Comparaison " : FONT_NAME 740, "Times new roman" : FONT_BOLD 740 : FONT_SIZE 740, 10 ALPHA 742 : PARENT 742, 740 : TOP 742, 40 : LEFT 742, 20 ALPHA 743 : PARENT 743, 740 : TOP 743, 70 : LEFT 743, 20 ALPHA 744 : PARENT 744, 740 : TOP 744, 100 : LEFT 744, 20
BUTTON 798 : TOP 798, 530 : LEFT 798, 490 : CAPTION 798, "Imprimer" : CURSOR_POINT 798 BUTTON 799 : TOP 799, 530 : LEFT 799, 590 : CAPTION 799, "Quitter" : CURSOR_POINT 799 : ON_CLICK 799, Cache700
END_IF ' mise à jour des champs calculés CAPTION 708, STR$(ConsoG) : CAPTION 709, STR$(MFG) CAPTION 710, STR$(ConsoE_hc) : CAPTION 711, STR$(MFE_hc) CAPTION 712, STR$(ConsoE_hp) : CAPTION 713, STR$(MFE_hp)
CAPTION 728, STR$(ConsoG3) : CAPTION 729, STR$(MRG) CAPTION 730, STR$(ConsoE_hc3): CAPTION 731, STR$(MRE_hc) CAPTION 732, STR$(ConsoE_hp3): CAPTION 733, STR$(MRE_hp)
IF MFG >MRG CAPTION 742, "Vous avez été surfacturé de : " + STR$(MFG-MRG)+" Euro" ELSE HIDE 742 END_IF IF MFE_hc >MRE_hc CAPTION 743, "Vous avez été surfacturé de : " + STR$(MFE_hc-MRE_hc)+" Euro" ELSE HIDE 743 END_IF IF MFE_hp >MRE_hp CAPTION 744, "Vous avez été surfacturé de : " + STR$(MFE_hp-MRE_hp)+" Euro" ELSE HIDE 744 END_IF Comme tu peux le constater, ce qui peut être gênant par la suite, c'est la numérotation de tes objets. Les numéros des champs "numériques" commencent juste après le dernier champs de texte : 707 -> dernier champs de description 708 -> premier champs "numérique" J'ai bien mis en évidence avec la mise en page du code ci-dessus... Si demain tu veux rajouter un nouveau champs, cela va être le merdier dans ta numérotation... Par exemple avec le container 701: tu peux te réserver de 702 à 719 les champs TEXTE et commencer la numérotation des champs numérique en 720 cela te laisseras un peu de gras pour la suite... | |
| | | Klaus
Nombre de messages : 12331 Age : 75 Localisation : Ile de France Date d'inscription : 29/12/2009
| Sujet: Re: Quelques lignes de code plus tard.... Ven 29 Juin 2012 - 10:16 | |
| Juste une astuce que j'utilise maintenant systématiquement, pour numéroter mes objets. Je n'ai plus jamais de problème avec l'insertion de numéros d'objets. Notons que l'idée initiale venait de Cosmos70, il y a un certain temps déjà. Je déclare une variable no% qui contient toujours le dernier numéro d'objet créé. A chaque création d'objet, j'incrémente cette variable, et je l'utilise pour paramétrer l'objet. Si cet objet doit être référencé plus tard, je mémorise son numéro dans une variable spécifique avec un nom parlant. Exemple: - Code:
-
dim no% : " dernier numéro d'objet utilisé dim no1% : ' copie de no% pour la commande PARENT si nécessaire dim no_nom%, no_descriptif%
no% = no% + 1 : alpha no% : top no%,10 ! left no%,10 caption no%,"Nom:" no% = no% + 1 : edit no% : no_nom% = no% : top no%,10 : left no%,100 no% = no% + 1 : container no% : top no%,40 : left no%,10 : width no%,400 : height no%,400 caption no%,"Informations" : no1% = no% no% = no% + 1 : memo no% : parent no%,no1% : no_descriptif% = no% top no%,50 : left no%,10 : width no%,350 : height no%,200 ...
Si maintenant, je veux insérer par exemple un champ pour un prix devant le mémo, je fais ceci: - Code:
-
dim no% : " dernier numéro d'objet utilisé dim no1% : ' copie de no% pour la commande PARENT si nécessaire dim no_nom%, no_descriptif% dim no_date%
no% = no% + 1 : alpha no% : top no%,10 ! left no%,10 caption no%,"Nom:" no% = no% + 1 : edit no% : no_nom% = no% : top no%,10 : left no%,100 no% = no% + 1 : container no% : top no%,40 : left no%,10 : width no%,400 : height no%,400 caption no%,"Informations" : no1% = no%
' objets ajoutés no% = no% + 1 : alpha no% : parent no%,no1% : top no%,20 : left no%,10 caption no%,"Date;" no% = no% + 1 : edit no% : parent no%,no1% : top no%,20 : left ,o%,70 no_date% = no% : text no_date%,date$ ' fin des objets ajoutés
no% = no% + 1 : memo no% : parent no%,no1% : no_descriptif% = no% top no%,50 : left no%,10 : width no%,350 : height no%,200 ...
On voit: plus aucun problème d'insertion d'objets. Et on référence les objets par des noms de variables parlants: text$(no_nom%) donne le nom text$(no_date%) donne la date item_add no_descriptif%,"Mes infos personnelles" ajoute une ligne dans le mémo | |
| | | Nardo26
Nombre de messages : 2294 Age : 56 Localisation : Valence Date d'inscription : 02/07/2010
| Sujet: Re: Quelques lignes de code plus tard.... Ven 29 Juin 2012 - 10:33 | |
| Tout à fait Klaus ! j'ai vu ça dans tes dernières créations, de même que la nouvelle structure de programme qui me parait plus claire maintenant. (j'essaye de "coller" à cette structure, cf mon utilitaire modbus) La solution que j'ai proposé à ygeronimi est "adaptée" à sa façon de coder (numérotation figée en "dur"). Des solutions concernant la numérotation, il en existe des palanqués ! Pour ma part, j'appelle un sous programme qui me renvoi un numero de libre... - Code:
-
SysNewObject: DIM SysNewObject_id : SysNewObject_id = 1 WHILE OBJECT_EXISTS(SysNewObject_id) = 1 : SysNewObject_id = SysNewObject_id + 1 : END_WHILE IF VARIABLE("SYS_STACK") = 0 DIM SYS_STACK : SYS_STACK = SysNewObject_id IF SYS_DEBUG = 0 DLIST SYS_STACK ELSE LIST SYS_STACK END_IF ELSE ITEM_ADD SYS_STACK, SysNewObject_id END_IF
FREE SysNewObject_id RETURN Cette solution est plus "lourde" et adaptée à ma façon de faire (passage de param via pile) mais c'est un choix, je créé mes formulaire de manière dynamique (avec les couples OBJECT_EXISTS/DELETE et DIM/FREE) | |
| | | bignono
Nombre de messages : 1127 Age : 67 Localisation : Val de Marne Date d'inscription : 13/11/2011
| Sujet: Re: Quelques lignes de code plus tard.... Ven 29 Juin 2012 - 11:20 | |
| merci Nardo, Mais le problème avec le prog de Ygeronimi, j'ai une erreur du style: (52) Not correct string expression: Error in function.line: 279 Une autre erreu aussi: Application Error: Exception EOleSysError in module histo.dll at 000568B5. grrr.... comme dirai ygeronimi J'avoue, que les dll, ça me dépasse! Merci à tous quand même. | |
| | | Jean Claude
Nombre de messages : 5950 Age : 70 Localisation : 83 Var Date d'inscription : 07/05/2009
| Sujet: Re: Quelques lignes de code plus tard.... Ven 29 Juin 2012 - 11:24 | |
| Salut à tous, Hé oui Klaus, j'ai moi aussi adopté la numérotation des objets avec no% et une variable de description. Je vais plus loin en construisant mon "GUI" au fur et à mesure de mes besoins et je prévois d'entrée l'activation ou la désactivation du groupe d'objet (regroupés ou pas) Voila l'exemple (non utilisable tel quel): - Code:
-
gui: label main_menu1:gosub main_menu1:' fabrication du menu label barre_info:gosub barre_info:' barre d' information label barre_outil:gosub barre_outil:' barre de bouttons label container_start:gosub container_start label container_sel_util:gosub container_sel_util:' pour saisie utilisateurs et mot de passe label container_statut_util:gosub container_statut_util:' gestion du statut d'un utilisateur (actif, inactif, radié) label container_admin:gosub container_admin:' gestion du 2emme statut (administrateur ou pas) return
' font_color no%,couleur(5),couleur(6),couleur(7):' police ' color no%,couleur(8),couleur(9),couleur(10):' remplissage
container_admin: dim container_admin%,alpha_admin%,option_pas_admin%,option_admin% label inactive_container_admin,active_container_admin no%=no%+1:container_admin%=no%:container no%:width no%,450:height no%,135 top no%,(height(0)/2)-(height(no%)/2):left no%,(width(0)/2)-(width(no%)/2) no%=no%+1:alpha_admin%=no%:alpha no%:parent no%,container_admin%:width no%,300:top no%,20:left no%,20 font_name no%,"Arial":font_size no%,10:font_bold no%:font_color no%,255,0,255 no%=no%+1:option_pas_admin%=no%:option no%:parent no%,container_admin%:width no%,300:top no%,60:left no%,20 font_name no%,"Arial":font_size no%,10:font_bold no%:font_color no%,couleur(5),couleur(6),couleur(7):caption no%,"Utilisateur Normal (pas Administrateur)" no%=no%+1:option_admin%=no%:option no%:parent no%,container_admin%:width no%,340:top no%,90:left no%,20 font_name no%,"Arial":font_size no%,10:font_bold no%:font_color no%,couleur(5),couleur(6),couleur(7):caption no%,"Administrateur" gosub inactive_container_admin return inactive_container_admin: for n%=container_admin%+2 to option_admin%:mark_off n%:inactive n%:next n%:inactive alpha_admin%:hide container_admin% return active_container_admin: gosub inactive_container_admin for n%=container_admin%+2 to option_admin%:active n%:next n%:active alpha_admin%:show container_admin% return A+ | |
| | | Nardo26
Nombre de messages : 2294 Age : 56 Localisation : Valence Date d'inscription : 02/07/2010
| Sujet: Re: Quelques lignes de code plus tard.... Ven 29 Juin 2012 - 12:41 | |
| | |
| | | bignono
Nombre de messages : 1127 Age : 67 Localisation : Val de Marne Date d'inscription : 13/11/2011
| Sujet: Re: Quelques lignes de code plus tard.... Ven 29 Juin 2012 - 13:01 | |
| OK Nardo, je vais me plonger dans ce code quand j'aurais le temps! merci de tes réponses! | |
| | | Nardo26
Nombre de messages : 2294 Age : 56 Localisation : Valence Date d'inscription : 02/07/2010
| Sujet: Re: Quelques lignes de code plus tard.... Ven 29 Juin 2012 - 13:11 | |
| Faut toujours partir du principe que l'utilisateur d'un programme est un pervers qui cherchera par tout les moyens de faire planter le programme. Dans sa tête, un programme qui fonctionne ne peut pas exister et donc il cherchera en PRIORITE la faille... (ça ne l'interesse pas d'obtenir un résultat, par contre un beau plantage, le fera jubiler) Si on veut vraiment faire un prog bétonné, il faut être un peu schizo... et encore il faut trouvé des beta-testeurs qui forcement vont tomber sur des choses auquel on n'aurait pas penser. Encore plus si c'est une belle-mere ! Donc les champs date doivent être controlé (format, chronologie, etc...) idem pour les valeurs numériques: on s'attend à avoir un chiffre compris entre 1 et 9 et on se retrouve avec des nombres à virgule voire même avec des exposant !! (vécu) Il m'arrive encore de rencontrer des erreurs sur des prog qui tournent depuis plus de 10ans... à un moment donné, y a un gars qui va faire LE truc à ne pas faire et tout foutre en vrac... (mais bon, si ygeronimi explique bien le fonctionnement du prog, cela ne devrait pas arriver...) | |
| | | Contenu sponsorisé
| Sujet: Re: Quelques lignes de code plus tard.... | |
| |
| | | | Quelques lignes de code plus tard.... | |
|
Sujets similaires | |
|
| Permission de ce forum: | Vous ne pouvez pas répondre aux sujets dans ce forum
| |
| |
| |