check etiquette perdu script

$p_simple = DB::table('product_simple')->get();
foreach ($p_simple as $s) {
   $sku = $s->sku;
   $etiquette = $s->etiquette;
   $update_p = (array)DB::table('db_update')->where('sku', $s->sku)->get();
   $new_label = "";
   $new_label_arr = explode(',', $etiquette);
   $lost_label = array();
   $exit_label=array();
   foreach ($update_p as $u) {


      if ($u->qty === null && $u->etiquette !== null) {
         if (in_array($u->etiquette, $new_label_arr) === false && in_array($u->etiquette, $lost_label)==false) {
            $lost_label[] = $u->etiquette;
         }elseif(in_array($u->etiquette, $new_label_arr)&& in_array($u->etiquette, $exit_label)==false)
         {
            $exit_label[]=$u->etiquette;
         }

      }


   }
   if(empty($lost_label)===false) {
      echo 'sku=>'.$sku.'  orginal->'.$etiquette." "."lost->".implode(',',$lost_label)."exit->".implode(',',$exit_label);
      echo '<br/>';
   }
}

Leave a Comment