<commit_before><?php

namespace mgate\StatBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use JMS\SecurityExtraBundle\Annotation\Secure;

use Ob\HighchartsBundle\Highcharts\Highchart;

use mgate\SuiviBundle\Entity\EtudeRepository;

class DefaultController extends Controller
{
    /**
     * @Secure(roles="ROLE_SUIVEUR")
     */
    public function indexAction()
    {
        // Chart
        $series = array(
            array("name" => "Data Serie Name",    "data" => array(1,2,4,5,6,3,8))
        );

        $ob = new Highchart();
        $ob->chart->renderTo('linechart');  // The #id of the div where to render the chart
        $ob->title->text('Chart Title');
        $ob->xAxis->title(array('text'  => "Horizontal axis title"));
        $ob->yAxis->title(array('text'  => "Vertical axis title"));
        $ob->series($series);

        return $this->render('mgateStatBundle:Default:test.html.twig', array(
            'chart' => $ob
        ));
    }
    
    /**
     * @Secure(roles="ROLE_SUIVEUR")
     */    
    public function caAction()
    {
        $em = $this->getDoctrine()->getManager();
        $etude = new \mgate\SuiviBundle\Entity\Etude;
        $etudes = $em->getRepository('mgateSuiviBundle:Etude')->getEtudesCa();
        
        $ca = array();
        $cumul=0;
        foreach ($etudes as $etude) {
            echo "bite";
            if($etude->getCc())
            {
                if($etude->getCc()->getDateSignature() )
                {
                    $cumul+= $this->get('mgate.etude_manager')->getTotalHT($etude);
                    $value = array();
                    $value[]=$etude->getCc()->getDateSignature()->getTimestamp()*1000;
                    $value[]=$cumul;
                    $ca[] = $value;
                }
            }
       }
        
        
        
        // Chart
        $series = array(
            array("name" => "Chiffre d'Affaire total",    "data" => $ca)
        );

        $ob = new Highchart();
        $ob->global->useUTC(false);
        $ob->chart->renderTo('linechart');  // The #id of the div where to render the chart
        $ob->title->text('Chiffre d\'Affaire titre du graph');
        $ob->xAxis->title(array('text'  => "Horizontal axis title"));
        $ob->xAxis->type('datetime');
        $ob->yAxis->title(array('text'  => "Vertical axis title"));
        $ob->series($series);

        return $this->render('mgateStatBundle:Default:ca.html.twig', array(
            'chart' => $ob
        ));
    }
}<commit_msg>amelioration stat CA signé<commit_after><?php

namespace mgate\StatBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use JMS\SecurityExtraBundle\Annotation\Secure;

use Ob\HighchartsBundle\Highcharts\Highchart;

use mgate\SuiviBundle\Entity\EtudeRepository;

class DefaultController extends Controller
{
    /**
     * @Secure(roles="ROLE_SUIVEUR")
     */
    public function indexAction()
    {
        // Chart
        $series = array(
            array("name" => "Data Serie Name",    "data" => array(1,2,4,5,6,3,8))
        );

        $ob = new Highchart();
        $ob->chart->renderTo('linechart');  // The #id of the div where to render the chart
        $ob->title->text('Chart Title');
        $ob->xAxis->title(array('text'  => "Horizontal axis title"));
        $ob->yAxis->title(array('text'  => "Vertical axis title"));
        $ob->series($series);

        return $this->render('mgateStatBundle:Default:test.html.twig', array(
            'chart' => $ob
        ));
    }
    
    /**
     * @Secure(roles="ROLE_SUIVEUR")
     */    
    public function caAction()
    {
        $etudeManager = $this->get('mgate.etude_manager');
        $em = $this->getDoctrine()->getManager();
        $etude = new \mgate\SuiviBundle\Entity\Etude;
        $etudes = $em->getRepository('mgateSuiviBundle:Etude')->getEtudesCa();
        
        $data = array();
        $cumul=0;
        foreach ($etudes as $etude) {

            if($etude->getCc())
            {
                if($etude->getCc()->getDateSignature() )
                {
                    $cumul+= $etudeManager->getTotalHT($etude);
                    
                    $data[]= array( "x"=>$etude->getCc()->getDateSignature()->getTimestamp()*1000,
                                    "y"=>$cumul, "name"=>$etudeManager->getRefEtude($etude)." - ".$etude->getNom(),
                                    'date'=>$etude->getCc()->getDateSignature()->format('d/m/Y'),
                                    'prix'=>$etudeManager->getTotalHT($etude));
                    
                }
            }
       }
        
        
        
        // Chart
        $series = array(
            array("name" => "Chiffre d'Affaire total",    "data" => $data)
        );

        $ob = new Highchart();
        $ob->global->useUTC(false);
        $ob->chart->renderTo('linechart');  // The #id of the div where to render the chart
        $ob->title->text('Chiffre d\'Affaire titre du graph');
        $ob->xAxis->title(array('text'  => "Date"));
        $ob->xAxis->type('datetime');
        $ob->yAxis->title(array('text'  => "Chiffre d'Affaire cumulé"));
        $ob->tooltip->headerFormat('<b>{series.name}</b><br />');
        $ob->tooltip->pointFormat('{point.y} le {point.date}<br />{point.name} à {point.prix} €');
        $ob->series($series);

        return $this->render('mgateStatBundle:Default:ca.html.twig', array(
            'chart' => $ob
        ));
    }
}
{'fraction_non_alphanumeric': 0.17325117796303008, 'fraction_numerical': 0.004349401957230881, 'mean_word_length': 1.968800430338892, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 114, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4039137', 'n_tokens_mistral': 1732, 'n_tokens_neox': 1685, 'n_words': 275}