Anlage des Repos
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
'(Declarations)
|
||||
|
||||
'Formula: IF_SKONTOBERECHNUNG
|
||||
'Description: Skontoberechnung beim Beleg speichern
|
||||
Function Formula ()
|
||||
BELEGART_GUTSCHRIFT = 6
|
||||
|
||||
BruttoGesamt = Invoicing.CalcGrossAmount()
|
||||
BelegNr = Value(0,39)
|
||||
|
||||
MsgBox "BelegNr: [" & BelegNr & "]"
|
||||
|
||||
' Skonto% für BelegNr abfragen
|
||||
SQL = "SELECT t2.c004 from t025 t (NOLOCK) join t226 t2 (NOLOCK) On t.c051 = t2.c010 where t2.c018 = 2 And t2.c004 > 0 And t.c055 = '"&BelegNr&"'"
|
||||
Set Result = CWLStart.Connection.Select(SQL)
|
||||
|
||||
' Wenn es Zahlungskonditionen gibt
|
||||
If Result.RowCount > 0 Then
|
||||
Skonto = Result.Value("c004")
|
||||
|
||||
' Wenn es einen Skonto% Wert gibt..
|
||||
If Skonto > 0 Then
|
||||
SkontoBetrag = BruttoGesamt * (Skonto / 100)
|
||||
ZahlBetrag = BruttoGesamt - SkontoBetrag
|
||||
|
||||
Value(0,121) = Cstr(Skonto)
|
||||
Value(0,122) = FormatNumber(SkontoBetrag, 2)
|
||||
Value(0,123) = FormatNumber(ZahlBetrag, 2)
|
||||
|
||||
UpdateOpBetrag ZahlBetrag, "Beleg mit Skonto%"
|
||||
Else ' Wenn kein Skonto hinterlegt ist..
|
||||
If BruttoGesamt >= 0 Then
|
||||
UpdateOpBetrag BruttoGesamt, "Brutto ist 0 oder größer"
|
||||
Else
|
||||
If Value(25,35) = BELEGART_GUTSCHRIFT Then
|
||||
UpdateOpBetrag BruttoGesamt, "Beleg ist Gutschrift"
|
||||
Else
|
||||
UpdateOpBetrag 0, "Keine Gutschrift"
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Else ' Wenn es keine Zahlungskonditionen gibt..
|
||||
UpdateOpBetrag BruttoGesamt, "Keine Zahlungskonditionen"
|
||||
End If
|
||||
|
||||
Formula = 1 'successful
|
||||
End Function
|
||||
|
||||
Function UpdateOpBetrag(Brutto, Grund)
|
||||
' Wenn Rechnungsnummer noch nicht gefüllt ist (= Neuanlage Rechnung ohne Rechnen/Drucken).
|
||||
If Len(Value(0,120)) = 0 Then
|
||||
Do_UpdateOpBetrag Brutto, Grund & ", Noch keine Rechnungsnummer"
|
||||
End If
|
||||
|
||||
' ODER Wenn Zahldatum (= Valutadatum) noch nicht gefüllt ist.
|
||||
'Elseif Len(Value(25,73)) = 0 Then
|
||||
' Do_UpdateOpBetrag Brutto, Grund & ", Noch kein Zahldatum"
|
||||
'End If
|
||||
End Function
|
||||
|
||||
Function Do_UpdateOpBetrag(Brutto, Grund)
|
||||
MsgBox "Neuer OP-Betrag ist: " & Cstr(Brutto) & " (Brutto)" & vbNewline & vbNewline & "Grund: '" & Grund & "'"
|
||||
Value(0,124) = FormatNumber(Brutto, 2)
|
||||
End Function
|
||||
|
||||
'''End of (Declarations)
|
||||
|
||||
Reference in New Issue
Block a user