<?php
$db = $GLOBALS ['db'];
$docs = array ();

$res = $db->query ( "SELECT id FROM ecmsales ORDER BY date_entered DESC LIMIT 0,2" );
while ( $r = $db->fetchByAssoc ( $res ) ) {
	$tmp = array ();
	$tmp ['module'] = 'EcmSales';
	$tmp ['record'] = $r ['id'];
	$docs [] = $tmp;
}

/*
$docs [] =  array (
		'module' => 'EcmQuotes',
		'record' => '23f6aa91-d557-f9a8-ec8a-54215ff5e9cc' 
);

$res = $db->query ( "SELECT id FROM ecminvoiceouts ORDER BY date_entered DESC LIMIT 0,2" );
while ( $r = $db->fetchByAssoc ( $res ) ) {
	$tmp = array ();
	$tmp ['module'] = 'EcmInvoiceOuts';
	$tmp ['record'] = $r ['id'];
	$docs [] = $tmp;
}
*/
/*
$params = array();
$params[0] = base64_encode(json_encode($docs));
$params[1] = "plik.pdf";
echo base64_encode(json_encode($params));
*/
$btn = '<input type="button" class="button" onclick="EcmMultiPdf_create(\''.base64_encode(json_encode($docs)).'\');" value="GO!"/>';
echo $btn;
?>