Advertisement
fadlyshafa

Untitled

Aug 1st, 2019
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.60 KB | None | 0 0
  1. if($request->hasFile('sample_file')){
  2.             $path = $request->file('sample_file')->getRealPath();
  3.             $data = \Excel::load($path)->get();
  4.             // dd($data);
  5.             if($data->count()){
  6.                 $uuid = \Uuid::generate(4);
  7.                 // $gr = $this->create_header_gr();
  8.                 // dd($gr);
  9.                 foreach ($data as $key => $vl) {
  10.                     // dd($vl);
  11.                     try {
  12.                         // $kode_toko = explode('-', $vl->document_no);
  13.                         // $kode_toko = $kode_toko[0];
  14.                         // // dd($kode_toko);
  15.                         // \DB::connection('hosting')->table('sales_order_2018')->insert([
  16.                         //  'id'=>\Uuid::generate(4),
  17.                         //  'kode_toko'=>$kode_toko,
  18.                         //  'tanggal'=>date('Y-m-d',strtotime($vl->order_date))
  19.                         // ]);
  20.  
  21.                         foreach ($data as $key => $vl) {
  22.                     // dd($vl->document_no);
  23.                             $header = $this->get_header_id($vl->document_no);
  24.                             // dd($header);
  25.                             foreach ($header->response->data as $hd) {
  26.                                 $header_id = $hd->id;
  27.                             }
  28.  
  29.                             $this->update_header($header_id);
  30.  
  31.                             $lines = $this->get_line($header_id);
  32.                             // dd($lines);
  33.                             foreach ($lines->response->data as $ln) {
  34.                                 $apus_line = $this->hapus_line($ln->id);
  35.                                 // dd($apus_line);
  36.                             }
  37.  
  38.                             $this->hapus_header($header_id);
  39.                         }
  40.  
  41.                     // GM TO DRAFT
  42.                     //  foreach ($data as $key => $vl) {
  43.                     // // dd($vl->document_no);
  44.                     //      $header = $this->get_header_id($vl->document_no);
  45.                     //      foreach ($header->response->data as $hd) {
  46.                     //          $header_id = $hd->id;
  47.                     //      }
  48.                     //      $apus = $this->so_to_dr($header_id);
  49.                     //  }
  50.                     } catch (Exception $e) {
  51.                         dd($e->getMessage());
  52.                     }
  53.                 }
  54.             }
  55.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement