1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182
|
<?php
//inclusion des fichier entete.php qui ouvre les balises html et inclu lui même fichier ouvrir.php qui ouvre la connexion à la BD
include("commun/entete_pdo.php");
$id_saison=4;
//à modifier avec la session
if (isset($_GET['id_adherent']))
{
$id_adherent=$_GET['id_adherent'];
}
$passage=0;
if (isset($_POST['activite']))
{ //enregistre les achats_preinscriptions
if (!(isset($id_adherent))||($id_adherent==""))
{
$id_adherent= $_SESSION["utilisateur"] ;
echo "id_adherent: ".$id_adherent;echo '<br/>';
}
// echo print_r($_POST);echo '<br/>';
$GNF = $_POST['GNF'] ;
$licence = $_POST['licence'] ;
$date_achat = date("d/m/Y");
$total_annees_prevu = $_POST['Total_Annees_prevu'];
$total_cotise = $_POST['total_cotise'];
$total_annees_reduit = $_POST['Total_Annees_reduit'];
$total_trimestres = $_POST['Total_Trimestres'];
$total_Seances = $_POST['Total_Seances'];
$retours = $liaison->prepare("INSERT INTO achats_preinscriptions
(id_adherent, GNF, licence, date_achat, total_annees_prevu, total_cotise, total_annees_reduit, total_trimestres, total_Seances)
VALUES (:id_adherent, :GNF, :licence, :date_achat, :total_annees_prevu, :total_cotise, :total_annees_reduit, :total_trimestres, :total_Seances)");
//La constante de type par défaut est STR
$retours->bindParam(':id_adherent', $id_adherent, PDO::PARAM_INT);
$retours->bindParam(':GNF', $GNF);
$retours->bindParam(':licence', $licence);
$retours->bindParam(':date_achat', $date_achat);
$retours->bindParam(':total_annees_prevu', $total_annees_prevu);
$retours->bindParam(':total_cotise', $total_cotise);
$retours->bindParam(':total_annees_reduit', $total_annees_reduit);
$retours->bindParam(':total_trimestres', $total_trimestres);
$retours->bindParam(':total_Seances', $total_Seances);
$reussit=$retours->execute();
//echo "résussit : ".$reussit;
if (!$reussit)
{
?>
<script>
alert('Une erreur s\'est produite les adhésions ne sont pas enregistrées. Prévenez l\'administrateur');
</script>
<?php
exit ;
}
//enregistre activites_adherents_temp
foreach( $_POST['activite'] as $index => $donnees )
{
//echo print_r($_POST);echo '<br/>';
if( isset($_POST['activite'][$index]) )
{
foreach( $_POST['activite'][$index] as $option )
{
$pos = strpos($option,"_");
$id_activite = substr($option,0,$pos);
$id_duree = substr($option,$pos+1);
$retours = $liaison->prepare("INSERT INTO activites_adherents_temp
(id_adherent, id_activite, id_duree, date_achat)
VALUES (:id_adherent, :id_activite, :id_duree, :date_achat)");
//La constante de type par défaut est STR
$retours->bindParam(':id_adherent', $id_adherent, PDO::PARAM_INT);
$retours->bindParam(':id_activite', $id_activite, PDO::PARAM_INT);
$retours->bindParam(':id_duree', $id_duree, PDO::PARAM_INT);
$retours->bindParam(':date_achat', $date_achat);
$reussit=$retours->execute();
if (!$reussit)
{
?>
<script>
alert('Une erreur s\'est produite les adhésions ne sont pas enregistrées. Prévenez l\'administrateur');
</script>
<?php
exit ;
}
}
}
}
$mode_paiement = $_POST['mode_paiement'];
if ($mode_paiement=="mode_cheque"){
$coupons=0;
$depot=0;
$nbre_cheq=$_POST['nbre_cheq'];
for ($i=1;$i<$nbre_cheq+1;$i++){
$mois_cheque[$i]= $_POST[strval($i)."_mois"];
$montant_cheque[$i]=$_POST[strval($i)."_cheque"];
if($i>1){
$GNF=0;
$licence=0;
}
}
}else if($mode_paiement=="mode_coupon"){
$coupons = $_POST['coupon'];
$depot = $_POST['espece'];
$montant_cheque = $_POST['cheque'];
}else{
$coupons=0;
$depot=$_POST['total_espece'];
$montant_cheque=0;
}
//enregistre les paiements
for ($i=1;$i<$nbre_cheq+1;$i++){
$retours = $liaison->prepare("INSERT INTO paiements
(id_saison, id_adherent, mois, montant_cheque, depot, GNF, Licence, coupons)
VALUES (:id_saison, :id_adherent, :mois, :montant_cheque, :depot, :GNF, :Licence, :coupons)");
//La constante de type par défaut est STR
$retours->bindParam(':id_saison', $id_saison, PDO::PARAM_INT);
$retours->bindParam(':id_adherent', $id_adherent, PDO::PARAM_INT);
$retours->bindParam(':mois', $mois_cheque[$i]);
$retours->bindParam(':montant_cheque', $montant_cheque[$i]);
$retours->bindParam(':depot', $depot);
$retours->bindParam(':GNF', $GNF);
$retours->bindParam(':Licence', $licence);
$retours->bindParam(':coupons', $coupons);
$reussit=$retours->execute();
//echo "résussit : ".$reussit;
if (!$reussit)
{
?>
<script>
alert('Une erreur s\'est produite les adhésions ne sont pas enregistrées. Prévenez l\'administrateur');
</script>
<?php
exit ;
}
}
$_SESSION["id_adherent"] = "";//avant de changer d'adhérent
$_SESSION["adherent"] = "";//avant de changer d'adhérent
header('Location:gestion_adherents_gnf_pdo.php');
}
?>
<SCRIPT TYPE="text/javascript">
var nbreA = 0 ;//variable qui enregistre le nombre d'activité à l'année pour obtenir la réduction
var nbreAPA = 0 ; //variable qui compte le nombre d'activités éligible à l'APA
var cout_mem = 0 ;//variable qui enregistre le cout d'une activité à l'année déjà enregistrée
//alert('testscript');
window.onload = function (){
document.getElementById('mode_coupon').style.visibility="hidden";
document.getElementById('mode_espece').style.visibility="hidden";
};
function Total(){
console.log("cout mem "+cout_mem+" nbreA "+nbreA);
if (cout_mem > 0 && nbreA >= 2)
{
alert("Réduction supplémentaire de " + (cout_mem * 0.05).toFixed(2) + " € égale à 5% sur l'année déjà prise")
document.getElementById('reduction').value = -(cout_mem * 0.05).toFixed(2) + " €";
cout_mem = -cout_mem ;//prépare si annule la nbreA diminue
}
else if (cout_mem < 0 && nbreA == 1)
{
document.getElementById('reduction').value = 0 ;
cout_mem = (-1) * cout_mem ;
}
parseFloat(document.querySelector('input[name=rd_licence]:checked').value);
console.log('total cotise1 '+document.getElementById('total_cotise').value);
console.log(parseFloat(document.getElementById('reduction').value));
document.getElementById('total_cotise').value =
(parseFloat(document.getElementById('licence').value))
+ (parseFloat(document.getElementById('GNF').value))
+ (parseFloat(document.getElementById('APA').value))
+ (parseFloat(document.getElementById('Total_Trimestres').value))
+ (parseFloat(document.getElementById('Total_Seances').value))
+ (parseFloat(document.getElementById('Total_Annees_reduit').value))
+ (parseFloat(document.getElementById('reduction').value))
+ " €";
console.log('total cotise '+document.getElementById('total_cotise').value);
repartition_cheque();
document.getElementById('coupon').value = 0;
document.getElementById('espece').value = 0;
document.getElementById('cheque').value = 0;
document.getElementById('total_coupon').value = (parseFloat(document.getElementById('total_cotise').value))+2+" €";//2€ de frais
document.getElementById('total_espece').value=parseFloat(document.getElementById('total_cotise').value)+" €";
}
function mode(cases)
{//détermine quel mode de paiement est choisi
var valeur = document.querySelector('input[name=mode_paiement]:checked').value;
console.log ("valeur "+valeur);
if (valeur=="mode_cheque"){
document.getElementById('mode_cheque').style.visibility="visible";
document.getElementById('premier').checked=true;
document.getElementById('l1').style.visibility="visible";
document.getElementById('l2').style.visibility="hidden";
document.getElementById('l3').style.visibility="hidden";
document.getElementById('l4').style.visibility="hidden";
document.getElementById('mode_coupon').style.visibility="hidden";
document.getElementById('mode_espece').style.visibility="hidden";
nbre_cheque(document.getElementById('premier'));
}else if (valeur=="mode_coupon"){
document.getElementById('mode_cheque').style.visibility="hidden";
document.getElementById('l1').style.visibility="hidden";
document.getElementById('l2').style.visibility="hidden";
document.getElementById('l3').style.visibility="hidden";
document.getElementById('l4').style.visibility="hidden";
document.getElementById('mode_coupon').style.visibility="visible";
document.getElementById('mode_espece').style.visibility="hidden";
document.getElementById('coupon').value = 0;
document.getElementById('espece').value = 0;
document.getElementById('cheque').value = 0;
}else {
document.getElementById('mode_cheque').style.visibility="hidden";
document.getElementById('l1').style.visibility="hidden";
document.getElementById('l2').style.visibility="hidden";
document.getElementById('l3').style.visibility="hidden";
document.getElementById('l4').style.visibility="hidden";
document.getElementById('mode_coupon').style.visibility="hidden";
document.getElementById('mode_espece').style.visibility="visible";
}
}
function nbre_cheque(cases)
{//en fontion du nombre de chèques montre les mois de prélèvement.
var id_case = document.getElementById(cases.id);
console.log("id "+id_case);
var valeur = parseFloat(id_case.value);
console.log("valeur "+valeur);
var total = document.getElementById('total_cotise').value;
console.log("total "+total);
if (valeur==1){
document.getElementById("l1").style.visibility="visible";
document.getElementById("l2").style.visibility="hidden";
document.getElementById("l3").style.visibility="hidden";
document.getElementById("l4").style.visibility="hidden";
}else if(valeur==2){
document.getElementById("l1").style.visibility="visible";
document.getElementById("l2").style.visibility="visible";
document.getElementById("l3").style.visibility="hidden";
document.getElementById("l4").style.visibility="hidden";
}else if(valeur==3){
document.getElementById("l1").style.visibility="visible";
document.getElementById("l2").style.visibility="visible";
document.getElementById("l3").style.visibility="visible";
document.getElementById("l4").style.visibility="hidden";
}else{
document.getElementById("l1").style.visibility="visible";
document.getElementById("l2").style.visibility="visible";
document.getElementById("l3").style.visibility="visible";
document.getElementById("l4").style.visibility="visible";
}
repartition_cheque();
}
function repartition_cheque()
{//répartition des montants des chèques
var premier=0; var deuxieme=0; var troisieme=0; var quatrieme=0; var reste=0;
var valeur = document.querySelector('input[name=nbre_cheq]:checked').value;
var nbre=parseFloat(valeur);
console.log("valeur "+nbre);
var total= parseFloat(document.getElementById('total_cotise').value);
console.log("total "+total);
//division du total par nbre cheque
if (nbre==1){
premier = total;
reste = 0;
}else if (nbre==2){
premier=Math.floor(total/nbre);
console.log("premier "+premier);
reste=total-premier;
console.log("reste "+reste);
deuxieme=reste;
}else if (nbre==3){
premier=Math.floor(total/nbre);
console.log("premier "+premier);
reste=total-premier;
console.log("reste "+reste);
deuxieme=Math.floor(reste/(nbre-1));
troisieme=reste-deuxieme;
}else{
premier=Math.floor(total/nbre);
console.log("premier "+premier);
reste=total-premier;
console.log("reste "+reste);
deuxieme=Math.floor(reste/(nbre-1));
reste=reste-deuxieme;
troisieme=Math.floor(reste/(nbre-2));
quatrieme=reste-troisieme;
}
document.getElementById('1_cheque').value=premier + " €";
document.getElementById('2_cheque').value=deuxieme + " €";
document.getElementById('3_cheque').value=troisieme + " €";
document.getElementById('4_cheque').value=quatrieme + " €";
}
function change_coupon(cases)
{
var total_coupon = parseFloat(document.getElementById('total_coupon').value);
var reste_coupon = total_coupon - parseFloat(cases.value);
console.log("reste_coupon "+ reste_coupon);
document.getElementById('espece').disabled=false;
document.getElementById('espece').value = reste_coupon;
document.getElementById('cheque').disabled=false;
document.getElementById('bouton_enregistrer').focus();
}
function click_coupon(cases)
{
cases.value=0;
cases.select();
document.getElementById('espece').value =0;
document.getElementById('cheque').value=0;
document.getElementById('espece').disabled=true;
document.getElementById('cheque').disabled=true;
}
function click_cheque(cases)
{
if (cases.value==0){
document.getElementById('cheque').value=document.getElementById('espece').value;
document.getElementById('espece').value = 0;
document.getElementById('bouton_enregistrer').focus();
}
}
function click_espece(cases)
{
if (cases.value==0){
document.getElementById('espece').value=document.getElementById('cheque').value;
document.getElementById('cheque').value = 0;
document.getElementById('bouton_enregistrer').focus();
}
}
function ApaChange(cases)
{
if (cases.checked){
document.getElementById('APA').value = document.getElementById('chk_APA').value +" €";
}else{
document.getElementById('APA').value = 0 +" €"
}
Total();
}
function Click_semaine_restante(cases)
{
alert(" Attention le changement de date du début de l'abonnement va s\'appliquer aux activités que vous allez maintenant sélectionner. \n 1) Changez la date de début de l'abonnement \n 2) Sélectionnez l'activité \n \n Attention si vous avez déjà sélectionné l\'activité, procédez ainsi: \n 1) Désélectionnez \'Semaines Restantes\' \n 2) Désélectionnez l'activité \n 3) Recommencez par sélectionner \'semaines restantes\'");
document.getElementById('semaine_restante').hidden=false;
}
function change_semaine_restante(cases)
{
var date_debut = document.getElementById('semaine_restante').value;
console.log("date début "+date_debut);
}
function tarif_licence(){
if (document.getElementById('licence_chk').checked){
var tarif = document.querySelector('input[name=rd_licence]:checked').value;
}else{
var tarif = 0 ;
}
document.getElementById('licence').value = tarif ;
}
function Chk_licence(){//si chk licence désactivé donc les licences
if (!document.getElementById('licence_chk').checked){//les licences pas sélectionnées
document.getElementById('licence').value = 0 ;
var bool=true;
}else{
tarif_licence();
var bool=false;
//document.getElementById('tarif_licence').value=0 + " €";
}
for (var elt of document.querySelectorAll('input[name=rd_licence]')){// for of equivaut à for each //tous les boutons radio "licence"
elt.disabled=bool;
}
Total();
}
function doChange(cases)// cases est l'élément envoyé lors de l'action onclick ici sur des checkbox
//fonction qui désactive les trimestres si Année est choisie et désactive Année si un trimestre est choisi. et incrémente ou décrémente les tarifs
{
//alert('textdo_change');
var noms = document.getElementsByName(cases.name);//nom de l'élément ici la case à cocher
//console.log('nombre de nom : '+noms.lenght);// erreur noms est indéfini
var checkbox = document.getElementById(cases.id);//id du checkbox
console.log('id cases '+cases.id);
console.log('name cases '+cases.name);
console.log ('type cases '+cases.type);
var num = (cases.id.indexOf('_'));//position de l'underscore(_)
//console.log ('num _ '+num);
var id_activite = cases.id.substring(0,num);
console.log ('id_activite : '+id_activite);
if (cases.type=='checkbox')
{
if (checkbox.disabled == true)//si checkbox est désactivée
{
return;// il ne se passe rien fin
}
else if (checkbox.checked)// si il est coché
{
//console.log('le checkbox est coché '+cases.id);
if (cases.id.substring(num+1,num+2)=='A') // vérifie si c'est un checkbox Année
{
if (document.getElementById(id_activite+'_Seances').value > 0)//s'il y a des séances cochées il faut les supprimer
{
alert ('Vous devez d\'abord remettre à zéro les séances');
cases.checked=false;
return;
}
else
{
//désactive les séances
document.getElementById(id_activite+'_Seances').disabled = true;
document.getElementById(id_activite+'_Seances').style.backgroundColor='lightGrey';
//active l'APA si valide
if (document.getElementById(id_activite+'_APA').value==1){
nbreAPA = nbreAPA+1;
document.getElementById('chk_APA').disabled=false;
}
//vérifie si semaine restante est coché dans ce ca pas de réduction au nombre d'années
if (document.getElementById('chk_semaine_restante').checked)
{
var date_debut = document.getElementById('semaine_restante').value;
//inscription de l'id_activité dans l'input caché pour être envoyé au serveur
document.getElementById('sr_id_activite').value = id_activite ;
console.log ('semaine_restante '+document.getElementById('semaine_restante').value);
console.log ('sr_id_activite '+document.getElementById('sr_id_activite').value);
document.getElementById('frm_id_activite').submit();
//***************************************************************************************************************************//
//introduire requete php et calcul du nbre de semaine
//c'est ici qu'il faut pouvoir interroger la base de donnée
var Total_Annees_reduit = (parseFloat(document.getElementById('Total_Annees_reduit').value)) + ((document.getElementById(id_activite+'_Tarif_Annee').value)*21/34); // ici 21sur 34 sont arbitraire pour les essais
// console.log('Total_Annees_reduit '+Total_Annees_reduit);
var Total_Annees_prevu = Total_Annees_reduit;
// console.log('Total_Annees_prevu '+Total_Annees_prevu);
}else{
//incrémente le nbre année
console.log('année '+cases.id.substring(num+1,num+2)+" est cochée");
nbreA = nbreA+1;
//console.log('nbreA '+nbreA);
if (nbreA > 2)
{
var Total_Annees_reduit = ((parseFloat(document.getElementById('Total_Annees_reduit').value)) + (parseFloat(document.getElementById(id_activite+'_Tarif_Annee').value)*95/100));
// console.log('Total_Annees_reduit '+Total_Annees_reduit);
var Total_Annees_prevu = ((parseFloat(document.getElementById('Total_Annees_prevu').value)) + (parseFloat(document.getElementById(id_activite+'_Tarif_Annee').value)));
// console.log('Total_Annees_prevu '+Total_Annees_prevu);
}
else if (nbreA > 1)
{
var Total_Annees_reduit = ((parseFloat(document.getElementById('Total_Annees_reduit').value)) + (parseFloat(document.getElementById(id_activite+'_Tarif_Annee').value)))*95/100;
// console.log('Total_Annees_reduit '+Total_Annees_reduit);
var Total_Annees_prevu = ((parseFloat(document.getElementById('Total_Annees_prevu').value)) + (parseFloat(document.getElementById(id_activite+'_Tarif_Annee').value)));
// console.log('Total_Annees_prevu '+Total_Annees_prevu);
}
else
{
var Total_Annees_reduit = (document.getElementById(id_activite+'_Tarif_Annee').value);
// console.log('Total_Annees_reduit '+Total_Annees_reduit);
var Total_Annees_prevu = Total_Annees_reduit;
// console.log('Total_Annees_prevu '+Total_Annees_prevu);
}
}
document.getElementById('Total_Annees_reduit').value = Total_Annees_reduit;
document.getElementById('Total_Annees_prevu').value = Total_Annees_prevu;
//désactive les trimestres
for(var i=0; i < 4; i++)
{
if(!noms[i].checked)// ! inverse la suite ici si la case est pas cochée
{
noms[i].disabled = true; // alors la case est désactivée vraie ( on ne peut pas la cochée elle est grisée)
}
else
{
noms[i].disabled = false; //ou la case est désactivée faux donc la case est activée (on peut la cochée et la décochée elle est bien visible)
}
}
}
}
else
{// si ce n'est pas Année c'est un trimestre
document.getElementById(id_activite+'_A').disabled = true; //désactive le checkbox qui pour id "str" ici l'année
var nbre=0; //nombre de trimestre coché
for(var i=0; i < 4; i++)
{
if (noms[i].checked)
{
nbre = nbre + 1;
}
}
if (nbre > 0)
{//il reste un trimestre coché donc année ne change pas
var tarif_trim = document.getElementById(id_activite+'_Tarif_Trim').value;
document.getElementById(id_activite+'_Total_Trim').value = nbre * tarif_trim;
// console.log('tarif trim : '+tarif_trim);
}
else
{
document.getElementById(id_activite+'_A').disabled = false; //active le checkbox qui pour id "str" ici l'année
}
document.getElementById('Total_Trimestres').value = (parseFloat(document.getElementById('Total_Trimestres').value)) +(parseFloat(document.getElementById(id_activite+'_Tarif_Trim').value)) ;
console.log(document.getElementById('Total_Trimestres').value);
}
}
else
{// le ckeckbox est actif mais décoché
console.log('le chck est décoché '+cases.id);
if (cases.id.substring(num+1,num+2)=='A')
{
if (document.getElementById('chk_semaine_restante').checked){
console.log("chk_semaine_restante cheked ");
Total_Annees_reduit = (parseFloat(document.getElementById('Total_Annees_reduit').value)) ;
console.log('Total_Annees_reduit '+Total_Annees_reduit);
var total_an = (parseFloat(document.getElementById(id_activite+'_Tarif_Annee').value))*21/34;
console.log("total_an "+total_an);
Total_Annees_reduit = Total_Annees_reduit -((parseFloat(document.getElementById(id_activite+'_Tarif_Annee').value))*21/34);
console.log('Total_Annees_reduit '+Total_Annees_reduit);
Total_Annees_prevu = Total_Annees_reduit;//((parseFloat(document.getElementById('Total_Annees_prevu').value)) - (parseFloat(document.getElementById(id_activite+'_Tarif_Annee').value)));
console.log('Total_Annees_reduit '+Total_Annees_reduit);
console.log('Total_Annees_prevu '+Total_Annees_prevu);
}else{
// si c'est une Année il faut réactivé les trimestres
var tarif_an = document.getElementById(id_activite+'_Tarif_Annee').value;
//console.log('tarif_an '+ tarif_an);
var Total_Annees_reduit = document.getElementById('Total_Annees_reduit').value ;
//console.log('Total_Annees_reduit '+Total_Annees_reduit);
console.log('nbreA '+nbreA);
nbreA = nbreA - 1;
console.log('nbreA-1 '+nbreA);
if (nbreA >= 2)
{
// console.log('nbreA '+nbreA);
// console.log('tarif95an '+tarif_an*95/100);
Total_Annees_reduit = ((parseFloat(document.getElementById('Total_Annees_reduit').value)) - (parseFloat(document.getElementById(id_activite+'_Tarif_Annee').value)*95/100));
// console.log('total_3an '+Total_Annees_reduit);
Total_Annees_prevu = ((parseFloat(document.getElementById('Total_Annees_prevu').value)) - (parseFloat(document.getElementById(id_activite+'_Tarif_Annee').value)));
// console.log('total_3an_sans '+Total_Annees_prevu);
}
else if (nbreA == 1)
{
console.log('nbreA '+nbreA);
Total_Annees_reduit = (((parseFloat(document.getElementById('Total_Annees_reduit').value))*100) - (parseFloat(document.getElementById(id_activite+'_Tarif_Annee').value))*95)/95;
Total_Annees_prevu = ((parseFloat(document.getElementById('Total_Annees_prevu').value)) - (parseFloat(document.getElementById(id_activite+'_Tarif_Annee').value)));
// console.log('total_3an_sans '+Total_Annees_prevu);
}
else
{
// console.log('nbreA '+nbreA);
Total_Annees_reduit = 0 ;
Total_Annees_prevu = 0 ;
}
document.getElementById('Total_Annees_reduit').value = Total_Annees_reduit;
document.getElementById('Total_Annees_prevu').value = Total_Annees_prevu;
}
for(var i=0; i < 4; i++)
{
noms[i].disabled = false;
}
//réactive la possibilité de sélectionner des séances
document.getElementById(id_activite+'_Seances').disabled = false;
document.getElementById(id_activite+'_Seances').style.backgroundColor='White';
//vérifie si l'APA peut encore activé
if (document.getElementById(id_activite+'_APA').value==1){//si l'activé qui vient d'être décoché permettait l'APA
nbreAPA = nbreAPA-1;//décrémente le nbre d'année qui autorise l'APA
console.log("nbre d APA "+nbreAPA);
if (nbreAPA==0){//il n'y a plus d'activités qui permettent l'APA
if (document.getElementById('chk_APA').checked){//si l'APA était cochée il faut diminuer le total cotisée
document.getElementById('APA').value = 0 ;
//'document.getElementById('total_cotise').value = parseFloat(document.getElementById('total_cotise').value) - parseFloat(document.getElementById('APA').value);
}
document.getElementById('chk_APA').checked = false;//décoche l'APA
document.getElementById('chk_APA').disabled = true;//déactive l'APA
}
}
}
else
{ //T1 ou T2 ou T3 sont encore cochés
var nbre = 0;
for(var i=0; i < 4; i++)
{
if (noms[i].checked)
{
nbre = nbre + 1;
}
}
if (nbre > 0)
{//il reste un trimestre coché donc année ne change pas
var tarif_trim = document.getElementById(id_activite+'_Tarif_Trim').value;
document.getElementById(id_activite+'_Total_Trim').value = nbre*tarif_trim;
}
else
{
document.getElementById(id_activite+'_Total_Trim').value ="";
document.getElementById(id_activite+'_A').disabled = false; //active le checkbox qui pour id "str" ici l'année
}
document.getElementById('Total_Trimestres').value = (parseFloat(document.getElementById('Total_Trimestres').value)) - (parseFloat(document.getElementById(id_activite+'_Tarif_Trim').value)) ;
console.log(document.getElementById('Total_Trimestres').value);
}
}
}
else if (cases.type=='text')//c'est coche séance
{
//console.log ('nbre séances '+cases.value);
cases.select();//sélectionne le contenu du text
if (document.getElementById(id_activite+'_Total_Seances').value > 0)//déjà des séances inscrites
{
document.getElementById('Total_Seances').value = (parseFloat(document.getElementById('Total_Seances').value)) -(parseFloat(document.getElementById(id_activite+'_Total_Seances').value)) ;
//faire un Total() à la fin
document.getElementById('total_cotise').value = document.getElementById('total_cotise').value - (parseFloat(document.getElementById(id_activite+'_Total_Seances').value));
}
document.getElementById(id_activite+'_Total_Seances').value = (document.getElementById(id_activite+'_Tarif_Seances').value) * cases.value;
document.getElementById('Total_Seances').value = (parseFloat(document.getElementById('Total_Seances').value)) +(parseFloat(document.getElementById(id_activite+'_Total_Seances').value)) ;
}
else
{ //c'est un radio licence
document.getElementById('licence').value = parseFloat(document.querySelector('input[name=rd_licence]:checked').value);
}
Total();
}
function enregistrer()
//fonction qui réactive certain élément pour pouvoir les envoyer
//et envoi du formulaire
{
if (document.getElementById('Total_Annees_reduit').value!=0 || document.getElementById('Total_Trimestres').value!=0 || document.getElementById('Total_Seances').value!=0 )
{
//vérification du paiement
//verifiier mode de paiement
var valeur = document.querySelector('input[name=mode_paiement]:checked').value;
if (valeur=="mode_coupon"){
//verife les coupons
var total_coupon=parseFloat(document.getElementById('total_coupon').value);
var coupon=parseFloat(document.getElementById('coupon').value);
var espece=parseFloat(document.getElementById('espece').value);
var cheque=parseFloat(document.getElementById('cheque').value);
//console.log ("reste "+coupon-cheque-espece);
console.log ("coupon "+coupon);
console.log ("coupon "+espece);
console.log ("coupon "+cheque);
if (total_coupon-coupon-cheque-espece!=0){
alert("Erreur dans le paiement par coupons. Un supplément de 2€ pour frais est appliquée.");
return;//=exit
}
}else if (valeur=="mode_cheque"){
var total=parseFloat(document.getElementById('total_cotise').value);
var premier_cheque=parseFloat(document.getElementById('1_cheque').value);
var deuxieme_cheque=parseFloat(document.getElementById('2_cheque').value);
var troisieme_cheque=parseFloat(document.getElementById('3_cheque').value);
var quatrieme_cheque=parseFloat(document.getElementById('4_cheque').value);
if (total-premier_cheque-deuxieme_cheque-troisieme_cheque-quatrieme_cheque!=0){
alert("Erreur dans le paiement par chèques. ");
return;//=exit
}
}
//enlève l'attribut disabled qui empêche l'envoi de données
document.getElementById("Total_Trimestres").removeAttribute("disabled");
document.getElementById("Total_Seances").removeAttribute("disabled");
document.getElementById("Total_Annees_reduit").removeAttribute("disabled");
document.getElementById("GNF").removeAttribute("disabled");
document.getElementById("total_espece").removeAttribute("disabled");
document.getElementById("adhesions_activites").submit();
//return;
alert('L\'enregistrement a bien été effectué');
//location.href="gestion_adherents_gnf_pdo.php";
}
else
{
alert('Vous n\'avez saisi aucune Activités');
}
}
</script>
<form id="adhesions_activites" style=" background: pink;" name="adhesions_activites" method="post" >
<div>
<!-- début affichage du tableau des activités -->
<table class="table_activite">
<caption><h1>Affichage des Activités de GNF pour <?php echo " ". $_SESSION["adherent"]; ?> </h1> </caption>
<!-- <input type ="text" name='cotisation' id='cotisation' value ="0" disabled>si déjà eu des achats valeur =1-->
<tr>
<th>N°</th>
<th class='tit_activite' >Description de l'activité</th>
<th>Année</th>
<th>Tarif</th>
<th colspan=3 width=80px>Trimestres</th>
<th>Tarif</th>
<th>Total<br/>
Trim</th>
<th colspan=3 width=70px>Séances</th>
</tr>
<tbody>
<?php
// On récupère tout le contenu de la table activites pour remplir le formulaire
$retours = $liaison -> prepare("SELECT Activites.ID, Activites.Description, Activites.id_Type_activite, Activites.id_saison, Activites.APA, Tarifs_type_activite.tarif_annee, Tarifs_type_activite.tarif_trimestre, Tarifs_type_activite.tarif_seance
FROM Tarifs_type_activite INNER JOIN Activites ON Tarifs_type_activite.id_type_activite = Activites.id_Type_activite
WHERE Activites.id_saison=4 ");
$retours -> execute();
while ($donnees = $retours -> fetch((PDO::FETCH_ASSOC))){
$cle = $donnees['ID'];//ex 97
// pour chaque activité rechercher les périodes valides
$retours2 = $liaison -> prepare ("SELECT intitule FROM Periodes INNER JOIN periodes_activites ON Periodes.ID = periodes_activites.id_periodes WHERE periodes_activites.id_saison = 4 AND periodes.intitule < 4 AND periodes_activites.id_activites = :id_activite");
$retours2 -> bindValue(':id_activite', $cle);
$retours2 -> execute();
//$mem_tri = array();
$mem_tri[0] = 0 ;
$mem_tri[1] = 0 ;
$mem_tri[2] = 0 ;
$mem_tri[3] = 0 ;
while ($donnees2 = $retours2 -> fetch((PDO::FETCH_ASSOC))){
$intitule = $donnees2['intitule'];
$trimestre = substr($intitule,0,1);//si c'est le chiffre 1,2,3
$mem_tri[0] = ($mem_tri[0]) + 1 ; //'pour les Années
switch ($trimestre) {
Case 1:
$mem_tri[1] = $mem_tri[1] + 1;
break;
Case 2:
$mem_tri[2] = $mem_tri[2] + 1;
break;
Case 3:
$mem_tri[3] = $mem_tri[3] + 1;
break;
}
}
If ($mem_tri[0] < 6) // les 6 moitiés de trimestre ne sont pas valides donc années n'est pas valide
$A_disabled = "disabled" ; //le ctl A est inactif
else
$A_disabled = "" ;
if ($mem_tri[1]==0)
$T1_disabled = "disabled" ;
else
$T1_disabled = "" ;
if ($mem_tri[2]==0)
$T2_disabled = "disabled" ;
else
$T2_disabled = "" ;
if ($mem_tri[3]==0)
$T3_disabled = "disabled" ;
else
$T3_disabled = "" ;
//echo "id_activite ".$cle. " " ; print_r($mem_tri); echo '<br/>';
//colorise les types d'activités
$id_type_activite = $donnees['id_Type_activite'];
//echo "id_type_activite ".$id_type_activite; echo '<br/>';
switch ($id_type_activite){
Case 1:
Case 8:
$background_color = 'Orange';break;
Case 2:
Case 7:
$background_color = 'Lightgreen';break;
Case 3:
$background_color = 'Lightblue';break;
Case 4:
Case 9:
$background_color = 'Pink';break;
Case 5:
Case 10:
$background_color = 'Darkgreen';break;
Case 6:
$background_color = 'Violet';break;
}
//echo "couleur ".$background_color; echo '<br/>';
$Activite = $cle . "_";//ex 97_
$Activite_name = 'activite[' . $cle .'][]' ;//ex activite97
$Annee = $Activite . "A"; //ex 97_A
$id_Tarif_Annee = $Activite . "Tarif_Annee";
$tarif_annee = $donnees['tarif_annee'];
$tarif_trimestre = $donnees['tarif_trimestre'];
$id_Trimestre = $Activite . "T";
$id_Tarif_Trim = $Activite . "Tarif_Trim";
$id_Total_Trim = $Activite . "Total_Trim";
$id_Seances = $Activite . "Seances";
$id_Tarif_Seances = $Activite . "Tarif_Seances";
$tarif_seance = $donnees['tarif_seance'];
$id_Total_Seances = $Activite . "Total_Seances";
$APA = $donnees['APA'];
$valid_APA = $Activite . "APA";
?>
<tr style="background-color: <?php echo $background_color ;?>;">
<!-- il suffit d'attribué "disabled" pour désactivé l'élément
un attribut booléen s'incrit simplement pour être actif ou n'apparait pas pour être inactif
Si un élément est 'disabled' il ne peut pas être envoyé par la méthode POST
Il faut passer par removeAttribute() enlever l'attribut (voir dans la fonction envoyer)-->
<td><input type ="text" name='ID_Activite' id=<?php echo $Activite . 'ID'; ?> value =<?php echo $cle ;?> style="width:27px; text-align:right; border:0px;" disabled></td>
<td><input type ="text" name='Description' id=<?php echo $Activite . 'Description'; ?> value ='<?php echo $donnees["Description"]; ?>' style="width:260px; border:0px;" disabled ></td>
<td><input type="checkbox" name=<?php echo $Activite_name; ?> id=<?php echo $Annee; ?> value=<?php echo $Annee; ?> <?php echo $A_disabled; ?> onClick="doChange(this)" ></td>
<td><input type ="text" name="Tarif_Annee" id=<?php echo $id_Tarif_Annee; ?> value =<?php echo ($tarif_annee);?> style="width:60px; text-align:right; border:0px;"disabled ></td>
<td><input type="checkbox" name=<?php echo $Activite_name; ?> id=<?php echo $id_Trimestre."1"; ?> value=<?php echo $id_Trimestre."1"; ?> <?php echo $T1_disabled; ?> onClick="doChange(this)" ></td>
<td><input type="checkbox" name=<?php echo $Activite_name; ?> id=<?php echo $id_Trimestre."2"; ?> value=<?php echo $id_Trimestre."2"; ?> <?php echo $T2_disabled; ?> onClick="doChange(this)" ></td>
<td><input type="checkbox" name=<?php echo $Activite_name; ?> id=<?php echo $id_Trimestre."3"; ?> value=<?php echo $id_Trimestre."3"; ?> <?php echo $T3_disabled; ?> onClick="doChange(this)" ></td>
<td><input type ="text" name='Tarif_Trim' id=<?php echo $id_Tarif_Trim; ?> value =<?php echo ($tarif_trimestre);?> style="width:40px; text-align:right; border:0px;" disabled ></td>
<td><input type ="text" name='Total_Trim' id=<?php echo $id_Total_Trim; ?> value ="" style="width:40px; border:0px;"disabled ></td>
<td><input type ="text" name='Seances' id=<?php echo $id_Seances; ?> value ="0" style="width:10px; background-color:#fff; border:0px;" onfocus=select() onChange="doChange(this)" ></td>
<td><input type ="text" name='Tarif_Seances' id=<?php echo $id_Tarif_Seances; ?> value =<?php echo $tarif_seance; ?> style="width:30px; text-align:right; border:0px;" disabled></td>
<td><input type ="text" name='Total_Seances' id=<?php echo $id_Total_Seances; ?> value ="" style="width:30px; border:0px;" disabled></td>
<td><input type ="text" name='valid_APA' id=<?php echo $valid_APA; ?> value =<?php echo ($APA);?> hidden disabled ></td>
</tr>
<?php
}
?>
<tr>
<!-- <td><input type ="text" value ="" style="width:27px; border:0px;" disabled></td> -->
<td colspan=3 width=307px style="text-align:right; padding-right:5px;" ><span class='tot_an'>Total des activités cotisées à l'année </span> </td>
<td><input type ="text" name="Total_Annees_reduit" id='Total_Annees_reduit' style="width:60px; border:0px;" value ="0" disabled></td>
<td colspan=4 width=120px style="text-align:right; padding-right:5px;"><span class='tot_trim'> aux trimestres </span> </td>
<td><input type ="text" name='Total_Trimestres' id='Total_Trimestres' value ="0" style="width:40px; border:0px;" disabled ></td>
<td colspan=2 width=40px style="text-align:right; padding-right:5px;"><span class='tot_trim'> seances </span> </td>
<td><input type ="text" name='Total_Seances' id='Total_Seances' value ="0" style="width:30px; border:0px;" disabled ></td>
</tr>
</tbody>
</table>
<div class="colonne_droite" style="float-left;width:auto; position:absolute; left:720px; top:90px;">
<div id="div_adhesion" ><!--; border:2px solid red-->
<?php
//récupération du tarif de GNF
$retours = $liaison -> prepare("SELECT Tarifs.tarif, Types_activite.type_activite
FROM Types_activite INNER JOIN Tarifs ON Types_activite.ID = Tarifs.id_type_activite
WHERE ((id_saison = 4) AND (type_activite = 'Adhesion GNF'))");
$retours -> execute();
while ($donnees = $retours -> fetch((PDO::FETCH_ASSOC)))
{
?>
<p id="lig_GNF" >
<span style="font-size:15px"> Adhésion Obligatoire à GNF de <?php echo $donnees['tarif']. " €"; ?></span>
<input type="text" name="GNF" id="GNF" value = <?php echo $donnees['tarif']; ?> hidden ></p>
<?php
}
?>
<?php
//récupération des tarifs des licences
$retours = $liaison -> prepare("SELECT Tarifs.tarif, Types_activite.type_activite
FROM Types_activite INNER JOIN Tarifs ON Types_activite.ID = Tarifs.id_type_activite
WHERE ((id_saison = 4) AND ((type_activite = 'Licence Adulte') Or (type_activite ='Licence Jeune')))");
$retours -> execute();
?>
<p id="lig_licence" ><span class="span_radio1" >
<input type="checkbox" name="licence_chk" id="licence_chk" checked onChange="Chk_licence()" >
<label for="licence">Licences</label>
<?php
$num_licence=0;
while ($donnees = $retours -> fetch((PDO::FETCH_ASSOC)))
{
$num_licence=$num_licence+1;
?>
<INPUT type= "radio" name="rd_licence" id=<?php echo $num_licence."licence"?> value=<?php echo $donnees['tarif'] . " "; ?><?php echo $donnees['type_activite'] =="Licence Adulte"?"checked":""; ?> onClick="doChange(this)" > <?php echo " ".$donnees['type_activite']." ".$donnees['tarif']." €"; ?>
<?php
}
?>
</span>
<input type="text" name="licence" id="licence" style="width:30px;" value ="" hidden>
</p>
<script>
tarif_licence();
</script>
</div>
<div class="APA" >
<?php
//récupération du tarif de APA
$retours = $liaison -> prepare("SELECT Tarifs.tarif, Types_activite.type_activite
FROM Types_activite INNER JOIN Tarifs ON Types_activite.ID = Tarifs.id_type_activite
WHERE ((id_saison = 4) AND (type_activite = 'APA'))");
$retours -> execute();
while ($donnees = $retours -> fetch((PDO::FETCH_ASSOC)))
{
?>
<p >
<span class="span_radio1">
<input type="checkbox" name="chk_APA" id="chk_APA" value = <?php echo $donnees['tarif']; ?> disabled onClick="ApaChange(this)" >
<label for="APA">Souscription au pack<?php echo " ". $donnees['type_activite'] ." : ". $donnees['tarif'] ." € "; ?></label>
</span>
<input type="text" name="APA" id="APA" style="width:30px;" value ="0" hidden >
</p>
<?php
}
?>
</div>
<div class="reduction" >
<p >
<label for="reduction" class="span_radio1">Réduction des années antérieures </label><input type="text" name="reduction" id="reduction" style="width:60px;" value ="0 €" disabled >
</p>
</div>
<div class="avoir" >
<?php
//récupération de l'avoir de l'adhérent requete
//<!-- ICI il faudrait faire le calcul . la règle de calcul pourrait changer chaque année -->
$retours = $liaison -> prepare("SELECT Tarifs.tarif, Types_activite.type_activite
FROM Types_activite INNER JOIN Tarifs ON Types_activite.ID = Tarifs.id_type_activite
WHERE ((id_saison = 4) AND (type_activite = 'APA'))");
$retours -> execute();
while ($donnees = $retours -> fetch((PDO::FETCH_ASSOC)))
{
?>
<p >
<label for="avoir" class="span_radio1">Avoir pour la saison 2021/2022 </label><input type="text" name="avoir" id="avoir" style="width:60px;" value ="0 €" disabled >
</p>
<?php
}
?>
</div>
<div class="span_radio1" >
<p >
<input type="checkbox" name="chk_semaine_restante" id="chk_semaine_restante" value = "" onClick="Click_semaine_restante(this)" >
<label for="chk_semaine_restante" >Semaines Restantes </label>
<input type="date" form="frm_id_activite" name="semaine_restante" id="semaine_restante" value =<?php echo date("Y-m-d"); ?> onChange="change_semaine_restante(this)" hidden >
<input type ="text" form="frm_id_activite" name="sr_id_activite" id="sr_id_activite" hidden >
</p>
<!--ici les inputs ont l'attribut form="frm_id_activite" pour que les forms ne soient pas imbriquer. La déclartion de la form est plus bas -->
</div>
<div class="total_cotisations" >
<p >
<!-- Total des activités cotisées réduit et prévu -->
<input type ='text' name='Total_Annees_prevu' id='Total_Annees_prevu' value="0" style="width:40px; border:1px solid;" hidden >
<h2 style="align-text:center;" > Total des cotisations
<input type ='text' name='total_cotise' id='total_cotise' value="0 €" style="width:60px; border:1px solid;" ></h2>
</p>
</div>
<div class="paiements" style="float-left; border:2px solid red;width:auto; "> <!--position:absolute; left:720px; top:140px; -->
<p><h2 style="align-text:center;" > Modalité de paiements</h2></p>
<div>
<span class="span_radio2">Chèques<INPUT type= "radio" name="mode_paiement" id="mode1" value="mode_cheque" onclick="mode(this)" checked ></span>
<span class="span_radio2">Coupons<INPUT type= "radio" name="mode_paiement" id="mode2" value="mode_coupon" onclick="mode(this)" ></span>
<span class="span_radio2">Espèces<INPUT type= "radio" name="mode_paiement" id="mode3" value="mode_espece" onclick="mode(this)" ></span>
</div>
<!-- mode de paiement par chèques -->
<div style="float-left; border:1px solid black;width:340px;font-size:15px;" id="mode_cheque" > <!--position:absolute; left:770px; top:100px; -->
<!-- <span><input type="button" name="paiement_cheque" id="paiement_cheque" value="Chèque" /> </span> -->
<span >Nombre de chèques :</span>
<span class="span_radio2">1<INPUT type= "radio" name="nbre_cheq" id="premier" value="1" onclick="nbre_cheque(this)" checked ></span>
<span class="span_radio2">2<INPUT type= "radio" name="nbre_cheq" id="deuxieme" value="2" onclick="nbre_cheque(this)" ></span>
<span class="span_radio2">3<INPUT type= "radio" name="nbre_cheq" id="troisieme" value="3" onclick="nbre_cheque(this)" ></span>
<span class="span_radio2">4<INPUT type= "radio" name="nbre_cheq" id="quatrieme" value="4" onclick="nbre_cheque(this)" ></span>
<!-- <form id="paiements" style=" background: pink;" name="paiements" method="post" > -->
<table class="table_cheque" style="width:340x;" >
<tbody>
<tr >
<th width=10px ><div class="vertical"><b>Septembre</b></div></th>
<th width=10px ><div class="vertical"><b>Octobre</b></div></th>
<th width=10px ><div class="vertical"><b>Novembre</b></div></th>
<th width=10px ><div class="vertical"><b>Décembre</b></div></th>
<th width=10px ><div class="vertical"><b>Janvier</b></div></th>
<th width=10px ><div class="vertical"><b>Février</b></div></th>
<th width=10px ><div class="vertical"><b>Mars</b></div></th>
<th width=10px ><div class="vertical"><b>Avril</b></div></th>
<th width=10px ><div class="vertical"><b>Mai</b></div></th>
<th width=10px ><div class="vertical"><b>Juin</b></div></th>
<th width=50px ><div ><b>Montant</b></div></th>
</tr>
<tr id="l1">
<td><span class="span_radio2"><INPUT type= "radio" name="1_mois" value="Septembre" checked></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="1_mois" value="Octobre"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="1_mois" value="Novembre"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="1_mois" value="Décembre"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="1_mois" value="Janvier"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="1_mois" value="Février"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="1_mois" value="Mars"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="1_mois" value="Avril"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="1_mois" value="Mai"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="1_mois" value="Juin"></span></td>
<td><input type ="text" name="1_cheque" id="1_cheque" value ="0" style="width:60px; border:0px;" ></td>
</tr>
<tr id="l2" style="visibility:hidden;">
<td><span class="span_radio2"><INPUT type= "radio" name="2_mois" value="Septembre"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="2_mois" value="Octobre"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="2_mois" value="Novembre" checked></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="2_mois" value="Décembre"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="2_mois" value="Janvier"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="2_mois" value="Février"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="2_mois" value="Mars"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="2_mois" value="Avril"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="2_mois" value="Mai"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="2_mois" value="Juin"></span></td>
<td><input type ="text" name="2_cheque" id="2_cheque" value ="0" style="width:60px; border:0px;" ></td>
</tr >
<tr id="l3" style="visibility:hidden;">
<td><span class="span_radio2"><INPUT type= "radio" name="3_mois" value="Septembre"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="3_mois" value="Octobre"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="3_mois" value="Novembre"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="3_mois" value="Décembre"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="3_mois" value="Janvier"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="3_mois" value="Février" checked></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="3_mois" value="Mars"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="3_mois" value="Avril"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="3_mois" value="Mai"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="3_mois" value="Juin"></span></td>
<td><input type ="text" name="3_cheque" id="3_cheque" value ="0" style="width:60px; border:0px;" ></td>
</tr>
<tr id="l4" style="visibility:hidden;">
<td><span class="span_radio2"><INPUT type= "radio" name="4_mois" value="Septembre"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="4_mois" value="Octobre"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="4_mois" value="Novembre"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="4_mois" value="Décembre"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="4_mois" value="Janvier"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="4_mois" value="Février"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="4_mois" value="Mars" checked></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="4_mois" value="Avril"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="4_mois" value="Mai"></span></td>
<td><span class="span_radio2"><INPUT type= "radio" name="4_mois" value="Juin"></span></td>
<td><input type ="text" name="4_cheque" id="4_cheque" value ="0" style="width:60px; border:0px;" ></td>
</tr>
</tbody>
</table>
<!-- </form> -->
</div>
<!-- mode de paiement par coupons -->
<div style="float-left; border:1px solid black;width:340px;font-size:15px;" id="mode_coupon" > <!--position:absolute; left:770px; top:100px; -->
<!-- <div><input type="button" name="paiement_coupon" id="paiement_coupon" value="Coupon" /> </div> -->
<table >
<tr>
<th ><div ><b>Coupon</b></div></th>
<th width=6px ><div ></div></th>
<th ><div ><b>Espece</b></div></th>
<th width=6px ><div ></div></th>
<th ><div ><b>Chèque</b></div></th>
<th width=6px ><div ></div></th>
<th ><div ><b>Total</b></div></th>
</tr>
<tr>
<td><input type ='text' name='coupon' id='coupon' value="0" style="width:60px; border:1px solid;" onChange="change_coupon(this)" onClick="click_coupon(this)" ></td>
<td><b>+</b></td>
<td><input type ='text' name='espece' id='espece' value="0" style="width:60px; border:1px solid;" disabled onclick="click_espece(this)" ></td>
<td><b>ou</b></td>
<td><input type ='text' name='cheque' id='cheque' value="0" style="width:60px; border:1px solid;" disabled onclick="click_cheque(this)"></td>
<td><b>=</b></td>
<td><input type ='text' name='total_coupon' id='total_coupon' value="" style="width:60px; border:1px solid;" disabled ></td>
</tr>
</table>
</div>
<!-- mode de paiement par Espèces -->
<div style="float-left; border:1px solid black;width:340px;font-size:15px;" id="mode_espece" > <!--position:absolute; left:770px; top:100px; -->
<span>Total versé en Espèces : </span><input type ='text' name='total_espece' id='total_espece' value="0" style="width:60px; border:1px solid;" disabled >
</div>
<div>
<input type="button" class="bouton" id="bouton_enregistrer" value="Enregistrer" onClick="enregistrer()" />
</div>
</div>
</div>
</div>
</form>
<form id="frm_id_activite" name="frm_id_activite" method="post" >
<!--ici form="frm_id_activite"
</form>
<?php
//recherche des cotistaions de l'adhérent déjà effectuées
$retours = $liaison->prepare("SELECT Adherents_cours.id_activite, Activites.Description, Adherents_cours.annee, Adherents_cours.prem_trimestre, Adherents_cours.deux_trimestre, Adherents_cours.trois_trimestre, Adherents_cours.seance, Adherents_cours.id_saison, Activites.id_Type_activite
FROM Adherents INNER JOIN (Activites INNER JOIN Adherents_cours ON Activites.ID = Adherents_cours.id_activite) ON Adherents.ID = Adherents_cours.id_adherent
WHERE (Adherents_cours.id_adherent = :id_adherent AND Adherents_cours.id_saison = 4)");
$retours -> bindValue(':id_adherent', $id_adherent, PDO::PARAM_INT);
$retours->execute();
//'$nbligne=
if ($retours->rowCount()>0)
{
//echo "nbre ligne ".$retours->rowCount();
while ($donnees = $retours->fetch(PDO::FETCH_ASSOC)){
$id_activite = $donnees['id_activite'];
$id_Type_activite = $donnees['id_Type_activite'];
$annee = $donnees['annee'];
$prem_trimestre = $donnees['prem_trimestre'];
$deux_trimestre = $donnees['deux_trimestre'];
$trois_trimestre = $donnees['trois_trimestre'];
if ($id_Type_activite<70)//si id_type_activite <70 c'est une activité si c'est un trimestre désactivé le trimestre et l'année
{
//echo "id_activite ".$id_activite;echo "<br/>";
// si c'est une année désactivé l'année et les trimestres
if ($annee<1)//c'est une activité au trimestre
{
$duree=array();
if ($prem_trimestre>0)
{
//prem_trimestre disabled
array_push($duree,'_T1'); //ajoute au tableau "duree" la variable '_T1'
}
if ($deux_trimestre>0)
{
//deux_trimestre disabled
array_push($duree,'_T2');
}
if ($trois_trimestre>0)
{
//prem_trimestre disabled
array_push($duree,'_T3');
}
}
else // c'est une année
{?>
<script>
nbreA = nbreA + 1 ;
var id_activite = <?php echo json_encode($id_activite,JSON_NUMERIC_CHECK); ?>;//transforme une variable php en une variable javascript
cout_mem = document.getElementById(id_activite+"_Tarif_Annee").value ;
console.log (cout_mem) ;
</script>
<?php
//trimestres disabled
//annee disabled
$duree=array('_A','_T1','_T2','_T3','_Seances');
}
foreach ($duree as $str_duree)
{
$var_id_activite = $id_activite.$str_duree;
?>
<script>
<!--désactive l'acivité -->
var var_id_activite = <?php echo json_encode($var_id_activite,JSON_NUMERIC_CHECK); ?>;//transforme une variable php en une variable javascript
console.log("var_id_activite "+var_id_activite);
var cases = document.getElementById(var_id_activite);
console.log (cases);
console.log(cases.style.backgroundColor);
cases.style.backgroundColor='lightGrey';
cases.checked=true;
cases.disabled=true;
<!-- mémorise -->
<!-- vv_id_activite=var_id_activite.substring(0,var_id_activite.indexOf("_",0)); -->
<!-- console.log("vv_id_activite "+vv_id_activite); -->
</script>
<?php
}
}
}
?>
<script>
//cotisations dejà effectuées
document.getElementById('GNF').value = 0 +" €";
document.getElementById('licence').value = 0 +" €";
document.getElementById('lig_GNF').style.display = "none"; //visibility ="hidden"; //
document.getElementById('lig_licence').style.display = "none";
console.log("fin des activités");
</script>
<?php
}
?>
<script>
Total();
</script>
<?php
include("commun/pied_pdo.php");
?> |