0
Gentlemen, I am developing a billing monitoring panel. I want to turn this number 56% directly into my Javascript code. Follow an excerpt of my code, it is directly fed by a query of my SQL.
This is the query that feeds my field into Javascript, the variable MT
receives her.
<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>
Code snippet in Javascript:
<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>
Upshot:
REALIZADO META ACUMULADO
5641673,96 12500000,00 45,13339168
The Accumulated should return as 45%.
Could you help me?
Complement: código no Javascript <div class="squareWhite" style="width:380px; font-size: 20px; height: 160px;"> MOTOROLA <br></br> META: <c:out value="${MT.Rows[0]. META}"/><br></br> REALIZED: <c:out value="${MT.Rows[0]. REALIZED}" /><br></br> ACCUMULATED: <c:out value="${MT.Rows[0]. ACCUMULATED}" /> </div>
– Gabriel Paixão Justino
It would be interesting if you took a look at tour to better understand how things work around here!
– Marconi