Problèmes SQLite - "Values et colomns"

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
PCPixMusic
Messages : 106
Inscription : ven. 06/janv./2017 9:50

Re: Problèmes SQLite - "Values et colomns"

Message par PCPixMusic »

Bonjour,

J'ai refondu complètement le code.

Si j'utilise le bouton Facture Client, et qu'en suite j'utilise le bouton pour enregistrer la fiche, ça me fait planter le code et me renvoie l'erreur ''The specified #Gadget is not initialised'.

J'ai regardé de partout, mais sans comprendre pourquoi.

Même ma Procedure InitGadget() ne ne résout pas le problème. :?

Merci d'avance si vous avez une réponse. :oops:

Voici la première partie du code (trop de caractère pour le mettre en une seule fois).

Code : Tout sélectionner

EnableExplicit

Enumeration
  #Window_0
  #Listview_0
  #Button_0
  #Button_1
  #Button_2
  #Button_3
  #Button_4
  #Button_5
  #Button_6
  #Button_7
  #Button_8
  #Button_9
  #Button_10
  #Button_11
  #Button_12
  #Button_13  
  #BoutonFacture
  #BoutonContrat
  #BoutonSeance
  #BoutonAgenda
  #Agenda
  #BoutonAPropos 
  #Image_0
  #Image_1   
  #Text_Contact_0
  #Text_Contact_1
  #Text_Contact_2
  #Text_Contact_3
  #Text_Contact_4
  #Text_Contact_5
  #Text_Contact_6
  #Text_Contact_7
  #Text_Contact_8
  #Text_Contact_9
  #Text_Contact_10
  #Text_Contact_11
  #Text_Contact_12
  #Text_Contact_13
  #Text_Contact_14
  #Text_Contact_15
  #Text_Contact_16
  #Text_Contact_17
  #Text_Contact_18
  #Text_Contact_19
  #Text_Contact_20 
  #Text_Contact_21  
  #StringContact_0
  #StringContact_1
  #StringContact_2
  #StringContact_3
  #StringContact_4
  #StringContact_5
  #StringContact_6
  #StringContact_7
  #StringContact_8
  #StringContact_9
  #StringContact_10
  #StringContact_11
  #StringContact_12
  #StringContact_13
  #StringContact_14
  #StringContact_15
  #StringContact_16
  #StringContact_17
  #StringContact_18
  #StringContact_19
  #StringContact_20
  #StringContact_21
  #StringFacture_0
  #StringFacture_1
  #StringFacture_2
  #StringFacture_3
  #StringFacture_4
  #StringFacture_5
  #StringFacture_6
  #StringFacture_7
  #StringFacture_8
  #StringFacture_9    
  #StringContrat_0
  #StringContrat_1
  #StringContrat_2
  #StringContrat_3
  #StringContrat_4
  #StringContrat_5
  #StringContrat_6    
  #StringSeance_0
  #StringSeance_1
  #StringSeance_2
  #StringSeance_3
  #StringSeance_4
  #StringSeance_5
  #StringSeance_6
  #StringSeance_7
  #StringSeance_8
  #StringSeance_9    
  #CheckBox_0
  #CheckBox_1
  #CheckBox_2
  #CheckBox_3
  #CheckBox_4
  #CheckBox_5
  #CheckBox_6
  #CheckBox_7
  #CheckBox_8
  #CheckBox_9
  #CheckBox_10          
  #CheckBox_11
  #CheckBox_12
  #CheckBox_13
  #CheckBox_14
  #CheckBox_15
  #CheckBox_16
  #CheckBox_17
  #CheckBox_18
  #CheckBox_19  
  #FenetreAgenda
  #FenetreApropos
  #FenetreFacture
  #FenetreContrat
  #FenetreSeance
  #TextAgenda
  #TextAPropos1
  #TextAPropos2
  #TextAPropos3
  #TextAPropos4
  #TextAPropos5    
  #TextFacture_0
  #TextFacture_1
  #TextFacture_2
  #TextFacture_3
  #TextFacture_4
  #TextFacture_5
  #TextFacture_6
  #TextFacture_7
  #TextFacture_8
  #TextFacture_9
  #TextFacture_10    
  #TextContrat_0
  #TextContrat_1
  #TextContrat_2
  #TextContrat_3
  #TextContrat_4
  #TextContrat_5
  #TextContrat_6
  #TextContrat_7
  #TextContrat_8
  #TextContrat_9
  #TextContrat_10    
  #TextTitreContrat_0
  #TextTitreContrat_1
  #TextTitreContrat_2
  #TextTitreContrat_3
  #TextTitreContrat_4
  #TextTitreContrat_5  
  #TextSeance_0
  #TextSeance_1
  #TextSeance_2
  #TextSeance_3
  #TextSeance_4
  #TextSeance_5
  #TextSeance_6
  #TextSeance_7
  #TextTitreSeance_0
  #TextTitreSeance_1
  #TextTitreSeance_2
  #TextTitreSeance_3
  #TextTitreSeance_4
  #TextTitreSeance_5  
EndEnumeration

Global glDBSQLite.l
Global glListviewItemSelected.l = -1
Global glImageMemory.l, glImageMemory2.l
Global glEvent, glGadget, glType

Define Modification.D,ModeListeview.D

UseJPEG2000ImageDecoder()
UseJPEG2000ImageEncoder()
UseJPEGImageDecoder()
UseJPEGImageEncoder()
UsePNGImageDecoder()
UsePNGImageEncoder()

Declare Main_WindowOpen()
Declare OpenEditionContrat()
Declare OpenEditionFacture()
Declare OpenEditionSeance()
Declare DB_Init()
Declare Reset()
   

Procedure InitGadget()
  
  Protected TestGadget.i
  Protected TestGadgetCheckGadget.i
  Protected TestImage.i 
  
 For TestGadget = #Text_Contact_0 To #Text_Contact_21
    StringGadget(TestGadget,0,0,0,0,"")
  Next    
  
  For TestGadget = #TextFacture_0 To #TextFacture_9    
    TextGadget(TestGadget,0,0,0,0,"")
  Next  
  
  For TestGadget = #TextContrat_0 To #TextContrat_6    
    TextGadget(TestGadget,0,0,0,0,"")
  Next  
  
  For TestGadget = #TextSeance_0 To #TextSeance_6    
    TextGadget(TestGadget,0,0,0,0,"")
  Next  

  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  For TestGadget = #StringContact_0 To #StringContact_21        
    StringGadget(TestGadget,0,0,0,0,"")
  Next       
  
  For TestGadget = #StringFacture_0 To #StringFacture_9    
    StringGadget(TestGadget,0,0,0,0,"")
  Next  

  For TestGadget = #StringContrat_0 To #StringContrat_6        
    StringGadget(TestGadget,0,0,0,0,"")
  Next
  
  For TestGadget = #StringSeance_0 To #StringSeance_6    
   StringGadget(TestGadget,0,0,0,0,"")
 Next 
 
  For TestGadgetCheckGadget = #CheckBox_0 To #CheckBox_19    
    TextGadget(TestGadgetCheckGadget,0,0,0,0,"")
  Next 
EndProcedure

