Ejemplo n.º 1
0
?>
<div class="draft-plan-index">



<?php 
$data_draft = DraftPlan::find()->all();
$dynamick = new DraftPlan();
//     /*converting obejct to array*/
$data = ArrayHelper::toArray($data_draft, ['lukisongroup\\master\\models\\DraftPlan' => ['ID' => function ($dynamick) {
    return $dynamick->IdDinamikScdl;
}, 'GEO_ID', 'LAYER_ID', 'DAY_ID', 'DAY_VALUE']]);
foreach ($data as $value) {
    # code...
    // echo $value['ID'];
    $dua[] = Jadwal::getArrayDateCust('2016', 'C', '1', '1', '', $value['ID'], '66');
}
// print_r($dynamick->IdDinamikScdl);
// die();
// print_r($dua);
// die();
// $dua= DraftPlan::getDateVal();
// print_r($dua);
// die();
// print_r(\ptrnov\salesforce\Jadwal::getDateOfWeekAndDayname('2016','34','1'));
// die();
/*
 * GRID draft_plan
 * @author wawan  [aditiya@lukison.com]
 * @since 1.2
*/
 /**
  * finds draftplan models.
  * @var $dynamick draftplan.
  * @var $data converting obejct to array.
  * save c0002scdl_plan_group via batch insert.
  * if success redirect page index
  * @return mixed
  * @author wawan 
  * @since 1.2.0
  */
 public function actionSendDraftX()
 {
     /*model draftplan*/
     $data_draft = DraftPlan::find()->all();
     $dynamick = new DraftPlan();
     /*converting obejct to array*/
     $data = ArrayHelper::toArray($data_draft, ['lukisongroup\\master\\models\\DraftPlan' => ['ID' => function ($dynamick) {
         return $dynamick->IdDinamikScdl;
     }, 'GEO_ID', 'LAYER_ID', 'DAY_ID', 'DAY_VALUE', 'CUST_KD', 'ODD_EVEN']]);
     // $dua = Jadwal::getArrayDateCust('2016','A','1','1','1','c00.1','66');
     // print_r($dua);
     // die();
     // foreach ($data as $value) {
     //          # code...
     //          // echo $value['ID'];
     //        }
     /*batch insert*/
     foreach ($data as $key => $value) {
         # code...
         if ($value['ID'] == 'NotSet') {
         } else {
             $dua = Jadwal::getArrayDateCust('2016', $value->custlayer->LAYER_NM, $value['ODD_EVEN'], $value['DAY_ID'], $value['GEO_ID'], $value['CUST_KD'], '66');
         }
         foreach ($dua as $val) {
             # code...
             $this->conn_esm()->CreateCommand()->batchInsert('c0002scdl_plan_detail', ['CUST_ID', 'TGL', 'SCDL_GROUP'], [[$val['custId'], $val['tg'], $val['scdlGrp']]])->execute();
         }
     }
     /*batch insert*/
     // foreach ($data as $val) {
     //     # code...
     //       $dua = Jadwal::getArrayDateCust('2016','C','1','1','',$val['ID'],'66');
     //        $array_nilai_uniq = array_unique($dua);
     //       foreach ($array_nilai_uniq as  $value) {
     //           # code...
     //     // $this->conn_esm()->CreateCommand()
     //     //                 ->batchInsert('c0002scdl_plan_group', ['SCDL_GROUP', 'GEO_ID','LAYER_ID','DAY_ID','DAY_VALUE'], [
     //     //         [$value['ID'],$value['GEO_ID'],$value['LAYER_ID'],$value['DAY_ID'],$value['DAY_VALUE']]
     //     //     ])->execute();
     //     //                     }
     //     $this->conn_esm()->CreateCommand()
     //                     ->batchInsert('c0002scdl_plan_group', ['SCDL_GROUP','TGL_START'], [
     //             [$value['custId'],$value['tg']]
     //         ])->execute();
     //     }
     // }
     // $array_nilai_uniq = array_unique($dua);
     // foreach ($array_nilai_uniq as $key => $val1) {
     //     # code...
     //    print_r($key);
     // die();
     //     // $this->conn_esm()->CreateCommand()
     //     //             ->batchInsert('c0002scdl_plan_group', ['SCDL_GROUP','TGL_START'], [
     //     //     [$val1['custId'],$val1['tg']]
     //     // ])->execute();
     // }
     return $this->redirect(['index']);
 }