Ejemplo n.º 1
0
API::useAPI(function(API $api){
    
    $layout=new LAYOUT($api); 
    
    if(!$api->estAuthentifier())
    {
        echo $layout->renderHeader("Gestion des commandes");
        echo $layout->render('{{> SimpleMessage}}','Vous devez vous authentifier pour accéder à cette page.');
    }
    else if(!$api->estAdmin())
    {
        echo $layout->renderHeader("Gestion des commandes");
        echo $layout->render('{{> SimpleMessage}}','Vous devez être un administrateur pour accéder à cette page.');
    }
    else
    {
        
        if(isset($_REQUEST['préparé_commandes']))
        {
            $selection = $_REQUEST['selection'];
            $api->API_Commande_Preparer($selection);
        }
        
        if(isset($_REQUEST['export_preparation']))
        {
            header('Location: ExportCommandesPreparation.php');  
        }
        
        if(isset($_REQUEST['importer_preparation']))
        {
            
            move_uploaded_file($_FILES['preparation_file']['tmp_name'],__DIR__.'/Preparations.xlsx');
            
            header('Location: ImportationCommandesPreparation.php');  
        }
        
        if(isset($_REQUEST['passer_livraison']))
        {
           $selection = $_REQUEST['selection'];  
           
           $api->API_Commande_Livrer($selection);
        }

        if(isset($_REQUEST['facturé_commandes']))
        {
            $selection = $_REQUEST['selection'];
            foreach ($selection as $id_commande) 
            {
                $compte = $api->API_Commande_Recupere($id_commande);
                $id_facture = $api->API_Facture_Ajouter($id_commande,$compte->id_compte);
                $api-> API_ElementCommande_Modifier_id_facture($id_facture, $id_commande) ;        
            }
            $api->API_Commande_Terminer($selection);
        }
        

        $etat = isset($_REQUEST['tri'])?
            (string)$_REQUEST['tri']:
            null;
        
        $date_debut = isset($_REQUEST['date_debut'])&!empty($_REQUEST['date_debut'])?
            (string)$_REQUEST['date_debut']:
            "2000-01-01";
        
        $date_fin = isset($_REQUEST['date_fin'])&!empty($_REQUEST['date_fin'])?
            (string)$_REQUEST['date_fin']:
            "2080-01-01";

        if (isset($_REQUEST['semaine']))
        {
           
            $date_debut = date('Y-m-d',strtotime("last Monday"));
            $date_fin = date('Y-m-d',strtotime("next Sunday"));
            
        }
       $not_etat=null;

        $commandes = $api->API_Commande_Lister(null,$etat, $not_etat, $date_debut, $date_fin);
        $commandes = $layout->Lookup($commandes,'etat',['etat'=>'etat']);

        foreach($commandes as &$commande)
        {
            $etat =$commande["etat"];
            $commande[$etat]=true;
        }

        echo $layout->renderHeader("Gestion des commandes");
        echo $layout->render('{{> CommandeList}}',['commandes'=>$commandes]);
    }
        
    $layout->renderFooter();
});
Ejemplo n.º 2
0
API::useAPI(function(API $api){
    
    $layout=new LAYOUT($api); 
    
    echo $layout->renderHeader("Saisie des réglements");
    
    ?>
    <script src="libs/jquery-1.11.3.js"></script>
    <script>
        $(function(){
            $('[data-autosubmit]').change(function(){
                    $(this.form).submit();
            });
        });  
    </script>      
    <?php 
    // fonctionnalités
    if(isset($_REQUEST['valider']))
    {
        if(isset($_REQUEST['id_compte_choisi']))
        {
            if(isset($_REQUEST['montant_reglement']))
            {
                if(isset($_REQUEST['SelectionFacture']))
                {
                    
                    $id_compte = (int)$_REQUEST['id_compte_choisi'];
                    $type_reglement = (string)$_REQUEST['type_reglement'];
                    $valeur = (float)$_REQUEST['montant_reglement'];
                    $selections = $_REQUEST['SelectionFacture'];
                    $id_reglement = $api->API_Reglement_Ajouter($id_compte,$type_reglement,$valeur);
                    
                    foreach ($selections as $selection) 
                    {
                        $id_facture = (int)$selection;
                        $api->API_Facture_Etat_Modifier($id_facture,'Reglement en cours');
                        $api->API_Facture_Rapprochement_Reglement($id_facture, $id_reglement, $id_compte);
                        
                    }
                    header('Location: SaisieReglement.php?id_compte_choisi='.$id_compte.'');
                    
                }else
                {   
                    $id_compte = (int)$_REQUEST['id_compte_choisi'];
                    $type_reglement = (string)$_REQUEST['type_reglement'];
                    $valeur = (float)$_REQUEST['montant_reglement'];
                    $selections = $_REQUEST['SelectionFacture'];
                    $id_reglement = $api->API_Reglement_Ajouter($id_compte,$type_reglement,$valeur);
                }   
            }else{$msg='Vous n\'avez pas entré le montant du réglement';}   
        }else{$msg='Vous n\'avez pas séléctionné de compte client';}   
    }else{$msg="";}   
       
    
    
    
    
           
    // affichage
    $comptes = $api->API_Comptes_Lister();
    if(isset($_REQUEST['id_compte_choisi']) )
    {
        $id_compte_choisi = $api->API_Compte_Recuperer($_REQUEST['id_compte_choisi']);
        $etat = 'En attente';
        $factures = $api->API_Factures_Lister($id_compte_choisi->id_compte, $etat, null, null, null);
           
    }
    if(isset($_REQUEST['type_reglement']))
    {
        $type_reglement = $_REQUEST['type_reglement'];    
    } 
     if(isset($_REQUEST['montant_reglement']))
    {
        $montant_reglement = $_REQUEST['montant_reglement'];    
    }
    
    
       
       
     echo $layout->render('{{> SaisieReglement}}',['comptes'=>$comptes,
                                                   'type_reglement' =>$type_reglement,
                                                   'id_compte_choisi' =>$id_compte_choisi,
                                                   'montant_reglement' =>$montant_reglement,
                                                   'factures' =>$factures,
                                                   'msg' =>$msg
                                                   ]);
    
        
    $layout->renderFooter();
});
Ejemplo n.º 3
0
API::useAPI(function(API $api){
    
    $layout=new LAYOUT($api); 
    
    echo $layout->renderHeader("Mon solde");
    
    if(!$api->estAuthentifier())
    {
        echo $layout->render('{{> SimpleMessage}}','Vous devez vous authentifier pour accéder à cette page.');
    }
    else
    {
        
        $not_etat = 'Création';
        $etat =null;
        $date_debut =null;
        $date_fin =null;

        $compte = $api->compteConnecte();
        $solde = $api->API_Solde_Compte_Recuperer($compte->id_compte);
        $factures = $api->API_Factures_Lister($compte->id_compte);
        $reglements = $api->API_Reglements_Lister($compte->id_compte);
         

        echo $layout->render('{{> MonSolde}}',[
            'compte'=>$compte,
            'solde'=>$solde,
            'factures'=>$factures,
            'reglements'=>$reglements
        ]);
    }
        
    $layout->renderFooter();
});
API::useAPI(function(API $api){
    
    $layout=new LAYOUT($api); 
    
    echo $layout->renderHeader("Rapprochement Facture et Reglement");
    
    ?>
    <script src="libs/jquery-1.11.3.js"></script>
    <script>
        $(function(){
            $('[data-autosubmit]').change(function(){
                    $(this.form).submit();
            });
        });  
    </script>      
    <?php 
    
    if(isset($_REQUEST['valider']))
    {
        $id_compte_choisi = $api->API_Compte_Recuperer($_REQUEST['id_compte_choisi']);
        $montant_facture=$_REQUEST['montant_facture'];
        $montant_reglement=$_REQUEST['montant_reglement'];
        if($montant_reglement>0)
        {
            if ($montant_facture == $montant_reglement)
            {
                $factures_selection = $_REQUEST['SelectionFacture'];
                $reglements_selection = $_REQUEST['SelectionReglement'];
                foreach ($reglements_selection as $id_reglement) 
                {
                    foreach ($factures_selection as $id_facture) 
                    {
                        $api->API_Facture_Etat_Modifier($id_facture,'Reglement en cours');
                        $api->API_Facture_Rapprochement_Reglement($id_facture, $id_reglement, $id_compte_choisi->id_compte);        
                    }
                }      
            }
            else 
            {
                $msg = "Le montant des factures séléctionnées ne correspond pas au montant des règlements";
            }
        }
        else 
        {
            $msg = "Vous n'avez pas selectionné de règlement!";
        }
    }
    
    // affichage
    $comptes = $api->API_Comptes_ReglementsNonRapproches_Lister();
    
   
    if(isset($_REQUEST['id_compte_choisi']) )
    {
        $id_compte_choisi = $api->API_Compte_Recuperer($_REQUEST['id_compte_choisi']);
        $factures = $api->API_FacturesNonRapproches_Lister($id_compte_choisi->id_compte);
        $reglements = $api->API_ReglementsNonRapproches_Lister($id_compte_choisi->id_compte);   
    }
   
    
    
    
    echo $layout->render('{{> Rapprochements_FactureReglement}}',['comptes'=>$comptes,
                                                   'id_compte_choisi' =>$id_compte_choisi,
                                                   'reglements' =>$reglements,
                                                   'factures' =>$factures,
                                                   'msg' =>$msg
                                                   ]);
    
        
    $layout->renderFooter();
});
Ejemplo n.º 5
0
API::useAPI(function(API $api){
    
    
    $layout=new LAYOUT($api);
    
    $id_facture = (int)$_REQUEST['id_facture'];
    $filename='Facture-date-' . $id_facture.'.pdf';
    
    function raccourcirChaine($chaine, $tailleMax)
  {
    
    $positionDernierEspace = 0;
    if( strlen($chaine) >= $tailleMax )
    {
      $chaine = substr($chaine,0,$tailleMax);
      $positionDernierEspace = strrpos($chaine,' ');
      $chaine = substr($chaine,0,$positionDernierEspace);
    }
    return $chaine;
  }
    

$facture= $api->API_Facture_Recupere_parId($id_facture);
    $date_facturation_commande = raccourcirChaine($facture->date_creation_facture, 11);
    $id_compte = (int)$facture->id_compte;
$compte=$api->API_Compte_Recuperer($id_compte);
    $titre_facturation = $compte->titre_facturation;
    $prenom_facturation = $compte->prenom_facturation;
    $nom_facturation = $compte->nom_facturation;
    $adresse_facturation = $compte->adresse_facturation;
    $codepostal_facturation = $compte->codepostal_facturation;
    $ville_facturation = $compte->ville_facturation;
    
    

ob_start();
?>





<table style='width:96%; height:100%;cellspacing=30'>
    
     <tr>
        <td style='width:30%;'>
            <table>
                <tr><th><div style='font-size:15;'>Du Jardin à la Ferme</div></th></tr>
                <tr><td>8 Hameau de Thiron</td></tr>
                <tr><td>78980 Bréval</td></tr>
                <tr><td>dujardinalaferme@gmail.com</td></tr>
            </table>
        </td>
        <td style='width:20%;'>
        </td>
        <td style='width:50%;text-align:center;font-size:30px;background-color:#ADD8E6'>Facture
        </td>
    </tr>
    <tr>
        <td colspan='3'>
        </td>
    </tr>
    <tr>
        <td>
            <table style='background-color:#ADD8E6'>
                <tr><td>Facture N° : <?php echo $id_facture?></td></tr>
                <tr><td>Date : <?php echo $date_facturation_commande?></td></tr>
                <tr><td>Client N° : <?php echo$id_compte?></td></tr>
            </table>
        </td>
        <td>
        </td>
        <td>
            <table>
                <tr><td><?php echo $titre_facturation?> <?php echo $prenom_facturation?> <?php echo $nom_facturation?></td></tr>
                <tr><td><?php echo $adresse_facturation?></td></tr>
                <tr><td><?php echo $codepostal_facturation?> <?php echo $ville_facturation?></td></tr>
            </table>
        </td>
    </tr>
    <tr>
        <td colspan='3'>
        </td>
    </tr>
    <tr>
        <td colspan='3'>
            <table style='border:solid 1;text-align:center;width:100%'>
                <tr style='background-color:#ADD8E6'>
                    <th style='width:10%;'>Quantité</th>
                    <th style='width:60%'>Désignation</th>
                    <th style='width:10%'>Poids unitaire</th>
                    <th style='width:10%'>Prix unitaire</th>
                    <th style='width:10%'>Prix total</th>
                </tr>
<?php
$elements = $api->API_Commande_lister_Elements($facture->id_commande);
    {
        foreach ($elements as $element) 
        {
            if($element->quantite_reel > 0)
            {
 ?>             <tr>
                    <td style='border-right:1'><?php echo $element->quantite_reel;?></td>
                    <td style='border-right:1'><?php echo $element->categorie;?> <?php echo $element->produit;?></td>
                    <td style='border-right:1'><?php echo $element->poids_unitaire;?></td>
                    <td style='border-right:1'><?php echo $element->prix_unitaire_ttc;?></td>
                    <td><?php echo $element->prix_total_element_ttc;?></td>
                </tr> 
 <?php     
            }
        }
    }
?>
            </table>
        </td>   
    </tr>
    
</table>        
        
            <table style='text-align:center;width:96%;font-size:15'>
                <?php if($facture->remise_total_commande>0)
                {?>
                <tr>
                    <th style='width:70%'></th>
                    <th style='border:1;width:20%'>Remise</th>
                    <th style='border:1;width:10%;background-color:#ADD8E6'><?php echo $facture->remise_total_commande;?> €</th>
                </tr>
                <tr>
                    <th></th>
                    <th style='border:1'>Total TTC</th>
                    <th style='border:1;background-color:#ADD8E6'><?php echo $facture->prix_total_facture_ttc;?> €</th>
                </tr>
                <?php
                }
                else 
                {?>
                <tr>
                    <th style='width:70%'></th>
                    <th style='border:1;width:20%'>Total</th>
                    <th style='border:1;width:10%;background-color:#ADD8E6'><?php  echo $facture->prix_total_facture_ttc, 2;?> €</th>
                </tr>
                <?php
                }?>
            </table>
         


<?php
    $content = ob_get_clean();
 
    
    $layout->HtmlToPDF($content,$filename);

});
Ejemplo n.º 6
0
API::useAPI(function(API $api){
    $layout=new LAYOUT($api);
    
    $id_composition=$_REQUEST['id_composition'];
    $panier = $api->API_panier_recuperer();
    $id_commande = $panier->id_commande;  
    
    // on modifie/cree les commandes de composition
    
    if (isset($_REQUEST['quantite_commande'])) 
    {
      $quantite = $_REQUEST['quantite_commande'];
      $commande =  $api->API_Commande_Composition_recuperer($id_composition, $id_commande);
      if (count($commande)>0 and $commande->quantite_commande_valide==null)
      {
        $api->API_CommandesCreation_Composition_Modifier($id_commande,$id_composition,$quantite);    
      }
      else
      {
         $api->API_Commandes_Composition_Creer($id_commande,$id_composition,$quantite);
      }
    }
    
   
    //on recupere les infos sur la compo
    $composition = $api->API_Composition_Detail_Lister($id_composition);
    //on recupere les stocks sur la compo
    $stocks = $api->API_Composition_Stocks_Lister($id_composition);
    //on recupere les produits de la compo
    $elements = $api->API_Elements_Composition_Lister($id_composition);
    //on revupere les elements de commande
    $commande =  $api->API_Commande_Composition_recuperer($id_composition, $id_commande);
   
   ?>
    <script src="libs/jquery-1.11.3.js"></script>
    <script>
        $(function(){
            $('[data-autosubmit]').change(function(){
                    $(this.form).submit();
            });
            
            $('[data-autocheck]').each(function(){
                var checkbox = $(this);
                var otherinput= $('#'+checkbox.data('autocheck'));
                checkbox.change(function(){
                    if(checkbox.prop('checked'))
                    {
                        otherinput.prop('disabled',false);
                    }
                    else{
                        otherinput.prop('disabled',true);
                        otherinput.val('');
                    }
                }); 
            })
            
        });
    </script>
    <?php

    echo $layout->renderHeader('Détail de la composition');
    
    echo $layout->render('{{> CompositionDetails}}', [
        'composition'=> $composition,
        'stocks'=> $stocks,
        'elements'=> $elements,
        'commande'=> $commande
        ]);
    
    echo $layout->renderFooter();
});
Ejemplo n.º 7
0
<?php
require_once('./private/config.php');
require_once('./private/api.php');
require_once('./private/layout.php');

