Advertisement
jcarlosriverae

consultas analizador

Nov 9th, 2022
951
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 24.43 KB | None | 0 0
  1. DATOS_BASICOS_CUENTA =  """
  2.    select
  3.        cac.id_cuenta_ahorro as idCuenta,
  4.        cac.id_cliente as idCliente,
  5.        cac.id_producto_ahorro_empresa as idPAE,
  6.        pae.nombre_producto,
  7.        pa.id_producto_ahorro as idProducto,
  8.        pa.nombre as tipoProducto,
  9.        -- id_producto_ahorro,
  10.        case cac.tipo_persona
  11.            when 0 then 'Física'
  12.            when 1 then 'Moral'
  13.        end as persona, -- 0: fisica, 1:moral
  14.        cac.saldo_ahorro,
  15.        date(cac.fecha_alta) as fechaAlta,
  16.        case cac.activo
  17.            when 0 then 'Activa'
  18.            when 1 then 'Inactiva'
  19.            when 2 then 'Autorizar retiro parcial'
  20.            when 3 then 'Autorizar retiro total'
  21.            when 10 then 'Eliminada'
  22.        end as estatus,
  23.        cac.alias,
  24.        cac.distribuidor,
  25.        cac.grupo_trabajo,
  26.        cac.no_cuenta as cuentaEje,
  27.        cac.id_cuenta_ahorro_padre as cuentaMadre
  28.    from
  29.        alquimia_vitae.cuenta_ahorro_cliente cac
  30.        join producto_ahorro_empresa pae
  31.            on pae.id_producto_ahorro_empresa = cac.id_producto_ahorro_empresa
  32.        join producto_ahorro pa on pae.id_producto_ahorro = pa.id_producto_ahorro
  33.    where id_cuenta_ahorro = ?;    
  34.    """
  35. SALDO_DE_CUENTA = """
  36.    SELECT
  37.        cac.saldo_ahorro
  38.    FROM
  39.        alquimia_vitae.cuenta_ahorro_cliente cac
  40.    WHERE id_cuenta_ahorro = ?;
  41. """
  42. DETERMINA_CUENTA_POR_EJE = """
  43.    select
  44.        id_cuenta_ahorro
  45.    from
  46.        cuenta_ahorro_cliente
  47.    where
  48.        no_cuenta =?;
  49.    """
  50.  
  51. DETERMINA_CUENTA_POR_CLABE = """
  52.    select
  53.        id_cuenta_ahorro
  54.    from
  55.        cuenta_ahorro_medio_pago
  56.    where
  57.        no_cuenta_medio_pago =?;
  58.    """
  59. DATOS_CLIENTE_MORAL="""
  60.    select
  61.        id_empresa,
  62.        nombre,
  63.        rfc,
  64.        fecha_alta
  65.    from
  66.        empresa
  67.    where
  68.        id_empresa=?;    
  69. """
  70. DATOS_CLIENTE_FISICA = """
  71.    select
  72.        id_cliente,
  73.        apellido_paterno,
  74.        apellido_materno,
  75.        nombre,
  76.        rfc,
  77.        curp,
  78.        email,
  79.        fecha_alta,
  80.        id_hsm
  81.    from
  82.        cliente
  83.    where
  84.        id_cliente=?;  
  85. """
  86. CLABES_POR_CUENTA="""
  87.    select
  88.        id_cuenta_ahorro,
  89.        no_cuenta_medio_pago as CLABE,
  90.        nombre_cobranza
  91.    from cuenta_ahorro_medio_pago
  92.    where id_cuenta_ahorro=?
  93.    group by no_cuenta_medio_pago;
  94. """
  95.  
  96. USUARIOS_POR_CUENTA="""
  97.    SELECT
  98.     mf.id_cuenta_ahorro as idCuenta,
  99.     mf.id_cliente as idUsuario,
  100.     aa.item_name as rol,
  101.     c.email ,
  102.     c.apellido_paterno as paterno,
  103.     c.apellido_materno as materno,
  104.     c.nombre
  105.    from
  106.        moral_fisica_roles mf join empresa e on e.id_empresa=mf.id_empresa
  107.        join cliente c on c.id_cliente = mf.id_cliente
  108.        join auth_assignment aa on aa.user_id = c.id_cliente
  109.    where
  110.        mf.activo = 0
  111.        and mf.id_cuenta_ahorro = ?;
  112. """
  113. MOVIMIENTOS_DE_CUENTA="""
  114.    select
  115.        tac.id_transaccion as idTx,
  116.        case tac.tipo_movimiento
  117.            when 30 then 'Abono'
  118.            when 31 then 'Cargo'
  119.            when 34 then 'Comisión'
  120.        end as tipoTx,        
  121.        tac.fecha_alta,
  122.        tac.valor_real,
  123.        tac.clave_rastreo,
  124.        case tac.id_medio_pago
  125.            when 2 then 'Cuenta eje'
  126.            when 3 then 'SPEI STP'
  127.            WHEN 4 then 'SPEI ASP'
  128.            WHEN 5 then 'Visa'
  129.            WHEN 6 then 'Gestopago'
  130.            when 7 then 'ATM Santander'
  131.            when 9 then 'PayCash'
  132.            when 10 then 'ASP Directo'
  133.        end as medioPago,
  134.        tac.concepto
  135.    from alquimia_vitae.transacciones_ahorro_cliente tac
  136.    where
  137.        id_cuenta_ahorro = ?
  138.        and tac.fecha_alta BETWEEN ? and ?
  139.    order by fecha_alta desc;
  140. """
  141.  
  142. ULTIMOS_N_MOVIMIENTOS_DE_CUENTA="""
  143.    select
  144.        tac.id_transaccion as idTx,
  145.        case tac.tipo_movimiento
  146.            when 30 then 'Abono'
  147.            when 31 then 'Cargo'
  148.            when 34 then 'Comisión'
  149.        end as tipoTx,        
  150.        tac.fecha_alta,
  151.        tac.valor_real,
  152.        tac.clave_rastreo,
  153.        case tac.id_medio_pago
  154.            when 2 then 'Cuenta eje'
  155.            when 3 then 'SPEI STP'
  156.            WHEN 4 then 'SPEI ASP'
  157.            WHEN 5 then 'Visa'
  158.            WHEN 6 then 'Gestopago'
  159.            when 7 then 'ATM Santander'
  160.            when 9 then 'PayCash'
  161.            when 10 then 'ASP Directo'
  162.        end as medioPago,
  163.        tac.concepto
  164.    from alquimia_vitae.transacciones_ahorro_cliente tac
  165.    where
  166.        id_cuenta_ahorro = ?
  167.    order by fecha_alta desc LIMIT ?;
  168. """
  169. CONFIGURACION_MEDIOS_PAGO_DE_CUENTA="""
  170.    select
  171.            case id_medio_pago
  172.                when 2 then 'Cuenta eje'
  173.                when 3 then 'SPEI STP'
  174.                WHEN 4 then 'SPEI ASP'
  175.                WHEN 5 then 'Visa'
  176.                WHEN 6 then 'Gestopago'
  177.                when 7 then 'ATM Santander'
  178.                when 9 then 'PayCash'
  179.                when 10 then 'ASP Directo'
  180.            end as medioPago,
  181.            case tipo_cash
  182.                    when 0 then 'in'
  183.                    when 1 then 'out'
  184.            end as cash,
  185.            case tipo_comision
  186.                    when 1 then 'fija ($)'
  187.                    when 2 then 'porcentual'
  188.            end as comision,
  189.            valor_comision
  190.    from cuenta_ahorro_medio_pago camp
  191.    where id_cuenta_ahorro =?
  192.    GROUP BY id_medio_pago , tipo_cash ;
  193. """
  194.  
  195. CONFIGURACION_PRODUCTO_AHORRO="""
  196.    select
  197.        case id_medio_pago
  198.            when 2 then 'Cuenta eje'
  199.            when 3 then 'SPEI STP'
  200.            WHEN 4 then 'SPEI ASP'
  201.            WHEN 5 then 'Visa'
  202.            WHEN 6 then 'Gestopago'
  203.            when 7 then 'ATM Santander'
  204.            when 9 then 'PayCash'
  205.            when 10 then 'ASP Directo'
  206.        end as medioPago,
  207.        case tipo_cash
  208.                when 0 then 'in'
  209.                when 1 then 'out'
  210.        end as cash,
  211.        case tipo_comision
  212.                when 1 then 'fija ($)'
  213.                when 2 then 'porcentual'
  214.        end as comision,
  215.        valor_comision,
  216.        saldo_basado_medio_pago as predeterminado,
  217.        calendario_transaccion as calendario,
  218.        hora_inicio as horaInicio,
  219.        hora_fin as horaFin
  220.    from transaccion_producto_configuracion tpc where producto_id  =?;  
  221. """
  222. REGISTRO_TRANSACCION_EN_TAC_POR_CLAVE_RASTREO="""
  223.    select
  224.        tac.id_cuenta_ahorro as idCuenta,
  225.        tac.id_transaccion as idTx,
  226.        case tac.tipo_movimiento
  227.            when 30 then 'Abono'
  228.            when 31 then 'Cargo'
  229.            when 34 then 'Comisión'
  230.        end as tipoTx,
  231.        case tac.id_medio_pago
  232.            when 2 then '2 - Cuenta AlquimiaPay (cuenta eje)'
  233.            when 3 then '3 - SPEI STP'
  234.            WHEN 4 then '4 - SPEI ASP'
  235.            WHEN 5 then '5 - Visa AlquimiaPay'
  236.            when 6 then '6 - Gestopago'
  237.            when 7 then '7 - Retiro ATM Santander'
  238.            when 9 then '9 - PayCash'
  239.        end as medioPago,
  240.        tac.fecha_alta,
  241.        tac.valor_real,
  242.        tac.clave_rastreo,
  243.        tac.concepto
  244.    from alquimia_vitae.transacciones_ahorro_cliente tac
  245.    where
  246.        tac.clave_rastreo LIKE ?
  247.        and tac.tipo_movimiento <> 34;
  248. """
  249. REGISTRO_TRANSACCION_EN_TAC_POR_ID_TX="""
  250.    select
  251.        tac.id_cuenta_ahorro as idCuenta,
  252.        tac.id_transaccion as idTx,
  253.        case tac.tipo_movimiento
  254.            when 30 then 'Abono'
  255.            when 31 then 'Cargo'
  256.            when 34 then 'Comisión'
  257.        end as tipoTx,
  258.        case tac.id_medio_pago
  259.            when 2 then '2 - Cuenta AlquimiaPay (cuenta eje)'
  260.            when 3 then '3 - SPEI STP'
  261.            WHEN 4 then '4 - SPEI ASP'
  262.            WHEN 5 then '5 - Visa AlquimiaPay'
  263.            when 6 then '6 - Gestopago'
  264.            when 7 then '7 - Retiro ATM Santander'
  265.            when 9 then '9 - PayCash'
  266.            when 6 then 'GestoPago'
  267.        end as medioPago,        
  268.        tac.fecha_alta,
  269.        tac.valor_real,
  270.        tac.clave_rastreo,
  271.        tac.concepto
  272.    from alquimia_vitae.transacciones_ahorro_cliente tac
  273.    where
  274.        tac.id_transaccion = ?
  275.        and tac.tipo_movimiento <> 34;
  276. """
  277. DATOS_TRANSACCION_POR_CLAVE_RASTREO_SALIENTE="""
  278.    select
  279.            toi.id as idTx,
  280.            toi.id_transaccion_ahorro_cliente,
  281.            toi.id_transaccion_spei,
  282.            toi.folio_orden,
  283.            toi.datos,
  284.            toi.detalle_error,
  285.            ts.json_respuesta, --
  286.            toi.fecha_autorizacion,
  287.            ts.fecha_actualizacion as timestamp_confirmacion_proveedor,
  288.            (ts.fecha_actualizacion - toi.fecha_autorizacion) as tiempo_total_transaccion,
  289.            toi.estatus,
  290.             toi.fecha_alta, toi.fecha_instruccion, toi.fecha_actualizacion,
  291.            toi.usuario_autorizador,
  292.            toi.usuario_instructor
  293.    from
  294.            temp_ordenes_importador toi
  295.            left JOIN transacciones_spei ts on toi.id_transaccion_spei = ts.id
  296.    where
  297.        ts.json_respuesta LIKE ?;
  298. """
  299.  
  300. DATOS_TRANSACCION_POR_ID_TRANSACCION="""
  301.    select
  302.            toi.id as idTx,
  303.            toi.id_transaccion_ahorro_cliente,
  304.            toi.id_transaccion_spei,
  305.            toi.folio_orden,
  306.            toi.datos,
  307.            toi.detalle_error,
  308.            ts.json_respuesta, --
  309.            toi.fecha_autorizacion,
  310.            ts.fecha_actualizacion as timestamp_confirmacion_proveedor,
  311.            (ts.fecha_actualizacion - toi.fecha_autorizacion) as tiempo_total_transaccion,
  312.            toi.estatus,
  313.             toi.fecha_alta, toi.fecha_instruccion, toi.fecha_actualizacion,
  314.            toi.usuario_autorizador,
  315.            toi.usuario_instructor
  316.    from
  317.            temp_ordenes_importador toi
  318.            left JOIN transacciones_spei ts on toi.id_transaccion_spei = ts.id
  319.    where
  320.        toi.id = ?;
  321. """
  322. DATOS_TRANSACCION_POR_CLAVE_RASTREO_ENTRANTE="""
  323.    select
  324.        claveRastreo,
  325.        cuentaOrdenante,
  326.        nombreOrdenante,
  327.        rfcCurpOrdenante,        
  328.        cuentaBeneficiario,
  329.        nombreBeneficiario,
  330.        rfcCurpBeneficiario,
  331.        conceptoPago,
  332.        monto,
  333.        referenciaNumerica,
  334.        fecha_actualizacion,
  335.        fecha_alta,
  336.        institucionContraparte
  337.    from
  338.        stp
  339.    where
  340.        claveRastreo LIKE ?;        
  341. """
  342. EMPRESA_POR_NOMBRE="""
  343.    select
  344.        id_empresa as idEmpresa,
  345.        rfc,
  346.        nombre
  347.    from
  348.        empresa
  349.    where
  350.        nombre LIKE ?
  351.        and rfc is not null
  352.    order by rfc asc;
  353. """
  354. EMPRESA_POR_ID="""
  355.    select
  356.        id_empresa as idEmpresa,
  357.        rfc,
  358.        nombre,
  359.        fecha_alta,
  360.        calle,
  361.        no_ext,
  362.        no_int,
  363.        entre_calle_primera,
  364.        entre_calle_segunda,
  365.        colonia,
  366.        alcaldia_municipio,
  367.        estado,
  368.        codigo_postal
  369.    from
  370.        empresa
  371.    where
  372.        id_empresa=?;
  373. """
  374. EMPRESA_POR_RFC="""
  375.    select
  376.        id_empresa,
  377.        rfc,
  378.        nombre
  379.    from
  380.        empresa
  381.    where
  382.        rfc LIKE ?;
  383. """
  384. ADMIN_EMPRESA_POR_ID_EMPRESA="""
  385.    select
  386.         c.id_cliente as idUsuario,
  387.         c.email,
  388.         concat(c.apellido_paterno," ",c.apellido_materno," ",c.nombre) as nombreUsuario    
  389.    from
  390.         moral_fisica_roles mfr join empresa e
  391.             on e.id_empresa = mfr.id_empresa
  392.         join cliente c on c.id_cliente = mfr.id_cliente
  393.    where
  394.        mfr.id_empresa = ?
  395.        and mfr.rol = "admin_empresa"
  396.    limit 1;
  397. """
  398. CUENTAS_DE_EMPRESA_POR_ID_EMPRESA="""
  399.    select
  400.         cac.id_cuenta_ahorro as idCuenta,
  401.         cac.id_producto_ahorro_empresa as pae,
  402.         pae.nombre_producto as nombreProducto,
  403.         cac.distribuidor,
  404.         cac.grupo_trabajo,
  405.         cac.alias,
  406.         cac.saldo_ahorro as saldo
  407.         ,count(tac.id_transaccion) as totalTx
  408.         ,date(cac.fecha_alta) as fechaAlta
  409.    from
  410.         cuenta_ahorro_cliente cac join producto_ahorro_empresa pae
  411.             on cac.id_producto_ahorro_empresa = pae.id_producto_ahorro_empresa
  412.         left join transacciones_ahorro_cliente tac on tac.id_cuenta_ahorro = cac.id_cuenta_ahorro
  413.    where
  414.         cac.id_cliente = ?
  415.         group by cac.id_cuenta_ahorro;
  416. """
  417. CUENTAS_MORAL_USUARIO="""
  418.     SELECT     
  419.        mf.id_cuenta_ahorro as idCuenta,
  420.        e.nombre,
  421.        cac.alias,
  422.        mf.rol
  423.    from
  424.        moral_fisica_roles mf
  425.        join empresa e on e.id_empresa=mf.id_empresa
  426.        join cliente c on c.id_cliente = mf.id_cliente
  427.        join cuenta_ahorro_cliente cac on cac.id_cliente = mf.id_empresa
  428.    where
  429.        c.id_cliente = ?
  430.        and mf.activo = 0
  431.    group by mf.id_cuenta_ahorro, mf.rol;
  432. """
  433. CUENTAS_FISICA_USUARIO="""
  434.   SELECT
  435.        cac.id_cuenta_ahorro as idCuenta,
  436.        pae.id_producto_ahorro_empresa as idPAE,
  437.        pae.nombre_producto as nombreProducto
  438.   FROM
  439.      cuenta_ahorro_cliente cac
  440.      join producto_ahorro_empresa pae
  441.            on cac.id_producto_ahorro_empresa = pae.id_producto_ahorro_empresa
  442.   WHERE
  443.         cac.id_cliente = ?;
  444. """
  445. ROLES_USUARIO="""
  446.   SELECT
  447.        user_id as idUsuario,
  448.        item_name as rol
  449.   FROM
  450.         auth_assignment
  451.      
  452.   WHERE
  453.         user_id= ?;
  454. """
  455. EMPRESA_USUARIO="""
  456.    SELECT
  457.            ce.id_cliente as idUsuario,
  458.            ce.id_empresa as idEmpresa,            
  459.            e.nombre as empresa
  460.    FROM
  461.            cliente_empresa ce
  462.            join empresa e on e.id_empresa = ce.id_empresa
  463.    WHERE
  464.            ce.id_cliente = ?;
  465. """
  466.  
  467. USUARIO_POR_NOMBRE="""
  468.    select
  469.         c.id_cliente as idUsuario
  470.         ,aa.item_name as rol
  471.         ,c.apellido_paterno
  472.         ,c.apellido_materno
  473.         ,c.nombre    
  474.         ,c.email
  475.         ,c.id_hsm
  476.    from
  477.         cliente c  left join auth_assignment aa on aa.user_id = c.id_cliente
  478.    where
  479.        c.apellido_paterno like ?
  480.        and c.apellido_materno like ?
  481.        and c.nombre like ?;
  482.    -- group by c.id_cliente
  483. """
  484. USUARIO_POR_ID="""
  485.    select
  486.         c.id_cliente as idUsuario
  487.         ,aa.item_name as rol
  488.         ,c.apellido_paterno
  489.         ,c.apellido_materno
  490.         ,c.nombre    
  491.         ,c.email
  492.         ,date(c.fecha_alta) as fechaAlta
  493.         ,c.id_hsm
  494.    from
  495.         cliente c  left join auth_assignment aa on aa.user_id = c.id_cliente
  496.    where
  497.        c.id_cliente = ?;
  498.    -- group by c.id_cliente
  499. """
  500. USUARIO_POR_EMAIL="""
  501.    select
  502.         c.id_cliente as idUsuario
  503.         ,aa.item_name as rol
  504.         ,c.apellido_paterno
  505.         ,c.apellido_materno
  506.         ,c.nombre    
  507.         ,c.email
  508.         ,c.id_hsm
  509.    from
  510.         cliente c  left join auth_assignment aa on aa.user_id = c.id_cliente
  511.    where
  512.        c.email like ?;
  513. """
  514. TARJETA_POR_NUMERO = """
  515.    SELECT
  516.            camp.id_cuenta_ahorro as idCuenta,
  517.            lt.no_tarjeta as numeroTarjeta,
  518.            lt.numero_interno_procesador as proxyNumber
  519.    FROM
  520.            lote_tarjetas lt
  521.            join cuenta_ahorro_medio_pago camp on camp.no_cuenta_medio_pago = lt.no_tarjeta
  522.    WHERE
  523.            lt.no_tarjeta = ?;
  524. """
  525.  
  526. TARJETA_POR_PROXY = """
  527.    SELECT
  528.            camp.id_cuenta_ahorro as idCuenta,
  529.            lt.no_tarjeta as numeroTarjeta,
  530.            lt.numero_interno_procesador as proxyNumber
  531.    FROM
  532.            lote_tarjetas lt
  533.            join cuenta_ahorro_medio_pago camp on camp.no_cuenta_medio_pago = lt.no_tarjeta
  534.    WHERE
  535.            lt.numero_interno_procesador = ?;
  536. """
  537. TARJETA_SIN_ASIGNAR_POR_PROXY="""
  538.    SELECT
  539.            lt.id,
  540.            lt.no_tarjeta as numeroTarjeta,
  541.            lt.numero_interno_procesador as proxyNumber
  542.    FROM
  543.            lote_tarjetas lt
  544.            
  545.    WHERE
  546.            lt.numero_interno_procesador = ?;
  547. """
  548. SALDOS_GLOBALES_FINANCIERAS="""
  549.     select  temp.institucion ,sum(temp.saldo_ahorro) as saldo from(
  550.            SELECT
  551.            c.id_cuenta_ahorro
  552.            ,c.saldo_ahorro
  553.            ,c.nombre_centro_costos
  554.            ,camp.no_cuenta_medio_pago as clabe
  555.            ,e.nombre
  556.            ,c.distribuidor
  557.            ,c.grupo_trabajo
  558.            ,case camp.id_medio_pago  
  559.                when 3 then 'STP'
  560.                when 4 then 'ASP Integra'
  561.            end as institucion
  562.        FROM
  563.            cuenta_ahorro_cliente c
  564.            join producto_ahorro_empresa pae on c.id_producto_ahorro_empresa = pae.id_producto_ahorro_empresa
  565.            join empresa e on e.id_empresa = pae.id_empresa
  566.            join cuenta_ahorro_medio_pago camp on camp.id_cuenta_ahorro = c.id_cuenta_ahorro
  567.        WHERE
  568.            e.id_empresa NOT IN (11,377,464,208)
  569.            and c.id_cuenta_ahorro NOT IN (2101,3128,1561,3122,1610,4488,1652)
  570.                    and camp.id_medio_pago in (3,4)
  571.                    and c.saldo_ahorro > 0.01
  572.        GROUP BY
  573.            c.id_cuenta_ahorro
  574.    ) as temp group by temp.institucion
  575. """
  576. TRANSACCION_BLU_POR_CLAVE_RASTREO="""
  577. select
  578.     t.id,
  579.     t.cuenta_origen,
  580.     t.concepto,
  581.     t.cuenta_destino,
  582.     tr.fecha_alta,
  583.     t.monto,
  584.     case t.estatus
  585.                    when 10 then '10 - Esperando a ser enviada'
  586.                    when 20 then '20 - Recibida por BLU'
  587.                    when 30 then '30 - Liquidada en ASP'
  588.                    when 40 then '40 - Devuelta'
  589.        end as estatus,
  590.     tr.clave_rastreo
  591. from
  592.     transferencia t
  593.     left join transferencia_rastreo tr on t.id = tr.id_transferencia
  594. where
  595.     tr.clave_rastreo = ?;
  596. """
  597. RETIROATM_POR_CLAVE_RASTREO="""
  598.     SELECT
  599.         aop.clave_rastreo,
  600.         ad.orden_pago_id,
  601.         aop.fecha_alta,
  602.         CASE aop.estatus
  603.             when 10 then '10 - Problema al sembrar en Santander'
  604.             when 20 then '20 - OK, SMS enviado'
  605.             when 30 then '30 - Devuelta'
  606.         END as estatus,
  607.         ad.importe,
  608.         ad.nombre_beneficiario,
  609.         ad.rfc_curp_beneficiario,
  610.         ad.numero_celular,
  611.         ad.email,
  612.         ad.clave_aceptacion_devolucion_rechazo
  613.         ,cm.mensaje_h2h
  614.         ,ad.referencia_atm
  615.         ,ad.pin_atm
  616.     FROM
  617.         atm_orden_pago aop join atm_detalle ad on aop.id = ad.orden_pago_id
  618.         join catalogo_mensaje cm on cm.codigo_ccbn = ad.clave_aceptacion_devolucion_rechazo COLLATE utf8_general_ci
  619.     WHERE
  620.         aop.clave_rastreo = ?;
  621. """
  622. LISTA_TARJETAS_VISA = """
  623.     select
  624.         cac.id_cuenta_ahorro as idCuenta,
  625.         cac.id_cuenta_ahorro_padre as idCuentaMadre,
  626.         e.nombre as empresa,
  627.         lt.no_tarjeta as numeroTarjeta,
  628.         lt.numero_interno_procesador as proxyNumber,
  629.         cac.saldo_ahorro as saldo
  630.     from
  631.         cuenta_ahorro_cliente cac  
  632.         join cuenta_ahorro_medio_pago camp on camp.id_cuenta_ahorro = cac.id_cuenta_ahorro
  633.         join lote_tarjetas lt on lt.no_tarjeta = camp.no_cuenta_medio_pago
  634.         join producto_ahorro_empresa pae on pae.id_producto_ahorro_empresa = cac.id_producto_ahorro_empresa
  635.         join empresa e on e.id_empresa = pae.id_empresa
  636.     where cac.id_producto_ahorro = 10
  637.     order by empresa
  638. """
  639.  
  640. TX_EN_COLA_IMPORTADOR = """
  641.    select      
  642.            json_extract(toi.datos, '$.cuenta_origen') as idCuenta,
  643.            toi.folio_orden,
  644.            count(*) as cantidad ,            
  645.            toi.fecha_autorizacion,
  646.            toi.fecha_alta,
  647.            toi.usuario_autorizador as usr_autorizador,
  648.            toi.usuario_instructor as usr_instructor
  649.    from
  650.            temp_ordenes_importador toi
  651.    where
  652.            DATE(toi.fecha_alta) = ?
  653.             and toi.estatus = 0 -- pendientes
  654.            group by folio_orden
  655.            order by toi.id asc;
  656. """
  657. TOKEN_USUARIO_ALQUIMIA = """
  658.    SELECT id_cliente, id_hsm FROM cliente
  659.    WHERE id_cliente = ?;
  660. """
  661. ACTUALIZA_TOKEN_USUARIO_ALQUIMIA = """
  662.    UPDATE cliente
  663.     SET id_hsm=NULL
  664.     WHERE id_cliente=?;
  665. """
  666. TOKEN_USUARIO_HSM = """
  667.    SELECT x.* FROM hsm_usuario x
  668.    WHERE id_usuario = ?;
  669. """
  670. ELIMINA_TOKEN_USUARIO_HSM = """
  671.    DELETE FROM hsm_usuario
  672.     WHERE id_usuario=?;
  673. """
  674. TRANSACCION_BLU_RECHAZO = """
  675.    SELECT * from devolucion
  676.    WHERE clave_rastreo = ?;
  677. """
  678. LOG_AUTORIZADOR = """
  679.    Select
  680.            -- ac.idTx,
  681.            -- ac.MTI,
  682.            -- nc.codigoRespuesta,
  683.            lt.dato_envio,
  684.            lt.dato_respuesta,
  685.            lt.fecha_hora
  686.    from
  687.            autorizacion_compra ac
  688.            join notificacion_compra nc on nc.idTx = ac.idTx
  689.            join log_transaccion lt on lt.idTx = ac.idTx
  690.    where ac.idTx =?;
  691. """
  692.  
  693. REPORTE_DIFERENCIAS_MOVIMIENTOS="""
  694. SELECT
  695.    cac.distribuidor,
  696.    cac.grupo_trabajo as grupoTrabajo,
  697.    cac.id_cuenta_ahorro as idCuenta,
  698.    DATE(cac.fecha_alta) as fechaAlta,
  699.    e.nombre as razonSocial,
  700.    tac.id_medio_pago AS idMP,
  701.    CASE tac.id_medio_pago
  702.        WHEN 2 then 'Cuenta eje'
  703.        WHEN 3 then 'SPEI STP'
  704.        WHEN 4 then 'SPEI ASP'
  705.        WHEN 5 then 'Visa'
  706.        WHEN 6 then 'Gestopago'
  707.        WHEN 7 then 'ATM Santander'
  708.        WHEN 9 then 'PayCash'
  709.        WHEN 10 then 'ASP Directo'
  710.     END AS medioPago,  
  711.    tipo_movimiento AS idMovimiento,
  712.    case tac.tipo_movimiento
  713.        when 30 then 'Abono'
  714.        when 31 then 'Cargo'
  715.        when 34 then 'Comision'
  716.    END AS tipoMovimiento,
  717.    SUM(monto) as monto
  718. FROM
  719.    cuenta_ahorro_cliente cac
  720.    JOIN transacciones_ahorro_cliente tac on tac.id_cuenta_ahorro = cac.id_cuenta_ahorro
  721.    JOIN producto_ahorro_empresa pae on pae.id_producto_ahorro_empresa = cac.id_producto_ahorro_empresa
  722.    JOIN empresa e on e.id_empresa = pae.id_empresa
  723. WHERE
  724.    cac.id_cuenta_ahorro_padre IS NULL
  725.    AND cac.tipo_persona= 1
  726.    AND cac.estatus = 0
  727.    AND DATE(tac.fecha_alta) BETWEEN ? and ?
  728.    AND cac.distribuidor = ?
  729. GROUP BY
  730.    cac.id_cuenta_ahorro,
  731.    YEAR (tac.fecha_alta),
  732.    MONTH(tac.fecha_alta),
  733.    tac.id_medio_pago,
  734.    tac.tipo_movimiento
  735. ;
  736. """
  737. LISTA_DISTRIBUIDORES_UNICOS = """
  738.    SELECT
  739.        DISTINCT distribuidor
  740.    FROM cuenta_ahorro_cliente cac
  741.        JOIN transacciones_ahorro_cliente tac on tac.id_cuenta_ahorro = cac.id_cuenta_ahorro
  742.        JOIN producto_ahorro_empresa pae on pae.id_producto_ahorro_empresa = cac.id_producto_ahorro_empresa
  743.        JOIN empresa e on e.id_empresa = pae.id_empresa
  744.    WHERE
  745.        cac.id_cuenta_ahorro_padre IS NULL
  746.        AND cac.tipo_persona = ?
  747.        AND cac.estatus = 0
  748.        AND cac.distribuidor IS NOT NULL
  749.        AND cac.distribuidor <> '';
  750. """
  751.  
  752.  
  753. COMPARATIVO_CONFIGURACION_PAE = """
  754.    SELECT *
  755.        FROM transaccion_producto_configuracion
  756.    ORDER BY producto_id DESC
  757. """
  758.  
  759. COMPARATIVO_CONFIGURACION_PAE_REFERENCIA = """
  760.    SELECT *
  761.        FROM transaccion_producto_configuracion_referencia;
  762. """
  763.  
  764. COMPARATIVO_CONFIGURACION_PAE_NOMBRE_PAE = """
  765.    SELECT id_producto_ahorro_empresa, id_empresa, nombre_producto
  766.        FROM producto_ahorro_empresa pae
  767.        WHERE
  768.            pae.id_producto_ahorro_empresa = ?;
  769. """
  770.  
  771. COMPARATIVO_CONFIGURACION_PAE_NOMBRE_EMPRESA_ASOCIADA = """
  772.    SELECT nombre
  773.        FROM empresa e
  774.        WHERE
  775.            e.id_empresa = ?;
  776. """
  777.  
  778. COMPARATIVO_CONFIGURACION_PAE_INSERTAR_REGISTRO_TABLA_REFERENCIA = """
  779. INSERT
  780.    INTO
  781.        transaccion_producto_configuracion_referencia (
  782.            id
  783.            ,tipo_producto
  784.            ,producto_id
  785.            ,tipo_comision
  786.            ,valor_comision
  787.            ,numero_maximo_transacciones
  788.            ,monto_maximo_transacciones
  789.            ,tipo_reseteo
  790.            ,horas_reseteo
  791.            ,hora_inicio
  792.            ,hora_fin
  793.            ,calendario_transaccion
  794.            ,fecha_alta
  795.            ,fecha_actualizacion
  796.            ,id_medio_pago
  797.            ,tipo_cash
  798.            ,activo
  799.            ,saldo_basado_medio_pago
  800.            ,nombre_centro_costos_stp
  801.            ,no_cuenta_medio_pago)
  802.    VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);"""
  803.  
  804. COMPARATIVO_CONFIGURACION_PAE_ACTUALIZAR_REGISTRO_TABLA_REFERENCIA = """
  805.    UPDATE
  806.        transaccion_producto_configuracion_referencia
  807.    SET
  808.        tipo_producto = ?
  809.        ,producto_id = ?
  810.        ,tipo_comision = ?
  811.        ,valor_comision = ?
  812.        ,numero_maximo_transacciones = ?
  813.        ,monto_maximo_transacciones = ?
  814.        ,tipo_reseteo = ?
  815.        ,horas_reseteo = ?
  816.        ,hora_inicio = ?
  817.        ,hora_fin = ?
  818.        ,calendario_transaccion = ?
  819.        ,fecha_alta = ?
  820.        ,fecha_actualizacion = ?
  821.        ,id_medio_pago = ?
  822.        ,tipo_cash = ?
  823.        ,activo = ?
  824.        ,saldo_basado_medio_pago = ?
  825.        ,nombre_centro_costos_stp = ?
  826.        ,no_cuenta_medio_pago = ?
  827.    WHERE
  828.        id = ?;
  829. """
  830.  
  831. COMPARATIVO_CONFIGURACION_PAE_ID_CUENTAS_PAE = """
  832. SELECT
  833.    id_cuenta_ahorro
  834. FROM
  835.    cuenta_ahorro_cliente cac
  836. WHERE
  837.    id_producto_ahorro_empresa = ?
  838. LIMIT
  839.    100;"""
  840.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement