text: /*
   * script route generated by KOMA
   * @author : Yan Yan Purdiansah
   */    
  var express = require('express');
  var router = express.Router();
  var dateFormat = require('dateformat');    
  var database = require('./dao');
  var dao = new database.Dao();    
  var sessionChecker = require('./security');
  var appresource = {
      Title:'MsbRevenueRead',
      Heading:'MsbRevenue',
      Subscriber:{label :'Subscriber'},
      Account:{label :'Account'},
      From:{label :'From'},
      To:{label :'To'},
      Debit:{label :'Debit'},
      Credit:{label :'Credit'},
      Description:{label :'Description'},
      Activity:{label :'Activity'},
      Datetime:{label :'Datetime'},
      Status:{label :'Status'},
      }
  
  router.get('/', sessionChecker, function(req, res, next) {
      var jsonObj = req.query;
      jsonObj.rowid = 0;
      req.session.previouspath = 'readMsbRevenue?'+req._parsedUrl.query;
      parameter = {
          session: req.session,
          cookies: req.cookies,
          resource: appresource,
          dateFormat: dateFormat,
      }
      var readMsbRevenue = new Promise((resolve, reject) => {
          setTimeout(() => {
              dao.readMsbRevenue(jsonObj,function(err,rows) {
                  if(err) res.status(err.code).end();
                  else{
                      if(rows[0]===undefined) res.redirect('/searchMsbRevenue');
                      else{ 
                          jsonObj = rows[0];
                          resolve(jsonObj);
                      }
                  }
              });
          },1000);
      });
      
      var sendResult = (results) => {
          console.log(jsonObj)
          parameter.record = jsonObj;        
          res.render('MsbRevenueReadPage',parameter);
      }    
      Promise.all([readMsbRevenue]).then(sendResult);
  });
  
  module.exports = router;
  