diff options
| author | polo <ordipolo@gmx.fr> | 2022-12-28 05:19:55 +0100 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2022-12-28 05:19:55 +0100 |
| commit | 1894fc377e6b938ea34df9980567a1634ec6ef48 (patch) | |
| tree | 812db64208797ecbdabbc9673a5247fbc18ebf8b /src/main.php | |
| parent | 7d564efbccc4b361d2fa2db2902fb35882304aae (diff) | |
| download | AppliGestionPHP-1894fc377e6b938ea34df9980567a1634ec6ef48.tar.gz AppliGestionPHP-1894fc377e6b938ea34df9980567a1634ec6ef48.tar.bz2 AppliGestionPHP-1894fc377e6b938ea34df9980567a1634ec6ef48.zip | |
réorganisation + bientôt finie la section 1
Diffstat (limited to 'src/main.php')
| -rwxr-xr-x | src/main.php | 160 |
1 files changed, 34 insertions, 126 deletions
diff --git a/src/main.php b/src/main.php index 3c9c4aa..12715f3 100755 --- a/src/main.php +++ b/src/main.php | |||
| @@ -39,162 +39,67 @@ require('model/CESU.php'); | |||
| 39 | require('model/Locations.php'); | 39 | require('model/Locations.php'); |
| 40 | 40 | ||
| 41 | require('view/Zenity.php'); // commande système zenity | 41 | require('view/Zenity.php'); // commande système zenity |
| 42 | require('view/zenity_setup.php'); // texte dans les fenêtres ET instanciation (un objet = une commande) | 42 | require('view/ZenitySetup.php'); // texte dans les fenêtres ET instanciation (un objet = une commande) |
| 43 | require('Latex.php'); // générer le code LaTeX | 43 | require('Latex.php'); // générer le code LaTeX |
| 44 | 44 | ||
| 45 | require('sections/1_new_service.php'); | ||
| 46 | |||
| 45 | 47 | ||
| 46 | // boucle principale | 48 | // boucle principale |
| 47 | $boucle = true; | 49 | $boucle = true; |
| 48 | while($boucle) | 50 | while($boucle) |
| 49 | { | 51 | { |
| 50 | // niveau 1: menu principal | 52 | // niveau 1: menu principal |
| 53 | $MenuPrincipal = new ZenityList(ZenitySetup::$menu_principal_text, ZenitySetup::$menu_principal_entrees); | ||
| 51 | $choix_niv1 = exec($MenuPrincipal->get()); | 54 | $choix_niv1 = exec($MenuPrincipal->get()); |
| 52 | 55 | ||
| 53 | // Nouvelle prestation | 56 | // -- SECTION 1: Nouvelle prestation -- |
| 54 | if($choix_niv1 === $menu_principal_entrees[0]) | 57 | if($choix_niv1 === ZenitySetup::$menu_principal_entrees[0]) |
| 55 | { | 58 | { |
| 56 | $Client = new Clients; | 59 | echo("choix: $choix_niv1\n"); |
| 57 | $id_client_connu = false; | 60 | newService(); |
| 58 | |||
| 59 | // niveau 2: est ce que le client est déjà dans la base? | ||
| 60 | if(exec($QuestionNouveauClient->get()) == '0') // $? = 0 signifie oui, double égal == pour le transtypage | ||
| 61 | { | ||
| 62 | echo "debug: recherche souhaitée\n"; | ||
| 63 | |||
| 64 | // niveau 3: saisie du nom du client | ||
| 65 | $nom_client = exec($RechercheClient->get()); | ||
| 66 | if($nom_client !== '') | ||
| 67 | { | ||
| 68 | echo "debug: recherche effectuée\n"; | ||
| 69 | $ResultatsRechercheClient->setListRows(rechercheClient($nom_client, $Client), $Client->getTable()); // recherche silencieuse | ||
| 70 | //~ var_dump($ResultatsRechercheClient->get()); die(); | ||
| 71 | unset($nom_client); | ||
| 72 | |||
| 73 | // niveau 4: sélection parmi les résultats | ||
| 74 | $choix_niv4 = exec($ResultatsRechercheClient->get()); | ||
| 75 | $ResultatsRechercheClient->cleanCommand(); | ||
| 76 | |||
| 77 | if($choix_niv4 !== '') | ||
| 78 | { | ||
| 79 | echo "debug: client sélectionné\n"; | ||
| 80 | $id_client_connu = true; | ||
| 81 | } | ||
| 82 | else | ||
| 83 | { | ||
| 84 | echo "debug: client pas trouvé ou pas sélectionné\n"; | ||
| 85 | } | ||
| 86 | } | ||
| 87 | else | ||
| 88 | { | ||
| 89 | echo "debug: recherche annulée ou saisie vide\n"; | ||
| 90 | } | ||
| 91 | } | ||
| 92 | else | ||
| 93 | { | ||
| 94 | echo "debug: nouveau client\n"; | ||
| 95 | } | ||
| 96 | |||
| 97 | // niveau 2: on n'a pas cherché OU on n'a pas trouvé | ||
| 98 | if(!$id_client_connu) | ||
| 99 | { | ||
| 100 | $id_client_connu = enregistrementNouveauClient(exec($NouveauClient->get()), $Client); // fenêtre + écriture BDD | ||
| 101 | } | ||
| 102 | |||
| 103 | // niveau 2: type comptable d'enregistrement: devis, facture, cesu ou pas de prestation | ||
| 104 | if($id_client_connu) | ||
| 105 | { | ||
| 106 | $choix_niv2 = exec($MenuEnregistrement->get()); | ||
| 107 | $continuer = true; | ||
| 108 | if($choix_niv2 === $menu_enregistrement_entrees[0]) | ||
| 109 | { | ||
| 110 | // | ||
| 111 | } | ||
| 112 | elseif($choix_niv2 === $menu_enregistrement_entrees[1]) | ||
| 113 | { | ||
| 114 | // | ||
| 115 | } | ||
| 116 | elseif($choix_niv2 === $menu_enregistrement_entrees[2]) | ||
| 117 | { | ||
| 118 | // | ||
| 119 | } | ||
| 120 | elseif($choix_niv2 === $menu_enregistrement_entrees[3]) | ||
| 121 | { | ||
| 122 | // | ||
| 123 | } | ||
| 124 | else | ||
| 125 | { | ||
| 126 | $continuer = false; // retour menu principal | ||
| 127 | } | ||
| 128 | |||
| 129 | if($continuer) | ||
| 130 | { | ||
| 131 | //niveau 3: détail de la prestation | ||
| 132 | $Date = new Dates(exec($Calendrier->get())); | ||
| 133 | $Objet->setDate($Date->getTimestamp()); // enregistrement du timestamp en BDD | ||
| 134 | |||
| 135 | exec($FormulairePrestation->get()); | ||
| 136 | // enregistrement date et prestation en BDD | ||
| 137 | |||
| 138 | exec($CommentairePrestation->get()); | ||
| 139 | // enregistrement commentaire en BDD | ||
| 140 | // vérification? | ||
| 141 | |||
| 142 | // tableau récaptilatif et demande de confirmation des informations | ||
| 143 | |||
| 144 | // création fichiers LaTeX et PDF | ||
| 145 | //~ $latex_path = '../data/latex/'; // noms de variables dans le config.php | ||
| 146 | //~ $file_name = 'devis.tex'; | ||
| 147 | //~ $template = 'devis'; // vaut 'devis' ou 'enveloppe_recto' ou 'enveloppe_verso' ou 'facture' ou 'location' | ||
| 148 | //~ $latex = getLatexFromTemplate($template); | ||
| 149 | //~ file_put_contents($latex_path . $file_name, $latex); // injection des variables & écriture du fichier | ||
| 150 | //~ $pdf_path = '../data/pdf/'; | ||
| 151 | //~ latexToPdf($latex_path, $file_name, $pdf_path); | ||
| 152 | |||
| 153 | // imprimer? | ||
| 154 | //~ $imprimer_facture = exec('zenity --question --width=250 --title="Base de données mise à jour" --text="Imprimer la facture?"'); | ||
| 155 | //~ $imprimer_enveloppe = exec('zenity --question --width=250 --title="Base de données mise à jour" --text="Imprimer l\'adresse sur une enveloppe? (insérer une enveloppe DL sans fenêtre dans l\'imprimante"'); | ||
| 156 | } | ||
| 157 | } | ||
| 158 | unset($Client); // suppression de la dernière référence (normallement) | ||
| 159 | } | 61 | } |
| 160 | 62 | ||
| 161 | // Modifier un enregistrement | 63 | // -- SECTION 2: Modifier un enregistrement -- |
| 162 | elseif($choix_niv1 === $menu_principal_entrees[1]) | 64 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[1]) |
| 163 | { | 65 | { |
| 164 | // niveau 2: | 66 | echo("choix: $choix_niv1\n"); |
| 165 | } | 67 | } |
| 166 | 68 | ||
| 167 | // Fichier clients | 69 | // -- SECTION 3: Fichier clients -- |
| 168 | elseif($choix_niv1 === $menu_principal_entrees[2]) | 70 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[2]) |
| 169 | { | 71 | { |
| 72 | echo("choix: $choix_niv1\n"); | ||
| 170 | // quel affichage? un grand tableau avec zenity? une page web? un document LaTeX? | 73 | // quel affichage? un grand tableau avec zenity? une page web? un document LaTeX? |
| 171 | } | 74 | } |
| 172 | 75 | ||
| 173 | // documents à imprimer | 76 | // -- SECTION 4: documents à imprimer -- |
| 174 | elseif($choix_niv1 === $menu_principal_entrees[3]) // = Créer/imprimer un document | 77 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[3]) // = Créer/imprimer un document |
| 175 | { | 78 | { |
| 79 | echo("choix: $choix_niv1\n"); | ||
| 80 | $MenuDocuments = new ZenityList(ZenitySetup::$menu_documents_text, ZenitySetup::$menu_documents_entrees); | ||
| 176 | $choix_niv2 = exec($MenuDocuments->get()); | 81 | $choix_niv2 = exec($MenuDocuments->get()); |
| 177 | if($choix_niv2 === $menu_documents_entrees[0]) | 82 | if($choix_niv2 === ZenitySetup::$menu_documents_entrees[0]) |
| 178 | { | 83 | { |
| 179 | 84 | ||
| 180 | } | 85 | } |
| 181 | elseif($choix_niv2 === $menu_documents_entrees[1]) // = Facture | 86 | elseif($choix_niv2 === ZenitySetup::$menu_documents_entrees[1]) // = Facture |
| 182 | { | 87 | { |
| 183 | 88 | ||
| 184 | } | 89 | } |
| 185 | elseif($choix_niv2 === $menu_documents_entrees[2]) // = Lettre avec adresse | 90 | elseif($choix_niv2 === ZenitySetup::$menu_documents_entrees[2]) // = Lettre avec adresse |
| 186 | { | 91 | { |
| 187 | 92 | ||
| 188 | } | 93 | } |
| 189 | elseif($choix_niv2 === $menu_documents_entrees[3]) // = Livre des recettes | 94 | elseif($choix_niv2 === ZenitySetup::$menu_documents_entrees[3]) // = Livre des recettes |
| 190 | { | 95 | { |
| 191 | 96 | ||
| 192 | } | 97 | } |
| 193 | elseif($choix_niv2 === $menu_documents_entrees[4]) // = Registre des achats | 98 | elseif($choix_niv2 === ZenitySetup::$menu_documents_entrees[4]) // = Registre des achats |
| 194 | { | 99 | { |
| 195 | 100 | ||
| 196 | } | 101 | } |
| 197 | elseif($choix_niv2 === $menu_documents_entrees[5]) // = Bilan annuel | 102 | elseif($choix_niv2 === ZenitySetup::$menu_documents_entrees[5]) // = Bilan annuel |
| 198 | { | 103 | { |
| 199 | 104 | ||
| 200 | } | 105 | } |
| @@ -204,19 +109,21 @@ while($boucle) | |||
| 204 | } | 109 | } |
| 205 | } | 110 | } |
| 206 | 111 | ||
| 207 | // Supports de communication | 112 | // -- SECTION 5: Supports de communication -- |
| 208 | elseif($choix_niv1 === $menu_principal_entrees[4]) // = Communication | 113 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[4]) // = Communication |
| 209 | { | 114 | { |
| 115 | echo("choix: $choix_niv1\n"); | ||
| 116 | $MenuCommunication = new ZenityList(ZenitySetup::$menu_communication_text, ZenitySetup::$menu_communication_entrees); | ||
| 210 | $choix_niv2 = exec($MenuCommunication->get()); | 117 | $choix_niv2 = exec($MenuCommunication->get()); |
| 211 | if($choix_niv2 === $menu_communication_entrees[0]) // = Flyer (nécessite gimp) | 118 | if($choix_niv2 === ZenitySetup::$menu_communication_entrees[0]) // = Flyer (nécessite gimp) |
| 212 | { | 119 | { |
| 213 | exec(windowAppCommand($image_editor, $flyer)); | 120 | exec(windowAppCommand($image_editor, $flyer)); |
| 214 | } | 121 | } |
| 215 | elseif($choix_niv2 === $menu_communication_entrees[1]) // = Carte de visite (nécessite scribus) | 122 | elseif($choix_niv2 === ZenitySetup::$menu_communication_entrees[1]) // = Carte de visite (nécessite scribus) |
| 216 | { | 123 | { |
| 217 | exec(windowAppCommand($publishing, $business_card)); | 124 | exec(windowAppCommand($publishing, $business_card)); |
| 218 | } | 125 | } |
| 219 | elseif($choix_niv2 === $menu_communication_entrees[2]) // = Explorateur de fichiers | 126 | elseif($choix_niv2 === ZenitySetup::$menu_communication_entrees[2]) // = Explorateur de fichiers |
| 220 | { | 127 | { |
| 221 | exec(windowAppCommand($file_explorer, $pub)); | 128 | exec(windowAppCommand($file_explorer, $pub)); |
| 222 | } | 129 | } |
| @@ -226,9 +133,10 @@ while($boucle) | |||
| 226 | } | 133 | } |
| 227 | } | 134 | } |
| 228 | 135 | ||
| 229 | // BDD | 136 | // -- SECTION 6: BDD -- |
| 230 | elseif($choix_niv1 === $menu_principal_entrees[5]) // = Base de données | 137 | elseif($choix_niv1 === ZenitySetup::$menu_principal_entrees[5]) // = Base de données |
| 231 | { | 138 | { |
| 139 | echo("choix: $choix_niv1\n"); | ||
| 232 | if($sqlitebrowser_enable) | 140 | if($sqlitebrowser_enable) |
| 233 | { | 141 | { |
| 234 | exec(windowAppCommand($sqlite_gui, $db_place)); | 142 | exec(windowAppCommand($sqlite_gui, $db_place)); |