API::useAPI(function(API $api){
    
    $layout=new LAYOUT($api);
	
    echo $layout->renderHeader('Accueil');
    
    echo $layout->render('{{> accueil}}',true);
    
    echo $layout->renderFooter();
});
Ejemplo n.º 8
0
API::useAPI(function(API $api){
    
    $layout=new LAYOUT($api); 
    
    echo $layout->renderHeader("Liste des cycles");
    ?>
    <script src="libs/jquery-1.11.3.js"></script>
    <script>
        $(function(){
            $('[data-autosubmit]').change(function(){
                    $(this.form).submit();
            });
            
            $('[data-autocheck]').each(function(){
                var checkbox = $(this);
                var otherinput= $('#'+checkbox.data('autocheck'));
                checkbox.change(function(){
                    if(checkbox.prop('checked'))
                    {
                        otherinput.prop('disabled',false);
                    }
                    else{
                        otherinput.prop('disabled',true);
                        otherinput.val('');
                    }
                }); 
            })
            
        });
    </script>
    <?php
    
    if(!$api->estAuthentifier())
    {
        echo $layout->render('{{> SimpleMessage}}','Vous devez vous authentifier pour accéder à cette page.');
    }
    else if(!$api->estAdmin())
    {
        echo $layout->render('{{> SimpleMessage}}','Vous devez être un administrateur pour accéder à cette page.');
    }
    else
    {
        
     $list_categories = $api->API_Categories_Lister_Tous();
     
     $tri=$_REQUEST['tri'];
     if (isset($tri) AND !empty($tri))
        {
         SWITCH($tri)
            {
             case "tous":
             $est_terminer=null;
             $tri_tous=1;
             unset($tri_actif);
             unset($tri_inactif);
             break;
             
             case "actif":
             $est_terminer=false;
             $tri_actif=1;
             unset($tri_tous);
             unset($tri_inactif);
             break;
             
             case "inactif":
             $est_terminer=1;
             $tri_inactif=1;
             unset($tri_actif);
             unset($tri_tous);
             break;  
            }
        }
        
       $date_debut=$_REQUEST['date_debut'];
       $date_fin=$_REQUEST['date_fin']; 
       $id_categorie=$_REQUEST['id_categorie'];
       if ( $id_categorie==1000)
            {
               $id_categorie = null;
            }
       
        $categorie_choisi =$api->API_Categorie_Recuperer($id_categorie);
       
        $cycles = $api->API_Cycle_Lister(null, $id_categorie, $date_debut, $est_terminer);
        $categorized =$layout->Lookup($cycles,'categorie',['categorie'=>'categorie']);
        $nb = count($cycles);
       
            foreach ($cycles as $cycle ) { $ids_cycle[]=$cycle->id_cycle; }
        
        $Evnts =$api->API_Evnts_Lister_parcycle($ids_cycle);
       
        
        foreach ( $Evnts as  $Evnt) 
        {
           if($Evnt->type == "semis")
           {
               $Evnts_semis[]=$Evnt;
           }
        }
        
       
     
        
    echo $layout->render('{{> CycleList}}', [
        
        'cycles'=>$categorized,
        'list_categories'=>$list_categories,
        'categorie_choisi'=>$categorie_choisi,
        'tri_tous'=>$tri_tous,
        'tri_actif'=>$tri_actif,
        'tri_inactif'=>$tri_inactif,
        'date_debut'=>$date_debut,
        'date_fin'=>$date_fin
    ]);
    }
        
    $layout->renderFooter();
});
Ejemplo n.º 9
0
API::useAPI(function(API $api){
    
    $layout=new LAYOUT($api); 
    
    echo $layout->renderHeader("Liste des comptes client");
    ?>
    <script src="libs/jquery-1.11.3.js"></script>
    <script>
        $(function(){
            $('[data-autosubmit]').change(function(){
                    $(this.form).submit();
            });
            
            $('[data-autocheck]').each(function(){
                var checkbox = $(this);
                var otherinput= $('#'+checkbox.data('autocheck'));
                checkbox.change(function(){
                    if(checkbox.prop('checked'))
                    {
                        otherinput.prop('disabled',false);
                    }
                    else{
                        otherinput.prop('disabled',true);
                        otherinput.val('');
                    }
                }); 
            })
            
        });
    </script>
    <?php
    
 $comptes = $api->API_Comptes_Lister($id_compte=null, $statut=null, $demande_statut=null, $date_creation_compte=null) ;
 $comptes = $layout->Lookup($comptes,'statut',['statut'=>'statut']);

        foreach($comptes as &$compte)
        {
            $statut =$compte["statut"];
            $compte[$statut]=true;
        }
 
 echo $layout->render('{{> CompteList}}',['comptes'=>$comptes]);
    
        
    $layout->renderFooter();
});
Ejemplo n.º 10
0
require_once('./private/config.php');
require_once('./private/entities.php');
require_once('./private/api.php');
require_once('./private/layout.php');

