function buildTable(data) {
//	console.log(data);
	var html;
	var record;
	$('.receipt-list tbody').empty();
	for (var i = 0; i <= data.length; i++) {
		record = data[i];
		console.log(JSON.stringify(record));
		html = '<tr>';
		html += '	<td class="text-center">' + record['issued_date'].substr(0, 10) + '</td>';
		html += '	<td class="text-center">' + record['issued_name'] + '</td>';
		html += '	<td class="text-center">' + record['student_name'] + '</td>';
		html += '	<td class="text-center">' + record['display_name'] + '</td>';
		html += '	<td class="text-right">$' + record['amount_to_pay'] + '</td>';
		html += '	<td class="text-center">' + ((record['receipts'].length == 0) ? '未交費' : '已交費') + '</td>';
		html += '	<td class="text-center"></td>';
		html += '	<td class="text-center"></td>';
		html += '</tr>';
		$('.receipt-list tbody').append(html);
	}
}

$(document).ready(function() {
	getRemoteData(
		'/api/invoicing/getInvoicesByStudentId',
		{
			id: id,
		},
		buildTable,
		getRemoteDataFail
	);
});
