Untitled

mail@pastecode.io avatar
unknown
abap
2 years ago
2.1 kB
1
Indexable
Never
/** PROSES PENGURANGAN TOTAL STOK ROLL */
    if ($jmlh_pakai_roll <= $stok_roll) {
      echo 'masuk';
      foreach ($sqlpilihroll as $row) {
        $id_bb = $row['id_bb'];
        $kode_bb = $row['kode_bb'];
        $jmlh_roll = $row['jmlh_roll'];

        if ($jmlh_pakai_roll > 0) {
          // buat var $temp sbg. pengurang 
          $temp = $jmlh_pakai_roll;

          /** PROSES PENGURANGAN ROLL */
          $jmlh_pakai_roll = $jmlh_pakai_roll - $jmlh_roll;
          $jmlh_roll - $temp;

          if ($jmlh_pakai_roll > 0) {
            $stok_update = 0;
            $stok_update1 = $jmlh_roll;
          } else {
            $stok_update = $jmlh_roll - $temp;
            $stok_update1 = $temp;
          }

          /** PROSES PENGURANGAN STOCK KG */
          if ($jmlh_pakai_kg <= $stok_allkg) {
            echo 'masuk';
            foreach ($sqlpilihkg as $roww) {
              $id_bb = $roww['id_bb'];
              $jmlh_kg = $roww['jmlh_kg'];
            }
            if ($jmlh_pakai_kg > 0) {
              // buat var $temp sbg. pengurang Jumlah KG
              $temp = $jmlh_pakai_kg;

              //proses pengurangan kg
              $jmlh_pakai_kg = $jmlh_pakai_kg - $jmlh_kg;
              $jmlh_kg - $temp;

              if ($jmlh_pakai_kg > 0) {
                $stok_updatekg = 0;
                $stok_updatekg1 = $jmlh_kg;
              } else {
                $stok_updatekg = $jmlh_kg - $temp;
                $stok_updatekg1 = $temp;
              }

              $this->db->set('jmlh_roll', $stok_update);
              $this->db->where('kode_bb', $bahan_pakai);
              $this->db->where('id_bb', $id_bb);
              $this->db->update('tb_bahanbaku');
              var_dump($stok_update);
              var_dump($stok_updatekg);
              $this->db->set('jmlh_kg', $stok_updatekg);
              $this->db->where('kode_bb', $bahan_pakai);
              $this->db->where('id_bb', $id_bb);
              $this->db->update('tb_bahanbaku');