Bonjour Mika,

Je voudrais savoir pourquoi j'ai cette erreur :

Division by zero
#0 C:\wamp\www\mkframework\data\genere\HyperInterim\plugin\plugin_chart.php(334): exception_error_handler(2, 'Division by zer...', 'C:\\wamp\\www\\mkf...', 334, Array)
#1 C:\wamp\www\mkframework\data\genere\HyperInterim\plugin\plugin_chart.php(66): plugin_chartPie->show()
#2 C:\wamp\www\mkframework\data\genere\HyperInterim\module\statistiques\view\statistiquecomplex.php(53): plugin_chart->show()
#3 C:\wamp\www\mkframework\lib\framework\class_view.php(85): include('C:\\wamp\\www\\mkf...')
#4 C:\wamp\www\mkframework\lib\framework\class_layout.php(158): _view->show()
#5 C:\wamp\www\mkframework\data\genere\HyperInterim\layout\bootstrap.php(32): _layout->load('main')
#6 C:\wamp\www\mkframework\lib\framework\class_layout.php(122): include('C:\\wamp\\www\\mkf...')
#7 C:\wamp\www\mkframework\data\genere\HyperInterim\module\statistiques\main.php(217): _layout->show()
#8 C:\wamp\www\mkframework\lib\framework\class_root.php(276): module_statistiques->after()
#9 C:\wamp\www\mkframework\data\genere\HyperInterim\public\index.php(47): _root->run()
#10 {main}
Je te met mon code a disposition :

Ma vue:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
 <?php 
$oForm=new plugin_form();
?>
 
<h2><center>Statistique</center></h2><br><br>
 
<form action="" method="POST">
 
Rayon Affectation <?php echo $oForm->getSelect('rayonaffects',$this->tstatistique,array('onChange'=>'this.parentNode.submit()'))?><br><br>
 
		<center><div class="col-sm-offset-2 col-sm-10">
		<input type="submit" name="Trans" class="btn btn-success" value="Transféré les données" /> 
		</center></div><br>
 
		<center><div class="col-sm-offset-2 col-sm-10">
		<input type="submit" name="Eff" class="btn btn-success" value="Vider la table" /> 
		</center></div><br><br><br>
 
		<center><div class="col-sm-offset-2 col-sm-10">
		<input type="submit" name="Raf" class="btn btn-success" value="Rafraichir" /><br><br> 
		</center></div>
 
		</form>
 
<p>&nbsp;</p>
 
<?php if(isset($this->oChartPie) ):?>
 
<h1><center>Total heures par Rayon </center></h1><br><br>
 
<table class="table">
 
		<tr>
			<th>Rayon</th>
			<th>Total Heure</th>
		</tr>
 
		<?php foreach($this->tData as $data):?>
 
		<?php list($rayonaffects,$nbheuremissiontotal)=$data;?>
 
		<tr>
				<td><?php echo $rayonaffects?></td>
				<td><?php echo $nbheuremissiontotal?></td>
			</tr>
 
			<?php endforeach;?>
	</table>
 
	<p>&nbsp;</p>
 
 
<center><?php echo $this->oChartPie->show()?></center>
 
