SHARE
TWEET

Untitled

a guest Dec 11th, 2019 123 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. for($i=29; $i >= 0; $i--){
  2.         $total = array();
  3.         // $time = strtotime("2010.12.11");
  4.         // $final = date("Y-m-d", strtotime("-".$i." days"));
  5.         $query = "SELECT
  6.         ( (a.replacement / b.counter) * (b.cost * b.price)) AS total
  7.         FROM sppct a
  8.         LEFT JOIN sppct_detail b ON a.id = b.idsppct
  9.         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)";
  10.         // echo $query."<br><br>";
  11.         $que = mysqli_query($koneksi, $query) or die(mysqli_error($koneksi));
  12.         $count = mysqli_num_rows($que);
  13.         if($count == 0){
  14.           $total [] = 0;
  15.         }else{
  16.           while($res = mysqli_fetch_array($que)){
  17.             $total[] = $res['total'];
  18.             // echo $res['total'];
  19.           }
  20.         }
  21.         // print_r($total);
  22.         // echo " | ".$x." <br>";
  23.         // $x++;
  24.         ${'totalcostpart' . $kodepart}[] = number_format(array_sum($total),2,".","");
  25.       }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top