public static function angin()
 {
     $sort = wbRequest::getVarClean('sort', 'str', 't_cuaca_id');
     $dir = wbRequest::getVarClean('dir', 'str', 'DESC');
     $query = wbRequest::getVarClean('query', 'str', '');
     $tahun = wbRequest::getVarClean('tahun', 'int', 0);
     $jenis = wbRequest::getVarClean('jenis', 'int', 0);
     try {
         $table =& wbModule::getModel('bds', 't_cuaca');
         //Set default criteria. You can override this if you want
         foreach ($table->fields as $key => $field) {
             if (!empty(${$key})) {
                 // <-- Perhatikan simbol $$
                 if ($field['type'] == 'str') {
                     $table->setCriteria($table->getAlias() . $key . $table->likeOperator . '?', array(${$key}));
                 } else {
                     $table->setCriteria($table->getAlias() . $key . ' = ?', array(${$key}));
                 }
             }
         }
         $query = $table->getDisplayFieldCriteria($query);
         if (!empty($query)) {
             $table->setCriteria($query);
         }
         $items = $table->getAll(0, -1, $sort, $dir);
     } catch (Exception $e) {
         $data['message'] = $e->getMessage();
     }
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $data['items'] = $items;
     $data['success'] = true;
     return $data;
 }
Esempio n. 2
0
 public function afterWrite()
 {
     if ($this->actionType == 'CREATE') {
         $table_inbox =& wbModule::getModel('bds', 't_message_inbox');
         $items = $this->record;
         try {
             // begin transaction block
             $table_inbox->dbconn->BeginTrans();
             // insert master
             $items[$table_inbox->pkey] = $table_inbox->GenID();
             unset($items['t_message_outbox_id']);
             $table_inbox->record = $items;
             $table_inbox->record['creation_date'] = date('Y-m-d h:i:s');
             $table_inbox->record['update_date'] = date('Y-m-d');
             $table_inbox->record['message_status'] = 'U';
             //print_r($table_inbox->record);
             //print_r($items);
             //exit;
             $table_inbox->create();
             // insert detail
             // all ok, commit transaction
             $table_inbox->dbconn->CommitTrans();
         } catch (Exception $e) {
             // something happen, rollback transaction
             $table_inbox->dbconn->RollbackTrans();
             throw new Exception($e->getMessage());
         }
     }
 }
 public static function pendidikan()
 {
     $tParameter =& wbModule::getModel('bds', 'p_parameter');
     $tParameter->setCriteria('p_parameter_type.ptype_code ILIKE ?', 'PENDIDIKAN');
     $items = $tParameter->getAll(0, -1, 'param_listing_no', 'ASC');
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $data['items'] = $items;
     $data['success'] = true;
     return $data;
 }
 public static function getProduksiKomoditas()
 {
     $jsonItems = wbRequest::getVarClean('jsonItems', 'str', '');
     $item = wbUtil::jsonDecode($jsonItems);
     $tProduksi =& wbModule::getModel('bds', 't_agr_komod_prod');
     $itemProduksi = $tProduksi->getProduksiKomoditas($item['tahun'], $item['d_agr_komiditas_id']);
     $data = array('items' => array(), 'total' => 0, 'success' => true, 'message' => '');
     $data['items'] = $itemProduksi;
     return $data;
 }
 public static function tampil()
 {
     $tahun = wbRequest::getVarClean('tahun', 'int', 0);
     $wilayah =& wbModule::getModel('bds', 'p_parameter');
     $items = $wilayah->pbb_sppt($tahun);
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $data['items'] = $items;
     $data['success'] = true;
     return $data;
 }
 public static function getItem()
 {
     $jsonItems = wbRequest::getVarClean('jsonItems', 'str', '');
     $item = wbUtil::jsonDecode($jsonItems);
     $tTernak =& wbModule::getModel('bds', 't_ternak');
     $itemTernak = $tTernak->getItem($item['tahun'], $item['param_id']);
     $data = array('items' => array(), 'total' => 0, 'success' => true, 'message' => '');
     $data['items'] = $itemTernak;
     return $data;
 }
 public static function tampil()
 {
     $tahun = wbRequest::getVarClean('tahun', 'int', 0);
     $daerah =& wbModule::getModel('bds', 'd_pasar');
     $items = $daerah->rekapPasar($tahun);
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $data['items'] = $items;
     $data['success'] = true;
     return $data;
 }
 public static function getItem()
 {
     $jsonItems = wbRequest::getVarClean('jsonItems', 'str', '');
     $item = wbUtil::jsonDecode($jsonItems);
     $tArmada =& wbModule::getModel('bds', 't_armada');
     $itemArmada = $tArmada->getItem($item['tahun'], $item['trayek_id']);
     $data = array('items' => array(), 'total' => 0, 'success' => true, 'message' => '');
     $data['items'] = $itemArmada;
     return $data;
 }
 public static function cek()
 {
     $wilayah =& wbModule::getModel('bds', 'p_wilayah');
     $param[0] = array('value' => '94', 'field' => 'wilayah_id');
     $param[1] = array('value' => '88', 'field' => 'wilayah_pid');
     $param[1] = array('value' => '42', 'field' => 'wilayah_status');
     $items = $wilayah->uniqueAll('bds_p_wilayah', $param);
     echo $items;
     exit;
 }
 public static function getJumlahPerKecamatan()
 {
     $jsonItems = wbRequest::getVarClean('jsonItems', 'str', '');
     $item = wbUtil::jsonDecode($jsonItems);
     $tPuskesmas =& wbModule::getModel('bds', 'd_puskesmas');
     $jumlah = $tPuskesmas->getJumlahPerKecamatan($item['wilayah_id']);
     $data = array('items' => array(), 'total' => 0, 'success' => true, 'message' => '');
     $data['items'] = $jumlah;
     return $data;
 }
 public static function show_per_jenis()
 {
     $tParameter =& wbModule::getModel('bds', 'p_parameter');
     $tParameter->setCriteria('p_parameter_type.ptype_code ILIKE ?', array('JENIS RUMAH SAKIT'));
     $itemsJenis = $tParameter->getAll(0, -1, 'param_listing_no', 'ASC');
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $data['items'] = $itemsJenis;
     $data['success'] = true;
     return $data;
 }
 public static function tampil()
 {
     $tahun = wbRequest::getVarClean('tahun', 'int', 0);
     $tahun_akhir = wbRequest::getVarClean('tahun_akhir', 'int', 0);
     $industri =& wbModule::getModel('bds', 't_industri');
     $items = $industri->rekapIndustriTahun($tahun, $tahun_akhir);
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $data['items'] = $items;
     $data['success'] = true;
     return $data;
 }
