Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for($i=29; $i >= 0; $i--){
- $total = array();
- // $time = strtotime("2010.12.11");
- // $final = date("Y-m-d", strtotime("-".$i." days"));
- $query = "SELECT
- ( (a.replacement / b.counter) * (b.cost * b.price)) AS total
- FROM sppct a
- LEFT JOIN sppct_detail b ON a.id = b.idsppct
- WHERE a.plant = '$pl' AND a.part = '$kodepart' AND a.line = '$kodeline' AND DATE_FORMAT(a.datetime, '%Y-%m-%d') = DATE_ADD(CURDATE(), INTERVAL -$i DAY)";
- // echo $query."<br><br>";
- $que = mysqli_query($koneksi, $query) or die(mysqli_error($koneksi));
- $count = mysqli_num_rows($que);
- if($count == 0){
- $total [] = 0;
- }else{
- while($res = mysqli_fetch_array($que)){
- $total[] = $res['total'];
- // echo $res['total'];
- }
- }
- // print_r($total);
- // echo " | ".$x." <br>";
- // $x++;
- ${'totalcostpart' . $kodepart}[] = number_format(array_sum($total),2,".","");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement