Document Services - Standard Reports

debugging jQuery around the standard reports, trying to sort out why formatting is getting mangled.

by matt_bernhardt

JavaScript

$(document).ready(function() {
   $.datepicker.setDefaults({
	dateFormat: 'yy-mm-dd'					
	});

	$(function() {
		$("#ReportFrom").datepicker();
		$("#ReportTo").datepicker();
		$("#ReportFrom2").datepicker();
		$("#ReportTo2").datepicker();
		$("#MetaPaymentFrom").datepicker();
		$("#MetaPaymentTo").datepicker();		
	});

	// ---------initialize
	set_addr($('#AddrCountry'));
	set_dates();

	var date_from_e = $('#ReportFrom');
	var date_from = date_from_e.val();
	var date_to_e = $('#ReportTo');	
	var date_to = date_to_e.val();
	
	var date_from_e2 = $('#ReportFrom2');
	var date_from2 = date_from_e2.val();
	var date_to_e2 = $('#ReportTo2');	
	var date_to2 = date_to_e2.val();
    var report_format = '';

	$('a.report').click(function() {
		var url = $(this).attr('href');
		var format_e = $('#report_format');				
		date_from = date_from_e.val();
		var date_to = date_to_e.val();

		// check if date values are present
		if (!date_from) {
			alert('Please enter a start date for the report.');
			date_from_e.focus();
			return false;
		}
		if (!date_to) {
			alert('Please enter a end date for the report.');
			date_to_e.focus();
			return false;
		}
		if ($('#report_format input:checked').length < 1 && !$('#report_format').val()) {
			alert('Please select a format for the report output.');
			return false;			
		} else {
			if ($('#report_format input:checked').length > 0) {
				report_format = $('#report_format input:checked').val();
			} else {
				report_format = $('#report_format').val();
			}
		}
		// we're ready to get the data
		url += '/date_from:'+date_from+'/date_to:'+date_to+'/format:'+report_format;
		window.location = url;
		return false;
	});
	
	// checkboxes
	$('tr.title input').click(function() {
		var checked_status = $(this).attr('checked');
		var row_class = $(this).parent().parent().attr('class');
		var sub_row_class = 'tr.'+row_class.replace(/title /,'listing.')+' input';
		$(sub_row_class).attr('checked',checked_status);
	});
	
	// set...