API::useAPI(function(API $api){
    $layout=new LAYOUT($api);
    
    $id_commande = $_REQUEST['id_commande'];
        
    $commande = $api->API_commande_recuperer($id_commande);
    $compte = $api->API_Compte_Recuperer($commande->id_compte);
    $elements = $api->API_commande_lister_elements($id_commande);
    $pointlivraison_choisi = $api->API_PointLivraison_Recuperer($commande->id_point_livraison);
    $composition = $api->API_Commandes_Composition_Lister(null, $id_commande, 0, null);
    $remise = $api->API_Remises_Lister($composition->id_composition, null, null);
    
    echo $layout->renderHeader("Détail commande n° ".$id_commande);
    
    $categorized =$layout->Lookup($elements,'id_categorie',['id_categorie'=>'id_categorie','categorie'=>'categorie']);
        
    echo $layout->render('{{> CommandeDetailsTest}}', [
        'commande'=>$commande,
        'elements'=>$categorized,
        'compte'=>$compte,
        'pointlivraison_choisi'=>$pointlivraison_choisi,
        'remise' => $remise
    ]);
    
    echo $layout->renderFooter();
});
Ejemplo n.º 11
0
API::useAPI(function(API $api){
    $layout=new LAYOUT($api);
    
    ?>
    <script src="libs/jquery-1.11.3.js"></script>
    <script>
        $(function(){
            $('[data-autosubmit]').change(function(){
                    $(this.form).submit();
            });
            
            $('[data-autocheck]').each(function(){
                var checkbox = $(this);
                var otherinput= $('#'+checkbox.data('autocheck'));
                checkbox.change(function(){
                    if(checkbox.prop('checked'))
                    {
                        otherinput.prop('disabled',false);
                    }
                    else{
                        otherinput.prop('disabled',true);
                        otherinput.val('');
                    }
                }); 
            })
            
        });
    </script>
    <?php
    
    $rechercheProduit=isset($_REQUEST['rechercheProduit'])? (string)$_REQUEST['rechercheProduit']:"";
    $produits = $api->API_produits_lister($rechercheProduit);
    
    $panier = $api->API_panier_recuperer();
    $id_commande = $panier->id_commande; 
    
     //if (isset($_REQUEST['quantite_commande'])) 
    //{
     // $id_composition=$_REQUEST['id_composition'];
     // $quantite = $_REQUEST['quantite_commande'];
     // $commande =  $api->API_Commande_Composition_recuperer($id_composition, $id_commande);
      //if (count($commande)>0 and $commande->quantite_commande_valide==null)
     // {
      //  $api->API_CommandesCreation_Composition_Modifier($id_commande,$id_composition,$quantite);    
     // }
     // else
      //{
        // $api->API_Commandes_Composition_Creer($id_commande,$id_composition,$quantite);
      //}
    //}
    
    
    // on liste et affiche les compositions disponibles
    
    $en_vente = true;
    $composition = $api->API_CompositionEnVente_Lister($id_commande);
    
    // on verifie si commande 
    //foreach ($composition as $compo) 
     //   {
     //   $compo->stocks = $api->API_Composition_Stocks_Lister($compo->id_composition);
     //   $commande =  $api->API_Commande_Composition_recuperer($compo->id_composition, $id_commande);
     //   if (count($commande)>0)
     //   {
     //       $compo->vente = $commande ;    
      //  }
      //   else 
       //     {
       //         $compo->vente = ['quantite_commande_creation'=>null];   
        //    }   
        
        //}
   
     
       
   
   
    if (isset ($_REQUEST['tous_produit']))
        {
         $produits = $api->API_produits_lister($rechercheProduit,false);   
        }
        
    
    echo $layout->renderHeader("Nos Produits");
    
    echo $layout->render("{{>RechercheProduits}}",$rechercheProduit);
    
    
    if(count($produits)==0)
    {
        if(empty($rechercheProduit))
        {
            echo $layout->render("{{>SimpleMessage}}","Il n'y as aucun produit correspondant à votre recherche.");
        }
        else
        {
            echo $layout->render("{{>SimpleMessage}}","Il n'y as aucun produit pour le moment.");
        }
    }
    else if(count($produits)==1)
    {
        echo $layout->render("{{>ProduitDetails}}",$produits[0]);
    }
    else if(count($produits)<=20)
    {
        $categorized =$layout->Lookup($produits,'id_categorie',['id_categorie'=>'id_categorie','categorie'=>'categorie']);
        
        echo $layout->render("{{>ProduitListDetails}}",[
        'categorized'=>$categorized,
        'composition'=>$composition
        ]);
    }
    else
    {   
        $categorized =$layout->Lookup($produits,'id_categorie',['id_categorie'=>'id_categorie','categorie'=>'categorie']);
        echo $layout->render("{{>ProduitListSimple}}",$categorized);
    }
    
    echo $layout->renderFooter();
});
Ejemplo n.º 12
0
API::useAPI(function(API $api){
    $layout=new LAYOUT($api);
    
    if(!$api->estAdmin())
    {   
        echo $layout->renderHeader('Créer une nouvelle page');

        echo $layout->render('{{> SimpleMessage}}','Vous ne pouvez pas créer de nouvelles pages.');
    }
    else 
    {   

        $page=new PageDetail();
        $type = (string)$_REQUEST['type'];
        switch($type)
        {
            case 'CreatePage':
                {
                    
                    $page->menu = $_REQUEST['page']['menu'];
                    $page->titre = $_REQUEST['page']['titre'];
                    $page->visible_par = $_REQUEST['page']['visible_par'];
                    $page->contenue = $_REQUEST['page']['contenue'];
                    $page= $api->API_page_creer($page->menu,$page->titre,$page->visible_par,$page->contenue);
                    if($page)
                    {
                        header('Location: Page.php?id='.$page->id_page);   
                        die();
                    }
                }
                break;
            default:
                {
                    $page->menu = "nouvelle Page";
                    $page->titre = "nouvelle Page";
                    $page->visible_par = PageDetail::VISIBLEPAR_Admin;
                    $page->contenue = "<p>Contenu de la nouvelle page</p>";
                }
                break;
        }
        
        echo $layout->renderHeader('Créer une nouvelle page');

        echo $layout->render('{{> AddPage}}', $page);
    }

    echo $layout->renderFooter();

});
Ejemplo n.º 13
0
<?php
require_once('./private/config.php');
require_once('./private/entities.php');
require_once('./private/api.php');
require_once('./private/layout.php');


