var db_manager=new Database();
            db_manager.configure();
            var carnet = new Carnet(db_manager.open("smarkhelp2",2));
            carnet.afficher($("#aacheter"),$("#total"),$("#depense"),$("#reste"));
            $("#chercher").on("click",function(){
                console.log('app');
            });
            $('#aacheter').delegate('.pchk','change',function(){
                 var fiche = new Carnet(db_manager.open("smarkhelp2",2));
                if($(this).is(":checked")){
                    fiche.effectue($(this).attr("value"),"oui");
                }
                else{
                    fiche.effectue($(this).attr("value"),"non");
                }      
            });
            
            $("#getRapport").on("click",function(){
               clearTimeout(compte);
               clearTimeout(loc);
               var depense = $("#depense").html().split('A')[0];
               var id=$("#courseTime").val().split('#')[0];
               console.log("course : "+$("#courseTime").val());
                console.log(id);
               var course = new Course(db_manager.open("smarkhelp3",2));
               console.log("course à finir : "+id);
                course.finir(id,depense);
               var duree = $("#hr").html()+"h"+$("#min").html()+"min";
                $("#dur").html(duree);
                $("#dep").html(depense+"Ar");
               var date=$("#courseTime").val().split('#')[1].split(" ");;
               var c="Course du "+date[2]+" "+date[1]+" "+date[3];
               $("#ctitre").html(c);
               console.log(c+" - "+duree);
               //carnet.afficher($("#aacheter"),$("#total"),$("#depense"));
               setTimeout(function(){
                   var produits=$(".list-group-item");
                   var cnet=new Carnet(db_manager.open("smarkhelp2",2));
                   //console.table($(".list-group-item-heading"));
                   cnet.saveHistory(id,$(".id-on-carnet"));
               },300); 
            });
            
        

            $("body").delegate("#finishCourse","click",function(){
                    console.log("accceeeeeeeeee");
                    document.location.href="";
            });