Esempio n. 13
0
 public function cekValid($param_name, $mmart_tahun)
 {
     $table =& wbModule::getModel('bds', 'p_parameter');
     $param_id = $table->getIDbyName($param_name);
     if (empty($param_id)) {
         return '- Kesalahan Penulisan Jenis Pasar : ' . $param_name . '<br> ';
     }
     $isExist = $this->isExist($param_id, $mmart_tahun);
     if ($isExist) {
         return '- Data ' . $param_name . ' di Tahun ' . $mmart_tahun . ' sudah ada <br>';
     }
     return '';
 }
Esempio n. 14
0
 /**
  * read
  * controler for get all items
  */
 public static function read($args = array())
 {
     // Security check
     //if (!wbSecurity::check('p_vat_type')) return;
     // Get arguments from argument array
     extract($args);
     $start = wbRequest::getVarClean('start', 'int', 0);
     $limit = wbRequest::getVarClean('limit', 'int', 50);
     $sort = wbRequest::getVarClean('sort', 'str', 'p_region_id');
     $dir = wbRequest::getVarClean('dir', 'str', 'ASC');
     $query = wbRequest::getVarClean('query', 'str', '');
     $p_region_id = wbRequest::getVarClean('p_region_id', 'int', 0);
     $parent_id = wbRequest::getVarClean('parent_id', 'int', 0);
     $description = wbRequest::getVarClean('description', 'str', '');
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     try {
         $table =& wbModule::getModel('bds', 'p_sub_region');
         //Set default criteria. You can override this if you want
         foreach ($table->fields as $key => $field) {
             if (!empty(${$key})) {
                 // <-- Perhatikan simbol $$
                 if ($field['type'] == 'str') {
                     $table->setCriteria($table->getAlias() . $key . $table->likeOperator . '?', array(${$key}));
                 } else {
                     $table->setCriteria($table->getAlias() . $key . ' = ?', array(${$key}));
                 }
             }
         }
         if (!empty($parent_id)) {
             $table->setCriteria('parent_id = ', array($parent_id));
         } else {
             $table->setCriteria("parent_id = 749");
         }
         if (!empty($code)) {
             $table->setCriteria('(code ILIKE ?)', array('%' . $code . '%'));
         }
         $query = $table->getDisplayFieldCriteria($query);
         if (!empty($query)) {
             $table->setCriteria($query);
         }
         $items = $table->getAll($start, $limit, $sort, $dir);
         $total = $table->countAll();
         $data['items'] = $items;
         $data['total'] = $total;
         $data['success'] = true;
     } catch (Exception $e) {
         $data['message'] = $e->getMessage();
     }
     return $data;
 }
 public static function show()
 {
     $tJalan =& wbModule::getModel('bds', 'd_jalan');
     $jenis_jalan = wbRequest::getVarClean('jenis_jalan', 'int', 0);
     //timestamp
     $t = wbRequest::getVarClean('t', 'str', '');
     if (empty($jenis_jalan)) {
         exit;
     }
     $items = $tJalan->getAllByJenisJalan($jenis_jalan);
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $data['items'] = $items;
     $data['success'] = true;
     return $data;
 }
 public static function tampil()
 {
     $tahun = wbRequest::getVarClean('tahun', 'int', 0);
     $penduduk =& wbModule::getModel('bds', 't_rpddk');
     $jenis = wbRequest::getVarClean('jenis', 'int', 0);
     if (!empty($jenis)) {
         $penduduk->setCriteria('jenisdata=' . $jenis);
     }
     if (!empty($tahun)) {
         $penduduk->setCriteria('tahun=' . $tahun);
     }
     $kelompok = array('1' => 'Usia', '2' => 'Pendidikan');
     $items = $penduduk->getAll(0, -1, 'kelompok_id', 'ASC');
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $data['items'] = $items;
     $data['success'] = true;
     return $data;
 }
 public static function get_deposit_amount($args = array())
 {
     extract($args);
     $subscriber_id = wbRequest::getVarClean('subscriber_id', 'int', 0);
     try {
         $items = array();
         $table =& wbModule::getModel('paymentccbs', 'subscriber_deposit');
         $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
         $data['items'] = empty($subscriber_id) ? 0 : $table->get_deposit_amount($subscriber_id);
         $data['success'] = true;
         $data['total'] = 1;
         $data['message'] = 'success return value';
     } catch (Exception $e) {
         $data['message'] = $e->getMessage();
         $data['success'] = false;
     }
     return $data;
 }
 public static function show()
 {
     $tSchoolLevel =& wbModule::getModel('bds', 'p_school_level');
     $tSchoolType =& wbModule::getModel('bds', 'p_school_type');
     $level_id = wbRequest::getVarClean('level_id', 'int', 0);
     $tahun = wbRequest::getVarClean('tahun', 'str', '');
     //timestamp
     $t = wbRequest::getVarClean('t', 'str', '');
     $items = $tSchoolType->getAllByLevelID($level_id, $tahun);
     $itemLevel = $tSchoolLevel->get($level_id);
     $retItems = array();
     $retItems['items'] = $items;
     $retItems['itemLevel'] = $itemLevel;
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $data['items'] = $retItems;
     $data['success'] = true;
     return $data;
 }
 public static function get_user_loket($args = array())
 {
     extract($args);
     $p_user_loket_id = wbRequest::getVarClean('p_user_loket_id', 'int', 0);
     try {
         $items = array();
         $table =& wbModule::getModel('paymentccbs', 'p_user_loket');
         $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
         $data['items'] = $table->get($p_user_loket_id);
         $data['success'] = true;
         $data['total'] = 1;
         $data['message'] = 'berhasil';
     } catch (Exception $e) {
         $data['message'] = $e->getMessage();
         $data['success'] = false;
     }
     return $data;
 }
 public static function read($args = array())
 {
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     extract($args);
     $page = wbRequest::getVarClean('current', 'int', 1);
     $limit = wbRequest::getVarClean('rowCount', 'int', 10);
     $sort = wbRequest::getVarClean('sortby', 'str', 'p_bank_branch_id');
     $dir = wbRequest::getVarClean('sortdir', 'str', 'DESC');
     $searchPhrase = wbRequest::getVarClean('searchPhrase', 'str', '');
     $p_bank_branch_id = wbRequest::getVarClean('p_bank_branch_id', 'int', 0);
     $p_bank_id = wbRequest::getVarClean('p_bank_id', 'int', 0);
     $start = ($page - 1) * $limit;
     try {
         $table =& wbModule::getModel('paymentccbs', 'p_bank_branch');
         //Set default criteria. You can override this if you want
         foreach ($table->fields as $key => $field) {
             if (!empty(${$key})) {
                 // <-- Perhatikan simbol $$
                 if ($field['type'] == 'str') {
                     $table->setCriteria($table->getAlias() . $key . $table->likeOperator . '?', array(${$key}));
                 } else {
                     $table->setCriteria($table->getAlias() . $key . ' = ?', array(${$key}));
                 }
             }
         }
         if (!empty($searchPhrase)) {
             $table->setCriteria("(UPPER(bank_branch.code) ILIKE ? OR UPPER(bank.code) ILIKE ?)", array('%' . $searchPhrase . '%', '%' . $searchPhrase . '%'));
         }
         $items = $table->getAll($start, $limit, $sort, $dir);
         $total = $table->countAll();
         $data['items'] = $items;
         $data['total'] = $total;
         $data['current'] = $page;
         $data['rowCount'] = $limit;
         $data['message'] = '';
         $data['success'] = true;
     } catch (Exception $e) {
         $data['message'] = $e->getMessage();
         $data['success'] = false;
     }
     return $data;
 }
 /**
  * read
  * controler for get all items
  */
 public static function read($args = array())
 {
     // Security check
     //if (!wbSecurity::check('p_finance_period')) return;
     // Get arguments from argument array
     extract($args);
     $start = wbRequest::getVarClean('start', 'int', 0);
     $limit = wbRequest::getVarClean('limit', 'int', 10);
     $sort = wbRequest::getVarClean('sort', 'str', 'p_bank_id');
     $dir = wbRequest::getVarClean('dir', 'str', 'DESC');
     $query = wbRequest::getVarClean('query', 'str', '');
     $query = rawurldecode($query);
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     try {
         $table =& wbModule::getModel('bds', 'abstract_model');
         //$query = $table->getDisplayFieldCriteria($query);
         //if (!empty($query)) $table->setCriteria($query);
         $user_name = wbSession::getVar('user_name');
         $query = str_replace("\n", "", $query);
         $query = str_replace("\r", "", $query);
         $query = preg_replace('/\\s+/S', " ", $query);
         $table->selectClause = "";
         $table->fromClause = $query;
         if (!preg_match('/SELECT /i', $query)) {
             $items = $table->dbconn->GetItem($query);
             $total = 1;
         } else {
             $items = $table->getAllNoOrder($start, $limit, $sort, $dir);
             $total = $table->countAll();
         }
         $data['items'] = $items;
         $data['total'] = $total;
         $data['success'] = true;
     } catch (Exception $e) {
         $data['message'] = $e->getMessage();
     }
     return $data;
 }
 public static function cancel_deposit($args = array())
 {
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $p_user_loket_id = wbRequest::getVarClean('p_user_loket_id', 'int', 0);
     $subscriber_id = wbRequest::getVarClean('subscriber_id', 'int', 0);
     $t_deposit_id = wbRequest::getVarClean('t_deposit_id', 'int', 0);
     $ip_address = wbRequest::getVarClean('ip_address', 'str', get_ip_address());
     $result = "";
     try {
         $table =& wbModule::getModel('paymentccbs', 't_deposit');
         $result = $table->cancel_deposit_amount($t_deposit_id, $subscriber_id, $p_user_loket_id, $ip_address);
         if ($result == 'OK') {
             $data['success'] = true;
             $data['message'] = 'Cancel deposit amount success';
         } else {
             $data['message'] = $result;
         }
         $data['total'] = 1;
     } catch (Exception $e) {
         $data['message'] = $e->getMessage();
         $data['success'] = false;
     }
     return $data;
 }
 /**
  * update
  * controler for remove item
  */
 public static function destroy($args = array())
 {
     // Security check
     if (!wbSecurity::check('PWilayahPerson')) {
         return;
     }
     // Get arguments from argument array
     extract($args);
     $jsonItems = wbRequest::getVarClean('items', 'str', '');
     $items =& wbUtil::jsonDecode($jsonItems);
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $table =& wbModule::getModel('bds', 'p_wilayah_person');
     try {
         $table->dbconn->BeginTrans();
         if (is_array($items)) {
             foreach ($items as $key => $value) {
                 if (empty($value)) {
                     throw new Exception('Empty parameter');
                 }
                 $table->remove($value);
                 $data['items'][] = array($table->pkey => $value);
                 $data['total']++;
             }
         } else {
             $items = (int) $items;
             if (empty($items)) {
                 throw new Exception('Empty parameter');
             }
             $table->remove($items);
             $data['items'][] = array($table->pkey => $items);
             $data['total'] = 1;
         }
         $data['success'] = true;
         $data['message'] = $data['total'] . ' Data berhasil dihapus';
         $table->dbconn->CommitTrans();
     } catch (Exception $e) {
         $table->dbconn->RollbackTrans();
         $data['message'] = $e->getMessage();
         $data['items'] = array();
         $data['total'] = 0;
     }
     return $data;
 }
 public static function upload_excel($args = array())
 {
     $jsonItems = wbRequest::getVarClean('jsonItems', 'str', '');
     $item = wbUtil::jsonDecode($jsonItems);
     $table =& wbModule::getModel('bds', 'p_vat_type_dtl');
     $table->actionType = 'CREATE';
     $items = $item['items'];
     $data = array('items' => array(), 'total' => 0, 'success' => true, 'message' => '');
     try {
         foreach ($items as $rec) {
             $rec[$table->pkey] = $table->GenID();
             $table->setRecord($rec);
             $table->create();
         }
         return $data;
     } catch (Exception $e) {
         $data['success'] = false;
         $data['message'] = $e->getMessage();
         return $data;
     }
 }
 public static function submitSptpd($args = array())
 {
     $jsonItems = wbRequest::getVarClean('items', 'str', '');
     $items = wbUtil::jsonDecode($jsonItems);
     $table =& wbModule::getModel('bds', 't_vat_settlement');
     $table->actionType = 'CREATE';
     //$items = $item['items'];
     $data = array('items' => array(), 'total' => 0, 'success' => true, 'message' => '');
     try {
         $user_name = wbSession::getVar('user_name');
         foreach ($items as $item) {
             $sql = "select sikp.f_first_submit_engine(501," . $item['t_customer_order_id'] . ",'" . $user_name . "')";
             $message = $table->dbconn->GetOne("{$sql}");
         }
         $data['success'] = true;
         $data['message'] = $message;
         return $data;
     } catch (Exception $e) {
         $data['success'] = false;
         $data['message'] = $e->getMessage();
         return $data;
     }
 }
 public static function upload_excel($args = array())
 {
     $jsonItems = wbRequest::getVarClean('jsonItems', 'str', '');
     $item = wbUtil::jsonDecode($jsonItems);
     $table =& wbModule::getModel('bds', 't_modern_mart');
     $table->actionType = 'CREATE';
     $parameter =& wbModule::getModel('bds', 'p_parameter');
     $items = $item['items'];
     $data = array('items' => array(), 'total' => 0, 'success' => true, 'message' => '');
     try {
         $errorMessage = '';
         /* cek data */
         foreach ($items as $rec) {
             $errorMessage .= $table->cekValid(trim($rec['param_name']), $rec['mmart_tahun']);
         }
         if (!empty($errorMessage)) {
             throw new Exception('Input data gagal, dikarenakan : <br>' . $errorMessage);
         }
         foreach ($items as $rec) {
             $rec[$table->pkey] = $table->GenID();
             $rec['type_id'] = $parameter->getIDbyName(trim($rec['param_name']));
             $table->setRecord($rec);
             $table->create();
         }
         return $data;
     } catch (Exception $e) {
         $data['success'] = false;
         $data['message'] = $e->getMessage();
         return $data;
     }
 }
 public static function cancel_payment($args = array())
 {
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     extract($args);
     $page = wbRequest::getVarClean('current', 'int', 1);
     $limit = wbRequest::getVarClean('rowCount', 'int', 10);
     $sort = wbRequest::getVarClean('sortby', 'str', '');
     $dir = wbRequest::getVarClean('sortdir', 'str', 'ASC');
     $searchPhrase = wbRequest::getVarClean('searchPhrase', 'str', '');
     /* post params */
     $service_no = wbRequest::getVarClean('service_no', 'str', '');
     $p_bank_branch_id = wbRequest::getVarClean('p_bank_branch_id', 'int', 0);
     $action = wbRequest::getVarClean('action', 'str', 'queryreceipt');
     $i_id = wbRequest::getVarClean('i_id', 'array', array());
     $i_subscriberid = wbRequest::getVarClean('i_subscriberid', 'int', 0);
     $cboxdeposit = wbRequest::getVarClean('cboxdeposit', 'str', 'N');
     $client_ip_address = wbRequest::getVarClean('client_ip_address', 'str', '');
     $p_user_loket_id = wbRequest::getVarClean('p_user_loket_id', 'int', 0);
     $user_name = wbRequest::getVarClean('user_name', 'str', '');
     /* make $i_id with comma separated */
     $idList = "";
     $prefix = "";
     foreach ($i_id as $theid) {
         $idList .= $prefix . "'" . substr($theid, 0, strpos($theid, "_")) . "'";
         $prefix = ", ";
     }
     $start = ($page - 1) * $limit;
     try {
         $items = array();
         $table =& wbModule::getModel('paymentccbs', 'payment');
         $table->dbconn->fetchMode = PGSQL_NUM;
         $query = "SELECT * FROM ifp.f_pay_acc(?,?,?,?,?,?,?,?,?,?,?,?)";
         /* tambahkan subscriber id, use_deposit */
         $result =& $table->dbconn->Execute($query, array($action, $service_no, $start, $limit, $idList, $p_user_loket_id, $user_name, $p_bank_branch_id, $client_ip_address, $i_subscriberid, $cboxdeposit, strtoupper(date("d-M-Y"))));
         $rows = $result->fields;
         if (isset($rows['cnt'])) {
             $data['total'] = $rows['cnt'];
             $data['message'] = $rows['msg'];
             $data['success'] = true;
             if ($rows['cnt'] == 0) {
                 $data['items'] = array();
                 if (strtoupper(substr($rows['msg'], 0, 5)) == 'ERROR') {
                     $data['success'] = false;
                 }
             } else {
                 $rows = array($rows);
                 for ($i = 0; $i < count($rows); $i++) {
                     $rows[$i]['id'] .= "_" . $rows[$i]['account_no'];
                 }
                 $data['items'] = $rows;
             }
         } else {
             for ($i = 0; $i < count($rows); $i++) {
                 $rows[$i]['id'] .= "_" . $rows[$i]['account_no'];
             }
             $data['items'] = $rows;
             $data['total'] = $rows[0]['cnt'];
             $data['message'] = $rows[0]['msg'];
             $data['success'] = true;
         }
         $data['current'] = $page;
         $data['rowCount'] = $limit;
     } catch (Exception $e) {
         $data['message'] = $e->getMessage();
         $data['success'] = false;
     }
     return $data;
 }
