InovacaoMediaBrasil/ProcessWorkflowsAndDatabaseScripts

View on GitHub
Src/Sankhya/Construtores de Componentes de BI/1.CONSTRUTOR TESTE.xml

Summary

Maintainability
Test Coverage
<gadget>
    <prompt-parameters>
        <parameter id="EXPEDICAO" description="EXPEDICAO" metadata="multiList:Integer" listType="sql" required="true" keep-last="false" keep-date="false">
            <expression type="SQL">
                <![CDATA[SELECT NUNOTA FROM sankhya.AD_PEDIDOVTEXSC SC inner join sankhya.TGFCAB CAB ON CAB.AD_PEDORIGINAL = SC.PEDORIGINAL WHERE ORDERID IN (SELECT ORDERID FROM sankhya.AD_PEDIDOVTEXSCFLUXO f where f.OCORRENCIA in('E','I')) and orderid not in (SELECT ORDERID FROM sankhya.AD_PEDIDOVTEXSCFLUXO f where f.OCORRENCIA in ('V','T','N')) AND CODTIPOPER = 505 AND DTNEG >= '2016-03-01']]>
            </expression>
        </parameter>
    </prompt-parameters>
    <level id="lvl_43w5r5" description="Principal">
        <grid id="grd_b7kwij">
            <expression type="sql" data-source="MGEDS">
                <![CDATA[ SELECT ITE.CODPROD, RTRIM(RTRIM(PRO.DESCRPROD) + ' ' + ISNULL(PRO.COMPLDESC,'')) AS PRODUTO, PRO.CODVOL, RTRIM(PRO.MARCA) AS MARCA, RTRIM(ISNULL(LOC.DESCRLOCAL,'<SEM LOCAL>')) AS LOCAL, COUNT(QTDNEG) AS QTDPRODUTOS, ISNULL(EST.ESTOQUE,0) AS ESTOQUEFISICO, COUNT(QTDNEG)-ISNULL(EST.ESTOQUE,0) AS DIFERENCA FROM sankhya.TGFITE ITE INNER JOIN sankhya.TGFPRO PRO ON PRO.CODPROD = ITE.CODPROD LEFT JOIN sankhya.TGFLOC LOC ON PRO.CODLOCALPADRAO = LOC.CODLOCAL left join sankhya.TGFEST EST ON EST.CODPROD = PRO.CODPROD   WHERE ITE.NUNOTA IN :EXPEDICAO  AND ITE.CODVOL != 'KT'   GROUP BY ITE.CODPROD, PRO.DESCRPROD, PRO.COMPLDESC, PRO.CODVOL, PRO.MARCA, LOC.DESCRLOCAL, EST.ESTOQUE    ORDER BY QTDPRODUTOS DESC]]>
            </expression>
            <metadata>
                <field name="CODPROD" label="CODPROD" type="I" visible="true" useFooter="false"/>
                <field name="PRODUTO" label="PRODUTO" type="S" visible="true" useFooter="false"/>
                <field name="CODVOL" label="CODVOL" type="S" visible="true" useFooter="false"/>
                <field name="MARCA" label="MARCA" type="S" visible="true" useFooter="false"/>
                <field name="LOCAL" label="LOCAL" type="S" visible="true" useFooter="false"/>
                <field name="QTDPRODUTOS" label="QTDPRODUTOS" type="I" visible="true" useFooter="false"/>
                <field name="ESTOQUEFISICO" label="ESTOQUEFISICO" type="I" visible="true" useFooter="false"/>
                <field name="DIFERENCA" label="DIFERENCA" type="I" visible="true" useFooter="false"/>
            </metadata>
        </grid>
    </level>
</gadget>