<?php endif;?>
Mon main (la partie concerné):
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
public function _statistiquecomplex(){
 
		if(_root::getParam('Trans') ){
 
			$tStatistique=model_mission::getInstance()->transmission(_root::getAuth()->getAccount()->magasin_id, _root::getAuth()->getAccount()->magasin_id, 
			_root::getAuth()->getAccount()->magasin_id, _root::getAuth()->getAccount()->magasin_id, _root::getAuth()->getAccount()->magasin_id,  _root::getAuth()->getAccount()->magasin_id, _root::getAuth()->getAccount()->magasin_id, _root::getAuth()->getAccount()->magasin_id, _root::getAuth()->getAccount()->magasin_id, _root::getAuth()->getAccount()->magasin_id);
 
		}
 
		if(_root::getParam('Eff') ){
 
			$tStatistique=model_mission::getInstance()->effmission();
 
		}
 
		if(_root::getParam('Raf') ){
 
		$tStatistique=model_statistique::getInstance()->missioncalcul();
		$tStatistique=model_statistique::getInstance()->missioncalcul2();
		}
 
		$oView=new _view('statistiques::statistiquecomplex');
 
		$tstatistique=model_statistique::getInstance()->getSelect();
 
		$oView->tstatistique=$tstatistique;
 
		$sRayAffects= _root::getParam('rayonaffects');
 
		$tjours=$this->getResultat( _root::getAuth()->getAccount()->magasin_id, $sRayAffects);
 
		if($tjours){
			$tData=array();
			foreach($tjours as $ojour){
				$tData[]=array($ojour->rayonaffects, $ojour->heuretotal);
		}
 
		$oChartPie=new plugin_chart('PIE',400,200);
		$oChartPie->setTextSizeLegend('12px arial');
		$oChartPie->setData($tData);
 
		//coordonnees de la legende
	    $oChartPie->setCoordLegend(220,60);
 
		$oView->oChartPie=$oChartPie;
 
		$oView->tData=$tData;
		}
 
		$this->oLayout->add('main',$oView);
 
	}
Mon modele
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
class model_statistique extends abstract_model{
 
	protected $sClassRow='row_statistique';
 
	protected $sTable='statistique';
	protected $sConfig='hyperinterim';
 
	protected $tId=array('idstatistique');
 
	public static function getInstance(){
		return self::_getInstance(__CLASS__);
	}
 
	public function findById($uId){
		return $this->findOne('SELECT * FROM '.$this->sTable.' WHERE idstatistique=?',$uId );
	}
	public function findAll(){
		return $this->findMany('SELECT * FROM '.$this->sTable);
	}
 
	public function missioncalcul(){
		return $this->execute('
		
		UPDATE statistique
		
		SET nbheuremoisrayon = SEC_TO_TIME( TIME_TO_SEC(nbheurejourmission) * pourcentages / 100),
			montantmoisrayon = cast( TIME_TO_SEC(nbheuremoisrayon)/3600 * prixdeagence * pourcentages / 100 as decimal(10,2)) 
		
		WHERE MONTH(datedebs) = MONTH(datefins)
		');
 
	}
 
	public function missioncalcul2(){
		return $this->execute('
		
		UPDATE statistique
		
		SET
			nbjourmission = DATEDIFF(datedebs, datefins),
			nbheuremoisrayon = SEC_TO_TIME( TIME_TO_SEC(nbheurejourmission) * pourcentages / 100),
			montantmoisrayon = cast( TIME_TO_SEC(nbheuremoisrayon)/3600 * prixdeagence * pourcentages / 100 as decimal(10,2)) 
		
		WHERE MONTH(datedebs) != MONTH(datefins)
		');
 
	}
 
	public function findbyRay($magId){
		return $this->findManySimple('SELECT DISTINCT rayonaffects FROM '.$this->sTable.'');
	}
 
	public function getSelect(){
		$tab=$this->findbyRay(_root::getAuth()->getAccount()->magasin_id);
		$tSelect=array(null);
		if($tab){
		foreach($tab as $oRow){
			$tSelect[ $oRow->rayonaffects ]=$oRow->rayonaffects;
		}
		}
		return $tSelect;
	}
 
	public function listrayon($magId, $rayonaffects){
		return $this->findMany('
		SELECT DISTINCT
		rayonaffects,
		IF(rayonaffects=rayonaffects, SEC_TO_TIME(SUM(DISTINCT TIME_TO_SEC(nbheuremoisrayon))),nbheuremoisrayon) AS heuretotal

		FROM statistique

		INNER JOIN user
				ON statistique.magasin_ids=user.magasin_id

		WHERE
		magasin_ids=?
		AND 
		rayonaffects=?
		
			',$magId, $rayonaffects);
	}