﻿function TemplateUpdateControls(gn,ctrlId,cellId,value)
{
    if(ctrlId=="MaskEdit1")
    {
        igtbl_getElementById(ctrlId).Text=value;
        return true;
    }
    else if(ctrlId=="PVDate1" || ctrlId=="PVDate2" || ctrlId=="PVDate3")
    {
        var d=new Date(value);
        igtbl_getElementById(ctrlId).Value=(d.getMonth()+1).toString()+"/"+d.getDate()+"/"+d.getFullYear();
        return true;
    }
    else if(ctrlId=="shipAddrId")
    {
        var s=value;
        igtbl_getElementById(ctrlId).innerText=value;
        return true;
    }
    else if(ctrlId=="tmplShipName")
    {
        igtbl_getElementById("tmplName").innerText=value;
    }
}

function TemplateUpdateCells(gn,ctrlId,cellId)
{
    if(ctrlId=="MaskEdit1")
    {
        igtbl_getCellById(cellId).setValue(igtbl_getElementById(ctrlId).TextWithMask);
        return true;
    }
    else if(ctrlId=="PVDate1" || ctrlId=="PVDate2" || ctrlId=="PVDate3")
    {
        igtbl_getCellById(cellId).setValue(igtbl_getElementById(ctrlId).Value);
        return true;
    }
    else if(ctrlId=="shipAddrId")
    {
        var s=igtbl_getElementById(ctrlId).innerText;
        igtbl_getCellById(cellId).setValue(s);
        return true;
    }
}

var gAutoPrint = true; 
function igtbl_reImprimirBtn_onclick(idDiv){
    if (document.getElementById != null)   {
        var html="<html>";
        html+="<body>";
        var printReadyElem = document.getElementById(idDiv);
        if (printReadyElem != null){
            html += printReadyElem.innerHTML;
        }
        else{
            alert("No se encuentra el texto a imprimir en el codigo HTML");
            return;
        }
        html+="</html></body>";
        //igtbl_gRowEditButtonClick();
        var printWin = window.open("Print.htm","_blank","left=20,top=20,width=580 ,height=550,toolbar=no,location=no,status=no,menubar=no,resizable=no,scrollbars=no"); 
        printWin.document.write(html);
        printWin.document.close();
        printWin.print();
        setTimeout("",2000);                   
        printWin.close();
        
        //var printWin = window.open("","popimpr");
        //printWin.document.open();
        //printWin.document.write(html);
        //printWin.document.close();
        //printWin.print();
        //printWin.close();
    }
    else{
        alert("Lo sentimos, pero su navegador no soporta esta opción.");
    }
}





