Gentlemen, I'm developing a billing monitoring dashboard. I want to turn this number 56% directly into my JavaScript code. Here is a snippet of my code, it is fed directly by a query from my SQL.
This is the query that feeds my field within JavaScript, the variable MT
receives it.
<snk:query var="MT">
SELECT
A.REALIZADO,
A.META,
(A.REALIZADO/A.META)*100 AS ACUMULADO
FROM (
SELECT
((SELECT ISNULL(SUM((ITE1.QTDNEG*ITE1.VLRUNIT)-ITE1.VLRDESC-ITE1.VLRREPRED),0)
FROM SANKHYA.TGFCAB CAB1 (NOLOCK)
LEFT JOIN SANKHYA.TGFITE ITE1 (NOLOCK) ON ITE1.NUNOTA=CAB1.NUNOTA
LEFT JOIN SANKHYA.TGFPRO PRO1 (NOLOCK) ON ITE1.CODPROD = PRO1.CODPROD
WHERE CAB1.TIPMOV = 'V'
AND MONTH(CAB1.DTFATUR)= DATEPART(MM,GETDATE())
AND YEAR (CAB1.DTFATUR)= DATEPART(YYYY,GETDATE())
AND ITE1.CODCFO IN (5102,5403,5405,5922,6102,6108,6110,6403,6404,6922)
AND CAB1.STATUSNFE <> 'D'
AND PRO1.AD_MARCA=14 ) -
(SELECT CONVERT(DECIMAL(10,2),ISNULL(SUM((ITE1.QTDNEG*ITE1.VLRUNIT)-ITE1.VLRDESC-ITE1.VLRREPRED) ,0))
FROM SANKHYA.TGFCAB CAB1 (NOLOCK)
LEFT JOIN SANKHYA.TGFITE ITE1 (NOLOCK) ON ITE1.NUNOTA=CAB1.NUNOTA
LEFT JOIN SANKHYA.TGFPRO PRO1 (NOLOCK) ON ITE1.CODPROD = PRO1.CODPROD
WHERE CAB1.TIPMOV = 'D'
AND MONTH(CAB1.DTFATUR)= DATEPART(MM,GETDATE())
AND YEAR (CAB1.DTFATUR)= DATEPART(YYYY,GETDATE())
AND ITE1.CODCFO IN (1202,1411,2202,2204,2411)
AND CAB1.STATUSNOTA = 'L'
AND PRO1.AD_MARCA=14)) AS REALIZADO,
(SELECT DISTINCT
MET.PREVREC AS META_VN
FROM SANKHYA.TGMMET MET
LEFT JOIN SANKHYA.TGFPRO PRO (NOLOCK) ON PRO.MARCA = MET.MARCA
WHERE MONTH(MET.DTREF)= DATEPART(MM,GETDATE())
AND YEAR (MET.DTREF)= DATEPART(YYYY,GETDATE())
AND PRO.AD_MARCA = 14) AS META
)A
</snk:query>
JavaScript snippet:
<div class="squareWhite" style="width:380px; font-size: 20px; height: 160px;">
APPLE<br></br>
META: <c:out value="${AP.rows[0].META}"/><br></br>
REALIZADO: <c:out value="${AP.rows[0].REALIZADO}" + "%"/><br></br>
ACUMULADO: <c:out value="${AP.rows[0].ACUMULADO}" /> //ESSE CAMPO DEVERIA RECEBER A PORCENTAGEM
</div>
Result:
REALIZADO META ACUMULADO
5641673,96 12500000,00 45,13339168
Accumulated should return as 45%.
Could you help me?