tenants_dash.prototype.reports = function () {
  var user_id = this.user_id; /* This defines the User for AJAX Save */

   $.get( "app/tenants/tenants-right-history-menu.php", function( data ) {
      $( "#main-container-right-body-menu" ).html( data );
//      show_right_menu(true);
      right_scroll();
      $('#testingdrop').dropdown(drop_effect);
   });
     
    $(".filterReportList").off("change");
      $(".filterReportList").on("change", function () {
        var report_entity_filter = $('#report_entity_filter').val();
        var report_month_filter = $('#report_month_filter').val();
        var report_year_filter = $('#report_year_filter').val();
        var report_type_filter = $('#report_type').val();
        
        if (report_type_filter == '') {
          alert('Please first select Report Type!');         
        } else {
      // Get transaction information
      $('#loadingReport').addClass('active');
      $.get("tenants/report/"+report_type_filter+".html", {entity_id: report_entity_filter, month: report_month_filter, year: report_year_filter}, function (data) {
        $("#reportShell").html(data);
        $('#loadingReport').removeClass('active');
        $('#printReport').removeClass('disabled');
        $('.filterReportList').removeClass('disabled');
      });
        }
    });
   
    $("#printReport").off("click");
    $("#printReport").on("click", function () {
      var report_entity_filter = $('#report_entity_filter').val();
      var report_month_filter = $('#report_month_filter').val();
      var report_year_filter = $('#report_year_filter').val();
      print_reports(report_entity_filter, report_month_filter, report_year_filter);
    });

};

function print_reports(entity_id, month, year) {
  var frame_id = 'print_reports';
  var report_type_filter = $('#report_type').val();
  var src = 'tenants/report/'+report_type_filter+'.html?use_html=true&entity_id='+entity_id+'&month='+month+'&year='+year;
  print_frame(frame_id, src);
}