return $models['TIME_DAYSTART'] != '' ? $models['TIME_DAYSTART'] : "<span class='fa fa-remove fa-1x'></span>";
}]], ['ID' => 4, 'ATTR' => ['FIELD' => 'TIME_DAYEND', 'SIZE' => '10px', 'label' => 'END TIME', 'align' => 'center', 'warna' => '249, 215, 100, 1', 'GRP' => false, 'FORMAT' => 'html', 'filter' => true, 'filterType' => false, 'filterwarna' => '249, 215, 100, 1', 'value' => function ($models) {
    return $models['TIME_DAYEND'] != '' ? $models['TIME_DAYEND'] : "<span class='fa fa-remove fa-1x'></span>";
}]]];
$gvHeadColomn = ArrayHelper::map($headColomnEvent, 'ID', 'ATTR');
if ($dataProviderHeader1) {
    /*GRIDVIEW EXPAND*/
    $attDinamik[] = ['class' => 'kartik\\grid\\ExpandRowColumn', 'width' => '50px', 'header' => 'Detail', 'value' => function ($model, $key, $index, $column) {
        return GridView::ROW_COLLAPSED;
    }, 'detail' => function ($model, $key, $index, $column) {
        $searchModelTime = new CustomercallTimevisitSearch(['TGL' => $model['TGL'], 'USER_ID' => $model['USER_ID']]);
        $searchModelStock = new ReviewInventorySearch(['TGL' => $model['TGL'], 'USER_ID' => $model['USER_ID'], 'SO_TYPE' => '5']);
        $searchModelRequest = new ReviewInventorySearch(['TGL' => $model['TGL'], 'USER_ID' => $model['USER_ID'], 'SO_TYPE' => '9']);
        $searchModelReture = new ReviewInventorySearch(['TGL' => $model['TGL'], 'USER_ID' => $model['USER_ID'], 'SO_TYPE' => '8']);
        $searchModelSellIN = new ReviewInventorySearch(['TGL' => $model['TGL'], 'USER_ID' => $model['USER_ID'], 'SO_TYPE' => '6']);
        $searchModelSellOut = new ReviewInventorySearch(['TGL' => $model['TGL'], 'USER_ID' => $model['USER_ID'], 'SO_TYPE' => '7']);
        $dataProvider = $searchModelTime->search(Yii::$app->request->queryParams);
        // USER INFO
        $dataProviderInfo = $dataProvider->getModels();
        //VISIT TIME
        $dataProviderTime = $dataProvider;
        // IMAGE VISIT
        $dataProviderImage = $dataProvider;
        // IVENTORY STOCK|RETURE|REQUEST|SELL_IN|SELL_OUT
        $inventoryProvider = new ArrayDataProvider(['allModels' => Yii::$app->db_esm->createCommand("\n\t\t\t\t\t\t\tSELECT (SELECT DISTINCT NM_BARANG FROM b0001 WHERE KD_BARANG=so_t2.KD_BARANG) AS NAME_ITEM, \n\t\t\t\t\t\t\t\t\t\t SUM(CASE WHEN SO_TYPE=5 THEN (CASE WHEN  SO_QTY<>-1 THEN SO_QTY ELSE 0 END) ELSE 0 END) as STOCK,\t\t\t\t\t\t\t\t    \n\t\t\t\t\t\t\t\t\t\t SUM(CASE WHEN SO_TYPE=6 THEN SO_QTY ELSE 0 END) as SELL_IN,\n\t\t\t\t\t\t\t\t\t\t SUM(CASE WHEN SO_TYPE=7 THEN SO_QTY ELSE 0 END) as SELL_OUT,\n\t\t\t\t\t\t\t\t\t\t SUM(CASE WHEN SO_TYPE=8 THEN SO_QTY ELSE 0 END) as RETURE,\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t SUM(CASE WHEN SO_TYPE=9 THEN SO_QTY ELSE 0 END) as REQUEST\t\n\t\t\t\t\t\t\tFROM so_t2\n\t\t\t\t\t\t\tWHERE TGL='" . $model['TGL'] . "' AND USER_ID='" . $model['USER_ID'] . "'  GROUP BY\t KD_BARANG\n\t\t\t\t\t\t")->queryAll(), 'pagination' => ['pageSize' => 50]]);
        //EXPIRED DETAIL
        $searchModelExpired = new CustomercallExpiredSearch(['TGL_KJG' => $model['TGL'], 'USER_ID' => $model['USER_ID']]);
        $dataProviderExpired = $searchModelExpired->searchReport(Yii::$app->request->queryParams);
        //MEMO DETAIL
        $searchModelMemo = new CustomercallMemoSearch(['TGL' => $model['TGL'], 'ID_USER' => $model['USER_ID']]);
        $dataProviderMemo = $searchModelMemo->search(Yii::$app->request->queryParams);
 public function actionTest1()
 {
     /**
      * Senen dikurang 2 Hari = sabtu
      * Hanya untuk menghitung hari minggu ke belakang
      * example tanggal 	2016-09-05(senen) AND 2016-09-11(minggu), input 2016-09-12
      */
     $day = date('2016-09-12');
     $weekDayStart = date('Y-m-d', strtotime('monday this week', strtotime('-2 days' . $day)));
     $weekDayEnd = date('Y-m-d', strtotime('sunday  this week', strtotime('-2 days' . $day)));
     //echo $weekDayStart .' AND '.$weekDayEnd.' ,hari:'.$day.' ,week:'.$week;
     $searchModelStock = new ReviewInventorySearch(['TGL7' => $weekDayStart, 'TGL' => $weekDayEnd, 'SO_TYPE' => '5']);
     $aryDataStock = $searchModelStock->searchWeekly(Yii::$app->request->queryParams);
     $dataModelStock = $aryDataStock->allModels;
     //Set ArrayProvider to Array
     $dataMapStock = ArrayHelper::map($dataModelStock, 'NM_BARANG', 'SO_QTY', 'CUST_NM');
     //Get index string
     $dataIndexStock = ArrayHelper::index($dataModelStock, 'CUST_NM');
     //Get index string
     $StockMergeRowColumn = ArrayHelper::merge($dataIndexStock, $dataMapStock);
     //index string Merge / Like Join index
     $StockIndexVal = array_values($StockMergeRowColumn);
     //index string to int
     //$aryProviderDetailStock ='';
     $aryProviderDetailStock = new ArrayDataProvider(['allModels' => $StockIndexVal, 'pagination' => ['pageSize' => 1000]]);
     $getHeaderStck = [];
     foreach ($StockIndexVal as $key => $value) {
         $getHeaderStck = ArrayHelper::merge($getHeaderStck, $StockIndexVal[$key]);
     }
     /**
      * Foreach to get All column Then remove Column selected
      * @author piter novian [ptr.nov@gmail.com]
      */
     $splitHeaderStck = [];
     foreach ($getHeaderStck as $ky => $value) {
         //$splitHeaderStck=ArrayHelper::merge($splitHeaderStck, array_splice($getHeaderStck, 3, 2));
         $splitHeaderStck = ArrayHelper::merge($splitHeaderStck, array_diff_key($getHeaderStck, ['USER_ID' => '', 'SCDL_GROUP' => '', 'KD_BARANG' => '', 'NM_BARANG' => '', 'SO_TYPE' => '', 'SO_QTY' => '']));
     }
     $aryProviderHeaderStock = $splitHeaderStck;
     return $this->render('indexTest1', ['dataProvider' => $aryDataStock, 'aryProviderDetailStock' => $aryProviderDetailStock, 'aryProviderHeaderStock' => $aryProviderHeaderStock]);
 }