API::useAPI(function(API $api){
    $layout=new LAYOUT($api);
    
    if($api->estAuthentifier())
    {
        $api->API_compte_deconnecter();
    }
    
    echo $layout->renderHeader('Déconnection');
    
    echo $layout->render('{{> SimpleMessage}}','Vous êtes maintenant déconnecté, à bientôt.');
    
    echo $layout->renderFooter();
});
Ejemplo n.º 14
0
API::useAPI(function(API $api){
    
    $layout=new LAYOUT($api); 
    
    echo $layout->renderHeader("Mon compte");
    
    if(!$api->estAuthentifier())
    {
        echo $layout->render('{{> SimpleMessage}}','Vous devez vous authentifier pour accéder à cette page.');
    }
    else
    {
        $erreur_change_password="";
        $erreur_demande_statut="";
        $erreur_change_adresses="";
    
        $form_type=isset($_REQUEST['type'])? (string)$_REQUEST['type']:"";
        
        switch($form_type)
        {
            case "Demande-Statut":
                try
                {       
                }
                catch(ErrorException $ex)
                {
                    $erreur_demande_statut=$ex->getMessage();
                }
                break;
            
            case "Change-Password":
                try
                {
                    $form_motdepasse=isset($_REQUEST['motdepasse'])? (string)$_REQUEST['motdepasse']:"";
                    $form_motdepasse_nouveau=isset($_REQUEST['motdepasse_nouveau'])? (string)$_REQUEST['motdepasse_nouveau']:"";
                    $form_motdepasse_nouveau_confirmation=isset($_REQUEST['motdepasse_nouveau_confirmation'])? (string)$_REQUEST['motdepasse_nouveau_confirmation']:"";
                    
                    if(empty($form_motdepasse_nouveau))
                        throw new ErrorException("vous n'avez pas spécifié de mot de passe!");
                    if($form_motdepasse_nouveau!==$form_motdepasse_nouveau_confirmation)
                        throw new ErrorException("Les mots de passes saisie ne se correspondent pas!");
                    
                    $api->API_compte_modifier_mot_de_passe($form_motdepasse,$form_motdepasse_nouveau);
                }
                catch(ErrorException $ex)
                {
                    $erreur_change_password=$ex->getMessage();
                }
                break;
            
            case "Change-Adresses":
                try
                {
                    $form_titre_facturation=isset($_REQUEST['titre_facturation'])? (string)$_REQUEST['titre_facturation']:"";
                    $form_prenom_facturation=isset($_REQUEST['prenom_facturation'])? (string)$_REQUEST['prenom_facturation']:"";
                    $form_nom_facturation=isset($_REQUEST['nom_facturation'])? (string)$_REQUEST['nom_facturation']:"";
                    $form_adresse_facturation=isset($_REQUEST['adresse_facturation'])? (string)$_REQUEST['adresse_facturation']:"";
                    $form_codepostal_facturation=isset($_REQUEST['codepostal_facturation'])? (string)$_REQUEST['codepostal_facturation']:"";
                    $form_ville_facturation=isset($_REQUEST['ville_facturation'])? (string)$_REQUEST['ville_facturation']:"";
                    $form_tel_facturation=isset($_REQUEST['tel_facturation'])? (string)$_REQUEST['tel_facturation']:"";
                    
                    $form_titre_livraison=isset($_REQUEST['titre_livraison'])? (string)$_REQUEST['titre_livraison']:"";
                    $form_prenom_livraison=isset($_REQUEST['prenom_livraison'])? (string)$_REQUEST['prenom_livraison']:"";
                    $form_nom_livraison=isset($_REQUEST['nom_livraison'])? (string)$_REQUEST['nom_livraison']:"";
                    $form_adresse_livraison=isset($_REQUEST['adresse_livraison'])? (string)$_REQUEST['adresse_livraison']:"";
                    $form_codepostal_livraison=isset($_REQUEST['codepostal_livraison'])? (string)$_REQUEST['codepostal_livraison']:"";
                    $form_ville_livraison=isset($_REQUEST['ville_livraison'])? (string)$_REQUEST['ville_livraison']:"";
                    
                    
                    
                    $api->API_Compte_Modifier_Info( 
                        $form_titre_facturation, 
                        $form_prenom_facturation, 
                        $form_nom_facturation, 
                        $form_adresse_facturation, 
                        $form_codepostal_facturation, 
                        $form_ville_facturation,
                        $form_tel_facturation
                        
                    // $form_titre_livraison, 
                    // $form_prenom_livraison, 
                    // $form_nom_livraison, 
                    // $form_adresse_livraison, 
                    // $form_codepostal_livraison, 
                    // $form_ville_livraison
                        );
                }
                catch(ErrorException $ex)
                {
                    $erreur_change_adresses=$ex->getMessage();
                }
                break;
            
            default:
                break;
        }
        $not_etat = 'Création';
        $etat =null;
        $date_debut =null;
        $date_fin =null;

        $compte = $api->compteConnecte();

        $commandes = $api->API_Commande_Lister($compte->id_compte,$etat,$not_etat, $date_debut, $date_fin);
      
         $commandes = $layout->Lookup($commandes,'etat',['etat'=>'etat']);

        foreach($commandes as &$commande)
        {
            $etat =$commande["etat"];
            $commande[$etat]=true;
        }

        echo $layout->render('{{> CompteDetails}}',[
            'compte'=>$compte,
            'erreur_change_password'=>$erreur_change_password,
            'erreur_demande_statut'=>$erreur_demande_statut,
            'erreur_change_adresses'=>$erreur_change_adresses,
            'commandes'=>$commandes
        ]);
    }
        
    $layout->renderFooter();
});
Ejemplo n.º 15
0
API::useAPI(function(API $api){
    $layout=new LAYOUT($api);


$panier = $api->API_panier_recuperer();
$id_commande = $panier->id_commande; 

if($_REQUEST['valider'])
{
    if(isset($_REQUEST['id_point_livraison']))
    {
        $id_point_livraison = $_REQUEST['id_point_livraison'];
        $pointlivraison_choisi = $api->API_PointLivraison_Recuperer($id_point_livraison);
        $msg= $api->API_Commande_quantite_verifier($id_commande,$id_point_livraison); 
        if(COUNT($msg)>0) // il existe des stocks insuffisants
        {
            $message_valider= 'Nous sommes désolé mais nous ne disposons plus des produits suffisants, votre commande a été modifiée en conséquence. N\'oubliez pas de valider la commande si celle-ci vous convient. ';  
        }
        else // les stocks sont vérifiés
        {
            $val = $api->API_Commande_Valider($id_commande,$id_point_livraison);
            $message_valider ='Votre commande d\'un montant de '.round($val->prix_total_commande_ttc , 2).' € a bien été validée sous le n° '.$val->id_commande;
            $panier = $api->API_panier_recuperer(); 
             $id_commande = $panier->id_commande;  
        }
    }
    else 
    {
        $message_valider = 'Merci de séléctionner un lieu de retrait de la commande';
    }
    
}

$pointlivraison = $api->API_PointLivraison_Lister_Tous();   
$compositions = $api->API_Commandes_Composition_Lister(null, $id_commande, $quantite_commande_creation, $quantite_commande_valide);
$elements = $api->API_commande_lister_elements($panier->id_commande);
$categorized =$layout->Lookup($elements,'id_categorie',['id_categorie'=>'id_categorie','categorie'=>'categorie']);

   
    echo $layout->renderHeader("Mon Panier");
    
    echo $layout->render('{{> CommandeDetailsSuite}}', [
        'compositions'=>$compositions,
        'elements'=>$categorized,
        'commande'=>$panier,
        'message_valider' =>$message_valider,
        'pointlivraison' =>$pointlivraison,
        'pointlivraison_choisi' =>$pointlivraison_choisi
    ]);
    
    echo $layout->renderFooter();
});
Ejemplo n.º 16
0
API::useAPI(function(API $api){
    
    $layout=new LAYOUT($api); 
    
    echo $layout->renderHeader("Mes factures");
    
    if(!$api->estAuthentifier())
    {
        echo $layout->render('{{> SimpleMessage}}','Vous devez vous authentifier pour accéder à cette page.');
    }
    else
    {
        
        $not_etat = 'Création';
        $etat =null;
        $date_debut =null;
        $date_fin =null;

        $compte = $api->compteConnecte();

        $factures = $api->API_Factures_Lister($compte->id_compte);
      
         $factures = $layout->Lookup($factures,'etat',['etat'=>'etat']);

        foreach($factures as &$facture)
        {
            $etat =$facture["etat"];
            $facture[$etat]=true;
        }
        
        echo $layout->render('{{> MesFactures}}',[
            'compte'=>$compte,
            'factures'=>$factures
        ]);
    }
        
    $layout->renderFooter();
});
API::useAPI(function(API $api){
    
    $layout= new LAYOUT($api); 
    
    
    if(!$api->estAuthentifier())
    {
        echo $layout->renderHeader("Importations des commandes en préparation");
        echo $layout->render('{{> SimpleMessage}}','Vous devez vous authentifier pour accéder à cette page.');
    }
    else if(!$api->estAdmin())
    {
        echo $layout->renderHeader("Importations des commandes en préparation");
        echo $layout->render('{{> SimpleMessage}}','Vous devez être un administrateur pour accéder à cette page.');
    }
    else
    {
        if (isset($_REQUEST['importer_commandes']))
        {
            $QteReel = $_REQUEST['QteReel'];
            
            foreach($QteReel as $id_commande => $Elm)
            {
                foreach($Elm as $id_produit => $qte)
                {
                    if(isset($qte) && $qte!="" && $qte>=0)
                        $api->API_ElementCommande_Modifier_quantite_reel((float)$qte,$id_commande,$id_produit);
                }
            }
            header('Location: GestionCommandes.php'); 
        }

        // Chargement du fichier Excel
        $xls = PHPExcel_IOFactory::load("Preparations.xlsx");

        $recapsheet=$xls->getSheet(0); 
        $cells= $recapsheet->GetCell('F1');
        $nbre_commande = $cells->getValue();

        $elements=[];

        For($i=1; $i<=$nbre_commande ; $i++ )
        {
            $ActiveSheet=$xls->getSheet($i);
            $id_compte = $ActiveSheet->GetCell('A2')->getValue();  
     
            $grid = $ActiveSheet->rangeToArray(
                'A5:I30',     // The worksheet range that we want to retrieve
                NULL,        // Value that should be returned for empty cells
                TRUE,        // Should formulas be calculated (the equivalent of getCalculatedValue() for each cell)
                FALSE,        // Should values be formatted (the equivalent of getFormattedValue() for each cell)
                TRUE         // Should the array be indexed by cell row and cell column
            );

            $grid = array_filter($grid,function($row){
                return !empty($row['A']); 
            });

            $elements_commande_courante = array_map(
                function($row)use($id_compte){
                    return [
                       'id_compte'=>$id_compte,    
                       'id_commande'=>$row['A'],
                       'id_produit'=> $row['B'],
                       'categorie'=>$row['C'],
                       'produit'=>$row['D'],
                       'quantite_commande'=>$row['E'],
                       'quantite_reel'=>$row['F'],
                       'prix_unitaire_ttc'=>$row['G']
                   ];
                },$grid
            );

            $elements = array_merge($elements, $elements_commande_courante);

        }
        
        $commandes = $layout->Lookup($elements,'id_commande',['id_commande'=>'id_commande']);
        foreach($commandes as &$commande)
        {
            $commande["complete"] = array_reduce(
                $commande['values'],
                function($carry,$row){ return $carry && !empty($row['quantite_reel']); },
                true
            );
        }

        $commandes_Cat = $layout->Lookup($commandes,'complete',['complete'=>'complete']);

        echo $layout->renderHeader("Importations des commandes en préparation");
        echo $layout->render('{{> CommandesImport}}',[
            'commandes'=>$commandes_Cat
        ]);
        
    }
    $layout->renderFooter();
});
Ejemplo n.º 18
0
<?php
require_once('./private/config.php');
require_once('./private/bdd.php');
require_once('./private/api.php');
require_once('./private/layout.php');

