== Descripción ==
Imprime el informe individual por cliente seleccionado de los antecedentes de transacciones. La ejecución proviene del [[FORM:ConsultaCRM]] y [[FORM:PosicionCRM]]
== Composición ==
[[TABLA:vidquoten1]]
[[TABLA:vidquoten3]]
[[TABLA:clientes]]
[[TABLA:clientescrmqry]]
== Estructura ==
<small><pre>
SELECT 
    T1.VidQuoteCliente,
    T2.RazonSocial,
    T1.TTransaccion,
    T1.NTransaccion,
    T1.VidQuoteFecha,
    T1.VidQuoteObra,
    T1.VidQuotePrecioP
FROM 
    ((SELECT DISTINCT
        vidquoten1.VidQuoteCliente  AS VidQuoteCliente,
        'OT'                        AS TTransaccion,
        vidquoten3.VidQuoteID       AS NTransaccion,
        vidquoten1.VidQuoteFecha    AS VidQuoteFecha,
        vidquoten1.VidQuoteObra     AS VidQuoteObra,
        SUM(vidquoten3.VidQuotePrecioP) 
                                    AS VidQuotePrecioP
    FROM
        vidquoten1 AS vidquoten1,
        vidquoten3 AS vidquoten3
    WHERE
        vidquoten1.VidQuoteID = vidquoten3.VidQuoteID AND
        vidquoten1.VidQuoteEstado = '1'
    GROUP By VidQuoteCliente,TTransaccion,NTransaccion)

    UNION
    (SELECT
        IF(ISNULL(`accreceiv`.`ClienteAR`),'00000000',`accreceiv`.`ClienteAR`) 
                                        AS VidQuoteCliente,
        `accreceiv`.`TDocumentoOrg`     AS TTransaccion,
        `accreceiv`.`NDocumentoOrg`     AS NTransaccion,
        `accreceiv`.`FechaAR`           AS VidQuoteFecha,
        ''                              AS VidQuoteObra,
        `accreceiv`.`ImporteAR` * -1    AS VidQuotePrecioP
    FROM `fzggestion`.`accreceiv`)) AS T1,

    clientes as T2
WHERE
    T1.VidQuoteCliente = T2.ClienteID
    AND
    T1.VidQuoteCliente IN (
        SELECT 
            clienteID
        FROM
            clientescrmqry)
ORDER BY T1.VidQuoteCliente, T1.VidQuoteFecha
</pre></small>
== Código Relacionado ==
== Bitácora ==
== Uso ==