table in html that does not show all the results of a select

0

Good friends I have a web application with a table to which at the moment of pressing the "search" button taking as value the one chosen in the default combobox '0' .. it must show me all the existing stores in the BD, probe in toadOracle and it works perfectly, they show me all the results, but in my web application it just shows me a result, pass the modified query to my project in java EE as is and probe that in fact it is capturing the '0' and if does, I may be doing wrong, then the query in java

String stringQuery = "SELECT DISTINCT * " + "FROM ( "
            + "SELECT tmp_barra_primaria.codigoPrincipal, "
            + "tmp_barra_primaria.descripcionCorta, "
            + "tmp_barra_primaria.descripcionLarga, " + "im.dept, "
            + "vi.vat_rate, " + "rfr2.selling_retail, "
            + "TO_CHAR(rpile.detail_start_date,'yyyymmdd'), " + "TO_CHAR(rpile.detail_end_date,'yyyymmdd'), "
            + "rpile.promo_comp_id, " + "rpile.promo_id, "
            + "DECODE(uil.uda_value, " + "'0', " + "'Normal', " + "'4', "
            + "'Pesable', " + "'7', " + "'Procesado') estado, "
            + "rfr2.simple_promo_retail,null,im.standard_uom,MFG_REC_RETAIL  " + "FROM item_master       im, "
            + "vat_item          vi, " + "store             s, "
            + "uda_item_lov      uil, " + "rpm_future_retail rfr2, " +

            "(SELECT decode(im.item_number_type, " + "'ITEM', "
            + "im.item, " + "im.item_parent) codigoPrincipal, "
            + "im.item_desc descripcionLarga, "
            + "im.short_desc descripcionCorta " + "FROM item_master im "
            + "WHERE im.item = ?1) tmp_barra_primaria " +

            "LEFT OUTER JOIN(item_loc il) "
            + "ON (tmp_barra_primaria.codigoPrincipal = il.item AND "
            + "il.loc = DECODE(?2,'0',il.loc,?2)) " +
            "LEFT OUTER JOIN(rpm_future_retail rfr) "
            + "ON (tmp_barra_primaria.codigoPrincipal = rfr.item AND "
            + "rfr.location = DECODE(?2,'0',rfr.location,?2) AND "
            + "TO_DATE(sysdate, 'DD/MM/YYYY') <= "
            + "TO_DATE(rfr.action_date, 'DD/MM/YYYY') AND "
            + "(to_date(sysdate) - to_date(rfr.action_date)) >= 0) "
            + "LEFT OUTER JOIN(rpm_promo_item_loc_expl rpile) "
            + "ON (tmp_barra_primaria.codigoPrincipal = rpile.item AND "
            + "rpile.location = DECODE(?2,'0',rpile.location,?2) AND "
            + "TO_DATE(sysdate, 'DD/MM/YYYY') between "
            + "TO_DATE(rpile.detail_start_date, 'DD/MM/YYYY') AND "
            + "to_date(rpile.detail_end_date, 'DD/MM/YYYY')) " +

            "WHERE im.item = tmp_barra_primaria.codigoPrincipal "
            + "AND VI.VAT_TYPE IN ('R', 'B')"
            + "AND vi.item = im.item " + "AND s.store = DECODE(?2,'0',s.store,?2) "
            + "AND s.vat_region = vi.vat_region "
            + "AND uil.item = im.item " + "AND uil.uda_id = 3 "
            + "AND rfr2.item = tmp_barra_primaria.codigoPrincipal "
            + "AND rfr2.location = DECODE(?2,'0',rfr2.location,?2) " +

            "AND (to_date(SYSDATE) - to_date(rfr2.action_date)) >= 0)";

in the decode if you select a store for example the number 1 shows only that, in exchange if in the combobox I select "all" that its index is '0' should show me in the table all stores and only shows me one

here the code of the table