Procedure Main_WindowOpen()   
  
  If OpenWindow(#Window_0, 0,0,1295,356, "Notysoft Photos Modèles - Gestion de Contacts",  #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_BorderLess)
    
    InitGadget()
       
    ButtonGadget(#Button_0, 10,  10, 120,26,"Nouveau")
    ButtonGadget(#Button_1, 10,  36, 120,26,"Enregistrer")
    ButtonGadget(#Button_2, 10,  62, 120,26,"Mettre à jour la base")
    ButtonGadget(#Button_3, 10,  88,120,26,"Supprimer une fiche")
    ButtonGadget(#Button_4, 10,  114,120,26,"Ajouter une photo")
    ButtonGadget(#Button_5, 10,  140,120,26,"Facture client")
    ButtonGadget(#Button_6, 10,  166,120,26,"Contrat photo")
    ButtonGadget(#Button_7, 10,  192,120,26,"Séance photo")
    ButtonGadget(#Button_8, 10,  218,120,26,"Mode Factures")    
    ButtonGadget(#Button_9, 10,  244,120,26,"Mode Prénoms")      
    ButtonGadget(#Button_10,10,  270,120,26,"Agenda")    
    ButtonGadget(#Button_11,10,  296,120,26,"Calculatrice")    
    ButtonGadget(#Button_12,10,  322,120,26,"A Propos")
    
    ListViewGadget(#Listview_0, 140, 10,374,337)
    ;ImageGadget(#Image_0, 980, 10, 244, 284, 00, #PB_Image_Border)
    ImageGadget(#Image_0, 990, 10, 294, 334, 00, #PB_Image_Border)
    
    ImageGadget(#Image_1, 0, 0, 0, 0, 00, #PB_Image_Border)
           
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
    TextGadget(#Text_Contact_0,  530,16, 110, 20, "Prénom      ")
    TextGadget(#Text_Contact_1,  530,47, 110, 20, "Nom         ")
    TextGadget(#Text_Contact_2,  530,78, 110, 20, "Profession  ")
    TextGadget(#Text_Contact_3,  530,109, 110, 20, "Société     ")
    TextGadget(#Text_Contact_4,  530,140, 110, 20, "Adresse 1   ")
    TextGadget(#Text_Contact_5,  530,171, 110, 20, "Adresse 2   ")
    TextGadget(#Text_Contact_6,  530,202, 110, 20, "Adresse 3   ")
    TextGadget(#Text_Contact_7,  530,232, 110, 20, "Code Postal ")
    TextGadget(#Text_Contact_8,  530,268, 110, 20, "Ville       ")
    TextGadget(#Text_Contact_9,  530,299, 110, 20, "Pays        ")    
    TextGadget(#Text_Contact_10, 530,330, 110, 20, "Téléphone   ")
   
    TextGadget(#Text_Contact_11, 760, 16,110, 20, "Fax         ")
    TextGadget(#Text_Contact_12, 760, 47,110, 20, "Mail        ")
    TextGadget(#Text_Contact_13, 760, 78,110, 20, "Naissance   ")
    TextGadget(#Text_Contact_14, 760, 109,110, 20, "Sexe        ")
    TextGadget(#Text_Contact_15, 760, 140,110, 20, "Cheveux     ")
    TextGadget(#Text_Contact_16, 760, 171, 110, 20, "Yeux        ")
    TextGadget(#Text_Contact_17, 760, 202, 110, 20, "Peau        ")
    TextGadget(#Text_Contact_18, 760, 232, 110, 20, "Taille      ")
    TextGadget(#Text_Contact_19, 760, 268, 110, 20, "Poids      ")
    TextGadget(#Text_Contact_20, 760, 299, 110, 20, "Hanches")    
    TextGadget(#Text_Contact_21, 760, 330, 110, 20, "Loisir(s)")     
     
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    StringGadget(#StringContact_0,  590, 12, 150, 20, "")      
    SetGadgetColor(#StringContact_0, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_1,  590, 43, 150, 20, "")    
    SetGadgetColor(#StringContact_1, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_2,  590, 74, 150, 20, "")
    SetGadgetColor(#StringContact_2, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_3,  590, 105, 150, 20, "")    
    SetGadgetColor(#StringContact_3, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_4,  590, 136, 150, 20, "")    
    SetGadgetColor(#StringContact_4, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_5,  590, 167, 150, 20, "")    
    SetGadgetColor(#StringContact_5, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_6,  590, 198, 150, 20, "")    
    SetGadgetColor(#StringContact_6, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_7, 590, 229, 150, 20, "")
    SetGadgetColor(#StringContact_7, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_8, 590, 264, 150, 20, "")
    SetGadgetColor(#StringContact_8, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_9, 590, 295, 150, 20, "")
    SetGadgetColor(#StringContact_9, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_10, 590, 326, 150, 20, "")
    SetGadgetColor(#StringContact_10, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    StringGadget(#StringContact_11, 820, 12, 150, 20, "")
    SetGadgetColor(#StringContact_11, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_12, 820, 43, 150, 20, "")
    SetGadgetColor(#StringContact_12, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_13, 820, 74, 150, 20, "")
    SetGadgetColor(#StringContact_13, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_14, 820, 105, 150, 20, "")
    SetGadgetColor(#StringContact_14, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_15, 820, 136, 150, 20, "")
    SetGadgetColor(#StringContact_15, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_16, 820, 167, 150, 20, "")
    SetGadgetColor(#StringContact_16, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_17, 820, 198, 150, 20, "")
    SetGadgetColor(#StringContact_17, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_18, 820, 229, 150, 20, "")
    SetGadgetColor(#StringContact_18, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_19, 820, 264, 150, 20, "")
    SetGadgetColor(#StringContact_19, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_20, 820, 295, 150, 20, "")
    SetGadgetColor(#StringContact_20, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContact_21, 820, 326, 150, 20, "")       
    SetGadgetColor(#StringContact_21, #PB_Gadget_BackColor, RGB(245, 222, 179))          

  EndIf                     
EndProcedure

Procedure OpenEditionFacture()  
  If OpenWindow(#FenetreFacture,153,40,462,320, "Édition de la facture", #PB_Window_TitleBar | #PB_Window_BorderLess,WindowID(#Window_0))            
    
    TextGadget(#TextFacture_0, 12,  10,100,20, "N°Client")
    TextGadget(#TextFacture_1, 242, 10, 70,20, "N°Facture")   
    TextGadget(#TextFacture_2, 12,  65,200,20, "Désignation prestation(s)")
    TextGadget(#TextFacture_3, 12, 120,50, 20, "Quantité")
    TextGadget(#TextFacture_4, 12, 175,200,20, "Commentaire(s)")
    TextGadget(#TextFacture_5, 12, 230,200,20, "Recommandation(s)")
    TextGadget(#TextFacture_6, 72, 120,80, 20, "Prix unitaire HT")
    TextGadget(#TextFacture_7, 162,120,100,20, "Date de règlement")   
    TextGadget(#TextFacture_8, 272,120,80,50,  "Date exécution")
    TextGadget(#TextFacture_9, 352,120,120,20, "Conditions escompte") 
    
      StringGadget(#StringFacture_0, 10, 30, 215, 20, "") 
    SetGadgetColor(#StringFacture_0, #PB_Gadget_BackColor, RGB(245, 222, 179))
      StringGadget(#StringFacture_1, 240,30, 215, 20, "")
    SetGadgetColor(#StringFacture_1, #PB_Gadget_BackColor, RGB(245, 222, 179))
      StringGadget(#StringFacture_2, 10,85,440,20, "")   
    SetGadgetColor(#StringFacture_2, #PB_Gadget_BackColor, RGB(245, 222, 179))
      StringGadget(#StringFacture_3, 10,140,50, 20, "")
    SetGadgetColor(#StringFacture_3, #PB_Gadget_BackColor, RGB(245, 222, 179))
      StringGadget(#StringFacture_4, 70,140,80, 20, "")
    SetGadgetColor(#StringFacture_4, #PB_Gadget_BackColor, RGB(245, 222, 179))
      StringGadget(#StringFacture_5, 160,140,100, 20, "")
    SetGadgetColor(#StringFacture_5, #PB_Gadget_BackColor, RGB(245, 222, 179))
      StringGadget(#StringFacture_6, 268,140,76,20, "")
    SetGadgetColor(#StringFacture_6, #PB_Gadget_BackColor, RGB(245, 222, 179))
      StringGadget(#StringFacture_7, 350,140,100, 20, "")     
    SetGadgetColor(#StringFacture_7, #PB_Gadget_BackColor, RGB(245, 222, 179))
      StringGadget(#StringFacture_8,  10, 195, 440, 20, "")       
    SetGadgetColor(#StringFacture_8, #PB_Gadget_BackColor, RGB(245, 222, 179))
      StringGadget(#StringFacture_9,   10, 250, 440, 20, "")
    SetGadgetColor(#StringFacture_9, #PB_Gadget_BackColor, RGB(245, 222, 179))
            
    ButtonGadget(#BoutonFacture,181,280,100,30, "Ok")    
    
  EndIf
EndProcedure

Procedure OpenEditionContrat()  
  If OpenWindow(#FenetreContrat,153,40,512,350, "Édition du contrat", #PB_Window_TitleBar | #PB_Window_BorderLess,WindowID(#Window_0))               
                
    TextGadget(#TextTitreContrat_0,14,10,200,20,"Edition du Contrat Modèle :")    
    TextGadget(#TextTitreContrat_1,14,100,200,20,"Autorisation modes de diffusion :")
    TextGadget(#TextTitreContrat_2,14,203,200,20,"Conditions financières :")                       
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;
    TextGadget(#TextContrat_0, 14 ,40,100,20,"N°Contrat")
    TextGadget(#TextContrat_1, 124,40,100,20,"Date du shooting")
    TextGadget(#TextContrat_2, 234,40,150,20,"Durée de l'autorisation")
    TextGadget(#TextContrat_3, 394,40,100,20,"Fin de validité")    
    TextGadget(#TextContrat_4, 310,171,100,20,"Autre (Préciser)")    
    
    StringGadget(#StringContrat_0,12,60,100,20, "")  
    SetGadgetColor(#StringContrat_0, #PB_Gadget_BackColor, RGB(245, 222, 179))         
    
    StringGadget(#StringContrat_1,122,60,100,20, "")
    SetGadgetColor(#StringContrat_1, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContrat_2,232,60,150,20, "")     
    SetGadgetColor(#StringContrat_2, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    StringGadget(#StringContrat_3,392,60,110,20, "")       
    SetGadgetColor(#StringContrat_3, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    CheckBoxGadget(#CheckBox_0, 16,130,100, 15, "Presse")
    CheckBoxGadget(#CheckBox_1, 16,150,100, 15, "Livre")
    CheckBoxGadget(#CheckBox_2, 16,170,100, 15, "Exposition")
   
    CheckBoxGadget(#CheckBox_5, 160,130,100,15, "Carte postale")
    CheckBoxGadget(#CheckBox_6, 160,150,120,15, "Projection publique")
    CheckBoxGadget(#CheckBox_7, 160,170,60, 15, "Publicité")           
   
    CheckBoxGadget(#CheckBox_4, 310,130,130, 15, "Objets de décoration")
    CheckBoxGadget(#CheckBox_3, 310,150,130, 15, "Publication électronique") 
    
      StringGadget(#StringContrat_4,394,169,110,20, "")
    SetGadgetColor(#StringContrat_4, #PB_Gadget_BackColor, RGB(245, 222, 179))     
    
    CheckBoxGadget(#CheckBox_8,  16,233,300, 15, "Autorisation à titre gratuit")
    CheckBoxGadget(#CheckBox_9,  16,253,290, 15, "Autorisation contre tirage : Pourcentage sur les recettes")
   
      TextGadget(#TextContrat_5  ,344,254,12,20,"%")
    StringGadget(#StringContrat_5,305,251,36,20,"")
    SetGadgetColor(#StringContrat_5, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
       TextGadget(#TextContrat_6 ,344,274,12,20,"€")
    StringGadget(#StringContrat_6,305,271,36,20,"")
    SetGadgetColor(#StringContrat_6, #PB_Gadget_BackColor, RGB(245, 222, 179))
   
    CheckBoxGadget(#CheckBox_10, 16,273,280, 15, "Autorisation contre rémunération - Montant fixe départ")   
    
    ButtonGadget(#Button_13, 380,210,120,26,"Ajouter une signature")
       ImageGadget(#Image_1, 380,240, 119,59, 00, #PB_Image_Border)
                     
    ButtonGadget(#BoutonContrat,206,310,100,30,"Ok")       

  EndIf
EndProcedure

Procedure OpenEditionSeance()  
  If OpenWindow(#FenetreSeance,153,40,502,380, "Édition du déroulement de la séance photo", #PB_Window_TitleBar | #PB_Window_BorderLess,WindowID(#Window_0))   
    
       TextGadget(#TextSeance_0, 10,14,100, 20,"Lieux de la séance")
    StringGadget(#StringSeance_0,115,11,380, 20,"")
    SetGadgetColor(#StringSeance_0, #PB_Gadget_BackColor, RGB(245, 222, 179))  
      
         TextGadget(#TextSeance_1,10,38,200,20,"Tenue vestimentaire ")
    StringGadget(#StringSeance_1,115,35,380,20,"")
    SetGadgetColor(#StringSeance_1, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
        TextGadget(#TextSeance_2,10, 62,200, 20,"Les accessoires, etc")
    StringGadget(#StringSeance_2,115,59,380,20,"")
    SetGadgetColor(#StringSeance_2, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    CheckBoxGadget(#CheckBox_11, 10 ,87 ,70,15,"Sac")
    CheckBoxGadget(#CheckBox_12, 10 ,107 ,70,15,"Chapeau")          
    CheckBoxGadget(#CheckBox_13, 220,87,70,15,"Gants")   
    CheckBoxGadget(#CheckBox_14, 220,107,70,15,"Bijoux")       
    CheckBoxGadget(#CheckBox_15, 430,87,70,15,"Armes")
    CheckBoxGadget(#CheckBox_16, 430,107,70,15,"Cosplay")           
    
        TextGadget(#TextSeance_3,10, 131,200, 20,"Projet de maquillage")
    StringGadget(#StringSeance_3,115,128,380, 20,"")
    SetGadgetColor(#StringSeance_3, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
      TextGadget(#TextSeance_4  , 10,155,200, 20,"Projet d'onglerie")
    StringGadget(#StringSeance_4,115,152,380, 20,"")
    SetGadgetColor(#StringSeance_4, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
       TextGadget(#TextSeance_5 ,10 ,179,200, 20,"Projet de coiffure")
    StringGadget(#StringSeance_5,115,176,380, 20,"")
    SetGadgetColor(#StringSeance_5, #PB_Gadget_BackColor, RGB(245, 222, 179))    
       
       TextGadget(#TextSeance_6 ,10 ,203,200, 20,"Partenariat(s)")
    StringGadget(#StringSeance_6,115,200,380, 20,"")
    SetGadgetColor(#StringSeance_6, #PB_Gadget_BackColor, RGB(245, 222, 179))
    
    TextGadget(#TextSeance_7,10 ,240,420, 20,"Condition de livraison des photos au format JPG, sous 2à 3 semaines")      
    
    CheckBoxGadget(#CheckBox_17, 10,270,300,15,"Vous recevrez vos photos sur DVD")
    CheckBoxGadget(#CheckBox_18, 10,290,300,15,"Vous recevrez vos photos en téléchargement")
    CheckBoxGadget(#CheckBox_19, 10,310,300,15,"Vous recevrez vos photos en tirages")    
    
    ButtonGadget(#BoutonSeance,206,340,100,30,"Ok")  
  EndIf  
 EndProcedure

Procedure DB_Init()
  Protected plFile.l
  Protected psSQLRequest.s
  UseSQLiteDatabase()
  If FileSize(#PB_Compiler_FilePath+"PhotosModèles.sqlite") < 0
    plFile = CreateFile(#PB_Any, #PB_Compiler_FilePath+"PhotosModèles.sqlite")
    If plFile
      CloseFile(plFile)
    EndIf
  EndIf
 
  glDBSQLite = OpenDatabase(#PB_Any, #PB_Compiler_FilePath+"PhotosModèles.sqlite", "", "", #PB_Database_SQLite)
  If glDBSQLite = 0
    MessageRequester("Notysoft Photos Modèles - Gestion de Contacts", DatabaseError())
    End
  ElseIf plFile
    psSQLRequest = "CREATE TABLE IF NOT EXISTS contacts ("
    psSQLRequest + "id_contact INTEGER PRIMARY KEY AUTOINCREMENT Not NULL, " 
    
    psSQLRequest + "contact_prenom TEXT Not NULL, "
    psSQLRequest + "contact_nom TEXT Not NULL, "
    psSQLRequest + "contact_job TEXT, "
    psSQLRequest + "contact_company TEXT, "
    psSQLRequest + "contact_address_1 TEXT, "
    psSQLRequest + "contact_address_2 TEXT, "
    psSQLRequest + "contact_address_3 TEXT, "
    psSQLRequest + "contact_postalcode TEXT, "
    psSQLRequest + "contact_city TEXT, "
    psSQLRequest + "contact_country TEXT, "
    psSQLRequest + "contact_phone TEXT, "
    psSQLRequest + "contact_fax TEXT, "
    psSQLRequest + "contact_mail TEXT, "
    psSQLRequest + "contact_date_de_naissance TEXT, "
    psSQLRequest + "contact_sexe TEXT, "
    psSQLRequest + "contact_cheveux TEXT, "
    psSQLRequest + "contact_yeux TEXT, "
    psSQLRequest + "contact_peau TEXT, "
    psSQLRequest + "contact_taille TEXT, "
    psSQLRequest + "contact_poids TEXT, "
    psSQLRequest + "contact_hanches TEXT, "
    psSQLRequest + "contact_loisir TEXT, "    
    
    psSQLRequest + "facture_Numero_Client TEXT, "
    psSQLRequest + "facture_Numero_Facture TEXT, "
    psSQLRequest + "facture_prestation TEXT, "
    psSQLRequest + "facture_quantite TEXT, "
    psSQLRequest + "facture_commentaires TEXT,"
    psSQLRequest + "facture_recommandations TEXT, "    
    psSQLRequest + "facture_prix_uht TEXT, "
    psSQLRequest + "facture_date_reglement TEXT, "
    psSQLRequest + "facture_date_execution TEXT, "
    psSQLRequest + "facture_conditions_escompte TEXT, "
     
    psSQLRequest + "contrat_Numero_Contrat TEXT, "
    psSQLRequest + "contrat_shooting TEXT, "
    psSQLRequest + "contrat_autorisation TEXT, "   
    psSQLRequest + "contrat_fin_validite TEXT, "
    psSQLRequest + "contrat_autres TEXT, "
    psSQLRequest + "contrat_pourcentage TEXT, "
    psSQLRequest + "contrat_euros TEXT, "  
    
    psSQLRequest + "Seance_lieux TEXT, "   
    psSQLRequest + "Seance_tenues TEXT, "   
    psSQLRequest + "Seance_accessoires TEXT, "   
    psSQLRequest + "Seance_makeup TEXT, "   
    psSQLRequest + "Seance_onglerie TEXT, "   
    psSQLRequest + "Seance_coiffure TEXT, "   
    psSQLRequest + "Seance_partenariats TEXT, " 
    
    psSQLRequest + "Etat_CheckBox_0 INTEGER, "
    psSQLRequest + "Etat_CheckBox_1 INTEGER, "
    psSQLRequest + "Etat_CheckBox_2 INTEGER, "
    psSQLRequest + "Etat_CheckBox_3 INTEGER, "
    psSQLRequest + "Etat_CheckBox_4 INTEGER, "
    psSQLRequest + "Etat_CheckBox_5 INTEGER, "
    psSQLRequest + "Etat_CheckBox_6 INTEGER, "
    psSQLRequest + "Etat_CheckBox_7 INTEGER, "
    psSQLRequest + "Etat_CheckBox_8 INTEGER, "
    psSQLRequest + "Etat_CheckBox_9 INTEGER, "
    psSQLRequest + "Etat_CheckBox_10 INTEGER, "
    psSQLRequest + "Etat_CheckBox_11 INTEGER, "
    psSQLRequest + "Etat_CheckBox_12 INTEGER, "
    psSQLRequest + "Etat_CheckBox_13 INTEGER, "
    psSQLRequest + "Etat_CheckBox_14 INTEGER, "
    psSQLRequest + "Etat_CheckBox_15 INTEGER, "
    psSQLRequest + "Etat_CheckBox_16 INTEGER, "
    psSQLRequest + "Etat_CheckBox_17 INTEGER, "
    psSQLRequest + "Etat_CheckBox_18 INTEGER, "
    psSQLRequest + "Etat_CheckBox_19 INTEGER, "    
    psSQLRequest + "contact_photo BLOB, "
    psSQLRequest + "contact_photo_s BLOB, "
    psSQLRequest + "contact_photo_size INTEGER,"
    psSQLRequest + "contact_photo_s_size INTEGER"
    psSQLRequest + ")"
    ; Debug psSQLRequest
    If DatabaseUpdate(glDBSQLite, psSQLRequest) = 0
      MessageRequester("Notysoft Photos Modèles - Gestion de Contacts - DB_Init()", DatabaseError())
    EndIf
  EndIf
  
  If DatabaseQuery(glDBSQLite, "SELECT rowid, facture_Numero_Facture,  contact_prenom, contact_nom, contact_job FROM contacts") <> 0 
    While NextDatabaseRow(glDBSQLite)   
      AddGadgetItem(#Listview_0, CountGadgetItems(#Listview_0), "Facture N°" +GetDatabaseString(glDBSQLite, 1) + " " +GetDatabaseString(glDBSQLite, 2) + " " + GetDatabaseString(glDBSQLite, 3) + " " + GetDatabaseString(glDBSQLite, 4))      
      SetGadgetItemData(#Listview_0, CountGadgetItems(#Listview_0)-1, GetDatabaseLong(glDBSQLite, 0))
    Wend
    FinishDatabaseQuery(glDBSQLite)
  EndIf
  
EndProcedure

;Nouveau client
Procedure Reset()
  Protected Gadget.i
  Protected CheckGadget.i
 
  For Gadget = #StringContact_0 To #StringContact_21    
    SetGadgetText(Gadget,"")
  Next
  
 For Gadget = #StringFacture_0 To #StringFacture_9
   SetGadgetText(Gadget,"")
  Next
  
  For Gadget = #StringContrat_0 To #StringContrat_6    
    SetGadgetText(Gadget,"")
  Next
  
  For Gadget = #StringSeance_0 To #StringSeance_6    
   SetGadgetText(Gadget,"")
 Next 
 
 For CheckGadget = #CheckBox_0 To #CheckBox_19
    SetGadgetState(CheckGadget, #PB_Checkbox_Unchecked)
  Next   
 
  If glImageMemory
    FreeMemory(glImageMemory)
    glImageMemory = AllocateMemory(1024) 
  EndIf
 
  If glImageMemory2
    FreeMemory(glImageMemory2)
    glImageMemory2 = AllocateMemory(1024) 
  EndIf  
 
  SetGadgetState(#Image_0, 0)
  SetGadgetState(#Image_1, 0)
EndProcedure

Procedure DB_InsertContact()
  Protected psSQLRequest.s
  psSQLRequest = "INSERT INTO contacts"
  psSQLRequest + "(contact_prenom, contact_nom, contact_job, contact_company, contact_address_1,contact_address_2,contact_address_3,"
  psSQLRequest + "contact_postalcode, contact_city, contact_country, contact_phone, contact_fax, contact_mail, contact_date_de_naissance,contact_sexe, contact_cheveux,contact_yeux,contact_peau,"
  psSQLRequest + "contact_taille,contact_poids,contact_hanches,contact_loisir,facture_Numero_Client,facture_Numero_Facture,facture_prestation,facture_quantite,facture_commentaires,facture_recommandations,facture_prix_uht,"  
  psSQLRequest + "facture_date_reglement,facture_date_execution,facture_conditions_escompte,contrat_Numero_Contrat,contrat_shooting,contrat_autorisation,contrat_fin_validite,contrat_autres,contrat_pourcentage,"
  psSQLRequest + "contrat_euros,Seance_lieux,Seance_tenues,Seance_accessoires,Seance_makeup,Seance_onglerie,Seance_coiffure,Seance_partenariats,Etat_CheckBox_0,Etat_CheckBox_1,Etat_CheckBox_2,Etat_CheckBox_3,"
  psSQLRequest + "Etat_CheckBox_4,Etat_CheckBox_5,Etat_CheckBox_6,Etat_CheckBox_7,Etat_CheckBox_8,Etat_CheckBox_9,Etat_CheckBox_10,Etat_CheckBox_11,Etat_CheckBox_12,Etat_CheckBox_13,"
  psSQLRequest + "Etat_CheckBox_14,Etat_CheckBox_15,Etat_CheckBox_16,Etat_CheckBox_17,Etat_CheckBox_18,Etat_CheckBox_19,contact_photo,contact_photo_s,contact_photo_size,contact_photo_s_size)" 
  psSQLRequest + "VALUES ("  
    
  psSQLRequest + "'"+GetGadgetText(#StringContact_0)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_1)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_2)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_3)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_4)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_5)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_6)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_7)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_8)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_9)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_10)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_11)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_12)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_13)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_14)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_15)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_16)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_17)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_18)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_19)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_20)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_21)+"',"
  
  psSQLRequest + "'"+GetGadgetText(#StringFacture_0)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringFacture_1)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringFacture_2)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringFacture_3)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringFacture_4)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringFacture_5)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringFacture_6)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringFacture_7)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringFacture_8)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringFacture_9)+"',"
  
  psSQLRequest + "'"+GetGadgetText(#StringContrat_0)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContrat_1)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContrat_2)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContrat_3)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContrat_4)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContrat_5)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContrat_6)+"',"
  
  psSQLRequest + "'"+GetGadgetText(#StringSeance_0)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringSeance_1)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringSeance_2)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringSeance_3)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringSeance_4)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringSeance_5)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringSeance_6)+"',"
  
  psSQLRequest + "'"+GetGadgetState(#CheckBox_0)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_1)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_2)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_3)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_4)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_5)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_6)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_7)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_8)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_9)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_10)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_11)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_12)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_13)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_14)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_15)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_16)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_17)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_18)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_19)+"',"
  psSQLRequest + "?,"
  psSQLRequest + "?,"
 
  If glImageMemory
    psSQLRequest + Str(MemorySize(glImageMemory)) + ","
  Else
    psSQLRequest + "0" + ","
  EndIf
 
  If glImageMemory2
    psSQLRequest + Str(MemorySize(glImageMemory2))
  Else
    psSQLRequest + "1"
  EndIf
 
  psSQLRequest + ")"
 
  If glImageMemory
    SetDatabaseBlob(glDBSQLite, 0, glImageMemory, MemorySize(glImageMemory)) 
  Else
    ReplaceString(psSQLRequest, "?", "'0'") 
  EndIf 
 
  If glImageMemory2   
    SetDatabaseBlob(glDBSQLite, 1, glImageMemory2, MemorySize(glImageMemory2))
  Else 
    ReplaceString(psSQLRequest, "?", "'1'")
  EndIf 
 
  If DatabaseUpdate(glDBSQLite, psSQLRequest) = 0
    MessageRequester("Notysoft Photos Modèles - Gestion de Contacts - DB_InsertContact()", DatabaseError())
  EndIf
   
  ; Ajoute le dernier element de la base dans la listeview
  ;Récupération de l'identifiant automatique du dernier enregistrement
  ;Mise en oeuvre de last_insert_rowid()
  psSQLRequest = "select last_insert_rowid() from contacts"
  If DatabaseQuery(glDBSQLite, psSQLRequest)   
    NextDatabaseRow(glDBSQLite)
    AddGadgetItem(#Listview_0, CountGadgetItems(#Listview_0), "Facture N°" + GetGadgetText(#StringFacture_0) + " " +GetGadgetText(#StringContact_0) + " " + GetGadgetText(#StringContact_1) + " " + GetGadgetText(#StringContact_2))
    SetGadgetItemData(#Listview_0, CountGadgetItems(#Listview_0)-1, GetDatabaseLong(glDBSQLite, 0))   
    SetGadgetState(#Listview_0, CountGadgetItems(#Listview_0)-1)
  Else
    MessageRequester("Notysoft Photos Modèles - Gestion de Contacts - DB_InsertContact", DatabaseError())
  EndIf
EndProcedure

Procedure DB_SelectContact(GadgetItem.l)
  Protected psSQLRequest.s
  Protected plFileImageSize.l
  Protected plFileImage.l
 
  Protected plFileImageSize2.l
  Protected plFileImage2.l
 
  Reset()
 
  psSQLRequest = "SELECT * FROM contacts WHERE rowid=" + Str(GetGadgetItemData(#Listview_0, GadgetItem))
  ;Debug psSQLRequest
  If DatabaseQuery(glDBSQLite, psSQLRequest) <> 0
    While NextDatabaseRow(glDBSQLite)
      
      SetGadgetText(#StringContact_0,GetDatabaseString(glDBSQLite,  1))
      SetGadgetText(#StringContact_1,GetDatabaseString(glDBSQLite,  2))
      SetGadgetText(#StringContact_2,GetDatabaseString(glDBSQLite,  3))
      SetGadgetText(#StringContact_3,GetDatabaseString(glDBSQLite,  4))
      SetGadgetText(#StringContact_4,GetDatabaseString(glDBSQLite,  5))
      SetGadgetText(#StringContact_5,GetDatabaseString(glDBSQLite,  6))
      SetGadgetText(#StringContact_6,GetDatabaseString(glDBSQLite,  7))
      SetGadgetText(#StringContact_7,GetDatabaseString(glDBSQLite,  8))
      SetGadgetText(#StringContact_8,GetDatabaseString(glDBSQLite,  9))
      SetGadgetText(#StringContact_9,GetDatabaseString(glDBSQLite,  10))
      SetGadgetText(#StringContact_10,GetDatabaseString(glDBSQLite, 11))   
      SetGadgetText(#StringContact_11,GetDatabaseString(glDBSQLite, 12))   
      SetGadgetText(#StringContact_12,GetDatabaseString(glDBSQLite, 13))   
      SetGadgetText(#StringContact_13,GetDatabaseString(glDBSQLite, 14))   
      SetGadgetText(#StringContact_14,GetDatabaseString(glDBSQLite, 15))   
      SetGadgetText(#StringContact_15,GetDatabaseString(glDBSQLite, 16))   
      SetGadgetText(#StringContact_16,GetDatabaseString(glDBSQLite, 17))   
      SetGadgetText(#StringContact_17,GetDatabaseString(glDBSQLite, 18))   
      SetGadgetText(#StringContact_18,GetDatabaseString(glDBSQLite, 19))   
      SetGadgetText(#StringContact_19,GetDatabaseString(glDBSQLite, 20))   
      SetGadgetText(#StringContact_20,GetDatabaseString(glDBSQLite, 21))
      SetGadgetText(#StringContact_21,GetDatabaseString(glDBSQLite, 22))
      
      SetGadgetText(#StringFacture_0, GetDatabaseString(glDBSQLite, 23))
      SetGadgetText(#StringFacture_1, GetDatabaseString(glDBSQLite, 24))
      SetGadgetText(#StringFacture_2, GetDatabaseString(glDBSQLite, 25))
      SetGadgetText(#StringFacture_3, GetDatabaseString(glDBSQLite, 26))
      SetGadgetText(#StringFacture_4, GetDatabaseString(glDBSQLite, 27))
      SetGadgetText(#StringFacture_5, GetDatabaseString(glDBSQLite, 28))
      SetGadgetText(#StringFacture_6, GetDatabaseString(glDBSQLite, 29))
      SetGadgetText(#StringFacture_7, GetDatabaseString(glDBSQLite, 30))
      SetGadgetText(#StringFacture_8, GetDatabaseString(glDBSQLite, 31))
      SetGadgetText(#StringFacture_9, GetDatabaseString(glDBSQLite, 32))
            
      SetGadgetText(#StringContrat_0,GetDatabaseString(glDBSQLite, 33)) 
      SetGadgetText(#StringContrat_1,GetDatabaseString(glDBSQLite, 34)) 
      SetGadgetText(#StringContrat_2,GetDatabaseString(glDBSQLite, 35))   
      SetGadgetText(#StringContrat_3,GetDatabaseString(glDBSQLite, 36))   
      SetGadgetText(#StringContrat_4,GetDatabaseString(glDBSQLite, 37)) 
      SetGadgetText(#StringContrat_5,GetDatabaseString(glDBSQLite, 38)) 
      SetGadgetText(#StringContrat_6,GetDatabaseString(glDBSQLite, 39)) 
      
      SetGadgetText(#StringSeance_0,GetDatabaseString(glDBSQLite, 40)) 
      SetGadgetText(#StringSeance_1,GetDatabaseString(glDBSQLite, 41)) 
      SetGadgetText(#StringSeance_2,GetDatabaseString(glDBSQLite, 42))   
      SetGadgetText(#StringSeance_3,GetDatabaseString(glDBSQLite, 43))   
      SetGadgetText(#StringSeance_4,GetDatabaseString(glDBSQLite, 44)) 
      SetGadgetText(#StringSeance_5,GetDatabaseString(glDBSQLite, 45)) 
      SetGadgetText(#StringSeance_6,GetDatabaseString(glDBSQLite, 46)) 
       
      SetGadgetState(#CheckBox_0,GetDatabaseFloat(glDBSQLite, 47))                 
      SetGadgetState(#CheckBox_1,GetDatabaseFloat(glDBSQLite, 48))
      SetGadgetState(#CheckBox_2,GetDatabaseFloat(glDBSQLite, 49))
      SetGadgetState(#CheckBox_3,GetDatabaseFloat(glDBSQLite, 50))
      SetGadgetState(#CheckBox_4,GetDatabaseFloat(glDBSQLite, 51))
      SetGadgetState(#CheckBox_5,GetDatabaseFloat(glDBSQLite, 52))
      SetGadgetState(#CheckBox_6,GetDatabaseFloat(glDBSQLite, 53))
      SetGadgetState(#CheckBox_7,GetDatabaseFloat(glDBSQLite, 54))
      SetGadgetState(#CheckBox_8,GetDatabaseFloat(glDBSQLite, 55))
      SetGadgetState(#CheckBox_9,GetDatabaseFloat(glDBSQLite, 56))
      SetGadgetState(#CheckBox_10,GetDatabaseFloat(glDBSQLite,57))   
      SetGadgetState(#CheckBox_11,GetDatabaseFloat(glDBSQLite,58))
      SetGadgetState(#CheckBox_12,GetDatabaseFloat(glDBSQLite,59))
      SetGadgetState(#CheckBox_13,GetDatabaseFloat(glDBSQLite,60))
      SetGadgetState(#CheckBox_14,GetDatabaseFloat(glDBSQLite,61))
      SetGadgetState(#CheckBox_15,GetDatabaseFloat(glDBSQLite,62))
      SetGadgetState(#CheckBox_16,GetDatabaseFloat(glDBSQLite,63))
      SetGadgetState(#CheckBox_17,GetDatabaseFloat(glDBSQLite,64))
      SetGadgetState(#CheckBox_18,GetDatabaseFloat(glDBSQLite,65))
      SetGadgetState(#CheckBox_19,GetDatabaseFloat(glDBSQLite,66))      
     
      plFileImageSize = GetDatabaseLong(glDBSQLite, 69)
      If plFileImageSize > 0
        glImageMemory = AllocateMemory(plFileImageSize)
        GetDatabaseBlob(glDBSQLite, 67, glImageMemory, plFileImageSize)
        plFileImage = CatchImage(#PB_Any, glImageMemory, plFileImageSize)
        If plFileImage
          ResizeImage(plFileImage, 290, 333)
          SetGadgetState(#Image_0, ImageID(plFileImage))
          FreeImage(plFileImage)
        EndIf
      Else
        SetGadgetState(#Image_0, 0)
      EndIf
      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
      plFileImageSize2 = GetDatabaseLong(glDBSQLite, 70)
      If plFileImageSize2 > 0
        glImageMemory2 = AllocateMemory(plFileImageSize2)
        GetDatabaseBlob(glDBSQLite, 68, glImageMemory2, plFileImageSize2)
        plFileImage2 = CatchImage(#PB_Any, glImageMemory2, plFileImageSize2)
        If plFileImage2
          ResizeImage(plFileImage2, 116, 55)         
          SetGadgetState(#Image_1, ImageID(plFileImage2))
          FreeImage(plFileImage2)
        EndIf
      Else
        SetGadgetState(#Image_1, 0)
      EndIf
      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
    Wend
    FinishDatabaseQuery(glDBSQLite)
  Else
    MessageRequester("Notysoft Photos Modèles - Gestion de Contacts - DB_SelectContact", DatabaseError())
  EndIf
EndProcedure

Procedure DB_UpdateContact(GadgetItem,ModeListeview.D)
  Protected psSQLRequest.s
  psSQLRequest = "UPDATE contacts SET "
  
  psSQLRequest + "contact_prenom='"              +GetGadgetText(#StringContact_0)+"', "
  psSQLRequest + "contact_nom='"                 +GetGadgetText(#StringContact_1)+"', "
  psSQLRequest + "contact_job='"                 +GetGadgetText(#StringContact_2)+"', "
  psSQLRequest + "contact_company='"             +GetGadgetText(#StringContact_3)+"', "
  psSQLRequest + "contact_address_1='"           +GetGadgetText(#StringContact_4)+"', "
  psSQLRequest + "contact_address_2='"           +GetGadgetText(#StringContact_5)+"', "
  psSQLRequest + "contact_address_3='"           +GetGadgetText(#StringContact_6)+"', "
  psSQLRequest + "contact_postalcode='"          +GetGadgetText(#StringContact_7)+"', "
  psSQLRequest + "contact_city='"                +GetGadgetText(#StringContact_8)+"', "
  psSQLRequest + "contact_country='"             +GetGadgetText(#StringContact_9)+"', "
  psSQLRequest + "contact_phone='"               +GetGadgetText(#StringContact_10)+"', "
  psSQLRequest + "contact_fax='"                 +GetGadgetText(#StringContact_11)+"', "
  psSQLRequest + "contact_mail='"                +GetGadgetText(#StringContact_12)+"', "
  psSQLRequest + "contact_date_de_naissance='"   +GetGadgetText(#StringContact_13)+"', "
  psSQLRequest + "contact_sexe='"                +GetGadgetText(#StringContact_14)+"', "
  psSQLRequest + "contact_cheveux='"             +GetGadgetText(#StringContact_15)+"',"
  psSQLRequest + "contact_yeux='"                +GetGadgetText(#StringContact_16)+"',"
  psSQLRequest + "contact_peau='"                +GetGadgetText(#StringContact_17)+"',"
  psSQLRequest + "contact_taille='"              +GetGadgetText(#StringContact_18)+"',"
  psSQLRequest + "contact_poids='"               +GetGadgetText(#StringContact_19)+"',"
  psSQLRequest + "contact_hanches='"             +GetGadgetText(#StringContact_20)+"',"
  psSQLRequest + "contact_loisir='"              +GetGadgetText(#StringContact_21)+"',"
  
  psSQLRequest + "facture_Numero_Client='"       +GetGadgetText(#StringFacture_0)+"', "
  psSQLRequest + "facture_Numero_Facture='"      +GetGadgetText(#StringFacture_1)+"', "  
  psSQLRequest + "facture_prestation='"          +GetGadgetText(#StringFacture_2)+"',"
  psSQLRequest + "facture_quantite='"            +GetGadgetText(#StringFacture_3)+"',"
  psSQLRequest + "facture_commentaires='"        +GetGadgetText(#StringFacture_4)+"',"
  psSQLRequest + "facture_recommandations='"     +GetGadgetText(#StringFacture_5)+"',"
  psSQLRequest + "facture_prix_uht='"            +GetGadgetText(#StringFacture_6)+"',"
  psSQLRequest + "facture_date_reglement='"      +GetGadgetText(#StringFacture_7)+"',"
  psSQLRequest + "facture_date_execution='"      +GetGadgetText(#StringFacture_8)+"',"
  psSQLRequest + "facture_conditions_escompte='" +GetGadgetText(#StringFacture_9)+"',"
  
  psSQLRequest + "contrat_Numero_Contrat='"      +GetGadgetText(#StringContrat_0)+"', "
  psSQLRequest + "contrat_shooting='"            +GetGadgetText(#StringContrat_1)+"',"
  psSQLRequest + "contrat_autorisation='"        +GetGadgetText(#StringContrat_2)+"',"
  psSQLRequest + "contrat_fin_validite='"        +GetGadgetText(#StringContrat_3)+"',"
  psSQLRequest + "contrat_autres='"              +GetGadgetText(#StringContrat_4)+"',"
  psSQLRequest + "contrat_pourcentage='"         +GetGadgetText(#StringContrat_5)+"',"   
  psSQLRequest + "contrat_euros='"               +GetGadgetText(#StringContrat_6)+"',"
  
  psSQLRequest + "Seance_lieux='"                +GetGadgetText(#StringSeance_0)+"',"
  psSQLRequest + "Seance_tenues='"               +GetGadgetText(#StringSeance_1)+"',"
  psSQLRequest + "Seance_accessoires='"          +GetGadgetText(#StringSeance_2)+"',"
  psSQLRequest + "Seance_makeup='"               +GetGadgetText(#StringSeance_3)+"',"
  psSQLRequest + "Seance_onglerie='"             +GetGadgetText(#StringSeance_4)+"',"
  psSQLRequest + "Seance_coiffure='"             +GetGadgetText(#StringSeance_5)+"'," 
  psSQLRequest + "Seance_partenariats='"         +GetGadgetText(#StringSeance_6)+"',"     
  
  psSQLRequest + "Etat_CheckBox_0='"             +GetGadgetState(#CheckBox_0)+"',"
  psSQLRequest + "Etat_CheckBox_1='"             +GetGadgetState(#CheckBox_1)+"',"
  psSQLRequest + "Etat_CheckBox_2='"             +GetGadgetState(#CheckBox_2)+"',"
  psSQLRequest + "Etat_CheckBox_3='"             +GetGadgetState(#CheckBox_3)+"',"
  psSQLRequest + "Etat_CheckBox_4='"             +GetGadgetState(#CheckBox_4)+"',"
  psSQLRequest + "Etat_CheckBox_5='"             +GetGadgetState(#CheckBox_5)+"',"
  psSQLRequest + "Etat_CheckBox_6='"             +GetGadgetState(#CheckBox_6)+"',"   
  psSQLRequest + "Etat_CheckBox_7='"             +GetGadgetState(#CheckBox_7)+"',"   
  psSQLRequest + "Etat_CheckBox_8='"             +GetGadgetState(#CheckBox_8)+"',"
  psSQLRequest + "Etat_CheckBox_9='"             +GetGadgetState(#CheckBox_9)+"',"   
  psSQLRequest + "Etat_CheckBox_10='"            +GetGadgetState(#CheckBox_10)+"',"    
  psSQLRequest + "Etat_CheckBox_11='"            +GetGadgetState(#CheckBox_11)+"',"
  psSQLRequest + "Etat_CheckBox_12='"            +GetGadgetState(#CheckBox_12)+"',"
  psSQLRequest + "Etat_CheckBox_13='"            +GetGadgetState(#CheckBox_13)+"',"
  psSQLRequest + "Etat_CheckBox_14='"            +GetGadgetState(#CheckBox_14)+"',"
  psSQLRequest + "Etat_CheckBox_15='"            +GetGadgetState(#CheckBox_15)+"',"
  psSQLRequest + "Etat_CheckBox_16='"            +GetGadgetState(#CheckBox_16)+"',"   
  psSQLRequest + "Etat_CheckBox_17='"            +GetGadgetState(#CheckBox_17)+"',"   
  psSQLRequest + "Etat_CheckBox_18='"            +GetGadgetState(#CheckBox_18)+"',"
  psSQLRequest + "Etat_CheckBox_19='"            +GetGadgetState(#CheckBox_19)+"',"     
  psSQLRequest + "contact_photo = ?,"
  psSQLRequest + "contact_photo_s = ?,"
 
  If glImageMemory
    psSQLRequest + "contact_photo_size = " + Str(MemorySize(glImageMemory)) + ","
  Else
    psSQLRequest + "contact_photo_size = 0" + ","
  EndIf
 
  If glImageMemory2
    psSQLRequest + "contact_photo_s_size = " + Str(MemorySize(glImageMemory2))
  Else
    psSQLRequest + "contact_photo_s_size = 1"
  EndIf
 
  psSQLRequest + " WHERE rowid = " + Str(GetGadgetItemData(#Listview_0, GadgetItem))
  ;Debug psSQLRequest
 
  If glImageMemory
    SetDatabaseBlob(glDBSQLite, 0, glImageMemory, MemorySize(glImageMemory))
  Else
    ReplaceString(psSQLRequest, "?", "'0'")
  EndIf
 
  If glImageMemory2
    SetDatabaseBlob(glDBSQLite, 1, glImageMemory2, MemorySize(glImageMemory2))
  Else
    ReplaceString(psSQLRequest, "?", "'1'")
  EndIf
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  If DatabaseUpdate(glDBSQLite, psSQLRequest) = 0
    MessageRequester("Notysoft Photos Modèles - Gestion de Contacts - DB_UpdateContact()", DatabaseError())
  Else
  If ModeListeview = 1
    SetGadgetItemText(#Listview_0, GadgetItem, "Facture N°"+GetGadgetText(#StringFacture_0)+" "+GetGadgetText(#StringContact_0)+" "+GetGadgetText(#StringContact_1)+" "+GetGadgetText(#StringContact_2))         
    
    SetGadgetState(#Listview_0, GadgetItem)
  EndIf

  If ModeListeview = 2       
    SetGadgetItemText(#Listview_0, GadgetItem, GetGadgetText(#StringContact_0)+" "+GetGadgetText(#StringContact_1)+" "+GetGadgetText(#StringContact_2)+" Facture N°"+GetGadgetText(#StringFacture_0))   
    SetGadgetState(#Listview_0, GadgetItem)
  EndIf
EndIf

EndProcedure                                         


Procedure DB_DeleteContact(GadgetItem.l)
  Protected psSQLRequest.s
 
  psSQLRequest = "DELETE FROM contacts WHERE rowid = " + Str(GetGadgetItemData(#Listview_0, GadgetItem))
  If DatabaseUpdate(glDBSQLite, psSQLRequest) = 0
    MessageRequester("Notysoft Photos Modèles - Gestion de Contacts - DB_DeleteContact()", DatabaseError())
  Else
    RemoveGadgetItem(#Listview_0, GadgetItem)
    Reset()
  EndIf
EndProcedure

Procedure ExecCalc()
Protected LanceCalc = RunProgram("C:\Windows\System32\calc.exe","", "", #PB_Program_Open | #PB_Program_Read)
  Protected Sortie$ = ""
  If LanceCalc
    While ProgramRunning(LanceCalc)
      If AvailableProgramOutput(LanceCalc)
        Sortie$ + ReadProgramString(LanceCalc) + Chr(13)
      EndIf
    Wend
    Sortie$ + Chr(13) + Chr(13)
    Sortie$ + "Code de retour : " + Str(ProgramExitCode(LanceCalc))
   
    CloseProgram(LanceCalc) ; Ferme la connection vers le programme
  EndIf
EndProcedure

Procedure OpenAgenda()  
  If OpenWindow(#FenetreAgenda,153,50,220,220, "Agenda", #PB_Window_TitleBar | #PB_Window_BorderLess,WindowID(#Window_0))        
    CalendarGadget(#Agenda,0,0,220, 190)
    ButtonGadget(#BoutonAgenda,0,192,220,26, "Ok")
  EndIf
EndProcedure

Procedure OpenAPropos()  
  If OpenWindow(#FenetreApropos,153,40,220,145, "A Propos", #PB_Window_TitleBar | #PB_Window_BorderLess,WindowID(#Window_0))            
    
    TextGadget(#TextAPropos1,10, 10, 200, 20,"Notysoft Photos Modèles - 2016 - 2017",#PB_Text_Center)    
    TextGadget(#TextAPropos2,10, 30, 200, 20,"Frédéric CHERPE",#PB_Text_Center)
    TextGadget(#TextAPropos3,10, 50, 200, 20,"Gestion de Contacts",#PB_Text_Center)           
    TextGadget(#TextAPropos4,10, 70, 200, 20,"Créer simplement sa base de données",#PB_Text_Center)        
    TextGadget(#TextAPropos5,10, 90, 200, 20,"modèles et photographes.",#PB_Text_Center)    
            
    ButtonGadget(#BoutonAPropos,85,110,50,30, "Ok")    
    
  EndIf
EndProcedure

Procedure OpenInfos(titre.S,text1.S,text2.S,text3.S,text4.S,text5.S) 
  MessageRequester(titre,text1+ #CRLF$ +text2+ #CRLF$ +text3+ #CRLF$ +text4+ #CRLF$ +text5,64)     
  ;MessageRequester("A Propos","Notysoft Photos Modèles - 2016 - 2017" + #CRLF$ + "Créer simplement sa base de données modèles et photographes.",64)              
EndProcedure

Main_WindowOpen()
DB_Init()

Modification = 1 
ModeListeview = 1

PCPixMusic
Messages : 106
Inscription : ven. 06/janv./2017 9:50

Re: Problèmes SQLite - "Values et colomns"

Message par PCPixMusic »

Voici la fin de ce code :

Code : Tout sélectionner

Repeat
  glEvent = WaitWindowEvent()
  glGadget= EventGadget()
  glType = EventType()
 
 
  If glEvent = #PB_Event_Gadget
    Select glGadget 
       
      Case #Listview_0 ;Selection d'un enregistrement
        If GetGadgetState(#Listview_0) <> -1
           Modification = 1   
          ;glListviewItemSelected = GetGadgetState(#Listview_0)
          glListviewItemSelected = GetGadgetItemData(#Listview_0, GetGadgetState(#Listview_0))
          DB_SelectContact(GetGadgetState(#Listview_0))
        EndIf
       
      Case #Button_0 ;Nouveau
        Reset()
        Modification = 0 
        MessageRequester("Notysoft Photos Modèles","Nouveau contact, c'est parti !",64)
                
        Case #Button_1 ;{Enregistrer
          If GetGadgetText(#StringFacture_0) <> "" And GetGadgetText(#StringContact_0) <> "" And GetGadgetText(#StringContact_1) <> "" And GetGadgetText(#StringContact_1) <> "" And Modification = 0                               
          Modification = 1
          DB_InsertContact()  
          
      Else
        If GetGadgetState(#Listview_0) >= 0 And GetGadgetState(#Listview_0) <= CountGadgetItems(#Listview_0)-1  And Modification = 1   
          DB_UpdateContact(GetGadgetState(#Listview_0),1)
          Modification = 1 
             MessageRequester("Notysoft Photos Modèles - Gestion de Contacts - ","Contact enregistrer !",64)               
          EndIf
        EndIf        
      ;}    
        
        
      Case #Button_2 ;{ Mettre à jour
        If GetGadgetState(#Listview_0) >= 0 And GetGadgetState(#Listview_0) <= CountGadgetItems(#Listview_0)-1
          If glType = #PB_EventType_LeftClick
            DB_UpdateContact(GetGadgetState(#Listview_0),1)
            MessageRequester("Notysoft Photos Modèles - Gestion de Contacts - ","Vos contacts sont à jour !",64)
          EndIf
        EndIf
        ;}
       
      Case #Button_3 ;{ Supprimer
        If GetGadgetState(#Listview_0) >= 0 And GetGadgetState(#Listview_0) <= CountGadgetItems(#Listview_0)-1
          If glType = #PB_EventType_LeftClick
            If MessageRequester("Notysoft Photos Modèles - Gestion de Contacts", "Voulez vous vraiment supprimer le contact courant "+Chr(34)+GetGadgetItemText(#Listview_0, GetGadgetState(#Listview_0))+Chr(34)+" ?", #PB_MessageRequester_YesNo) = #PB_MessageRequester_Yes
              DB_DeleteContact(GetGadgetState(#Listview_0))
            EndIf
          EndIf
        EndIf
        ;}
      Case #Button_4 ;{ Parcourir
        Define.s psFileImage
        Define.l plFileImage
       
        ; Ouvre une boîte de dialogue standard pour choisir une image
        psFileImage = OpenFileRequester("Choisissez une image à charger", "", "Fichiers Images|*.png;*.bmp;*.jpg;*.jpeg|Tous les fichiers (*.*)|*.*", 0)
        If psFileImage
          ; Charge une image
          plFileImage = LoadImage(#PB_Any, psFileImage)
          If plFileImage
            ; Redimensionne l'image à la taille de l'ImageGadget            
            ResizeImage(plFileImage, 290, 333)
            ; Change l'image affichée par l' ImageGadget
            SetGadgetState(#Image_0, ImageID(plFileImage))
            ; Libère l'image
            FreeImage(plFileImage)
            ; Charge l'image dans la zone mémoire globale dédiée 'glImageMemory'
            plFileImage = OpenFile(#PB_Any, psFileImage)
            If plFileImage
              glImageMemory = AllocateMemory(Lof(plFileImage))
              If glImageMemory
                ReadData(plFileImage, glImageMemory, Lof(plFileImage))
              EndIf
              CloseFile(plFileImage)
            EndIf
          EndIf
        EndIf
        ;}
        
      Case #Button_5 ; {Fenêtre Facture
        OpenEditionFacture()  
        
      Case #Button_6 ; {Fenêtre Contrat
        OpenEditionContrat()  
        
      Case #Button_7 ; {Fenêtre Seance
        OpenEditionSeance()          
        
      Case #Button_8 ; {Mode Factures
        ModeListeview = 1
        If GetGadgetState(#Listview_0) >= 0 And GetGadgetState(#Listview_0) <= CountGadgetItems(#Listview_0)-1
          If glType = #PB_EventType_LeftClick
            DB_UpdateContact(GetGadgetState(#Listview_0),1)            
          EndIf
        EndIf;}
        
      Case #Button_9 ; {Mode Prénoms
        ModeListeview = 2
        If GetGadgetState(#Listview_0) >= 0 And GetGadgetState(#Listview_0) <= CountGadgetItems(#Listview_0)-1
          If glType = #PB_EventType_LeftClick            
            DB_UpdateContact(GetGadgetState(#Listview_0),2)           
          EndIf
        EndIf;}       
      
      Case #Button_10 ; Lance l'Agenda
        OpenAgenda()
       
      Case #Button_11 ; Lance la calculatrice
        ExecCalc()        
        
      Case #Button_12 ; lance A_Propos        
        ;OpenInfos("A Propos","Notysoft Photos Modèles - 2016 - 2017","Créer simplement sa base de données modèles et photographes.","","","")
        OpenAPropos()  
      
      Case #Button_13 ; Parcourir Signiature
        Define.s psFileImage2
        Define.l plFileImage2
        ;Ouvre une boîte de dialogue standard pour choisir une image
        psFileImage2 = OpenFileRequester("Choisissez une image à charger", "", "Fichiers Images|*.png;*.bmp;*.jpg;*.jpeg|Tous les fichiers (*.*)|*.*", 0)
        If psFileImage2
          ;Charge une image
          plFileImage2 = LoadImage(#PB_Any, psFileImage2)
          If plFileImage2
            ;Redimensionne l'image à la taille de l'ImageGadget
            ResizeImage(plFileImage2, 116, 55)
            ;Change l'image affichée par l' ImageGadget
            SetGadgetState(#Image_1 , ImageID(plFileImage2))
            ;Libère l'image
            FreeImage(plFileImage2)
            ;Charge l'image dans la zone mémoire globale dédiée 'glImageMemory'
            plFileImage2 = OpenFile(#PB_Any, psFileImage2)
            If plFileImage2
              glImageMemory2 = AllocateMemory(Lof(plFileImage2))
              If glImageMemory2
                ReadData(plFileImage2, glImageMemory2, Lof(plFileImage2))
              EndIf
              CloseFile(plFileImage2)
            EndIf
          EndIf
        EndIf
        ;}
        
       Case #BoutonFacture
         CloseWindow(#FenetreFacture)        
         
       Case #BoutonContrat
        CloseWindow(#FenetreContrat)        
        
      Case #BoutonSeance
       CloseWindow(#FenetreSeance)              
       
       Case #BoutonAgenda
        CloseWindow(#FenetreAgenda)
        
      Case #BoutonAPropos
       CloseWindow(#FenetreApropos) 
       
    EndSelect
  EndIf
 
Until glEvent = #PB_Event_CloseWindow

End
Avatar de l’utilisateur
Fig
Messages : 1176
Inscription : jeu. 14/oct./2004 19:48

Re: Problèmes SQLite - "Values et colomns"

Message par Fig »

Une fois que tu as fermé la fenetre dans laquelle était ton stringgadget(#StringFacture_0) avec closewindow(), tu n'as plus accès à cette information avec getgadgettext(#StringFacture_0), le gadget est supprimé en même temps que la fenetre.
Cela ne pourrait il pas être ça le problème ? :?:
Il y a deux méthodes pour écrire des programmes sans erreurs. Mais il n’y a que la troisième qui marche.
Version de PB : 6.00LTS - 64 bits
PCPixMusic
Messages : 106
Inscription : ven. 06/janv./2017 9:50

Re: Problèmes SQLite - "Values et colomns"

Message par PCPixMusic »

Bonsoir Fig, merci d'avoir pris pris le temps de regarder mon code.

Oui tout fonctionnait dans mon ancienne version de code, quand j'avais tous les StringGadget sur un même plan.

Depuis que j'ai mis dans des fenêtres Facture, Contrat et Séance, ça ne marche plus.

Comment faire pour que les #StringXXXXXXXXXXX etc, ne soit plus perdu une fois la fenêtre fermée ?

J'ai supprimé la croix de fermeture et remplacé par un bouton, car je n'arrivais pas à faire la bonne boucle et la fermeture de la croix entraînait aussi la fermeture de tout le logiciel.
Avatar de l’utilisateur
Fig
Messages : 1176
Inscription : jeu. 14/oct./2004 19:48

Re: Problèmes SQLite - "Values et colomns"

Message par Fig »

Je n'utilise jamais la gui intégrée donc je ne suis pas le mieux placé pour te dire comment architecturer ton code.
Néanmoins, si tu récupère les valeurs des gadgets qui intéressent dans une variable, juste avant de fermer la fenêtre, ça devrait fonctionner... Genre:

Code : Tout sélectionner

       Case #BoutonFacture
       TextGadgetFacture_0.s=GetGadgetText(#StringFacture_0)
         CloseWindow(#FenetreFacture) 
et au lieu de tester Getgadgettext(#StringFacture_0) dans le reste de ton code, tu te sert de la variable TextGadgetFacture_0
Ca devrait marcher mais je ne sais pas te dire si c'est ce qu'il y a de plus élégant. :wink:
Il y a deux méthodes pour écrire des programmes sans erreurs. Mais il n’y a que la troisième qui marche.
Version de PB : 6.00LTS - 64 bits
PCPixMusic
Messages : 106
Inscription : ven. 06/janv./2017 9:50

Re: Problèmes SQLite - "Values et colomns"

Message par PCPixMusic »

Merci beaucoup,

Que veux tu dire par la GUI intégrée ? Tu parles de OpenWindow ? Tu écris tes propres fenêtre et interface graphique ?

Cette nuit, j'avais aussi pensé à écrire un truc comme ça.

J'ai fait l'expérience, mais j'ai beau avoir changé les variables à la place des constantes, dans les différentes procedures,ça ne veut pas enregistré ces enregistrements-là, dans la base de données et ça pose beaucoup de problèmes pour également mettre les etats des checkbox.

Le plus simple serait de faire quelque chose comme ça, mais c'est interdit par le langage :

Code : Tout sélectionner

Case #BoutonFacture
#StringFacture_0_Save=#StringFacture_0
CloseWindow(#FenetreFacture)
#StringFacture_0=#StringFacture_0_Save
Ou alors :

Code : Tout sélectionner

Case #BoutonFacture
        StringFacture_0=GetGadgetText(#StringFacture_0)
        CloseWindow(#FenetreFacture)*
        SetGadgetText(#StringContact_0,StringFacture_0)
Dernière modification par PCPixMusic le lun. 23/janv./2017 10:24, modifié 2 fois.
Avatar de l’utilisateur
Fig
Messages : 1176
Inscription : jeu. 14/oct./2004 19:48

Re: Problèmes SQLite - "Values et colomns"

Message par Fig »

Ce n'est pas interdit par le langage, c'est juste incorrecte, ta constante # est un indice, pas la valeur elle-même.
Je vois que tu es plus novice que je ne pensais. Je vais regarder pour que ça fonctionne...

En fait, je ne comprends pas le mode fonctionnement que tu attends de tout ça... J'ai besoin d'une explication là...
Pour chaque fiche qui contient donc: [Prenom, nom etc... Loisirs]
Tu veux pouvoir ajouter plusieurs photos, plusieurs facture client...
Tu peux détailler ça stp ?
Dernière modification par Fig le lun. 23/janv./2017 10:36, modifié 1 fois.
Il y a deux méthodes pour écrire des programmes sans erreurs. Mais il n’y a que la troisième qui marche.
Version de PB : 6.00LTS - 64 bits
PCPixMusic
Messages : 106
Inscription : ven. 06/janv./2017 9:50

Re: Problèmes SQLite - "Values et colomns"

Message par PCPixMusic »

Merci beaucoup, oui j'apprends, je viens de faire une maj de mon précédent post.

Voici mon dernier code partie 1:

Code : Tout sélectionner

EnableExplicit

Enumeration
  #Window_0
  #Listview_0
  #Button_0
  #Button_1
  #Button_2
  #Button_3
  #Button_4
  #Button_5
  #Button_6
  #Button_7
  #Button_8
  #Button_9
  #Button_10
  #Button_11
  #Button_12
  #Button_13  
  #BoutonFacture
  #BoutonContrat
  #BoutonSeance
  #BoutonAgenda
  #Agenda
  #BoutonAPropos 
  #Image_0
  #Image_1   
  #Text_Contact_0
  #Text_Contact_1
  #Text_Contact_2
  #Text_Contact_3
  #Text_Contact_4
  #Text_Contact_5
  #Text_Contact_6
  #Text_Contact_7
  #Text_Contact_8
  #Text_Contact_9
  #Text_Contact_10
  #Text_Contact_11
  #Text_Contact_12
  #Text_Contact_13
  #Text_Contact_14
  #Text_Contact_15
  #Text_Contact_16
  #Text_Contact_17
  #Text_Contact_18
  #Text_Contact_19
  #Text_Contact_20 
  #Text_Contact_21  
  #StringContact_0
  #StringContact_1
  #StringContact_2
  #StringContact_3
  #StringContact_4
  #StringContact_5
  #StringContact_6
  #StringContact_7
  #StringContact_8
  #StringContact_9
  #StringContact_10
  #StringContact_11
  #StringContact_12
  #StringContact_13
  #StringContact_14
  #StringContact_15
  #StringContact_16
  #StringContact_17
  #StringContact_18
  #StringContact_19
  #StringContact_20
  #StringContact_21
  #StringFacture_0
  #StringFacture_1
  #StringFacture_2
  #StringFacture_3
  #StringFacture_4
  #StringFacture_5
  #StringFacture_6
  #StringFacture_7
  #StringFacture_8
  #StringFacture_9    
  #StringContrat_0
  #StringContrat_1
  #StringContrat_2
  #StringContrat_3
  #StringContrat_4
  #StringContrat_5
  #StringContrat_6    
  #StringSeance_0
  #StringSeance_1
  #StringSeance_2
  #StringSeance_3
  #StringSeance_4
  #StringSeance_5
  #StringSeance_6
  #StringSeance_7
  #StringSeance_8
  #StringSeance_9    
  #CheckBox_0
  #CheckBox_1
  #CheckBox_2
  #CheckBox_3
  #CheckBox_4
  #CheckBox_5
  #CheckBox_6
  #CheckBox_7
  #CheckBox_8
  #CheckBox_9
  #CheckBox_10          
  #CheckBox_11
  #CheckBox_12
  #CheckBox_13
  #CheckBox_14
  #CheckBox_15
  #CheckBox_16
  #CheckBox_17
  #CheckBox_18
  #CheckBox_19  
  #FenetreAgenda
  #FenetreApropos
  #FenetreFacture
  #FenetreContrat
  #FenetreSeance
  #TextAgenda
  #TextAPropos1
  #TextAPropos2
  #TextAPropos3
  #TextAPropos4
  #TextAPropos5    
  #TextFacture_0
  #TextFacture_1
  #TextFacture_2
  #TextFacture_3
  #TextFacture_4
  #TextFacture_5
  #TextFacture_6
  #TextFacture_7
  #TextFacture_8
  #TextFacture_9
  #TextFacture_10    
  #TextContrat_0
  #TextContrat_1
  #TextContrat_2
  #TextContrat_3
  #TextContrat_4
  #TextContrat_5
  #TextContrat_6
  #TextContrat_7
  #TextContrat_8
  #TextContrat_9
  #TextContrat_10    
  #TextTitreContrat_0
  #TextTitreContrat_1
  #TextTitreContrat_2
  #TextTitreContrat_3
  #TextTitreContrat_4
  #TextTitreContrat_5  
  #TextSeance_0
  #TextSeance_1
  #TextSeance_2
  #TextSeance_3
  #TextSeance_4
  #TextSeance_5
  #TextSeance_6
  #TextSeance_7
  #TextTitreSeance_0
  #TextTitreSeance_1
  #TextTitreSeance_2
  #TextTitreSeance_3
  #TextTitreSeance_4
  #TextTitreSeance_5 
  
EndEnumeration

Global glDBSQLite.l
Global glListviewItemSelected.l = -1
Global glImageMemory.l, glImageMemory2.l
Global glEvent, glGadget, glType

Global Modification.D,ModeListeview.D
Global StringFacture_0.S,StringFacture_1.S,StringFacture_2.S,StringFacture_3.S,StringFacture_4.S
Global StringFacture_5.S,StringFacture_6.S,StringFacture_7.S,StringFacture_8.S,StringFacture_9.S
Global StringContrat_0.S,StringContrat_1.S,StringContrat_2.S,StringContrat_3.S,StringContrat_4.S
Global StringContrat_5.S,StringContrat_6.S,StringContrat_7.S,StringContrat_8.S,StringContrat_9.S
Global StringSeance_0.S,StringSeance_1.S,StringSeance_2.S,StringSeance_3.S,StringSeance_4.S
Global StringSeance_5.S,StringSeance_6.S,StringSeance_7.S,StringSeance_8.S,StringSeance_9.S

UseJPEG2000ImageDecoder()
UseJPEG2000ImageEncoder()
UseJPEGImageDecoder()
UseJPEGImageEncoder()
UsePNGImageDecoder()
UsePNGImageEncoder()

Declare Main_WindowOpen()
Declare OpenEditionContrat()
Declare OpenEditionFacture()
Declare OpenEditionSeance()
Declare DB_Init()
Declare Reset()
   

Procedure InitGadget()
  
  Protected TestGadget.i
  Protected TestGadgetCheckGadget.i
  Protected TestImage.i 
  
 For TestGadget = #Text_Contact_0 To #Text_Contact_21
    StringGadget(TestGadget,0,0,0,0,"")
  Next    
  
  For TestGadget = #TextFacture_0 To #TextFacture_9    
    TextGadget(TestGadget,0,0,0,0,"")
  Next  
  
  For TestGadget = #TextContrat_0 To #TextContrat_6    
    TextGadget(TestGadget,0,0,0,0,"")
  Next  
  
  For TestGadget = #TextSeance_0 To #TextSeance_6    
    TextGadget(TestGadget,0,0,0,0,"")
  Next  

  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  For TestGadget = #StringContact_0 To #StringContact_21        
    StringGadget(TestGadget,0,0,0,0,"")
  Next       
  
  For TestGadget = #StringFacture_0 To #StringFacture_9    
    StringGadget(TestGadget,0,0,0,0,"")
  Next  

  For TestGadget = #StringContrat_0 To #StringContrat_6        
    StringGadget(TestGadget,0,0,0,0,"")
  Next
  
  For TestGadget = #StringSeance_0 To #StringSeance_6    
   StringGadget(TestGadget,0,0,0,0,"")
 Next 
 
  For TestGadgetCheckGadget = #CheckBox_0 To #CheckBox_19    
    TextGadget(TestGadgetCheckGadget,0,0,0,0,"")
  Next 
EndProcedure

Procedure Main_WindowOpen()   
  Protected iColorContacts.I
  
  If OpenWindow(#Window_0, 0,0,1295,356, "Notysoft Ordinem - Gestion de Contacts",  #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_BorderLess)
    
    InitGadget()
       
    ButtonGadget(#Button_0, 10,  10, 120,26,"Nouveau")
    ButtonGadget(#Button_1, 10,  36, 120,26,"Enregistrer")
    ButtonGadget(#Button_2, 10,  62, 120,26,"Mettre à jour la base")
    ButtonGadget(#Button_3, 10,  88,120,26,"Supprimer une fiche")
    ButtonGadget(#Button_4, 10,  114,120,26,"Ajouter une photo")
    ButtonGadget(#Button_5, 10,  140,120,26,"Facture client")
    ButtonGadget(#Button_6, 10,  166,120,26,"Contrat photo")
    ButtonGadget(#Button_7, 10,  192,120,26,"Séance photo")
    ButtonGadget(#Button_8, 10,  218,120,26,"Mode Factures")    
    ButtonGadget(#Button_9, 10,  244,120,26,"Mode Prénoms")      
    ButtonGadget(#Button_10,10,  270,120,26,"Agenda")    
    ButtonGadget(#Button_11,10,  296,120,26,"Calculatrice")    
    ButtonGadget(#Button_12,10,  322,120,26,"A Propos")
    
    ListViewGadget(#Listview_0, 140, 10,374,337)
    ;ImageGadget(#Image_0, 980, 10, 244, 284, 00, #PB_Image_Border)
    ImageGadget(#Image_0, 990, 10, 294, 334, 00, #PB_Image_Border)
    
    ImageGadget(#Image_1, 0, 0, 0, 0, 00, #PB_Image_Border)
           
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
    TextGadget(#Text_Contact_0,  530,16, 110, 20, "Prénom      ")
    TextGadget(#Text_Contact_1,  530,47, 110, 20, "Nom         ")
    TextGadget(#Text_Contact_2,  530,78, 110, 20, "Profession  ")
    TextGadget(#Text_Contact_3,  530,109, 110, 20, "Société     ")
    TextGadget(#Text_Contact_4,  530,140, 110, 20, "Adresse 1   ")
    TextGadget(#Text_Contact_5,  530,171, 110, 20, "Adresse 2   ")
    TextGadget(#Text_Contact_6,  530,202, 110, 20, "Adresse 3   ")
    TextGadget(#Text_Contact_7,  530,232, 110, 20, "Code Postal ")
    TextGadget(#Text_Contact_8,  530,268, 110, 20, "Ville       ")
    TextGadget(#Text_Contact_9,  530,299, 110, 20, "Pays        ")    
    TextGadget(#Text_Contact_10, 530,330, 110, 20, "Téléphone   ")
   
    TextGadget(#Text_Contact_11, 760, 16,110, 20, "Fax         ")
    TextGadget(#Text_Contact_12, 760, 47,110, 20, "Mail        ")
    TextGadget(#Text_Contact_13, 760, 78,110, 20, "Naissance   ")
    TextGadget(#Text_Contact_14, 760, 109,110, 20, "Sexe        ")
    TextGadget(#Text_Contact_15, 760, 140,110, 20, "Cheveux     ")
    TextGadget(#Text_Contact_16, 760, 171, 110, 20, "Yeux        ")
    TextGadget(#Text_Contact_17, 760, 202, 110, 20, "Peau        ")
    TextGadget(#Text_Contact_18, 760, 232, 110, 20, "Taille      ")
    TextGadget(#Text_Contact_19, 760, 268, 110, 20, "Poids      ")
    TextGadget(#Text_Contact_20, 760, 299, 110, 20, "Hanches")    
    TextGadget(#Text_Contact_21, 760, 330, 110, 20, "Loisir(s)")     
    
    StringGadget(#StringContact_0,  590, 12, 150, 20, "")      
    StringGadget(#StringContact_1,  590, 43, 150, 20, "")    
    StringGadget(#StringContact_2,  590, 74, 150, 20, "")
    StringGadget(#StringContact_3,  590, 105, 150, 20, "")       
    StringGadget(#StringContact_4,  590, 136, 150, 20, "")        
    StringGadget(#StringContact_5,  590, 167, 150, 20, "")    
    StringGadget(#StringContact_6,  590, 198, 150, 20, "")    
    StringGadget(#StringContact_7, 590, 229, 150, 20, "")  
    StringGadget(#StringContact_8, 590, 264, 150, 20, "")
    StringGadget(#StringContact_9, 590, 295, 150, 20, "")
    StringGadget(#StringContact_10, 590, 326, 150, 20, "")
    StringGadget(#StringContact_11, 820, 12, 150, 20, "")    
    StringGadget(#StringContact_12, 820, 43, 150, 20, "")    
    StringGadget(#StringContact_13, 820, 74, 150, 20, "")
    StringGadget(#StringContact_14, 820, 105, 150, 20, "")
    StringGadget(#StringContact_15, 820, 136, 150, 20, "")
    StringGadget(#StringContact_16, 820, 167, 150, 20, "")
    StringGadget(#StringContact_17, 820, 198, 150, 20, "")    
    StringGadget(#StringContact_18, 820, 229, 150, 20, "")
    StringGadget(#StringContact_19, 820, 264, 150, 20, "")   
    StringGadget(#StringContact_20, 820, 295, 150, 20, "")
    StringGadget(#StringContact_21, 820, 326, 150, 20, "")       
   
    For iColorContacts = #StringContact_0 To #StringContact_21   
    SetGadgetColor(iColorContacts, #PB_Gadget_BackColor, RGB(245, 222, 179))
    Next

  EndIf                     
EndProcedure

Procedure OpenEditionFacture()  
  Protected iColorFactures
  
  If OpenWindow(#FenetreFacture,153,40,462,320, "Édition de la facture", #PB_Window_TitleBar | #PB_Window_BorderLess,WindowID(#Window_0))            
    
    TextGadget(#TextFacture_0, 12,  10,100,20, "N°Client")
    TextGadget(#TextFacture_1, 242, 10, 70,20, "N°Facture")   
    TextGadget(#TextFacture_2, 12,  65,200,20, "Désignation prestation(s)")
    TextGadget(#TextFacture_3, 12, 120,50, 20, "Quantité")
    TextGadget(#TextFacture_4, 12, 175,200,20, "Commentaire(s)")
    TextGadget(#TextFacture_5, 12, 230,200,20, "Recommandation(s)")
    TextGadget(#TextFacture_6, 72, 120,80, 20, "Prix unitaire HT")
    TextGadget(#TextFacture_7, 162,120,100,20, "Date de règlement")   
    TextGadget(#TextFacture_8, 272,120,80,50,  "Date exécution")
    TextGadget(#TextFacture_9, 352,120,120,20, "Conditions escompte") 
    
     StringGadget(#StringFacture_0, 10, 30, 215, 20, "")
     StringGadget(#StringFacture_1, 240,30, 215, 20, "")
     StringGadget(#StringFacture_2, 10,85,440,20, "")
     StringGadget(#StringFacture_3, 10,140,50, 20, "")
     StringGadget(#StringFacture_4, 70,140,80, 20, "")
     StringGadget(#StringFacture_5, 160,140,100, 20, "")
     StringGadget(#StringFacture_6, 268,140,76,20, "")
     StringGadget(#StringFacture_7, 350,140,100, 20,"")
     StringGadget(#StringFacture_8,  10, 195, 440, 20,"")       
     StringGadget(#StringFacture_9,  10, 250, 440, 20,"")
     
    For iColorFactures = #StringFacture_0 To #StringFacture_9
    SetGadgetColor(iColorFactures, #PB_Gadget_BackColor, RGB(245, 222, 179))
    Next
            
    ButtonGadget(#BoutonFacture,181,280,100,30, "Ok")    
    
  EndIf
EndProcedure

Procedure OpenEditionContrat()  
  Protected iColorContrats
  
  If OpenWindow(#FenetreContrat,153,40,512,350, "Édition du contrat", #PB_Window_TitleBar | #PB_Window_BorderLess,WindowID(#Window_0))               
                
    TextGadget(#TextTitreContrat_0,14,10,200,20,"Edition du Contrat Modèle :")    
    TextGadget(#TextTitreContrat_1,14,100,200,20,"Autorisation modes de diffusion :")
    TextGadget(#TextTitreContrat_2,14,203,200,20,"Conditions financières :")                           
    TextGadget(#TextContrat_0, 14 ,40,100,20,"N°Contrat")
    TextGadget(#TextContrat_1, 124,40,100,20,"Date du shooting")
    TextGadget(#TextContrat_2, 234,40,150,20,"Durée de l'autorisation")
    TextGadget(#TextContrat_3, 394,40,100,20,"Fin de validité")    
    TextGadget(#TextContrat_4, 310,171,100,20,"Autre (Préciser)")    
    
    StringGadget(#StringContrat_0,12,60,100,20, "")      
    StringGadget(#StringContrat_1,122,60,100,20, "")
    StringGadget(#StringContrat_2,232,60,150,20, "")         
    StringGadget(#StringContrat_3,392,60,110,20, "")       
    
    CheckBoxGadget(#CheckBox_0, 16,130,100, 15, "Presse")
    CheckBoxGadget(#CheckBox_1, 16,150,100, 15, "Livre")
    CheckBoxGadget(#CheckBox_2, 16,170,100, 15, "Exposition")
   
    CheckBoxGadget(#CheckBox_5, 160,130,100,15, "Carte postale")
    CheckBoxGadget(#CheckBox_6, 160,150,120,15, "Projection publique")
    CheckBoxGadget(#CheckBox_7, 160,170,60, 15, "Publicité")           
   
    CheckBoxGadget(#CheckBox_4, 310,130,130, 15, "Objets de décoration")
    CheckBoxGadget(#CheckBox_3, 310,150,130, 15, "Publication électronique") 
    
      StringGadget(#StringContrat_4,394,169,110,20, "")    
    
    CheckBoxGadget(#CheckBox_8,  16,233,300, 15, "Autorisation à titre gratuit")
    CheckBoxGadget(#CheckBox_9,  16,253,290, 15, "Autorisation contre tirage : Pourcentage sur les recettes")
   
      TextGadget(#TextContrat_5  ,344,254,12,20,"%")
    StringGadget(#StringContrat_5,305,251,36,20,"")    
    
       TextGadget(#TextContrat_6 ,344,274,12,20,"€")
    StringGadget(#StringContrat_6,305,271,36,20,"")    
    
    For iColorContrats = #StringContrat_0 To #StringContrat_6
      SetGadgetColor(iColorContrats, #PB_Gadget_BackColor, RGB(245, 222, 179))
    Next
   
    CheckBoxGadget(#CheckBox_10, 16,273,280, 15, "Autorisation contre rémunération - Montant fixe départ")   
    
    ButtonGadget(#Button_13, 380,210,120,26,"Ajouter une signature")
       ImageGadget(#Image_1, 380,240, 119,59, 00, #PB_Image_Border)
                     
    ButtonGadget(#BoutonContrat,206,310,100,30,"Ok")       

  EndIf
EndProcedure

Procedure OpenEditionSeance() 
  Protected iColorSeances
  
  If OpenWindow(#FenetreSeance,153,40,502,380, "Édition du déroulement de la séance photo", #PB_Window_TitleBar | #PB_Window_BorderLess,WindowID(#Window_0))   
    
       TextGadget(#TextSeance_0, 10,14,100, 20,"Lieux de la séance")
    StringGadget(#StringSeance_0,115,11,380, 20,"")    
      
         TextGadget(#TextSeance_1,10,38,200,20,"Tenue vestimentaire ")
    StringGadget(#StringSeance_1,115,35,380,20,"")    
    
        TextGadget(#TextSeance_2,10, 62,200, 20,"Les accessoires, etc")
    StringGadget(#StringSeance_2,115,59,380,20,"")    
    
    CheckBoxGadget(#CheckBox_11, 10 ,87 ,70,15,"Sac")
    CheckBoxGadget(#CheckBox_12, 10 ,107 ,70,15,"Chapeau")          
    CheckBoxGadget(#CheckBox_13, 220,87,70,15,"Gants")   
    CheckBoxGadget(#CheckBox_14, 220,107,70,15,"Bijoux")       
    CheckBoxGadget(#CheckBox_15, 430,87,70,15,"Armes")
    CheckBoxGadget(#CheckBox_16, 430,107,70,15,"Cosplay")           
    
        TextGadget(#TextSeance_3,10, 131,200, 20,"Projet de maquillage")
    StringGadget(#StringSeance_3,115,128,380, 20,"")
    
      TextGadget(#TextSeance_4  , 10,155,200, 20,"Projet d'onglerie")
    StringGadget(#StringSeance_4,115,152,380, 20,"")    
    
       TextGadget(#TextSeance_5 ,10 ,179,200, 20,"Projet de coiffure")
    StringGadget(#StringSeance_5,115,176,380, 20,"")    
       
       TextGadget(#TextSeance_6 ,10 ,203,200, 20,"Partenariat(s)")
    StringGadget(#StringSeance_6,115,200,380, 20,"")    
    
    For iColorSeances = #StringSeance_0 To #StringSeance_6
      SetGadgetColor(iColorSeances, #PB_Gadget_BackColor, RGB(245, 222, 179))
    Next
       
    TextGadget(#TextSeance_7,10 ,240,420, 20,"Condition de livraison des photos au format JPG, sous 2à 3 semaines")      
    
    CheckBoxGadget(#CheckBox_17, 10,270,300,15,"Vous recevrez vos photos sur DVD")
    CheckBoxGadget(#CheckBox_18, 10,290,300,15,"Vous recevrez vos photos en téléchargement")
    CheckBoxGadget(#CheckBox_19, 10,310,300,15,"Vous recevrez vos photos en tirages")    
    
    ButtonGadget(#BoutonSeance,206,340,100,30,"Ok")  
  EndIf  
 EndProcedure

Procedure DB_Init()
  Protected plFile.l
  Protected psSQLRequest.s
  UseSQLiteDatabase()
  If FileSize(#PB_Compiler_FilePath+"Ordinem.sqlite") < 0
    plFile = CreateFile(#PB_Any, #PB_Compiler_FilePath+"Ordinem.sqlite")
    If plFile
      CloseFile(plFile)
    EndIf
  EndIf
 
  glDBSQLite = OpenDatabase(#PB_Any, #PB_Compiler_FilePath+"Ordinem.sqlite", "", "", #PB_Database_SQLite)
  If glDBSQLite = 0
    MessageRequester("Notysoft Ordinem - Gestion de Contacts", DatabaseError())
    End
  ElseIf plFile
    psSQLRequest = "CREATE TABLE IF NOT EXISTS contacts ("
    psSQLRequest + "id_contact INTEGER PRIMARY KEY AUTOINCREMENT Not NULL, " 
    
    psSQLRequest + "contact_prenom TEXT Not NULL, "
    psSQLRequest + "contact_nom TEXT Not NULL, "
    psSQLRequest + "contact_job TEXT, "
    psSQLRequest + "contact_company TEXT, "
    psSQLRequest + "contact_address_1 TEXT, "
    psSQLRequest + "contact_address_2 TEXT, "
    psSQLRequest + "contact_address_3 TEXT, "
    psSQLRequest + "contact_postalcode TEXT, "
    psSQLRequest + "contact_city TEXT, "
    psSQLRequest + "contact_country TEXT, "
    psSQLRequest + "contact_phone TEXT, "
    psSQLRequest + "contact_fax TEXT, "
    psSQLRequest + "contact_mail TEXT, "
    psSQLRequest + "contact_date_de_naissance TEXT, "
    psSQLRequest + "contact_sexe TEXT, "
    psSQLRequest + "contact_cheveux TEXT, "
    psSQLRequest + "contact_yeux TEXT, "
    psSQLRequest + "contact_peau TEXT, "
    psSQLRequest + "contact_taille TEXT, "
    psSQLRequest + "contact_poids TEXT, "
    psSQLRequest + "contact_hanches TEXT, "
    psSQLRequest + "contact_loisir TEXT, "    
    
    psSQLRequest + "facture_Numero_Client TEXT, "
    psSQLRequest + "facture_Numero_Facture TEXT, "
    psSQLRequest + "facture_prestation TEXT, "
    psSQLRequest + "facture_quantite TEXT, "
    psSQLRequest + "facture_commentaires TEXT,"
    psSQLRequest + "facture_recommandations TEXT, "    
    psSQLRequest + "facture_prix_uht TEXT, "
    psSQLRequest + "facture_date_reglement TEXT, "
    psSQLRequest + "facture_date_execution TEXT, "
    psSQLRequest + "facture_conditions_escompte TEXT, "
     
    psSQLRequest + "contrat_Numero_Contrat TEXT, "
    psSQLRequest + "contrat_shooting TEXT, "
    psSQLRequest + "contrat_autorisation TEXT, "   
    psSQLRequest + "contrat_fin_validite TEXT, "
    psSQLRequest + "contrat_autres TEXT, "
    psSQLRequest + "contrat_pourcentage TEXT, "
    psSQLRequest + "contrat_euros TEXT, "  
    
    psSQLRequest + "Seance_lieux TEXT, "   
    psSQLRequest + "Seance_tenues TEXT, "   
    psSQLRequest + "Seance_accessoires TEXT, "   
    psSQLRequest + "Seance_makeup TEXT, "   
    psSQLRequest + "Seance_onglerie TEXT, "   
    psSQLRequest + "Seance_coiffure TEXT, "   
    psSQLRequest + "Seance_partenariats TEXT, " 
    
    psSQLRequest + "Etat_CheckBox_0 INTEGER, "
    psSQLRequest + "Etat_CheckBox_1 INTEGER, "
    psSQLRequest + "Etat_CheckBox_2 INTEGER, "
    psSQLRequest + "Etat_CheckBox_3 INTEGER, "
    psSQLRequest + "Etat_CheckBox_4 INTEGER, "
    psSQLRequest + "Etat_CheckBox_5 INTEGER, "
    psSQLRequest + "Etat_CheckBox_6 INTEGER, "
    psSQLRequest + "Etat_CheckBox_7 INTEGER, "
    psSQLRequest + "Etat_CheckBox_8 INTEGER, "
    psSQLRequest + "Etat_CheckBox_9 INTEGER, "
    psSQLRequest + "Etat_CheckBox_10 INTEGER, "
    psSQLRequest + "Etat_CheckBox_11 INTEGER, "
    psSQLRequest + "Etat_CheckBox_12 INTEGER, "
    psSQLRequest + "Etat_CheckBox_13 INTEGER, "
    psSQLRequest + "Etat_CheckBox_14 INTEGER, "
    psSQLRequest + "Etat_CheckBox_15 INTEGER, "
    psSQLRequest + "Etat_CheckBox_16 INTEGER, "
    psSQLRequest + "Etat_CheckBox_17 INTEGER, "
    psSQLRequest + "Etat_CheckBox_18 INTEGER, "
    psSQLRequest + "Etat_CheckBox_19 INTEGER, "    
    psSQLRequest + "contact_photo BLOB, "
    psSQLRequest + "contact_photo_s BLOB, "
    psSQLRequest + "contact_photo_size INTEGER,"
    psSQLRequest + "contact_photo_s_size INTEGER"
    psSQLRequest + ")"
    ; Debug psSQLRequest
    If DatabaseUpdate(glDBSQLite, psSQLRequest) = 0
      MessageRequester("Notysoft Ordinem - Gestion de Contacts - DB_Init()", DatabaseError())
    EndIf
  EndIf
  
  If DatabaseQuery(glDBSQLite, "SELECT rowid, facture_Numero_Facture,  contact_prenom, contact_nom, contact_job FROM contacts") <> 0 
    While NextDatabaseRow(glDBSQLite)   
      AddGadgetItem(#Listview_0, CountGadgetItems(#Listview_0), "Facture N°" +GetDatabaseString(glDBSQLite, 1) + " " +GetDatabaseString(glDBSQLite, 2) + " " + GetDatabaseString(glDBSQLite, 3) + " " + GetDatabaseString(glDBSQLite, 4))      
      SetGadgetItemData(#Listview_0, CountGadgetItems(#Listview_0)-1, GetDatabaseLong(glDBSQLite, 0))
    Wend
    FinishDatabaseQuery(glDBSQLite)
  EndIf
  
EndProcedure

;Nouveau client
Procedure Reset() 
  Protected Gadget.i
  Protected CheckGadget.i  
 
  For Gadget = #StringContact_0 To #StringContact_21    
    SetGadgetText(Gadget,"")
  Next
  
 For Gadget = #StringFacture_0 To #StringFacture_9
   SetGadgetText(Gadget,"")
 Next
 
  
  For Gadget = #StringContrat_0 To #StringContrat_6    
    SetGadgetText(Gadget,"")
  Next  
  
  For Gadget = #StringSeance_0 To #StringSeance_6    
   SetGadgetText(Gadget,"")
 Next 
 
 For CheckGadget = #CheckBox_0 To #CheckBox_19
    SetGadgetState(CheckGadget, #PB_Checkbox_Unchecked)
  Next   
 
  If glImageMemory
    FreeMemory(glImageMemory)
    glImageMemory = AllocateMemory(1024) 
  EndIf
 
  If glImageMemory2
    FreeMemory(glImageMemory2)
    glImageMemory2 = AllocateMemory(1024) 
  EndIf  
 
  SetGadgetState(#Image_0, 0)
  SetGadgetState(#Image_1, 0)
EndProcedure

Procedure DB_InsertContact()
  ;Passages de contantes en variables
  Protected psSQLRequest.s
  psSQLRequest = "INSERT INTO contacts"
  psSQLRequest + "(contact_prenom, contact_nom, contact_job, contact_company, contact_address_1,contact_address_2,contact_address_3,"
  psSQLRequest + "contact_postalcode, contact_city, contact_country, contact_phone, contact_fax, contact_mail, contact_date_de_naissance,contact_sexe, contact_cheveux,contact_yeux,contact_peau,"
  psSQLRequest + "contact_taille,contact_poids,contact_hanches,contact_loisir,facture_Numero_Client,facture_Numero_Facture,facture_prestation,facture_quantite,facture_commentaires,facture_recommandations,facture_prix_uht,"  
  psSQLRequest + "facture_date_reglement,facture_date_execution,facture_conditions_escompte,contrat_Numero_Contrat,contrat_shooting,contrat_autorisation,contrat_fin_validite,contrat_autres,contrat_pourcentage,"
  psSQLRequest + "contrat_euros,Seance_lieux,Seance_tenues,Seance_accessoires,Seance_makeup,Seance_onglerie,Seance_coiffure,Seance_partenariats,Etat_CheckBox_0,Etat_CheckBox_1,Etat_CheckBox_2,Etat_CheckBox_3,"
  psSQLRequest + "Etat_CheckBox_4,Etat_CheckBox_5,Etat_CheckBox_6,Etat_CheckBox_7,Etat_CheckBox_8,Etat_CheckBox_9,Etat_CheckBox_10,Etat_CheckBox_11,Etat_CheckBox_12,Etat_CheckBox_13,"
  psSQLRequest + "Etat_CheckBox_14,Etat_CheckBox_15,Etat_CheckBox_16,Etat_CheckBox_17,Etat_CheckBox_18,Etat_CheckBox_19,contact_photo,contact_photo_s,contact_photo_size,contact_photo_s_size)" 
  psSQLRequest + "VALUES ("  
    
  psSQLRequest + "'"+GetGadgetText(#StringContact_0)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_1)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_2)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_3)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_4)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_5)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_6)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_7)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_8)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_9)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_10)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_11)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_12)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_13)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_14)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_15)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_16)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_17)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_18)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_19)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_20)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContact_21)+"',"
  
  psSQLRequest + "'"+GetGadgetText(#StringFacture_0)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringFacture_1)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringFacture_2)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringFacture_3)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringFacture_4)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringFacture_5)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringFacture_6)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringFacture_7)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringFacture_8)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringFacture_9)+"',"
  
  psSQLRequest + "'"+GetGadgetText(#StringContrat_0)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContrat_1)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContrat_2)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContrat_3)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContrat_4)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContrat_5)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringContrat_6)+"',"
  
  psSQLRequest + "'"+GetGadgetText(#StringSeance_0)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringSeance_1)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringSeance_2)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringSeance_3)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringSeance_4)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringSeance_5)+"',"
  psSQLRequest + "'"+GetGadgetText(#StringSeance_6)+"',"
  
  psSQLRequest + "'"+GetGadgetState(#CheckBox_0)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_1)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_2)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_3)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_4)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_5)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_6)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_7)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_8)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_9)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_10)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_11)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_12)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_13)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_14)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_15)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_16)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_17)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_18)+"',"
  psSQLRequest + "'"+GetGadgetState(#CheckBox_19)+"',"
  psSQLRequest + "?,"
  psSQLRequest + "?,"
 
  If glImageMemory
    psSQLRequest + Str(MemorySize(glImageMemory)) + ","
  Else
    psSQLRequest + "0" + ","
  EndIf
 
  If glImageMemory2
    psSQLRequest + Str(MemorySize(glImageMemory2))
  Else
    psSQLRequest + "1"
  EndIf
 
  psSQLRequest + ")"
 
  If glImageMemory
    SetDatabaseBlob(glDBSQLite, 0, glImageMemory, MemorySize(glImageMemory)) 
  Else
    ReplaceString(psSQLRequest, "?", "'0'") 
  EndIf 
 
  If glImageMemory2   
    SetDatabaseBlob(glDBSQLite, 1, glImageMemory2, MemorySize(glImageMemory2))
  Else 
    ReplaceString(psSQLRequest, "?", "'1'")
  EndIf 
 
  If DatabaseUpdate(glDBSQLite, psSQLRequest) = 0
    MessageRequester("Notysoft Ordinem - Gestion de Contacts - DB_InsertContact()", DatabaseError())
  EndIf
   
  ; Ajoute le dernier element de la base dans la listeview
  ;Récupération de l'identifiant automatique du dernier enregistrement
  ;Mise en oeuvre de last_insert_rowid()
  psSQLRequest = "select last_insert_rowid() from contacts"
  If DatabaseQuery(glDBSQLite, psSQLRequest)   
    NextDatabaseRow(glDBSQLite)
    AddGadgetItem(#Listview_0, CountGadgetItems(#Listview_0), "Facture N°" + GetGadgetText(#StringFacture_0) + " " +GetGadgetText(#StringContact_0) + " " + GetGadgetText(#StringContact_1) + " " + GetGadgetText(#StringContact_2))
    SetGadgetItemData(#Listview_0, CountGadgetItems(#Listview_0)-1, GetDatabaseLong(glDBSQLite, 0))   
    SetGadgetState(#Listview_0, CountGadgetItems(#Listview_0)-1)
  Else
    MessageRequester("Notysoft Ordinem - Gestion de Contacts - DB_InsertContact", DatabaseError())
  EndIf
EndProcedure

Procedure DB_SelectContact(GadgetItem.l)
  Protected psSQLRequest.s
  Protected plFileImageSize.l
  Protected plFileImage.l
 
  Protected plFileImageSize2.l
  Protected plFileImage2.l
 
  Reset()
 
  psSQLRequest = "SELECT * FROM contacts WHERE rowid=" + Str(GetGadgetItemData(#Listview_0, GadgetItem))
  ;Debug psSQLRequest
  If DatabaseQuery(glDBSQLite, psSQLRequest) <> 0
    While NextDatabaseRow(glDBSQLite)
      
      SetGadgetText(#StringContact_0,GetDatabaseString(glDBSQLite,  1))
      SetGadgetText(#StringContact_1,GetDatabaseString(glDBSQLite,  2))
      SetGadgetText(#StringContact_2,GetDatabaseString(glDBSQLite,  3))
      SetGadgetText(#StringContact_3,GetDatabaseString(glDBSQLite,  4))
      SetGadgetText(#StringContact_4,GetDatabaseString(glDBSQLite,  5))
      SetGadgetText(#StringContact_5,GetDatabaseString(glDBSQLite,  6))
      SetGadgetText(#StringContact_6,GetDatabaseString(glDBSQLite,  7))
      SetGadgetText(#StringContact_7,GetDatabaseString(glDBSQLite,  8))
      SetGadgetText(#StringContact_8,GetDatabaseString(glDBSQLite,  9))
      SetGadgetText(#StringContact_9,GetDatabaseString(glDBSQLite,  10))
      SetGadgetText(#StringContact_10,GetDatabaseString(glDBSQLite, 11))   
      SetGadgetText(#StringContact_11,GetDatabaseString(glDBSQLite, 12))   
      SetGadgetText(#StringContact_12,GetDatabaseString(glDBSQLite, 13))   
      SetGadgetText(#StringContact_13,GetDatabaseString(glDBSQLite, 14))   
      SetGadgetText(#StringContact_14,GetDatabaseString(glDBSQLite, 15))   
      SetGadgetText(#StringContact_15,GetDatabaseString(glDBSQLite, 16))   
      SetGadgetText(#StringContact_16,GetDatabaseString(glDBSQLite, 17))   
      SetGadgetText(#StringContact_17,GetDatabaseString(glDBSQLite, 18))   
      SetGadgetText(#StringContact_18,GetDatabaseString(glDBSQLite, 19))   
      SetGadgetText(#StringContact_19,GetDatabaseString(glDBSQLite, 20))   
      SetGadgetText(#StringContact_20,GetDatabaseString(glDBSQLite, 21))
      SetGadgetText(#StringContact_21,GetDatabaseString(glDBSQLite, 22))
      
      SetGadgetText(#StringFacture_0, GetDatabaseString(glDBSQLite, 23))
      SetGadgetText(#StringFacture_1, GetDatabaseString(glDBSQLite, 24))
      SetGadgetText(#StringFacture_2, GetDatabaseString(glDBSQLite, 25))
      SetGadgetText(#StringFacture_3, GetDatabaseString(glDBSQLite, 26))
      SetGadgetText(#StringFacture_4, GetDatabaseString(glDBSQLite, 27))
      SetGadgetText(#StringFacture_5, GetDatabaseString(glDBSQLite, 28))
      SetGadgetText(#StringFacture_6, GetDatabaseString(glDBSQLite, 29))
      SetGadgetText(#StringFacture_7, GetDatabaseString(glDBSQLite, 30))
      SetGadgetText(#StringFacture_8, GetDatabaseString(glDBSQLite, 31))
      SetGadgetText(#StringFacture_9, GetDatabaseString(glDBSQLite, 32))
            
      SetGadgetText(#StringContrat_0,GetDatabaseString(glDBSQLite, 33)) 
      SetGadgetText(#StringContrat_1,GetDatabaseString(glDBSQLite, 34)) 
      SetGadgetText(#StringContrat_2,GetDatabaseString(glDBSQLite, 35))   
      SetGadgetText(#StringContrat_3,GetDatabaseString(glDBSQLite, 36))   
      SetGadgetText(#StringContrat_4,GetDatabaseString(glDBSQLite, 37)) 
      SetGadgetText(#StringContrat_5,GetDatabaseString(glDBSQLite, 38)) 
      SetGadgetText(#StringContrat_6,GetDatabaseString(glDBSQLite, 39)) 
      
      SetGadgetText(#StringSeance_0,GetDatabaseString(glDBSQLite, 40)) 
      SetGadgetText(#StringSeance_1,GetDatabaseString(glDBSQLite, 41)) 
      SetGadgetText(#StringSeance_2,GetDatabaseString(glDBSQLite, 42))   
      SetGadgetText(#StringSeance_3,GetDatabaseString(glDBSQLite, 43))   
      SetGadgetText(#StringSeance_4,GetDatabaseString(glDBSQLite, 44)) 
      SetGadgetText(#StringSeance_5,GetDatabaseString(glDBSQLite, 45)) 
      SetGadgetText(#StringSeance_6,GetDatabaseString(glDBSQLite, 46)) 
       
      SetGadgetState(#CheckBox_0,GetDatabaseFloat(glDBSQLite, 47))                 
      SetGadgetState(#CheckBox_1,GetDatabaseFloat(glDBSQLite, 48))
      SetGadgetState(#CheckBox_2,GetDatabaseFloat(glDBSQLite, 49))
      SetGadgetState(#CheckBox_3,GetDatabaseFloat(glDBSQLite, 50))
      SetGadgetState(#CheckBox_4,GetDatabaseFloat(glDBSQLite, 51))
      SetGadgetState(#CheckBox_5,GetDatabaseFloat(glDBSQLite, 52))
      SetGadgetState(#CheckBox_6,GetDatabaseFloat(glDBSQLite, 53))
      SetGadgetState(#CheckBox_7,GetDatabaseFloat(glDBSQLite, 54))
      SetGadgetState(#CheckBox_8,GetDatabaseFloat(glDBSQLite, 55))
      SetGadgetState(#CheckBox_9,GetDatabaseFloat(glDBSQLite, 56))
      SetGadgetState(#CheckBox_10,GetDatabaseFloat(glDBSQLite,57))   
      SetGadgetState(#CheckBox_11,GetDatabaseFloat(glDBSQLite,58))
      SetGadgetState(#CheckBox_12,GetDatabaseFloat(glDBSQLite,59))
      SetGadgetState(#CheckBox_13,GetDatabaseFloat(glDBSQLite,60))
      SetGadgetState(#CheckBox_14,GetDatabaseFloat(glDBSQLite,61))
      SetGadgetState(#CheckBox_15,GetDatabaseFloat(glDBSQLite,62))
      SetGadgetState(#CheckBox_16,GetDatabaseFloat(glDBSQLite,63))
      SetGadgetState(#CheckBox_17,GetDatabaseFloat(glDBSQLite,64))
      SetGadgetState(#CheckBox_18,GetDatabaseFloat(glDBSQLite,65))
      SetGadgetState(#CheckBox_19,GetDatabaseFloat(glDBSQLite,66))      
     
      plFileImageSize = GetDatabaseLong(glDBSQLite, 69)
      If plFileImageSize > 0
        glImageMemory = AllocateMemory(plFileImageSize)
        GetDatabaseBlob(glDBSQLite, 67, glImageMemory, plFileImageSize)
        plFileImage = CatchImage(#PB_Any, glImageMemory, plFileImageSize)
        If plFileImage
          ResizeImage(plFileImage, 290, 333)
          SetGadgetState(#Image_0, ImageID(plFileImage))
          FreeImage(plFileImage)
        EndIf
      Else
        SetGadgetState(#Image_0, 0)
      EndIf
      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
      plFileImageSize2 = GetDatabaseLong(glDBSQLite, 70)
      If plFileImageSize2 > 0
        glImageMemory2 = AllocateMemory(plFileImageSize2)
        GetDatabaseBlob(glDBSQLite, 68, glImageMemory2, plFileImageSize2)
        plFileImage2 = CatchImage(#PB_Any, glImageMemory2, plFileImageSize2)
        If plFileImage2
          ResizeImage(plFileImage2, 116, 55)         
          SetGadgetState(#Image_1, ImageID(plFileImage2))
          FreeImage(plFileImage2)
        EndIf
      Else
        SetGadgetState(#Image_1, 0)
      EndIf
      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
    Wend
    FinishDatabaseQuery(glDBSQLite)
  Else
    MessageRequester("Notysoft Ordinem - Gestion de Contacts - DB_SelectContact", DatabaseError())
  EndIf
EndProcedure

Procedure DB_UpdateContact(GadgetItem,ModeListeview.D)
  Protected psSQLRequest.s
  psSQLRequest = "UPDATE contacts SET "
  
  psSQLRequest + "contact_prenom='"              +GetGadgetText(#StringContact_0)+"', "
  psSQLRequest + "contact_nom='"                 +GetGadgetText(#StringContact_1)+"', "
  psSQLRequest + "contact_job='"                 +GetGadgetText(#StringContact_2)+"', "
  psSQLRequest + "contact_company='"             +GetGadgetText(#StringContact_3)+"', "
  psSQLRequest + "contact_address_1='"           +GetGadgetText(#StringContact_4)+"', "
  psSQLRequest + "contact_address_2='"           +GetGadgetText(#StringContact_5)+"', "
  psSQLRequest + "contact_address_3='"           +GetGadgetText(#StringContact_6)+"', "
  psSQLRequest + "contact_postalcode='"          +GetGadgetText(#StringContact_7)+"', "
  psSQLRequest + "contact_city='"                +GetGadgetText(#StringContact_8)+"', "
  psSQLRequest + "contact_country='"             +GetGadgetText(#StringContact_9)+"', "
  psSQLRequest + "contact_phone='"               +GetGadgetText(#StringContact_10)+"', "
  psSQLRequest + "contact_fax='"                 +GetGadgetText(#StringContact_11)+"', "
  psSQLRequest + "contact_mail='"                +GetGadgetText(#StringContact_12)+"', "
  psSQLRequest + "contact_date_de_naissance='"   +GetGadgetText(#StringContact_13)+"', "
  psSQLRequest + "contact_sexe='"                +GetGadgetText(#StringContact_14)+"', "
  psSQLRequest + "contact_cheveux='"             +GetGadgetText(#StringContact_15)+"',"
  psSQLRequest + "contact_yeux='"                +GetGadgetText(#StringContact_16)+"',"
  psSQLRequest + "contact_peau='"                +GetGadgetText(#StringContact_17)+"',"
  psSQLRequest + "contact_taille='"              +GetGadgetText(#StringContact_18)+"',"
  psSQLRequest + "contact_poids='"               +GetGadgetText(#StringContact_19)+"',"
  psSQLRequest + "contact_hanches='"             +GetGadgetText(#StringContact_20)+"',"
  psSQLRequest + "contact_loisir='"              +GetGadgetText(#StringContact_21)+"',"
  
  psSQLRequest + "facture_Numero_Client='"       +GetGadgetText(#StringFacture_0)+"', "
  psSQLRequest + "facture_Numero_Facture='"      +GetGadgetText(#StringFacture_1)+"', "  
  psSQLRequest + "facture_prestation='"          +GetGadgetText(#StringFacture_2)+"',"
  psSQLRequest + "facture_quantite='"            +GetGadgetText(#StringFacture_3)+"',"
  psSQLRequest + "facture_commentaires='"        +GetGadgetText(#StringFacture_4)+"',"
  psSQLRequest + "facture_recommandations='"     +GetGadgetText(#StringFacture_5)+"',"
  psSQLRequest + "facture_prix_uht='"            +GetGadgetText(#StringFacture_6)+"',"
  psSQLRequest + "facture_date_reglement='"      +GetGadgetText(#StringFacture_7)+"',"
  psSQLRequest + "facture_date_execution='"      +GetGadgetText(#StringFacture_8)+"',"
  psSQLRequest + "facture_conditions_escompte='" +GetGadgetText(#StringFacture_9)+"',"
  
  psSQLRequest + "contrat_Numero_Contrat='"      +GetGadgetText(#StringContrat_0)+"', "
  psSQLRequest + "contrat_shooting='"            +GetGadgetText(#StringContrat_1)+"',"
  psSQLRequest + "contrat_autorisation='"        +GetGadgetText(#StringContrat_2)+"',"
  psSQLRequest + "contrat_fin_validite='"        +GetGadgetText(#StringContrat_3)+"',"
  psSQLRequest + "contrat_autres='"              +GetGadgetText(#StringContrat_4)+"',"
  psSQLRequest + "contrat_pourcentage='"         +GetGadgetText(#StringContrat_5)+"',"   
  psSQLRequest + "contrat_euros='"               +GetGadgetText(#StringContrat_6)+"',"
  
  psSQLRequest + "Seance_lieux='"                +GetGadgetText(#StringSeance_0)+"',"
  psSQLRequest + "Seance_tenues='"               +GetGadgetText(#StringSeance_1)+"',"
  psSQLRequest + "Seance_accessoires='"          +GetGadgetText(#StringSeance_2)+"',"
  psSQLRequest + "Seance_makeup='"               +GetGadgetText(#StringSeance_3)+"',"
  psSQLRequest + "Seance_onglerie='"             +GetGadgetText(#StringSeance_4)+"',"
  psSQLRequest + "Seance_coiffure='"             +GetGadgetText(#StringSeance_5)+"'," 
  psSQLRequest + "Seance_partenariats='"         +GetGadgetText(#StringSeance_6)+"',"     
  
  psSQLRequest + "Etat_CheckBox_0='"             +GetGadgetState(#CheckBox_0)+"',"
  psSQLRequest + "Etat_CheckBox_1='"             +GetGadgetState(#CheckBox_1)+"',"
  psSQLRequest + "Etat_CheckBox_2='"             +GetGadgetState(#CheckBox_2)+"',"
  psSQLRequest + "Etat_CheckBox_3='"             +GetGadgetState(#CheckBox_3)+"',"
  psSQLRequest + "Etat_CheckBox_4='"             +GetGadgetState(#CheckBox_4)+"',"
  psSQLRequest + "Etat_CheckBox_5='"             +GetGadgetState(#CheckBox_5)+"',"
  psSQLRequest + "Etat_CheckBox_6='"             +GetGadgetState(#CheckBox_6)+"',"   
  psSQLRequest + "Etat_CheckBox_7='"             +GetGadgetState(#CheckBox_7)+"',"   
  psSQLRequest + "Etat_CheckBox_8='"             +GetGadgetState(#CheckBox_8)+"',"
  psSQLRequest + "Etat_CheckBox_9='"             +GetGadgetState(#CheckBox_9)+"',"   
  psSQLRequest + "Etat_CheckBox_10='"            +GetGadgetState(#CheckBox_10)+"',"    
  psSQLRequest + "Etat_CheckBox_11='"            +GetGadgetState(#CheckBox_11)+"',"
  psSQLRequest + "Etat_CheckBox_12='"            +GetGadgetState(#CheckBox_12)+"',"
  psSQLRequest + "Etat_CheckBox_13='"            +GetGadgetState(#CheckBox_13)+"',"
  psSQLRequest + "Etat_CheckBox_14='"            +GetGadgetState(#CheckBox_14)+"',"
  psSQLRequest + "Etat_CheckBox_15='"            +GetGadgetState(#CheckBox_15)+"',"
  psSQLRequest + "Etat_CheckBox_16='"            +GetGadgetState(#CheckBox_16)+"',"   
  psSQLRequest + "Etat_CheckBox_17='"            +GetGadgetState(#CheckBox_17)+"',"   
  psSQLRequest + "Etat_CheckBox_18='"            +GetGadgetState(#CheckBox_18)+"',"
  psSQLRequest + "Etat_CheckBox_19='"            +GetGadgetState(#CheckBox_19)+"',"     
  psSQLRequest + "contact_photo = ?,"
  psSQLRequest + "contact_photo_s = ?,"
 
  If glImageMemory
    psSQLRequest + "contact_photo_size = " + Str(MemorySize(glImageMemory)) + ","
  Else
    psSQLRequest + "contact_photo_size = 0" + ","
  EndIf
 
  If glImageMemory2
    psSQLRequest + "contact_photo_s_size = " + Str(MemorySize(glImageMemory2))
  Else
    psSQLRequest + "contact_photo_s_size = 1"
  EndIf
 
  psSQLRequest + " WHERE rowid = " + Str(GetGadgetItemData(#Listview_0, GadgetItem))
  ;Debug psSQLRequest
 
  If glImageMemory
    SetDatabaseBlob(glDBSQLite, 0, glImageMemory, MemorySize(glImageMemory))
  Else
    ReplaceString(psSQLRequest, "?", "'0'")
  EndIf
 
  If glImageMemory2
    SetDatabaseBlob(glDBSQLite, 1, glImageMemory2, MemorySize(glImageMemory2))
  Else
    ReplaceString(psSQLRequest, "?", "'1'")
  EndIf
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  If DatabaseUpdate(glDBSQLite, psSQLRequest) = 0
    MessageRequester("Notysoft Ordinem - Gestion de Contacts - DB_UpdateContact()", DatabaseError())
  Else
  If ModeListeview = 1
    SetGadgetItemText(#Listview_0, GadgetItem, "Facture N°"+GetGadgetText(#StringFacture_0)+" "+GetGadgetText(#StringContact_0)+" "+GetGadgetText(#StringContact_1)+" "+GetGadgetText(#StringContact_2))         
    
    SetGadgetState(#Listview_0, GadgetItem)
  EndIf

  If ModeListeview = 2       
    SetGadgetItemText(#Listview_0, GadgetItem, GetGadgetText(#StringContact_0)+" "+GetGadgetText(#StringContact_1)+" "+GetGadgetText(#StringContact_2)+" Facture N°"+GetGadgetText(#StringFacture_0))
    SetGadgetState(#Listview_0, GadgetItem)
  EndIf
EndIf

EndProcedure                                         


Procedure DB_DeleteContact(GadgetItem.l)
  Protected psSQLRequest.s
 
  psSQLRequest = "DELETE FROM contacts WHERE rowid = " + Str(GetGadgetItemData(#Listview_0, GadgetItem))
  If DatabaseUpdate(glDBSQLite, psSQLRequest) = 0
    MessageRequester("Notysoft Ordinem - Gestion de Contacts - DB_DeleteContact()", DatabaseError())
  Else
    RemoveGadgetItem(#Listview_0, GadgetItem)
    Reset()
  EndIf
EndProcedure

Procedure ExecCalc()
Protected LanceCalc = RunProgram("C:\Windows\System32\calc.exe","", "", #PB_Program_Open | #PB_Program_Read)
  Protected Sortie$ = ""
  If LanceCalc
    While ProgramRunning(LanceCalc)
      If AvailableProgramOutput(LanceCalc)
        Sortie$ + ReadProgramString(LanceCalc) + Chr(13)
      EndIf
    Wend
    Sortie$ + Chr(13) + Chr(13)
    Sortie$ + "Code de retour : " + Str(ProgramExitCode(LanceCalc))
   
    CloseProgram(LanceCalc) ; Ferme la connection vers le programme
  EndIf
EndProcedure

Procedure OpenAgenda()  
  If OpenWindow(#FenetreAgenda,153,50,220,220, "Agenda", #PB_Window_TitleBar | #PB_Window_BorderLess,WindowID(#Window_0))        
    CalendarGadget(#Agenda,0,0,220, 190)
    ButtonGadget(#BoutonAgenda,0,192,220,26, "Ok")
  EndIf
EndProcedure

Procedure OpenAPropos()  
  If OpenWindow(#FenetreApropos,153,40,220,145, "A Propos", #PB_Window_TitleBar | #PB_Window_BorderLess,WindowID(#Window_0))            
    
    TextGadget(#TextAPropos1,10, 10, 200, 20,"Notysoft Ordinem - 2016 - 2017",#PB_Text_Center)    
    TextGadget(#TextAPropos2,10, 30, 200, 20,"Frédéric CHERPE",#PB_Text_Center)
    TextGadget(#TextAPropos3,10, 50, 200, 20,"Gestion de Contacts",#PB_Text_Center)           
    TextGadget(#TextAPropos4,10, 70, 200, 20,"Créer simplement sa base de données",#PB_Text_Center)        
    TextGadget(#TextAPropos5,10, 90, 200, 20,"modèles et photographes.",#PB_Text_Center)    
            
    ButtonGadget(#BoutonAPropos,85,110,50,30, "Ok")    
    
  EndIf
EndProcedure

Procedure OpenInfos(titre.S,text1.S,text2.S,text3.S,text4.S,text5.S) 
  MessageRequester(titre,text1+ #CRLF$ +text2+ #CRLF$ +text3+ #CRLF$ +text4+ #CRLF$ +text5,64)     
  ;MessageRequester("A Propos","Notysoft Ordinem - 2016 - 2017" + #CRLF$ + "Créer simplement sa base de données modèles et photographes.",64)              
EndProcedure

Main_WindowOpen()
DB_Init()

Modification = 1 
ModeListeview = 1
PCPixMusic
Messages : 106
Inscription : ven. 06/janv./2017 9:50

Re: Problèmes SQLite - "Values et colomns"

Message par PCPixMusic »

Dernier code partie 2 :

Code : Tout sélectionner

Repeat
  glEvent = WaitWindowEvent()
  glGadget= EventGadget()
  glType = EventType()
 
 
  If glEvent = #PB_Event_Gadget
    Select glGadget 
       
      Case #Listview_0 ;Selection d'un enregistrement
        If GetGadgetState(#Listview_0) <> -1
           Modification = 1   
          ;glListviewItemSelected = GetGadgetState(#Listview_0)
          glListviewItemSelected = GetGadgetItemData(#Listview_0, GetGadgetState(#Listview_0))
          DB_SelectContact(GetGadgetState(#Listview_0))
        EndIf
       
      Case #Button_0 ;Nouveau
        Reset()
        Modification = 0 
        MessageRequester("Notysoft Ordinem","Nouveau contact, c'est parti !",64)
                
        Case #Button_1 ;{Enregistrer
          If GetGadgetText(#StringFacture_0) <> "" And GetGadgetText(#StringContact_0) <> "" And GetGadgetText(#StringContact_1) <> "" And GetGadgetText(#StringContact_1) <> "" And Modification = 0                               
          Modification = 1
          DB_InsertContact()  
          
      Else
        If GetGadgetState(#Listview_0) >= 0 And GetGadgetState(#Listview_0) <= CountGadgetItems(#Listview_0)-1  And Modification = 1   
          DB_UpdateContact(GetGadgetState(#Listview_0),1)
          Modification = 1 
             MessageRequester("Notysoft Ordinem - Gestion de Contacts - ","Contact enregistrer !",64)               
          EndIf
        EndIf        
      ;}    
        
        
      Case #Button_2 ;{ Mettre à jour
        If GetGadgetState(#Listview_0) >= 0 And GetGadgetState(#Listview_0) <= CountGadgetItems(#Listview_0)-1
          If glType = #PB_EventType_LeftClick
            DB_UpdateContact(GetGadgetState(#Listview_0),1)
            MessageRequester("Notysoft Ordinem - Gestion de Contacts - ","Vos contacts sont à jour !",64)
          EndIf
        EndIf
        ;}
       
      Case #Button_3 ;{ Supprimer
        If GetGadgetState(#Listview_0) >= 0 And GetGadgetState(#Listview_0) <= CountGadgetItems(#Listview_0)-1
          If glType = #PB_EventType_LeftClick
            If MessageRequester("Notysoft Ordinem - Gestion de Contacts", "Voulez vous vraiment supprimer le contact courant "+Chr(34)+GetGadgetItemText(#Listview_0, GetGadgetState(#Listview_0))+Chr(34)+" ?", #PB_MessageRequester_YesNo) = #PB_MessageRequester_Yes
              DB_DeleteContact(GetGadgetState(#Listview_0))
            EndIf
          EndIf
        EndIf
        ;}
      Case #Button_4 ;{ Parcourir
        Define.s psFileImage
        Define.l plFileImage
       
        ; Ouvre une boîte de dialogue standard pour choisir une image
        psFileImage = OpenFileRequester("Choisissez une image à charger", "", "Fichiers Images|*.png;*.bmp;*.jpg;*.jpeg|Tous les fichiers (*.*)|*.*", 0)
        If psFileImage
          ; Charge une image
          plFileImage = LoadImage(#PB_Any, psFileImage)
          If plFileImage
            ; Redimensionne l'image à la taille de l'ImageGadget            
            ResizeImage(plFileImage, 290, 333)
            ; Change l'image affichée par l' ImageGadget
            SetGadgetState(#Image_0, ImageID(plFileImage))
            ; Libère l'image
            FreeImage(plFileImage)
            ; Charge l'image dans la zone mémoire globale dédiée 'glImageMemory'
            plFileImage = OpenFile(#PB_Any, psFileImage)
            If plFileImage
              glImageMemory = AllocateMemory(Lof(plFileImage))
              If glImageMemory
                ReadData(plFileImage, glImageMemory, Lof(plFileImage))
              EndIf
              CloseFile(plFileImage)
            EndIf
          EndIf
        EndIf
        ;}
        
      Case #Button_5 ; {Fenêtre Facture
        OpenEditionFacture()  
        
      Case #Button_6 ; {Fenêtre Contrat
        OpenEditionContrat()  
        
      Case #Button_7 ; {Fenêtre Seance
        OpenEditionSeance()          
        
      Case #Button_8 ; {Mode Factures
        ModeListeview = 1
        If GetGadgetState(#Listview_0) >= 0 And GetGadgetState(#Listview_0) <= CountGadgetItems(#Listview_0)-1
          If glType = #PB_EventType_LeftClick
            DB_UpdateContact(GetGadgetState(#Listview_0),1)            
          EndIf
        EndIf;}
        
      Case #Button_9 ; {Mode Prénoms
        ModeListeview = 2
        If GetGadgetState(#Listview_0) >= 0 And GetGadgetState(#Listview_0) <= CountGadgetItems(#Listview_0)-1
          If glType = #PB_EventType_LeftClick            
            DB_UpdateContact(GetGadgetState(#Listview_0),2)           
          EndIf
        EndIf;}       
      
      Case #Button_10 ; Lance l'Agenda
        OpenAgenda()
       
      Case #Button_11 ; Lance la calculatrice
        ExecCalc()        
        
      Case #Button_12 ; lance A_Propos        
        ;OpenInfos("A Propos","Notysoft Ordinem - 2016 - 2017","Créer simplement sa base de données modèles et photographes.","","","")
        OpenAPropos()  
      
      Case #Button_13 ; Parcourir Signiature
        Define.s psFileImage2
        Define.l plFileImage2
        ;Ouvre une boîte de dialogue standard pour choisir une image
        psFileImage2 = OpenFileRequester("Choisissez une image à charger", "", "Fichiers Images|*.png;*.bmp;*.jpg;*.jpeg|Tous les fichiers (*.*)|*.*", 0)
        If psFileImage2
          ;Charge une image
          plFileImage2 = LoadImage(#PB_Any, psFileImage2)
          If plFileImage2
            ;Redimensionne l'image à la taille de l'ImageGadget
            ResizeImage(plFileImage2, 116, 55)
            ;Change l'image affichée par l' ImageGadget
            SetGadgetState(#Image_1 , ImageID(plFileImage2))
            ;Libère l'image
            FreeImage(plFileImage2)
            ;Charge l'image dans la zone mémoire globale dédiée 'glImageMemory'
            plFileImage2 = OpenFile(#PB_Any, psFileImage2)
            If plFileImage2
              glImageMemory2 = AllocateMemory(Lof(plFileImage2))
              If glImageMemory2
                ReadData(plFileImage2, glImageMemory2, Lof(plFileImage2))
              EndIf
              CloseFile(plFileImage2)
            EndIf
          EndIf
        EndIf
        ;}
        
      Case #BoutonFacture  
        CloseWindow(#FenetreFacture)             
        
      Case #BoutonContrat            
        CloseWindow(#FenetreContrat)        
        
       Case #BoutonSeance  
       CloseWindow(#FenetreSeance)              
       
       Case #BoutonAgenda       
        CloseWindow(#FenetreAgenda)
        
      Case #BoutonAPropos
       CloseWindow(#FenetreApropos) 
       
    EndSelect
  EndIf
 
Until glEvent = #PB_Event_CloseWindow

End
Avatar de l’utilisateur
Fig
Messages : 1176
Inscription : jeu. 14/oct./2004 19:48

Re: Problèmes SQLite - "Values et colomns"

Message par Fig »

En fait, je ne comprends pas le mode fonctionnement que tu attends de tout ça... J'ai besoin d'une explication là...
Pour chaque fiche qui contient donc: [Prenom, nom etc... Loisirs]
Tu veux pouvoir ajouter plusieurs photos, plusieurs facture client... ?
Tu peux détailler cette partie stp ?
Il y a deux méthodes pour écrire des programmes sans erreurs. Mais il n’y a que la troisième qui marche.
Version de PB : 6.00LTS - 64 bits
PCPixMusic
Messages : 106
Inscription : ven. 06/janv./2017 9:50

Re: Problèmes SQLite - "Values et colomns"

Message par PCPixMusic »

C'est un logiciel de base de données de modèles et photographes (avec impression de facture, de contrat et du déroulement de la séance photos) :

Chaque fiche contact avec la photo du contact, doivent contenir des informations pour éditer une facture, des informations pour éditer un contrat avec une signature enregistrée dans la base de données, le déroulement d'une séance photos, avec ensuite la possibilité d'imprimer ces trois catégories au moyen d'un bouton Imprimer qui se trouvera dans chaque fenêtre respectives. Les procedures d'impressions seront faites à la fin, car avant, il va falloir que j'arrive à mettre plusieurs tables, par exemple, une table contacts, une table factures, une table contrats, une table seances ...

Voici la version du code avec les variables qui rempacent les constantes, comme tu me l'a proposé, mais qui ne s'enregistre pas dans la base de données avec les enregistrements sous forme de variables factures, contrats et seances (via mon espace hubic) :
http://ovh.to/iZPMZLK
Avatar de l’utilisateur
Fig
Messages : 1176
Inscription : jeu. 14/oct./2004 19:48

Re: Problèmes SQLite - "Values et colomns"

Message par Fig »

Je suppose que tes models ont un contrat, une facture et un compte rendu de sceance pour chaque client ?
Est ce qu'il faut envisager plusieurs compte rendu de sceance par contrat par exemple ?
Ou plusieurs contrats par client eventuellement ?

Il faut commencer par faire un schéma de tous tes menus et les boutons que tu veux dessus avec les fonctionnalités associées et les tris dont tu as besoin...
Il y a deux méthodes pour écrire des programmes sans erreurs. Mais il n’y a que la troisième qui marche.
Version de PB : 6.00LTS - 64 bits
PCPixMusic
Messages : 106
Inscription : ven. 06/janv./2017 9:50

Re: Problèmes SQLite - "Values et colomns"

Message par PCPixMusic »

Le photographe c'est moi, chaque fiche dans listeview est un numéro de facture avec le numéro de client, donc d'un(e) modèl(e)s et ses coordonnées, sa facture et son contrat.

Il n'y a pas de compte rendu de séance de prévu, je n'ai jamais fait ça, peux-être es que c'est une chose à ajouter, pourquoi pas.
Tu viens de souligner en effet quelque chose d'important qu'il manque à ce projet.

Il y a donc bien plusieurs factures, contrats et déroulement de séances photos par contact (qui sont donc des modèles et clientes/clients)

Je n'ai jamais mis de menu dans mes programmes, car je trouve ça pas pratique, je préfère avoir des boutons comme ceci, directement sur l'interface.

il y a deux modes d'affichage :

-N°Facture Prénom Nom profession
-Prénom Nom profession N°Facture

Je n'ai pas d'expérience en base de données, mais en effet on m'a dit de faire plusieurs tables (exemple : Contacts, Factures, Contrats et Séances), afin de pouvoir facilement faire des tries et pouvoir faire des recherches (Exemple : retrouvez les factures, contrats ou déroulement de séances photos de marie clochettes etc)
Marc56
Messages : 2198
Inscription : sam. 08/févr./2014 15:19

Re: Problèmes SQLite - "Values et colomns"

Message par Marc56 »

Un système de facturation est souvent organisé autour de 3 tables.
- Clients: identifiés par un numéro unique (souvent une séquence)
- Produit: identifiés par un numéro unique
- Facture: Contient numéro de client + numéro(s)à de produit(s) + quantité(s)

Ce sont les numéro de clients et numéros de produits qui servent de liens entre tables
La table facture n'est qu'une suite de lignes ID_Facture, ID_Client, ID_Produit, Quantité, Date
Pour l'archivage légal, on conserve en plus souvent la l'édition de la facture sous forme de texte brut (utile pour indexer une GED) et/ou sous forme de fichier PDF (utile pour envoyer un double au client)

On peut faire plein de tables, mais cela devient vite ingérables, il vaut mieux par exemple que la table Clients contienne à la fois les Clients, les Fournisseurs et les Prospects et juste un champ qui indique le status (un prospect devient ainsi un client sans avoir à ressaisir)
De même, la table produits peut contenir des consommables, des prestations, des contrats

:)
PCPixMusic
Messages : 106
Inscription : ven. 06/janv./2017 9:50

Re: Problèmes SQLite - "Values et colomns"

Message par PCPixMusic »

J'ai résolu tous les bugs et revus un peu peu l'interface. :mrgreen:

Merci beaucoup pour tes explications.

Ici il n'y a pas de produit, de fournisseurs ou de prospects ce n'est pas de la vente de produits, mais de services.
Ce n'est pas pour une boutique photos, mais pour une activité de "photographe de terrain événementiel"

Si j'adapte, cela donne donc ? (c'est vrai que j'ai fais moi-même cette erreur dans mon code, je vais remplacé client par modèle) :

- Modèle: identifiés par un numéro unique
- Contrat: identifiés par un numéro unique
- Facture: Contient numéro de modèle + numéro(s)à de contrat(s) + Thème de la/les séance(s)

Ayant déjà un système de comptabilité et de facturation. Je voulais juste m'amuser à généré une impression de facture à partir des informations de la base.

Encore une fois le but de ce code est très basic (sans jeux de mots), dans listeview, les factures se suivent avec à chaque fois les coordonnées et numéro de client, contrats et numéro et désignation de facture.

Exemple de demande d'une modèle :

"Bonjour, je suis Anne Halyse, nous avons fait une séance photos le 12 Septembre 2016 pouvez-vous me renvoyer mes documents par mails ? "

Documents = Facture, Contrat de droit à l'image, Déroulement de la séance et pourquoi pas le conte rendu de séance dont tu as parlé.

Donc, je pense qu'il manque une fonction de recherche par prénom et nom, par facture et par date, ensuite cela va sélectionner la fiche en question dans listeview.

:mrgreen:
Répondre