<?php
session_start();
    header('Access-Control-Allow-Origin:*');
    header('Content-Type; application/json; charset=utf-8');
    header('Access-control-Allow-Method: POST');
    header('Access-control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-request-With');
    include('db.php');
        $inputdata = json_decode(file_get_contents("php://input"), true);
        
        $deb = date('Y-m-d', mktime(0, 0, 0, date('m'), date('01'), date('Y')));

        $fin = date('Y-m-d', mktime(0, 0, 0, date('m'), date('31'), date('Y')));
        
        
        
        $pub=$db->prepare('SELECT SUM(nap) AS somme FROM tbl_invoice WHERE order_date BETWEEN ? AND ?');
        $pub->execute(array($deb, $fin));
        $image = $pub->fetchAll();    
        echo(json_encode(['data' => $image]));