tenants.prototype.view_transaction = function () {
  var user_id = this.user_id; //this.user_id; /* This defines the User for AJAX Save */
  var transtype = this.transtype;
  var baltype = this.baltype;
  var the_tenant = this.id;
  var the_filter = this.filter;
  var the_tab = this.tab;
  var trans_id = this.transid;
  var trans_type = transtype;
  var trans_bal = baltype;
  var lease_id = this.lease_id;

  $('#printReceiptBtn').prop("disabled", true);

  $('.edt').addClass('disabled');
  $('#editTransaction textarea').prop('disabled', true);
  $('.dropdown').dropdown(drop_effect); /* Re-encode for new class...disabled */
  
  $('#transactionNumber').text(trans_id);

  $('#hrefTenant').attr('href', "#Tenants/" + the_filter + "/" + the_tenant + "/Profile/" + lease_id);
  $('#hrefLease').attr('href', '#Tenants/'+ the_filter + '/' + the_tenant + '/Lease/' + lease_id);
  $('#hrefTransactions').attr('href', '#Tenants/'+ the_filter + '/' + the_tenant + '/Transactions/' + lease_id);

  $("#transDetailsClose").off("click");
  $("#transDetailsClose").on("click", function () {
    router.navigate('Tenants/' + the_filter + '/' + the_tenant + '/Transactions/' + lease_id);
  });

  $(".editvTransaction").off('click');
  $(".editvTransaction").on("click", function () {
    var val = $(this).attr("data-editType");
    if (val == 'void') {
      alert(val);
    } else if (val == 'transfer') {
      $('.edt').removeClass('disabled');
      $('#editTransaction textarea').prop('disabled', false);
      $('#editbtn').text('Save');
      $('.dropdown').dropdown(drop_effect); /* Re-encode for removed class of disabled */
    }
  });  
 
  $(".printViewTransactions").off('click');
  $(".printViewTransactions").on("click", function () {
    var val = $(this).attr("data-printCopy");
    var x = false;
    switch(val) {
      case 'both': x = 'both'; break;
      case 'office': x = 'office'; break;  
      case 'tenant': x = 'tenant'; break;    
    }
    if (x !== false) {
      print_receipt_view_trans(trans_id, x);
    }
  });
  
};

function print_receipt_view_trans(transactionID, copy) {
    if (transactionID == '0' || transactionID == null || transactionID === undefined) {
      alert('Please close out and try again');
    } else {
      var frameID = 'printTransDetails';
      var src = 'app/tenants/print-receipt.php?trans_id=' + transactionID + '&copy=' +copy;
      print_frame(frameID, src);
    }
}