<!--
//  Title:       Region Summary
//  Developer:   Wade McDonough
//  Verion:      1.0
//  Date:        3 Nov 2006
//  Description: 
// 
/////////////////////////////

function invoice_t_pre_summary_onclick(x_button)
{
	if (x_button == 'apply')
	{
		ajax_showdiv('div_result');

		var url = 'modules/invoice_t_pre/invoice_t_pre_summary.php';

		var param = 'filter_client=' 		+ encodeURIComponent(document.getElementById('filter_client').value);
		param += '&filter_client_id=' 	+ document.getElementById('filter_client_id').value;

		var div = 'div_body';
		var callback = "invoice_t_pre_summary_onload();";
		ajax_processRequestPost(url,param,div,callback)
		return false;
	}
	if (x_button == 'reset')
	{
		ajax_showdiv('div_result');
		var url = 'modules/invoice_t_pre/invoice_t_pre_summary.php';

		var param 	 = 'filter_client=' 	+ '';
		param 		+= '&filter_client_id=' 	+ '0';
	
		var div = 'div_body';
		var callback = "invoice_t_pre_summary_onload();";
		ajax_processRequestPost(url,param,div,callback)
		return false;
	}
	else if (x_button == 'with_select_apply')
	{
		if (!isSelected('with_selected', 'Please select a \'With Selected\''))
			return false;
		
		// Test for at least one checked checkbox
		var checkbox_count = 0;
		var checkbox_string = '';
		for (var i=1; i<document.forms[0].elements.length; i++) 
		{
			// Look for check box matches
			if ((document.forms[0].elements[i].type == "checkbox") && (document.forms[0].elements[i].name == "checkbox_id[]")) 
			{
				if (document.forms[0].elements[i].checked == true)
				{
					checkbox_count++;
					checkbox_string += document.forms[0].elements[i].value + ',';
				}
			}
		}
		checkbox_string = checkbox_string.slice(0, -1)

		if (checkbox_count == 0)
		{
			alert('No items selected!\n\nPlease select at least one checkbox');
			return;
		}

		var with_selected = document.getElementById('with_selected').value
		document.getElementById('with_selected').value = 0; // Reset Starting Position

		// Assign Invoice
		if (with_selected == 1)
		{
			ajax_showdiv('div_result');
			
			var url = 'modules/invoice_t_pre/invoice_t_pre_summary.php';

			var param = 'mode=assign_invoice';
			param += '&invoice_id=' 	+ checkbox_string;

			var div = 'div_body';
			var callback = "invoice_t_pre_summary_onload();";
			ajax_processRequestPost(url,param,div,callback)
			return false;
		}
	}
	return false;
}

function invoice_pre_t_summary_action(mode,id,x_param)
{
	if ((mode == 'edit') || (mode == 'view'))
	{
		ajax_showdiv('div_result');
		
		var url 		= 'modules/transport/transport_detail.php';
		var div 		= 'div_popup_1';
		var param   	= 'mode=' + mode;
		param   		+= '&transport_id=' + id;
		param   		+= '&transport_return=invoice_t_pre';
		var callback 	= "transport_detail_onload('" + mode + "');";
		callback 		+= "ajax_hidediv('div_result');";
		
		ajax_processRequestPost(url,param,div,callback)
	}
}

function invoice_t_pre_summary_onload()
{
	// Onload
}
-->