API::useAPI(function(API $api){
    
    $layout=new LAYOUT($api); 
    
    echo $layout->renderHeader("Mon Compte");
    
    echo $layout->render('{{> MiseEnPage}}',['comptes'=>$comptes,
                                                   'id_compte_choisi' =>$id_compte_choisi,
                                                   'reglements' =>$reglements,
                                                   'factures' =>$factures,
                                                   'msg' =>$msg
                                                   ]);
    
        
    $layout->renderFooter();
});
Ejemplo n.º 19
0
API::useAPI(function(API $api){
    
    $layout=new LAYOUT($api); 
    
    echo $layout->renderHeader("Stocks des produits");
    ?>
    <script src="libs/jquery-1.11.3.js"></script>
    <script>
        $(function(){
            $('[data-autosubmit]').change(function(){
                    $(this.form).submit();
            });
            
            $('[data-autocheck]').each(function(){
                var checkbox = $(this);
                var otherinput= $('#'+checkbox.data('autocheck'));
                checkbox.change(function(){
                    if(checkbox.prop('checked'))
                    {
                        otherinput.prop('disabled',false);
                    }
                    else{
                        otherinput.prop('disabled',true);
                        otherinput.val('');
                    }
                }); 
            })
            
        });
    </script>
    <?php
    
    if(!$api->estAuthentifier())
    {
        echo $layout->render('{{> SimpleMessage}}','Vous devez vous authentifier pour accéder à cette page.');
    }
    else if(!$api->estAdmin())
    {
        echo $layout->render('{{> SimpleMessage}}','Vous devez être un administrateur pour accéder à cette page.');
    }
    else
    {   
        
                if(isset($_REQUEST['QteReel']))
                    {   
                        $quantite_bloque = $_REQUEST['quantite_bloque'];
                        $nom = $_REQUEST['nom'];
                        $type_remise_choisi = $_REQUEST['type_remise'];
                        $realisation_compostion =true;
                        $QteReel = $_REQUEST['QteReel'];
                        $id_commande=null;
                        foreach($QteReel as $id_produit => $Elm)
                        {
                            foreach($Elm as $prix_unitaire_ttc => $qte)
                            {
                            (float)$total_ttc=$prix_unitaire_ttc*$qte;
                            $calculs[]=['id_produit'=>$id_produit,
                                        'prix_unitaire_ttc'=>$prix_unitaire_ttc,
                                        'qte'=>$qte,
                                        'total_ttc'=>$total_ttc,
                                        'details'=>$api->API_produit_recuperer_hors_commande($id_produit, $id_commande)];
                            }
                        }
                        $total_compo_ttc = (float)$total_compo_ttc;
                        $nbre_elements = (int)$nbre_elements;
                        foreach ($calculs as $calcul)
                        {
                        $total_compo_ttc = $total_compo_ttc + $calcul['total_ttc'];
                        if ($calcul['qte']> 0)
                                {
                                    $nbre_elements = $nbre_elements + 1 ;
                                }
                        }
                        if (isset($_REQUEST['remise']))
                            {
                                $remise = (float)$_REQUEST['remise'];
                                $total_compo_ttc = $total_compo_ttc - $remise;
                            } else { $remise = 0 ;}
                        $detail_composition = [];
                        $detail_composition = ['remise'=>$remise,
                                            'nbre_elements' =>$nbre_elements,
                                            'total_compo_ttc' =>$total_compo_ttc,
                                            'nom' =>$nom,
                                            'quantite_bloque' =>$quantite_bloque
                                            ];
                                            
                    
                    }
                        if(isset($_REQUEST['valider_composition']))
                        {
                            if(isset($_REQUEST['QteReel']))
                            {   
                                $poids_unitaire=null;
                                $produit = $nom;
                                $prix_unitaire_ttc_apres_remise = $detail_composition['total_compo_ttc'];
                                $en_vente=true;
                                $id_composition = $api->API_Composition_Creer($remise, $nom, $en_vente, $quantite_bloque, $prix_unitaire_ttc_apres_remise, $type_remise_choisi);
                                foreach ($calculs as $calcul)
                                {   
                                    if ($calcul['qte']!= 0)
                                    {
                                        $quantite_bloque = $_REQUEST['quantite_bloque'];
                                        $id_produit = $calcul['id_produit'];
                                        $quantite_dans_composition = $calcul['qte'];
                                        $quantite_bloque = $quantite_bloque * $quantite_dans_composition ;
                                        $api->API_Elements_Composition_Creer($id_composition, $id_produit, $quantite_dans_composition, $quantite_bloque);
                                    }
                                }
                              header('Location: DetailComposition.php?id_composition='.$id_composition.'');      
                            }
                            
                        }
                
                    
                    
                if(isset($_REQUEST['creation_composition']))
                    {
                        $realisation_compostion =true;
                        $list_type_remise=[];
                        $list_type_remise = ['Remise sur composition',
                                             'Remise sur grande quantité',
                                             'Remise découverte']; 
                                      
                    }
       
        $produits=[];
        $id_commande = null;
        foreach ($api->API_Stocks_Lister() as $stocks)   
        {
            if($stocks->StockProd!=0 or $stocks->StockVentePrev!=0) 
            {
                
                $produits[] = $api->API_produit_recuperer_hors_commande($stocks->id_produit, $id_commande);
                
            }   
        }
        $categorized =$layout->Lookup($produits,'categorie',['categorie'=>'categorie']);
        foreach ($categorized as $categorize) {
           
        }
        
        
        echo $layout->render('{{> StocksList}}', [
        
        'produits'=>$categorized,
        'realisation_compostion'=>$realisation_compostion,
        'calculs'=>$calculs,
        'detail_composition' =>$detail_composition,
        'list_type_remise' =>$list_type_remise,
        'type_remise_choisi' =>$type_remise_choisi
    ]);
       
     }
        
    $layout->renderFooter();
});
Ejemplo n.º 20
0
<?php
require_once('./private/config.php');
require_once('./private/api.php');
require_once('./private/layout.php');

