//-------------------------------------------------------//
// Author:Rodolfo Machon
// Company:WebSoft, SA de CV 
// Nombre del archivo: gmsws.js
// Created: 2022-11-27
// Updates: 2022-11-27
// Copyright - All Rights Reserved
//-------------------------------------------------------//
//-------------------------------------------------------//
var openwindow = {};
//-------------------------------------------------------//
window.onload = function(){
	const d = new Date();
	let text = d.toLocaleString();
	document.getElementById("fecha").innerHTML = "GENERADO EL :"+text;
	resizeTo(1200,700);
};
//-------------------------------------------------------//
//LEVEL 1
function OpenBalance(id){
	let cla = document.getElementById('clase').value;
    winame="Balance_"+cla;
    var fields="";
    var values="";
    if (!openwindow[winame] || openwindow[winame].closed){
	win ="window.open('../bin/bsws.pl?clase={clase}&id="+id+"&fields="+fields+"&values="+values+"','"+winame+"','left=0,top=0,width=100,height=100,resizable=yes,scrollbars=yes')";
	openwindow[winame]=eval(win);
    }
    else{openwindow[winame].focus()}
}
function OpenAdministrativo(id,clase){
    //alert(clase);
    if(clase=="inmueble"){clase="inmueble_administrativo"}
    if(clase=="empresa"){clase="empresa_administrativo"}
    winame="Balance";
    var fields="";
    var values="";
        if (!openwindow[winame] || openwindow[winame].closed){
	    win ="window.open('../bin/gdf.pl?clase="+clase+"&id="+id+"&fields="+fields+"&values="+values+"&dt_vencimiento=2008-07-31','"+winame+"','left=0,top=0,width=100,height=100,resizable=yes,scrollbars=yes')";
	    openwindow[winame]=eval(win);
	}
	else{openwindow[winame].focus()}
}
function OpenNotificacion(id){
    winame="Notificacion_"+id;
    var fields="";
    var values="";
    if (!openwindow[winame] || openwindow[winame].closed){
	win ="window.open('../pl/mora_notificacion_expediente_rept.pl?clase={clase}&id="+id+"&fields="+fields+"&values="+values+"','"+winame+"','left=0,top=0,width=100,height=100,resizable=yes,scrollbars=yes')";
        //alert(win);
	openwindow[winame]=eval(win);
    }
    else{openwindow[winame].focus()}
}
function MarkAll(){
    var T     = document.getElementById('Grid');
    var trows = T.rows;
    for (i = trows.length-2; i != 0; i--) {
	if(eval("document.form.chk_"+i+".checked")){
		eval("document.form.chk_"+i+".checked=false")
	}else{
		eval("document.form.chk_"+i+".checked=true")			
	}
    }
}
function MoraNotificacionExpedientes(){
    var count = 0;
    var expe = "";
    for (i=1; i<document.getElementById('Grid').rows.length-1; i++){
	if(eval("document.form.chk_"+i+".checked")){
	    var x=document.getElementById('Grid').rows[i].cells[1].getElementsByTagName('a');
	    expe += x[0].innerHTML+"|";
	    count++;
	}
    }
    document.form.str_expedientes.value = expe;
    //alert(document.form.str_expedientes.value);
    if(count>0){document.form.submit();}else{alert("Favor MARQUE con un CHEQUE los Expedientes que desea notificar..")}
} 
