var weekend = [0,6]; var weekendColor = "#a0e0e0"; var fontface = "Verdana"; var fontsize = 2; var gNow = new Date(); var ggWinCal; var gFCN = true; try { // Toma la Fecha Contable de la seccion de Usuario gNow.setFullYear(splitCal(qzCAL,"-")[0]); gNow.setMonth(1*splitCal(qzCAL,"-")[1] - 1); gNow.setDate(splitCal(qzCAL,"-")[2]); } catch (Exception) { gNow = new Date(); gFCN = false; } Calendar.Months=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]; Calendar.DOMonth = [31,28,31,30,31,30,31,31,30,31,30,31]; Calendar.lDOMonth = [31,29,31,30,31,30,31,31,30,31,30,31]; function splitCal(d,e){ var f = new Array(); kf = d.lastIndexOf(e); ko = i = 0; while(ko"; vHeader_Code = this.cal_header(); vData_Code = this.cal_data(); vCode = vCode + vHeader_Code + vData_Code; vCode = vCode + ""; return vCode; } Calendar.prototype.show = function(){ var vCode = ""; this.gWinCal.document.open(); this.wwrite(""); this.wwrite("Calendario"); this.wwrite(""); this.wwrite(""); this.wwriteA(""); this.wwriteA(this.gMonthName+" " + this.gYear); this.wwriteA("
"); var prevMMYYYY=Calendar.calc_month_year(this.gMonth,this.gYear,-1); var prevMM=prevMMYYYY[0]; var prevYYYY=prevMMYYYY[1]; var nextMMYYYY=Calendar.calc_month_year(this.gMonth,this.gYear,1); var nextMM=nextMMYYYY[0]; var nextYYYY=nextMMYYYY[1]; this.wwrite("
"); this.wwrite("[<<<\/A>]"); this.wwrite("[<<\/A>]"); this.wwrite("[><\/A>]"); this.wwrite("[>><\/A>]

"); vCode = this.getMonthlyCalendarCode(); this.wwrite(vCode); if(!gFCN) this.wwrite("
* No se obtuvo Fecha Contable
"); this.wwrite("
"); this.gWinCal.document.close(); } Calendar.prototype.wwrite = function(wtext){ this.gWinCal.document.writeln(wtext); } Calendar.prototype.wwriteA = function(wtext){ this.gWinCal.document.write(wtext); } Calendar.prototype.cal_header = function(){ var vCode = ""; vCode += ""; vCode += "Dom"; vCode += "Lun"; vCode += "Mar"; vCode += "Mié"; vCode += "Jue"; vCode += "Vie"; vCode += "Sáb"; vCode += ""; return vCode; } Calendar.prototype.cal_data = function(){ var vDate = new Date(); vDate.setDate(1); vDate.setMonth(this.gMonth); vDate.setFullYear(this.gYear); var vFirstDay = vDate.getDay(); var vDay = 1; var vLastDay = Calendar.get_daysofmonth(this.gMonth, this.gYear); var vOnLastDay = 0; var vCode = ""; vCode = vCode + ""; for(i=0; i "; } for(j=vFirstDay; j<7; j++){ vCode += "" + "" + this.format_day(vDay) + "" + ""; vDay = vDay + 1; } vCode += ""; for(k=2; k<7; k++){ vCode += ""; for(j=0; j<7; j++){ vCode += ""+ this.format_day(vDay) + "" + ""; vDay++; if(vDay>vLastDay){ vOnLastDay = 1; break; } } if(j==6) vCode = vCode + ""; if(vOnLastDay==1) break; } for(m=1; m<(7-j); m++){ if(this.gYearly) vCode += " "; else vCode += "" + m + ""; } return vCode; } Calendar.prototype.format_day = function(vday){ var vNowDay = gNow.getDate(); var vNowMonth = gNow.getMonth(); var vNowYear = gNow.getFullYear(); if(vday==vNowDay&&this.gMonth==vNowMonth&&this.gYear==vNowYear) return ("" + vday + ""); else return (vday); } Calendar.prototype.write_weekend_string=function(vday){ var i; for(i=0; i0){ tipoOld = e.substring(0,1); for(i=1; i<=e.length; i++){ tipo1 = e.substring(i-1, i); if(tipo1==tipoOld){ //descubre el formato acumulándolo if(tipo1=="D" && tipo1==tipoOld) tipo += tipo1; else if(tipo1=="M" && tipo1==tipoOld) tipo += tipo1; else if(tipo1=="Y" && tipo1==tipoOld) tipo += tipo1; else if(tipo1=="h" && tipo1==tipoOld) tipo += tipo1; else if(tipo1=="H" && tipo1==tipoOld) tipo += tipo1; else if(tipo1=="m" && tipo1==tipoOld) tipo += tipo1; else if(tipo1=="s" && tipo1==tipoOld) tipo += tipo1; else if(tipo1=="t" && tipo1==tipoOld) tipo += tipo1; else{ result += tipo1; tipoOld = e.substring(i, i+1); } }else{ //aquí ejecuta el formato acumulado horaH = x.getHours()>12 ? (x.getHours()-12) : x.getHours(); dia = x.getDay(); mes = x.getMonth() + 1; año = "" + x.getFullYear(); tt = x.getHours()>12 ? true : false; if(tipo=="D") result += x.getDate(); else if(tipo=="DD") result += x.getDate()<10 ? "0" + x.getDate() : x.getDate(); else if(tipo=="DDD") result += dia==0 ? "dom" : dia==1 ? "lun" : dia==2 ? "mar" : dia==3 ? "mié" : dia==4 ? "jue" : dia==5 ? "vie" : dia==6 ? "sáb" : ""; else if(tipo=="DDDD") result += dia==0 ? "domingo" : dia==1 ? "lunes" : dia==2 ? "martes" : dia==3 ? "miércoles" : dia==4 ? "jueves" : dia==5 ? "viernes" : dia==6 ? "sábado" : ""; else if(tipo=="M") result += mes; else if(tipo=="MM") result += mes<10 ? "0" + mes : mes; else if(tipo=="MMM") result += mes==1 ? "ene" : mes==2 ? "feb" : mes==3 ? "mar" : mes==4 ? "abr" : mes==5 ? "may" : mes==6 ? "jun" : mes==7 ? "jul" : mes==8 ? "ago" : mes==9 ? "sep" : mes==10 ? "oct" : mes==11 ? "nov" : mes==12 ? "dic" : ""; else if(tipo=="MMMM") result += mes==1 ? "enero" : mes==2 ? "febrero" : mes==3 ? "marzo" : mes==4 ? "abril" : mes==5 ? "mayo" : mes==6 ? "junio" : mes==7 ? "julio" : mes==8 ? "agosto" : mes==9 ? "septiembre" : mes==10 ? "octubre" : mes==11 ? "noviembre" : mes==12 ? "diciembre" : ""; else if(tipo=="YY") result += año.substring(2); else if(tipo=="YYYY") result += año; else if(tipo=="h") result += horaH; else if(tipo=="hh") result += horaH<10 ? "0" + horaH : horaH; else if(tipo=="H") result += x.getHours(); else if(tipo=="HH") result += x.getHours()<10 ? "0" + x.getHours() : x.getHours(); else if(tipo=="m") result += x.getMinutes(); else if(tipo=="mm") result += x.getMinutes()<10 ? "0" + x.getMinutes() : x.getMinutes(); else if(tipo=="s") result += x.getSeconds(); else if(tipo=="ss") result += x.getSeconds()<10 ? "0" + x.getSeconds() : x.getSeconds(); else if(tipo=="t") result += tt ? "P" : "A"; else if(tipo=="tt") result += tt ? "PM" : "AM"; else result += "?"; --i; tipo = ""; tipoOld = tipo1; } } } vData = result.substring(0, result.length - 1); //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ } return vData; } function Build(p_item, p_month, p_year, p_format){ var p_WinCal = ggWinCal; gCal = new Calendar(p_item, p_WinCal, p_month,p_year, p_format); // Customize your Calendar here.. gCal.gBGColor = "white"; gCal.gLinkColor = "black"; gCal.gTextColor = "black"; gCal.gHeaderColor = "darkgreen"; // Choose appropriate show function if(gCal.gYearly) gCal.showY(); else gCal.show(); } function showCal(p_item, p_format, p_month, p_year){ /* p_item=arguments[0]; p_format=arguments[1]==null||arguments[1]==""?"DD-MM-YYYY":arguments[1]; p_month=arguments[2]==null||arguments[2]==""?new String(gNow.getMonth()):arguments[2]; p_year=arguments[3]==null||arguments[3]==""?new String(gNow.getFullYear().toString()):arguments[3]; */ p_item = "fb." + p_item.name + (p_item.idd!=null && findElByName(p_item.name).length>1 ? "[" + p_item.idd + "]" : ""); p_format = p_format==null || p_format=="" ? "DD-MM-YYYY" : p_format; p_month = p_month==null || p_month=="" ? new String(gNow.getMonth()) : "" + parseInt(p_month,10) - 1; p_year = p_year==null || p_year=="" ? new String(gNow.getFullYear().toString()) : p_year; cerrarCal(); vWinCal = window.open("", "Calendario", "width=250,height=250,status=no,resizable=no,top=200,left=200"); vWinCal.opener = self; ggWinCal = vWinCal; Build(p_item, p_month, p_year, p_format); } function cerrarCal(){ if(ggWinCal){ ggWinCal.close(); ggWinCal=null; } }