API::useAPI(function(API $api){

    $id_page = (int)$_REQUEST['id'];
    
    $layout=new LAYOUT($api);

    $page = $api->API_page_recuperer($id_page);
	
    echo $layout->renderHeader($page->titre);
    
    echo $layout->render('{{> Page}}',$page);
    
    echo $layout->renderFooter();
},true);
Ejemplo n.º 21
0
<?php
require_once('./private/config.php');
require_once('./private/entities.php');
require_once('./private/api.php');
require_once('./private/layout.php');

API::useAPI(function(API $api){
    
    $layout=new LAYOUT($api); 
    
    echo $layout->renderHeader("Gestion des factures");
    
    if(!$api->estAuthentifier())
    {
        echo $layout->render('{{> SimpleMessage}}','Vous devez vous authentifier pour accéder à cette page.');
    }
    else 
    if(!$api->estAdmin())
    {
        echo $layout->render('{{> SimpleMessage}}','Vous devez être un administrateur pour accéder à cette page.');
    }
    else
    {
        $reglement = (int)$_REQUEST['tri'];
        $factures = $api->API_Facture_Lister_Par_Reglement($reglement);
        $factures = $layout->Lookup($factures,'reglement',['reglement'=>'reglement']);
        echo $layout->render('{{> FactureList}}',['factures'=>$factures]);
    }
        
    $layout->renderFooter();
});
API::useAPI(function(API $api){
    
    $layout= new LAYOUT($api); 
    
    
    if(!$api->estAuthentifier())
    {
        echo $layout->renderHeader("Export des commandes en préparation");
        echo $layout->render('{{> SimpleMessage}}','Vous devez vous authentifier pour accéder à cette page.');
        echo $layout->renderFooter();
    }
    else if(!$api->estAdmin())
    {
        echo $layout->renderHeader("Export des commandes en préparation");
        echo $layout->render('{{> SimpleMessage}}','Vous devez être un administrateur pour accéder à cette page.');
        echo $layout->renderFooter();
    }
    else
    {

        $commandesaexport = $api->API_Commande_Lister(null,Commande::ETAT_PREPARATION,null,null,null,false);

        $xls = new PHPExcel();

        $recapsheet=$xls->getSheet(0);
        $recapsheet->setTitle("Recapitilatif");
        $nbre_commandes=0;

        $recap=[['# produit', 'categorie','produit','quantité commandé']];

        foreach($commandesaexport as &$commande)
        {
            $elements = $api->API_commande_lister_elements($commande->id_commande);
            $compte = $api->API_Compte_Recuperer($commande->id_compte);

            $grid2=[['# Client','Nom','Prénom','email','Téléphone','Lieu de livraison']];
            $grid2[] = [
                        $compte->id_compte,
                        $compte->nom_facturation,
                        $compte->prenom_facturation,
                        $compte->email,
                        $compte->tel_facturation,
                        $compte->lieu-livraison
                    ];       

            $grid=[['# commande','# produit','categorie','produit','quantite_commande','quantite_reel','PUTTC','PTTC Commande','PTTC Commande Réel']];
            foreach($elements as $elm)
            {
                $grid[] = [
                        $elm->id_commande,
                        $elm->id_produit,
                        $elm->categorie,
                        $elm->produit,
                        $elm->quantite_commande,
                        $elm->quantite_reel,
                        $elm->prix_unitaire_ttc,
                        '=OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),0,-3)*OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),0,-1)',
                        '=OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),0,-3)*OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),0,-2)'
                    ];

                if(!isset($recap[$elm->id_produit]))
                {
                    $recap[$elm->id_produit]=[$elm->id_produit,$elm->categorie,$elm->produit,0.0];
                }
                if($elm->quantite_reel===null)
                {
                    $recap[$elm->id_produit][3] += $elm->quantite_commande;
                }
            }
            
            $sheet = new PHPExcel_Worksheet($xls,"commande ".$commande->id_commande);
            $sheet->fromArray(
                $grid2,       // The data to set
                NULL,        // Array values with this value will not be set
                'A1'         // Top left coordinate of the worksheet range where we want to set these values (default is A1)
            );
            $sheet->fromArray(
                $grid,       // The data to set
                NULL,        // Array values with this value will not be set
                'A4'         // Top left coordinate of the worksheet range where we want to set these values (default is A1)
            );
            $xls->addSheet($sheet);
            $nbre_commandes = $nbre_commandes+1;
        }
        $recapsheet->SetCellValue('F1', $nbre_commandes);
        $recapsheet->fromArray(
            $recap,       // The data to set
            NULL,        // Array values with this value will not be set
            'A1'         // Top left coordinate of the worksheet range where we want to set these values (default is A1)
        );

        $xlsWriter = new PHPExcel_Writer_Excel2007($xls);
        $file = tempnam(sys_get_temp_dir(), 'Tux');
        $xlsWriter->save($file);
        header('Content-Description: File Transfer');
        header('Content-Type: application/octet-stream');
        header('Content-Disposition: attachment; filename=Preparations.xlsx');
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
        header('Content-Length: ' . filesize($file));
        ob_clean();
        flush();
        readfile($file);
        unlink($file);
    }
});
Ejemplo n.º 23
0
API::useAPI(function(API $api){
    $layout=new LAYOUT($api);
    $erreurauth="";
    $erreurcrea="";
    
    if(!$api->estAuthentifier())
    {   
        $email=isset($_REQUEST['email'])? (string)$_REQUEST['email']:"";
        $motdepasse=isset($_REQUEST['motdepasse'])? (string)$_REQUEST['motdepasse']:"";
        $type=isset($_REQUEST['type'])? (string)$_REQUEST['type']:"";
        
        if(!empty($email) && !empty($motdepasse))
        {
            if($type=='CREATION')
            {
                $motdepasse_confirmation = (string)$_REQUEST['motdepasse_confirmation'];
                if($motdepasse_confirmation===$motdepasse)
                {
                    try
                    {
                        $api->API_compte_creer($email, $motdepasse);
                        header('location:MonCompte.php');
                        return;
                        
                    }
                    catch(Exception $ex)
                    {
                        $erreurauth= $ex->getMessage();
                    }
                }
                else
                {
                    $erreurcrea= 'Les mots de passe ne correspondent pas!';
                }
            }
            else
            {
                try
                {
                    $api->API_compte_authentifier($email, $motdepasse);
                }
                catch(Exception $ex)
                {
                    $erreurauth= $ex->getMessage();
                }
            }
        }
    }
     
    echo $layout->renderHeader('Connexion');
        
    if(!$api->estAuthentifier())
    {   
        echo $layout->render('{{> Connection}}', $erreurauth);
        
        echo $layout->render('{{> CreationCompte}}', $erreurcrea);
    }
    else
    {
        
        echo $layout->render('{{> info_message}}','');
    }
    
    echo $layout->renderFooter();
});