Torna al Thread

Public Function CalcolaGuadagnoPuntiDaTotaleScontrino(ByVal totalescontrino As Double) As String 'integer a regime 'ogni 10 euro di spesa = 3 pti 'todo: ***ATTENZIONE*** SE LA TESSERA FIDELITY GODE DI SCONTO STANDARD NON HA DIRITTO ALL'ACCUMULO PUNTI. Dim divisione As Double = 0 Dim sottrazione As Double = 0 Dim arrotonda As Integer = 0 Dim punti As Integer = 0 'divido per 10 perchè 3pti ongi 10 euro 'per evitare l'arrotondamento per eccesso tolgo 0.5 divisione = (totalescontrino / 10) sottrazione = divisione - 0.5 arrotonda = CInt(sottrazione) punti = arrotonda * 3 Return totalescontrino & ":" & 10 & "=" & divisione & vbCrLf _ & "tolgo 0.5 per arrotondare sempre per difetto = " & sottrazione & vbCrLf _ & "arrotondo a numero intero = " & arrotonda & vbCrLf _ & "moltiplico x 3 e trovo il punteggio = " & punti 'Return punti End Function
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5