Esempio n. 28
0
 public static function upload_excel($args = array())
 {
     $jsonItems = wbRequest::getVarClean('jsonItems', 'str', '');
     $item = wbUtil::jsonDecode($jsonItems);
     $table =& wbModule::getModel('bds', 'smp_detail');
     $table->actionType = 'CREATE';
     $items = $item['items'];
     $data = array('items' => array(), 'total' => 0, 'success' => true, 'message' => '');
     try {
         $errorMessage = '';
         /* cek data sd */
         $tahunAjaranSMPExist = $table->isExistTahunAjaran($items[0]['smp_id'], $items[0]['smp_det_thn_ajaran']);
         if (!$tahunAjaranSMPExist) {
             $items[0][$table->pkey] = $table->GenID();
             $table->setRecord($items[0]);
             $table->create();
         } else {
             $errorMessage .= '- Data SMP Tahun Ajaran ' . $items[0]['smp_det_thn_ajaran'] . ' tidak dapat diinput karena sudah ada <br>';
         }
         /* cek data mi */
         $tahunAjaranMTSExist = $table->isExistTahunAjaran($items[1]['smp_id'], $items[1]['smp_det_thn_ajaran']);
         if (!$tahunAjaranMTSExist) {
             $items[1][$table->pkey] = $table->GenID();
             $table->setRecord($items[1]);
             $table->create();
         } else {
             $errorMessage .= '- Data MTS Tahun Ajaran ' . $items[1]['smp_det_thn_ajaran'] . ' tidak dapat diinput karena sudah ada <br>';
         }
         if (empty($errorMessage)) {
             return $data;
         } else {
             throw new Exception($errorMessage);
         }
     } catch (Exception $e) {
         $data['success'] = false;
         $data['message'] = $e->getMessage();
         return $data;
     }
 }
