//-------------------------------------------------------//
// 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 OpenWindows = {};
//-------------------------------------------------------//
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 clase = document.getElementById('clase').value;
    var winame 	= "ExpedienteBSWS";
	if (!OpenWindows[winame] || OpenWindows[winame].closed){
		OpenWindows[winame]= window.open("../bin/bsws.pl?clase="+clase+"&id="+id,"ExpedienteBSWSRept","left=150,top=100,width=900,height=600,scrollbars=1,toolbar=0,menubar=0,resizable=1,location=0,status=0");
	}else{OpenWindows[winame].focus();}  
}
function OpenAdministrativo(id,clase){
    if(clase == "inmueble"){clase="inmueble_administrativo";}
    if(clase == "empresa"){clase="empresa_administrativo";}
    var winame 	= "ExpedienteGDF";
	if (!OpenWindows[winame] || OpenWindows[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')";
		OpenWindows[winame]= window.open("../bin/gdfl.pl?clase="+clase+"&id="+id,"ExpedienteBSWSRept","left=150,top=100,width=900,height=600,scrollbars=1,toolbar=0,menubar=0,resizable=1,location=0,status=0");
	}else{OpenWindows[winame].focus();}  
}
function MarkAll(){
	var T = document.getElementById("Grid").getElementsByTagName('tbody')[0];	
    var trows = T.rows;
    for (let i = 0; i<trows.length; i++) {
		if(document.getElementById("chk_"+i)){
			if(document.getElementById("chk_"+i).checked){
				document.getElementById("chk_"+i).checked=false;
			}else{
				document.getElementById("chk_"+i).checked=true;
			}
		}
    }
}
function MoraNotificacionExpedientes(){
	var expe = "";
	var T = document.getElementById("Grid").getElementsByTagName('tbody')[0];	
    var trows = T.rows;
    for (let i = 0; i<trows.length; i++) {
		if(document.getElementById("chk_"+i)){
			if(document.getElementById("chk_"+i).checked){
				var x = T.rows[i].cells[1].getElementsByTagName('a');
				expe += x[0].innerHTML+"|";
			}
		}
    }
    document.form.str_expedientes.value = expe;
    //alert(document.form.str_expedientes.value);
    if(document.form.str_expedientes.value!=""){document.form.submit();}else{alert("Favor MARQUE con un CHEQUE los Expedientes que desea notificar..");}
} 
function OpenNotificacion(id){
    let clase = document.getElementById('clase').value;	
    var winame 	= "ExpedienteNotificacion";
	if (!OpenWindows[winame] || OpenWindows[winame].closed){
		OpenWindows[winame]= window.open("../pl/mora_notificacion_expediente_rept.pl?clase="+clase+"&id="+id,"ExpedienteNotificacionRept","left=150,top=100,width=900,height=600,scrollbars=1,toolbar=0,menubar=0,resizable=1,location=0,status=0");
	}else{OpenWindows[winame].focus();}  
}