Bom dia, eu precisava saber como arrumar este erro que estou recebendo no code analysis em anexo, tentei pesquisar por mim mesmo mas não consegui achar muito sobre, segue o fonte, obrigado
Static Function ValSaldo()
Local nTolera := GETMV("ES_PCPP15A")
Local nQtdTol := 0
Local cMargem := Right(Alltrim(Str(nTolera)),1)+"0"
cFalSal := "N"
If Left(cNewPro,1) == "S"
cQryP15A := " SELECT D4_PRODUTO, RTRIM(D4_COD)D4_COD, LEFT(B1_DESC,50)B1_DESC, D4_LOCAL, D4_OP, D4_QTDEORI, D4_X_QTSEP, "
cQryP15A += " ISNULL(B201,0) LOCAL01, "
cQryP15A += " ISNULL(B202,0) LOCAL02, "
cQryP15A += " ISNULL(B206,0) LOCAL06, "
cQryP15A += " ISNULL(B297,0) LOCAL97, "
cQryP15A += " ISNULL(B299,0) LOCAL99, "
cQryP15A += " SALDO_TOT "
cQryP15A += " FROM SD4010 D4 (NOLOCK) "
cQryP15A += " INNER JOIN SB1010 B1 (NOLOCK) ON B1.D_E_L_E_T_ = '' AND B1_COD = D4_COD AND B1_TIPO NOT IN ('PI') "
cQryP15A += " LEFT JOIN( "
cQryP15A += " SELECT B1.B1_COD PRODUT, "
cQryP15A += " ISNULL(B201.B2_QATU,0)'B201', "
cQryP15A += " ISNULL(B202.B2_QATU,0)'B202', "
cQryP15A += " ISNULL(B206.B2_QATU,0)'B206', "
cQryP15A += " ISNULL(B297.B2_QATU,0)'B297', "
cQryP15A += " ISNULL(B299.B2_QATU,0)'B299', "
cQryP15A += " (ISNULL(B201.B2_QATU,0) + ISNULL(B202.B2_QATU,0) + ISNULL(B206.B2_QATU,0) + ISNULL(B297.B2_QATU,0) + ISNULL(B299.B2_QATU,0) ) 'SALDO_TOT' "
cQryP15A += " FROM SB1010 B1 (NOLOCK) "
cQryP15A += " LEFT JOIN SB2010 B2 (NOLOCK) ON B1.D_E_L_E_T_ = '' AND B1_COD = B2.B2_COD AND B2.B2_LOCAL = '01' "
cQryP15A += " LEFT JOIN SB2010 B201 (NOLOCK) ON B201.D_E_L_E_T_ = '' AND B201.B2_FILIAL = B2.B2_FILIAL AND B201.B2_COD = B2.B2_COD AND B201.B2_LOCAL = '01' "
cQryP15A += " LEFT JOIN SB2010 B202 (NOLOCK) ON B202.D_E_L_E_T_ = '' AND B202.B2_FILIAL = B2.B2_FILIAL AND B202.B2_COD = B2.B2_COD AND B202.B2_LOCAL = '02' "
cQryP15A += " LEFT JOIN SB2010 B206 (NOLOCK) ON B206.D_E_L_E_T_ = '' AND B206.B2_FILIAL = B2.B2_FILIAL AND B206.B2_COD = B2.B2_COD AND B206.B2_LOCAL = '06' "
cQryP15A += " LEFT JOIN SB2010 B297 (NOLOCK) ON B297.D_E_L_E_T_ = '' AND B297.B2_FILIAL = B2.B2_FILIAL AND B297.B2_COD = B2.B2_COD AND B297.B2_LOCAL = '97' "
cQryP15A += " LEFT JOIN SB2010 B299 (NOLOCK) ON B299.D_E_L_E_T_ = '' AND B299.B2_FILIAL = B2.B2_FILIAL AND B299.B2_COD = B2.B2_COD AND B299.B2_LOCAL = '99' "
cQryP15A += " WHERE B201.D_E_L_E_T_ = '' "
cQryP15A += " AND B2.B2_FILIAL = '1001' "
cQryP15A += " AND B2.B2_LOCAL IN ('01','02','06','97','99') "
cQryP15A += " )X ON D4_COD = PRODUT "
cQryP15A += " WHERE D4.D_E_L_E_T_ = '' "
cQryP15A += " AND D4_FILIAL = '1001' "
cQryP15A += " AND D4_QUANT > SALDO_TOT "
cQryP15A += " AND D4_OP = '"+cOP+"' "
If Select("TRBSB2A") > 0
TRBSB2A->( dbCloseArea() )
EndIf
DBUSEAREA(.T.,"TOPCONN", TCGenQry(,,cQryP15A),"TRBSB2A", .F., .T.)
cArq := CriaTrab(NIL,.F.)
Copy To &cArq
If Select("TRBSB2A") > 0
TRBSB2A->( dbCloseArea() )
EndIf
DBUSEAREA(.T.,,cArq,"TRBSB2A",.T.)
// Margem
If Left(Right(Alltrim(Str(nTolera)),2),1) = "."
cMargem := Right(Alltrim(Str(nTolera)),1)+"0"
Else
cMargem := Right(Alltrim(Str(nTolera)),2)
Endif
TRBSB2A->(dbGoTop())
While TRBSB2A->(!EOF())
nQtdTol := NoRound(TRBSB2A->SALDO_TOT * nTolera, 0)
If TRBSB2A->D4_QTDEORI > nQtdTol
aAdd(aBrwSal,{.F.,;
Alltrim(TRBSB2A->D4_COD),;
Rtrim(Transform(TRBSB2A->D4_QTDEORI,"@E 9,999,999")),;
Transform(TRBSB2A->SALDO_TOT,"@E 9,999,999"),;
Transform(TRBSB2A->LOCAL01,"@E 9,999,999"),;
Transform(TRBSB2A->LOCAL02,"@E 9,999,999"),;
Transform(TRBSB2A->LOCAL06,"@E 9,999,999"),;
Transform(TRBSB2A->LOCAL97,"@E 9,999,999"),;
Transform(TRBSB2A->LOCAL99,"@E 9,999,999"),;
TRBSB2A->B1_DESC})
Endif
TRBSB2A->(dbSkip())
Enddo
Endif
If Len(aBrwSal) > 0
TelaVal()
aBrwSal := {}
Endif
Return()
Você está criando um arquivo CTREE com base numa query?
— Daniel Mendes 14 de May de 2024Isso mesmo daniel, desculpa a demora para responder
— Gustavo de Souza Abade Barbosa 15 de May de 2024