All pastes #165566 Raw Edit

Unnamed

public text v1 · immutable
#165566 ·published 2006-09-09 23:43 UTC
rendered paste body
domapi.loadUnit("listgrid");
domapi.loadUnit("window");
domapi.loadUnit("toolbar");
domapi.loadUnit("speedbutton");
domapi.loadUnit("menubar");
domapi.loadUnit("popupmenu");
domapi.loadUnit("thirdparty/gkafka/splitter");
domapi.loadUnit("label");
onload = function () {
    grid = domapi.Listgrid( {
        parent : domapi.getElm("oW"), x : 0, y : 0, w : 500, h : 243, position : "absolute"}
    );
    grid.doBorder = true;
    grid.doLedgerMode = true;
    grid.doVirtualMode = true;
    grid.doVirtualMode = true;
    grid.setGridlines('both');
    var ncols = 2;
    var w = 490;
    var data = {
        cols : [ {
            sortable : true, editable : false, fieldName : "Courts.IdCourt", hidden : true, text : "Courts.IdCourt", w : w / ncols}
        , {
            sortable : false, editable : false, fieldName : "Expenses.IdExpenses", hidden : true, text : "Expenses.IdCourt", w : w / ncols}
        , {
            sortable : true, editable : false, fieldType : ftString, fieldName : "idperiod", text : "Exercício", w : w / ncols}
        , {
            sortable : true, editable : false, fieldType : ftString, fieldName : "Courts.Name", text : "Corte", w : w / ncols}
        ], rows : []}
    ;
    grid.loadFromJson(data);
    oToolbar = domapi.Toolbar( {
        parent : domapi.getElm("toolbar"), x : 0, y : 242, position : "absolute", w : 500, h : 28, doBGFill : false}
    );
    oToolbar.setAlign(alTop);
    function OnTBClick(E) {
        alert("'" + this.hint + "' clicked.");
    }
    ;
    btn1 = domapi.Speedbutton( {
        parent : oToolbar, position : "relative", text : "Incluir", src : "/cnj/images/16/actions/new.gif", hint : "Adicionar novo registro", enabled : true, orientation : "horizontal"}
    );
    oToolbar.addSpacer();
    btn2 = domapi.Speedbutton( {
        parent : oToolbar, position : "relative", text : "Alterar", src : "/cnj/images/16/actions/edit.gif", hint : "Editar registro", enabled : true, orientation : "horizontal"}
    );
    oToolbar.addSpacer();
    btn3 = domapi.Speedbutton( {
        parent : oToolbar, position : "relative", text : "Excluir", src : "/cnj/images/16/actions/delete.gif", hint : "Excuir registro", enabled : true, orientation : "horizontal"}
    );
    oToolbar.addSpacer();
    btn4 = domapi.Speedbutton( {
        parent : oToolbar, position : "relative", text : "Pesquisar", src : "/cnj/images/16/actions/find.gif", hint : "Localizar registro", orientation : "horizontal"}
    );
    oToolbar.addSpacer();
    btn5 = domapi.Speedbutton( {
        parent : oToolbar, position : "relative", text : "Visualizar", src : "/cnj/images/16/actions/print.gif", hint : "Imprimir registro(s) selecionado(s)", orientation : "horizontal"}
    );
    oToolbar.addSpacer();
    btn6 = domapi.Speedbutton( {
        parent : oToolbar, position : "relative", text : "Ajuda", src : "/cnj/images/16/actions/help.gif", hint : "Tópicos de ajuda", orientation : "horizontal"}
    );
    oToolbar.spaceControls();
    function m1100Add() {
        var w = 500, h = 300;
        var oW1 = parent.domapi.Window( {
            text : '<img src="/cnj/images/16/expense.gif" alt="" align="texttop" border="0"> Despesas', w : w, h : h, windowType : "IFRAME", destroyOnClose : true}
        );
        oW1.loadURL("/cgi-bin/indicadores.exe/formExpensesAdd?theme=system&skin=true");
        oW1.moveTo(parent.domapi.bodyWidth()/2-w/2, parent.domapi.bodyHeight()/2-h/2);
        oW1.setModal(false);
        oW1.onclose = function () {
            if (this.destroyOnClose)this.setSize(1, 1);
        }
        ;
    }
    ;
    function m1100Edit() {
        var courtid = grid.data.getValue(grid.currentRow, 0);
        var IdExpenses = grid.data.getValue(grid.currentRow, 1);
        if (courtid != null) {
            var w = 500, h = 300;
            var urlvar = '/cgi-bin/indicadores.exe/formExpensesEdit?theme=system&skin=true&dbname=indicators.mdb&qryName=QryExpenses&CourtId=' + courtid + '&IdExpenses=' + IdExpensesvar oW1 = parent.domapi.Window( {
                text : '<img src="/cnj/images/16/expense.gif" alt="" align="texttop" border="0"> Despesas', w : w, h : h, windowType : "IFRAME", destroyOnClose : true}
            );
            oW1.loadURL(urlvar);
            oW1.moveTo(parent.domapi.bodyWidth()/2-w/2, parent.domapi.bodyHeight()/2-h/2);
            oW1.setModal(false);
            oW1.onclose = function () {
                if (this.destroyOnClose)this.setSize(1, 1);
            }
            ;
        }
        else {
            alert('Selecione a corte cujos dados serão alterados');
        }
    }
    ;
    function m1100Delete() {
        var courtid = grid.data.getValue(grid.currentRow, 0);
        var IdExpenses = grid.data.getValue(grid.currentRow, 1);
        if (courtid != null) {
            var w = 500, h = 300;
            var urlvar = '/cgi-bin/indicadores.exe/formExpensesDelete?theme=system&skin=true&dbname=indicators.mdb&qryName=QryExpenses&CourtId=' + courtid + '&IdExpenses=' + IdExpensesvar oW1 = parent.domapi.Window( {
                text : '<img src="/cnj/images/16/expense.gif" alt="" align="texttop" border="0"> Despesas', w : w, h : h, windowType : "IFRAME", destroyOnClose : true}
            );
            oW1.loadURL(urlvar);
            oW1.moveTo(parent.domapi.bodyWidth()/2-w/2, parent.domapi.bodyHeight()/2-h/2);
            oW1.setModal(false);
            oW1.onclose = function () {
                if (this.destroyOnClose)this.setSize(1, 1);
            }
            ;
        }
        else {
            alert('Selecione a corte cujos dados serão alterados');
        }
    }
    ;
    function m1100View() {
        var courtid = grid.data.getValue(grid.currentRow, 0);
        var IdExpenses = grid.data.getValue(grid.currentRow, 1);
        if (courtid != null) {
            var w = 500, h = 300;
            var urlvar = '/cgi-bin/indicadores.exe/formExpensesView?theme=system&skin=true&dbname=indicators.mdb&qryName=QryExpenses&CourtId=' + courtid + '&IdExpenses=' + IdExpensesvar oW1 = parent.domapi.Window( {
                text : '<img src="/cnj/images/16/expense.gif" alt="" align="texttop" border="0"> Despesas', w : w, h : h, windowType : "IFRAME", destroyOnClose : true}
            );
            oW1.loadURL(urlvar);
            oW1.moveTo(parent.domapi.bodyWidth()/2-w/2, parent.domapi.bodyHeight()/2-h/2);
            oW1.setModal(false);
            oW1.onclose = function () {
                if (this.destroyOnClose)this.setSize(1, 1);
            }
            ;
        }
        else {
            alert('Selecione a corte cujos dados serão alterados');
        }
    }
    ;
    grid.ondblclick = function () {
        m1100View();
    }
    ;
    btn1.onclick = function () {
        m1100Add();
    }
    ;
    btn2.onclick = function () {
        m1100Edit();
    }
    ;
    btn3.onclick = function () {
        m1100Delete();
    }
    ;
}
;