
Hedera.Invoices = new Class
({
	Extends: Hedera.Form
	
	,activate: function ()
	{
		var params = this.params;

		if (!params.$.from)
		{
			var from = new Date ();
			from.setDate (from.getDate () - 30);
			from.setHours (0, 0, 0, 0);
			params.assign ({from: from});
		}
	}

	,onDownloadClick: function  (column, invoiceId)
	{
		if (!invoiceId)
			return;
			
		var params = {
			 'srv': 'rest:dms/invoice'
			,'invoice': invoiceId
			,'token': this.conn.token
		};
			
		var url = '?'+ Vn.Url.makeUri (params);
		window.open (url, '_blank');
	}
});

