/** * ACTION INDEX */ public function actionIndex() { /*CNT Barang Prodak*/ $cntBrgProdak = "SELECT COUNT(KD_BARANG) As KD_BARANG FROM b0001 WHERE PARENT=1"; $cntBrgPrdk = Barang::findBySql($cntBrgProdak)->one(); /*CNT Barang Umum*/ $cntBrgUmum = "SELECT COUNT(KD_BARANG) As KD_BARANG FROM b0001 WHERE PARENT=0"; $cntBrgUmn = Barang::findBySql($cntBrgUmum)->one(); /*CNT Barang Type*/ $cntType = "SELECT COUNT(NM_TYPE) as NM_TYPE FROM b1001"; $cntTyp = Tipebarang::findBySql($cntType)->one(); /*CNT Barang Kategori*/ $cntCategory = "SELECT COUNT(NM_KATEGORI) as NM_KATEGORI FROM b1002"; $cntCtg = Kategori::findBySql($cntCategory)->one(); /*CNT Barang Unit*/ $cntUnit = "SELECT COUNT(KD_UNIT) as KD_UNIT FROM ub0001"; $cntUnt = Unitbarang::findBySql($cntUnit)->one(); /*CNT Supplier*/ $cntSupplier = "SELECT COUNT(KD_SUPPLIER) as KD_SUPPLIER FROM s1000"; $cntSpl = Suplier::findBySql($cntSupplier)->one(); /*CNT Distributor*/ $cntDistributor = "SELECT COUNT(KD_DISTRIBUTOR) as KD_DISTRIBUTOR FROM d0001"; $cntDist = Distributor::findBySql($cntDistributor)->one(); /*CNT Customer*/ $cntCustomer = "SELECT COUNT(CUST_KD) as CUST_KD FROM c0001"; $cntCst = Customers::findBySql($cntCustomer)->one(); //print_r($cntBrgPrdk->KD_BARANG); return $this->render('index', ['cntBrgPrdk' => $cntBrgPrdk->KD_BARANG, 'cntBrgUmn' => $cntBrgUmn->KD_BARANG, 'cntTyp' => $cntTyp->NM_TYPE, 'cntCtg' => $cntCtg->NM_KATEGORI, 'cntUnt' => $cntUnt->KD_UNIT, 'cntSpl' => $cntSpl->KD_SUPPLIER, 'cntDist' => $cntDist->KD_DISTRIBUTOR, 'cntCst' => $cntCst->CUST_KD]); }