jQuery("#tablaProductos")
                        .jqGrid(
                        {
                            //  url:'tabla_producto.html',
                            datatype: "json",
                            height: 190,
                            width: 865,
                            colNames: [ 'Ip',
                                'Sistema',
                                'NumeroSucursal',
                                'Sucursal',
                                'Código Principal',
                                'Descripción Corta',
                                'Precio',
                                'Precio Promoción',
                                'PV Justo'],
                            colModel: [
                                {
                                    name: 'ip',
                                    index: 'ip',
                                    width: 50,
                                    align: "center",
                                    hidden: true,
                                    sortable: false

                                },
                                {
                                    name: 'sistema',
                                    index: 'sistema',
                                    width: 50,
                                    align: "center",
                                    hidden: true,
                                    sortable: false

                                },
                                {
                                    name: 'numeroSucursal',
                                    index: 'numeroSucursal',
                                    width: 50,
                                    align: "center",
                                    hidden: true,
                                    sortable: false

                                },
                                {
                                    name: 'sucursal',
                                    index: 'sucursal',
                                    width: 50,
                                    align: "center",
                                    sortable: false

                                },
                                {
                                    name: 'codigoPrincipal',
                                    index: 'codigoPrincipal',
                                    width: 50,
                                    align: "center",
                                    sortable: false

                                }
                                ,
                                {
                                    name: 'descripcionCorta',
                                    index: 'descripcionCorta',
                                    width: 70,
                                    align: "center",
                                    sortable: false

                                },
                                {
                                    name: 'precio',
                                    index: 'precio',
                                    width: 35,
                                    align: "center",
                                    sortable: false

                                },
                                {
                                    name: 'precioPromocion',
                                    index: 'precioPromocion',
                                    width: 35,
                                    align: "center",
                                    sortable: false

                                },
                                {
                                    name: 'pvJusto',
                                    index: 'pvJusto',
                                    width: 35,
                                    align: "center",
                                    sortable: false

                                },
                            ],
                            rowNum: 5,
                            rowList: [ 8, 10, 20, 30 ],
                            pager: '#plist4',
                            sortname: 'sucursal',
                            jsonReader: {
                                repeatitems: false,
                                id: "0"
                            },
                            recordpos: 'left',
                            multiselect: true,
                            multiboxonly: true,

                            viewrecords: true,
                            sortorder: "desc",
                            toolbar: [ true, "top" ],

                            subGrid: true,
                            caption: "Información Productos RMS",

                            afterInsertRow: function (ids, aData) {
                                jQuery("#tablaProductoRms")
                                        .jqGrid(
                                        'setCell',
                                        ids,
                                        'precio',
                                        '',
                                        {
                                            color: 'red'

                                        });
                                jQuery("#tablaProductoRms")
                                        .jqGrid(
                                        'setCell',
                                        ids,
                                        'precioPromocion',
                                        '',
                                        {
                                            color: 'red'
                                        });
                            },
                            onSelectRow: function (id) {


                                jQuery('#tablaProductoRms').jqGrid('editRow', id, true);

                            },

                            ondblClickRow: function (ids) {
                                $("#tablaProductos2").jqGrid(
                                        'setGridState',
                                        'visible');
                                $("#loading").show();
                                //  $("#tablaProductoControlador").jqGrid('setGridState','visible');
                                var fila = jQuery(
                                        "#tablaProductos")
                                        .getRowData(ids);

I hope you can guide me on what I could be doing wrong, I do not know if the table will have any property that allows you to only show one result per query, I hope your help thanks

he fills the table through this method Informationproduct ()

.. here is

function informacionProducto() {
        $("#loading");
        var formulario = $('#formularioBusqueda');

        if (document.formularioBusqueda.radio2.checked) {
            var x = 0;
            $
                    .post(
                    'ConsultasRms/tabla_consultaProductoPromocion.html',
                    formulario.serialize(),
                    function (data) {
                        $("#loading").hide();
                        if (data.rows[0].length == 0 && data.rows[1].length == 0) {
                            $("#dialog-NoDataPromocion").dialog("open");
                        }


                        else {
                            //borramos el contenido de los option del select
                            //$("#comboboxSucursales").html("");
                            //recorremos todas las filas del resultado del proceso que obtenemos en Json


                            comboSucursales = document.getElementById('comboboxSucursales');
                            sucursalConsulta = comboSucursales.options[comboSucursales.selectedIndex].text;

                            var listaProductoActivo = data.rows[0];
                            for (x = 0; x < listaProductoActivo.length; x++) {


                                var datarow = {
                                    sucursal: sucursalConsulta,
                                    numeroSucursal:comboSucursales.options[comboSucursales.selectedIndex].value,
                                    ip: ipControlador,
                                    sistema: tipoSucursal,
                                    codigoPrincipal: listaProductoActivo[x].codigoPrincipal,
                                    descripcionCorta: listaProductoActivo[x].descripcionCorta,
                                    precio: listaProductoActivo[x].precio,
                                    precioPromocion: listaProductoActivo[x].precioPromocion,
                                    pvJusto: listaProductoActivo[x].pvJusto,
                                    statusProducto: listaProductoActivo[x].statusProducto


                                };
                                datarowRmsDetalle[cont] = {
                                    descripcionLarga: listaProductoActivo[x].descripcionLarga,
                                    iva: listaProductoActivo[x].iva,
                                    estado: listaProductoActivo[x].estado,
                                    departamento: listaProductoActivo[x].departamento,
                                    codigoComponente: listaProductoActivo[x].codigoComponente,
                                    codigoPromocion: listaProductoActivo[x].codigoPromocion,
                                    fechaInicioPromocion: listaProductoActivo[x].fechaInicioPromocion,
                                    fechaFinPromocion: listaProductoActivo[x].fechaFinPromocion

                                };


                                var su = jQuery("#tablaProductoRms")
                                        .jqGrid('addRowData', cont,
                                        datarow);

                                cont++;
                            }
    
asked by Jdeveloper 17.11.2016 в 15:22
source

0 answers