67
| <![CDATA[<script type="text/javascript">
//Load content via ajax
var settings = {
WEBSIS_LIB_URL: '//siapegov.pindamonhangaba.sp.gov.br/websis/../siap-lib/',
WEBSIS_URL: '//siapegov.pindamonhangaba.sp.gov.br/pmpinda/websis/'
};
function MM_openBrWindow(theURL, winName = "Prefeitura Municipal de Pindamonhangaba", larg) { //v3.0
if ($('#modal').length == 0) {
$('.page-content').append("<div id='modal' class='modal' tabindex='-1' aria-labelledby='myModalLabel' aria-hidden='false'><div class='modal-dialog'><div class='modal-content'><div class='modal-header'><button type='button' class='close' data-dismiss='modal' aria-hidden='true'>�</button><h4 class='modal-title text-center' id='myModalLabel'>" + winName + "</h4></div><div id='printSection' class='modal-body'></div><div class='modal-footer no-margin hidden-xs'><button type='button' class='btn btn-default' data-dismiss='modal'>Fechar</button><button class='btn btn-info' aria-hidden='true' id='imprimeModal'><i class='fa fa-print'></i> Imprimir</button></div></div></div></div>");
}
spin = "<div class='text-center'><i class='ace-icon fa fa-circle-o-notch fa-spin blue bigger-250'></i></div>";
$('#modal .modal-body').html(spin);
$('#modal').modal('show');
$.ajax({
type: 'get',
url: theURL,
beforeSend: function( xhr ) {
xhr.overrideMimeType( "text/plain; charset=ISO-8859-1" ); },
success: function(conteudo){
$('#modal .modal-body').html(conteudo);
$('#modal .modal-dialog').css('width', '95%');
$('#modal .modal-body').css('max-height', function () {
return String(($(window).height()) - 200) + 'px';
});
$('#modal .modal-body').css('overflow', 'auto');
}
});
$("#imprimeModal").off();
$("#imprimeModal").on("click", function(){
PrintContent("printSection");
});
}
function PrintContent(div_to_print,css = null) {
if (css === null) {
var css1 = "<link rel='stylesheet' type='text/css' href='"+settings.WEBSIS_LIB_URL+"siap-lib/ace-template/assets/css/bootstrap.min.css' media='all'>\n";
var css2 = "<link rel='stylesheet' type='text/css' href='"+settings.WEBSIS_URL+"_css/egov/print.css' media='all'>\n";
var css = css1 + css2;
}
var DocumentContainer = document.getElementById(div_to_print);
var UniqueName = new Date();
var WindowObject = window.open("", "PrintWindow" + UniqueName.getTime(), "width=750,height=650,top=50,left=50,toolbars=no,scrollbars=yes,status=no,resizable=yes");
WindowObject.document.writeln("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html lang=\"en\">\n<head>\n" + css + "</head>\n<body>\n" + DocumentContainer.innerHTML.replace("", "") + "\n</body>\n</html>");
WindowObject.document.close();
WindowObject.focus();
setTimeout(function() {
WindowObject.print()
setTimeout(function() {
WindowObject.close()
}, 1000);
}, 1000);
}
$.ajaxSetup({ // Força os scripts a serem carregados com o encoding ISO-8859-1 (padrão dos fontes do Siap e-Gov), evitando assim, problemas de acentuação.
beforeSend: function(jqXHR) {
jqXHR.overrideMimeType('application/x-www-form-urlencoded; charset=ISO-8859-1');
}
});
</script>]]>
|