Пример #1
0
         }
         echo json_encode($donnee_an);
     } catch (PDOException $e) {
         echo $e->getMessage();
     }
 } elseif ($data3 == "sous_tot") {
     $donnee_an = array();
     try {
         foreach ($_POST['liste_vetos'] as $key => $value) {
             $donne_init2 = requetemysql::sous_tot(array('debut' => $_POST['debut'], 'fin' => $_POST['fin'], 'permission' => $value['login'], 'recherche' => 'totale'));
             $donne_init = requetemysql::sous_tot(array('debut' => $_POST['debut'], 'fin' => $_POST['fin'], 'permission' => $value['login'], 'recherche' => 'total'));
             $donne_esp = requetemysql::sous_tot(array('debut' => $_POST['debut'], 'fin' => $_POST['fin'], 'permission' => $value['login'], 'recherche' => 'espece'));
             $donne_cheq = requetemysql::sous_tot(array('debut' => $_POST['debut'], 'fin' => $_POST['fin'], 'permission' => $value['login'], 'recherche' => 'cheque'));
             $donne_carte = requetemysql::sous_tot(array('debut' => $_POST['debut'], 'fin' => $_POST['fin'], 'permission' => $value['login'], 'recherche' => 'carte'));
             $donne_vir = requetemysql::sous_tot(array('debut' => $_POST['debut'], 'fin' => $_POST['fin'], 'permission' => $value['login'], 'recherche' => 'virement'));
             $donne_repartition = requetemysql::sous_tot(array('debut' => $_POST['debut'], 'fin' => $_POST['fin'], 'permission' => $value['login'], 'recherche' => 'repartition'));
             $array_tempo = array('sous_tot_nom' => $value['login'], 'sous_tot_ttc' => arrondi($donne_init2[0]['total']), 'sous_tot_ht' => arrondi($donne_init[0]['total'] / (1 + $_POST['tva'])), 'sous_tot_tva' => arrondi($donne_init[0]['total'] - $donne_init[0]['total'] / (1 + $_POST['tva'])), 'sous_tot_ttc2' => arrondi($donne_init[0]['totalttc']), 'sous_tot_ttc3' => arrondi($donne_init[0]['reglementttc']), 'sous_tot_acte' => arrondi($donne_init[0]['reglement_acte']), 'sous_tot_medic' => arrondi($donne_init[0]['reglement_medic']), 'sous_tot_tot_acte' => arrondi($donne_init[0]['total_acte']), 'sous_tot_tot_medic' => arrondi($donne_init[0]['total_medic']), 'sous_tot_espece' => arrondi($donne_esp[0]['total']), 'sous_tot_cheque' => arrondi($donne_cheq[0]['total']), 'sous_tot_carte' => arrondi($donne_carte[0]['total']), 'sous_tot_virement' => arrondi($donne_vir[0]['total']), 'sous_tot_repartition' => arrondi($donne_repartition[0]['total']));
             array_push($donnee_an, $array_tempo);
         }
         echo json_encode($donnee_an);
     } catch (PDOException $e) {
         echo $e->getMessage();
     }
 } elseif ($data3 == "vente") {
     $donnee = array();
     $search_vente = requetemysql::vente(array('debut' => $_POST['debut'] * 1000, 'fin' => $_POST['fin'] * 1000));
     foreach ($search_vente as $key => $value) {
         $value2 = json_decode($value['medic'], true);
         foreach ($value2 as $key_unit => $value_unit) {
             $array_tempo = array('date_vente' => $value['date_medoc'], 'nom' => $value_unit['nom'], 'nombre' => $value_unit['quantite']);
             array_push($donnee, $array_tempo);