’;
for(e=0;e<g;e++)if(!this._hrrar||!this._hrrar[e])
{
if(this.getColWidth(e) == 0)
{
//continue;
}
for(var i=this.hdr.rows[1].cells[this.hdr.rows[1]._childIndexes?this.hdr.rows[1]._childIndexes[parseInt(e)]:e],j=i.colSpan||1,k=i.rowSpan||1,m=1;m<j;m++)
{
h[e]+=h[m];
}
if(this.getColWidth(e) == 0)
{
c+=’’+this.getHeaderCol(e)+" | ";
}
else
{
c+=’’+this.getHeaderCol(e)+" | ";
}
e+=j-1}c+="</tr>";
//}
for(e=2;e<this.hdr.rows.length;e++)
if(_isIE){
c+="<tr style='background-color:lightgrey' class='header_row_"+e+"'>";
for(var l=this.hdr.rows[e].childNodes,m=0;m<l.length;m++)
if(!this._hrrar||!this._hrrar[l[m]._cellIndex])c+=l[m].outerHTML;
c+="</tr>"
}
else c+="<tr class='header_row_"+e+"' style='background-color:lightgrey; border-bottom:solid 1px #999999;'>"+(this._fake?this._fake.hdr.rows[e].innerHTML:"")+this.hdr.rows[e].innerHTML+"</tr>";
for(e=0;e<f;e++)
if(c+="<tr>",this.rowsCol[e]&&this.rowsCol[e]._cntr)
{
c+=this.rowsCol[e].innerHTML.replace(/<img[^>]*>/gi,"")+"</tr>";
}
else if(!(this.rowsCol[e]&&this.rowsCol[e].style.display=="none"))
{
var n;
if(this.getColWidth(e) == 0)
{
//continue;
}
if(this.rowsCol[e])
{n=this.rowsCol[e].idd;}
else if(this.rowsBuffer[e])
{n=this.rowsBuffer[e].idd;}
else
{continue;}
for(m=0;m<g;m++)if(!this._hrrar||!this._hrrar[m])
{
//
if(this.rowsAr[n]&&this.rowsAr[n].tagName=="TR")
var o=this.cells(n,m),p=o._setState?"":o.getContent?o.getContent():o.getImage||o.combo?o.cell.innerHTML:o.getValue();else p=this._get_cell_value(this.rowsBuffer[e],m);
var r=this.columnColor[m]?"background-color:"+this.columnColor[m]+";":"",q=this.cellAlign[m]?"text-align:"+this.cellAlign[m]+";":"",s=o.getAttribute("colspan");
c+='<td style="'+r+q+'; border-bottom:solid 1px #999999;" '+(s?'colSpan="'+s+'"':"")+">"+(p===""?" ":p)+"</td>";
s&&(m+=s-1)}c+="</tr>";
if(this.rowsCol[e]&&this.rowsCol[e]._expanded)
{
var x=this.cells4(this.rowsCol[e]._expanded.ctrl);
c+=x.getSubGrid?'<tr><td colspan="'+g+'">'+x.getSubGrid().printView()+"</td></tr>":'<tr><td colspan="'+g+'">'+this.rowsCol[e]._expanded.innerHTML+"</td></tr>"
}
}
if(this.ftr)for(e=1;e<this.ftr.childNodes[0].rows.length;e++)c+="<tr style='background-color:lightgrey; border-bottom:solid 1px #999999;'>"+(this._fake?
this._fake.ftr.childNodes[0].rows[e].innerHTML:"")+this.ftr.childNodes[0].rows[e].innerHTML+"</tr>";
c+="</table>";
// end of printview
windowManagerPrinter = new dhtmlXWindows();
windowManagerPrinter.enableAutoViewport(false);
windowManagerPrinter.attachViewportTo("body");
windowManagerPrinter.setImagePath("../codebase3.5/imgs/");
windowPrinter = windowManagerPrinter.createWindow("janela_printer", 200, 200, 470, 240);
windowPrinter.button("park").hide();
windowPrinter.setIcon("printer.png", "printer.png");
windowPrinter.setText("Opções de configurações do documento");
windowPrinter.keepInViewport(true);
windowPrinter.centerOnScreen();
windowPrinter.denyResize();
windowPrinter.attachEvent("onClose", function (win)
{
windowManagerPrinter.window("janela_printer").hide();
//W2.isLog = false;
});
var toolbar = windowPrinter.attachToolbar();
toolbar.setIconsPath("../codebase3.5/imgs/");
toolbar.addButton("gerar", 1, "gerar documento", "gerar.png", "gerar.png");
toolbar.attachEvent("onClick", function(id)
{
if(id=="gerar")
{
toolbar.disableItem("gerar");
var url = json.url, strType = json.type, header = json.header || "", footer = json.footer || "";
var margem_superior = form.getItemValue("margem_superior") || "2.5";
var margem_inferior = form.getItemValue("margem_inferior") || "2.5";
var margem_direita = form.getItemValue("margem_direita") || "3.0";
var margem_esquerda = form.getItemValue("margem_esquerda") || "3.0";
var strMargem = margem_superior +"cm "+margem_esquerda+"cm "+margem_direita+"cm "+margem_inferior+"cm";
var formato = form.getCombo("formato").getSelectedValue();
var tipo_documento = form.getCombo("tipo_documento").getSelectedValue();
var orientacao = form.getCombo("orientacao").getSelectedValue();
var params = "name=grid_"+(new Date).getTime();
params += "&c="+W2.Encoder.htmlDecode(encodeURI(c));
params += "&type="+tipo_documento;
params += "&formato="+formato+"";
params += "&margem="+strMargem+"";
params += "&orientation="+orientacao+"";
params += "&tpl_header="+W2.Encoder.htmlDecode(encodeURI(header));
params += "&tpl_footer="+W2.Encoder.htmlDecode(encodeURI(footer));
function showFile(json)
{
window.open(json.url);
toolbar.enableItem("gerar");
windowManagerPrinter.window("janela_printer").hide();
}
dhtmlxAjax.post(url, params, function(loader){
try{
showFile(eval("(" + loader.xmlDoc.responseText + ")"));
}
catch(e){
alert("Formato da resposta inválido. \nVerifique se ocorreu algum erro no servidor!");
alert(loader.xmlDoc.responseText);
}
});
}
});
barraStatusWindow = windowPrinter.attachStatusBar();
barraStatusWindow.setText("Configure tamanho do papel, dimensões da margem e orientação do documento");
var form = windowPrinter.attachForm();
var template =
[
{type: "settings", labelWidth: 130, offsetLeft: 10, inputWidth: 80, position:"label-top", offsetTop: 6},
{type: "combo", name: "formato", label: "Tamanho do papel", options:[
{value : "A4", text : "A4 - 21.0cm 29.7cm"}
,{value : "A5", text : "A5 - 14.8cm 21.0cm"}
,{value : "A6", text : "A6 - 10.5cm 14.8cm"}
,{value : "oficio", text : "Ofício - 21.5cm 35.5cm"}
,{value : "executive", text : "Executivo - 18.4cm 26.6cm"}
,{value : "letter", text : "Carta - 21.5cm 27.9cm"}
,{value : "envelope_10", text : "Envelope #10 - 10.4cm 24.1cm"}
], validate: "NotEmpty", inputWidth: 150},
{type: "combo", name: "tipo_documento", label: "Tipo de documento", options:[
{value : "pdf", text : "PDF"}
,{value : "doc", text : "DOC"}
,{value : "html", text : "HTML"}
], validate: "NotEmpty", inputWidth: 150},
{type: "combo", name: "orientacao", label: "Orientação do papel", options:[
{value : "portrait", text : "vertical"}
,{value : "landscape", text : "horizontal"}
], validate: "NotEmpty", inputWidth: 150},
{type:"newcolumn"},
{type:"fieldset", label : "Dimensão das margens - em centímetros", width : "260", list : [
{type:"input", name: 'margem_superior', label : "superior", position:"label-top", labelWidth: 80, value : "2.5"},
{type:"input", name: 'margem_direita', label : "direita", position:"label-top", labelWidth: 80, value : "3.0", offsetTop: 9},
{type:"newcolumn"},
{type:"input", name: 'margem_inferior', label : "inferior", position:"label-top", labelWidth: 80, value : "2.5"},
{type:"input", name: 'margem_esquerda', label : "esquerda", position:"label-top", labelWidth: 80, value : "3.0", offsetTop: 9}
]},
];
form.loadStruct( template, "json", function ()
{
});
if(json.type)
{
form.getCombo("tipo_documento").selectOption(form.getCombo("tipo_documento").getIndexByValue(json.type),false,true)
}
};