Jump to content
Fivewin Brasil

MAPA DE TROCO - PDV


marcioe

Recommended Posts

Rascunhei agora essa funcão, nos testes rápidos que fiz deu certo. Veja se ela te ajuda e se tiver algo errado corrija e poste aqui caso alguem precise no futuro

 

 

Function u_Main()
Local nValor := 287.77
 
aTroco := CalculaNotas(nValor)
 
MsgStop(Sr_ShowVector(aTroco))
 
Return
 
Static Function CalculaNotas(nValor)
Local aNotas := {200100502010521, .50, .25, .10, .05, .01}
Local nDif := nValor * 100
Local nI
Local aTroco := {}
Local nCedulas
 
For nI := 1 to Len(aNotas)
  aNotas[nI] := aNotas[nI] * 100
Next
 
For nI := 1 to Len(aNotas)
  nCedulas := Int(nDif / aNotas[nI])
  nDif := nDif - (nCedulas * aNotas[nI])
 
  If nCedulas > 0
    aadd(aTroco, {aNotas[nI]/100, nCedulas})
  EndIf
Next
 
Return aTroco
Link to comment
Share on other sites

16 horas atrás, kapiaba disse:

 MsgStop( Sr_ShowVector( aTroco ) )

 

Who is this?

 

Abs

 

é uma função do SQLRDD que exibe em texto um array, pode ignorar pois isso não tem referencia nenhuma a funcionalidade, é apenas uma maneira fácil de exibir um array na tela.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...