Esempio n. 29
0
 public static function updateInfo($args = array())
 {
     // Security check
     wbSecurity::check('User', ACCESS_EDIT);
     // Get arguments from argument array
     extract($args);
     $user_password1 = trim(wbRequest::getVarClean('user_password1', 'str', ''));
     $user_password2 = trim(wbRequest::getVarClean('user_password2', 'str', ''));
     $user_email = trim(wbRequest::getVarClean('user_email', 'str', ''));
     $mobile_no = trim(wbRequest::getVarClean('mobile_no', 'str', ''));
     $user_realname = trim(wbRequest::getVarClean('user_realname', 'str', ''));
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $sessionInfo = wbUser::getSession();
     $uid = $sessionInfo['user_id'];
     try {
         if (empty($uid)) {
             throw new Exception('Bad Params : Empty UserID');
         }
         $table =& wbModule::getModel('base', 'roles.p_app_user');
         $table->actionType = 'UPDATE';
         $record = array('p_app_user_id' => $uid, 'email_address' => $user_email, 'full_name' => $user_realname);
         if (!empty($user_password1)) {
             if (strcmp($user_password1, $user_password2) != 0) {
                 throw new Exception("Password tidak sama. Mohon periksa kembali");
             }
             if (strlen($user_password1) < 5) {
                 throw new Exception("Panjang password minimal 5 karakter");
             }
             $record['user_pwd'] = $user_password1;
         }
         $table->setRecord($record);
         $table->update();
         $sql = "update t_cust_account a\n\t\t\t\t\tset a.mobile_no = '" . $mobile_no . "'\n\t\t\t\t\twhere t_customer_id = (select t_customer_id from t_customer_user where p_app_user_id = " . $uid . ")";
         $data['items'] = $table->dbconn->GetItem($sql);
         $data['success'] = true;
         $data['message'] = 'Data berhasil di-update';
     } catch (Exception $e) {
         $data['message'] = $e->getMessage();
     }
     return $data;
 }
 public static function getNpwd($args = array())
 {
     extract($args);
     $start = wbRequest::getVarClean('start', 'int', 0);
     $limit = wbRequest::getVarClean('limit', 'int', 50);
     $sort = wbRequest::getVarClean('sort', 'str', 't_cust_order_legal_doc_id');
     $dir = wbRequest::getVarClean('dir', 'str', 'ASC');
     $query = wbRequest::getVarClean('query', 'str', '');
     $t_cust_order_legal_doc_id = wbRequest::getVarClean('t_cust_order_legal_doc_id', 'int', 0);
     $trans_date = wbRequest::getVarClean('trans_date', 'str', '');
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $dbConnParams_rwnet = array('name' => wbConfig::get('DB.name_rwnet'), 'user' => wbConfig::get('DB.user_rwnet'), 'password' => wbConfig::get('DB.password_rwnet'), 'host' => wbConfig::get('DB.host_rwnet'), 'type' => wbConfig::get('DB.type_rwnet'), 'schema' => 'sikp');
     try {
         $table =& wbModule::getModel('bds', 'd_hotel');
         $user_name = wbSession::getVar('user_name');
         $query = "select ty_lov_npwd as t_cust_order_legal_doc_id, npwd, company_name,\n                        p_vat_type_id, vat_code, p_vat_type_dtl_id, vat_code_dtl\n                        from f_get_npwd_by_username('{$user_name}') AS tbl (ty_lov_npwd)\n                        where upper(npwd) like '%{$s_keyword}%' OR\n                        upper(company_name) like '%{$s_keyword}%'";
         $items = $table->dbconn->GetAllAssocLimit($query, $limit, $start);
         $query = "SELECT COUNT(1) from sikp.f_get_cust_acc_dtl_trans({$t_cust_order_legal_doc_id},'{$trans_date}') " . $table->getCriteriaSQL();
         $countitems = $table->dbconn->GetOne($query);
         if ($countitems === false) {
             throw new Exception($dbConn_rwnet->ErrorMsg());
         }
         $total = $table->countAll();
     } catch (UserLoginFailedException $e) {
         $data['message'] = $e->getMessage();
     }
     $data['items'] = $items;
     $data['total'] = $countitems;
     $data['success'] = true;
     return $data;
 }