div. Änderungen, etc.
This commit is contained in:
@@ -2500,6 +2500,22 @@ Public Class cRKSV
|
||||
|
||||
End Function
|
||||
|
||||
Private Shared Function checkifSaldo(mandant As Integer, Jahr As Integer, kontoNr As Integer) As Boolean
|
||||
|
||||
|
||||
Dim sql = "Select COUNT([FIBU2].dbo.fibu_periodensaldo.i_konto) FROM [FIBU2].dbo.fibu_periodensaldo WHERE [FIBU2].dbo.fibu_periodensaldo.i_firm_refid = " & mandant & " And [FIBU2].dbo.fibu_periodensaldo.si_jahr = " & Jahr & " And [FIBU2].dbo.fibu_periodensaldo.i_konto = " & kontoNr & ""
|
||||
|
||||
Dim cntTxt = (New VERAG_PROG_ALLGEMEIN.SQL).getValueTxtBySqlVarList(sql, "FIBU", , "0")
|
||||
|
||||
Dim cnt As Integer = 0
|
||||
If Integer.TryParse(cntTxt, cnt) AndAlso cnt > 0 Then
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Public Shared Property DefaultMandant As Integer = 9
|
||||
Public Shared Property DefaultKassenkonto As Integer = 2700
|
||||
@@ -2577,6 +2593,162 @@ Public Class cRKSV
|
||||
BelegNrUID &= FIBU_YEAR.ToString.Substring(2, 2)
|
||||
BelegNrUID &= i_beleg_refid.ToString("D5")
|
||||
|
||||
|
||||
'insert perioden-salden!!
|
||||
|
||||
|
||||
For Each Konten In dtKonten.Rows
|
||||
|
||||
Dim kontoNr As Integer = CInt(Konten("Konto"))
|
||||
|
||||
If Not checkifSaldo(mandant, FIBU_YEAR, kontoNr) Then
|
||||
Dim aktellerSaldo As String = sql.getValueTxtBySqlVarList("Select [FIBU2].dbo.fibu_konto.dec_aktuellersaldo FROM [FIBU2].dbo.fibu_konto WHERE [FIBU2].dbo.fibu_konto.i_firm_refid = " & SafeIntToSql(mandant) & " And [FIBU2].dbo.fibu_konto.i_konto = " & kontoNr & " ", "FIBU",, "0")
|
||||
If aktellerSaldo <> "" AndAlso IsNumeric(aktellerSaldo) Then
|
||||
InsertFibuPeriodensaldo(sql, mandant, jahr, kontoNr, CDbl(aktellerSaldo))
|
||||
End If
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
|
||||
'Set @dec_aktuellersaldo = (Select [FIBU2].dbo.fibu_konto.dec_aktuellersaldo FROM [FIBU2].dbo.fibu_konto WHERE [FIBU2].dbo.fibu_konto.i_firm_refid = @MandantNr And [FIBU2].dbo.fibu_konto.i_konto = @Schleifenkonto)
|
||||
'If @dec_aktuellersaldo Is NULL SET @dec_aktuellersaldo = 0
|
||||
|
||||
'INSERT INTO [FIBU2].dbo.fibu_periodensaldo (
|
||||
'[FIBU2].dbo.fibu_periodensaldo.i_firm_refid,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.si_jahr,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.i_konto,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.i_perioden,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_eroeff,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_abschluss,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_soll_1,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_haben_1,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_soll_2,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_haben_2,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_soll_3,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_haben_3,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_soll_4,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_haben_4,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_soll_5,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_haben_5,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_soll_6,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_haben_6,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_soll_7,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_haben_7,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_soll_8,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_haben_8,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_soll_9,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_haben_9,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_soll_10,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_haben_10,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_soll_11,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_haben_11,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_soll_12,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_haben_12,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_soll_13,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.dec_haben_13,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_eroeff,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_abschluss,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_soll_1,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_haben_1,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_soll_2,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_haben_2,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_soll_3,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_haben_3,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_soll_4,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_haben_4,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_soll_5,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_haben_5,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_soll_6,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_haben_6,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_soll_7,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_haben_7,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_soll_8,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_haben_8,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_soll_9,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_haben_9,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_soll_10,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_haben_10,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_soll_11,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_haben_11,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_soll_12,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_haben_12,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_soll_13,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.eur_haben_13,
|
||||
'[FIBU2].dbo.fibu_periodensaldo.i_buchungskreis)
|
||||
|
||||
'VALUES (
|
||||
'@MandantNr,
|
||||
'@Jahr,
|
||||
'@Schleifenkonto,
|
||||
'0,
|
||||
'@dec_aktuellersaldo,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'@dec_aktuellersaldo,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'0,
|
||||
'1)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
InsertBelegskopf_new(sql, mandant, jahr, periode, SafeIntToSql(i_beleg_refid), beleg.BelegDat.ToShortDateString, SafeString(beleg.BelegNr), 1, buchungstext, CType(betrag, Double), "EUR", Now(), VERAG_PROG_ALLGEMEIN.cAllgemein.USRNAME, protokollId, BelegNrUID)
|
||||
|
||||
' 8) insert belegzeilen depending on type
|
||||
@@ -2742,8 +2914,8 @@ Public Class cRKSV
|
||||
End Sub
|
||||
|
||||
Private Shared Function GetStapelRefId(sql As VERAG_PROG_ALLGEMEIN.SQL, mandant As Integer) As String
|
||||
Dim v = sql.getValueTxtBySqlVarList("SELECT i_stapel_refid FROM [FIBU2].dbo.fibu_stapelart WHERE c_stapelname LIKE 'Auszahlungskasse 1' AND i_firm_refid = " & SafeIntToSql(mandant), "FIBU",, "")
|
||||
Return If(String.IsNullOrWhiteSpace(v), "0000", v)
|
||||
Dim v = sql.getValueTxtBySqlVarList("SELECT i_stapel_refid FROM [FIBU2].dbo.fibu_stapelart WHERE c_stapelname Like 'Auszahlungskasse 1' AND i_firm_refid = " & SafeIntToSql(mandant), "FIBU",, "")
|
||||
Return If(String.IsNullOrWhiteSpace(v), "0000", v)
|
||||
End Function
|
||||
|
||||
Private Shared Function GetNextStapelLfdNr(sql As VERAG_PROG_ALLGEMEIN.SQL, stapelRefId As String, mandant As Integer) As Integer
|
||||
@@ -2797,6 +2969,33 @@ Public Class cRKSV
|
||||
sql.doSQL(sqlStr, "FIBU")
|
||||
End Sub
|
||||
|
||||
Private Shared Sub InsertFibuPeriodensaldo(
|
||||
sql As VERAG_PROG_ALLGEMEIN.SQL,
|
||||
mandant As Integer,
|
||||
jahr As Integer,
|
||||
konto As Integer,
|
||||
decAktuellerSaldo As Double)
|
||||
|
||||
Dim saldo As String = decAktuellerSaldo.ToString().Replace(",", ".")
|
||||
|
||||
Dim sqlStr As String =
|
||||
"INSERT INTO [FIBU2].dbo.fibu_periodensaldo (i_firm_refid, si_jahr, i_konto, i_perioden, dec_eroeff, dec_abschluss, dec_soll_1, dec_haben_1, dec_soll_2, dec_haben_2, dec_soll_3, dec_haben_3,dec_soll_4, dec_haben_4, dec_soll_5, dec_haben_5, dec_soll_6, dec_haben_6, dec_soll_7, dec_haben_7, dec_soll_8, dec_haben_8, dec_soll_9, dec_haben_9, " &
|
||||
" dec_soll_10, dec_haben_10, dec_soll_11, dec_haben_11, dec_soll_12, dec_haben_12, dec_soll_13, dec_haben_13, eur_eroeff, eur_abschluss, eur_soll_1, eur_haben_1, eur_soll_2, eur_haben_2, eur_soll_3, eur_haben_3, eur_soll_4, eur_haben_4, eur_soll_5, eur_haben_5, eur_soll_6, eur_haben_6, eur_soll_7, eur_haben_7, eur_soll_8, eur_haben_8, eur_soll_9, eur_haben_9, " &
|
||||
" eur_soll_10, eur_haben_10, eur_soll_11, eur_haben_11, eur_soll_12, eur_haben_12, eur_soll_13, eur_haben_13, i_buchungskreis) " &
|
||||
"VALUES (" &
|
||||
SafeIntToSql(mandant) & "," &
|
||||
jahr & "," &
|
||||
konto & "," &
|
||||
"0," &
|
||||
String.Join(",", Enumerable.Repeat("0", 32)) & "," &
|
||||
saldo & "," &
|
||||
String.Join(",", Enumerable.Repeat("0", 26)) & "," &
|
||||
"1);"
|
||||
|
||||
sql.doSQL(sqlStr, "FIBU")
|
||||
|
||||
End Sub
|
||||
|
||||
Private Shared Sub createOP_new(mandant As Integer, Betrag As Double, BelegNrText As String, datumKurz As String, BelegNr As String, Buchungstext As String, Buchungsbetrag As Double, Waehrung As String, Personenkonto As Integer, Forderungskonto As Integer, i_op_refid As String, c_op_Typ As Char, Sprache As String, Zahlungsziel As String, Skonto As String, Skontodatum As String, Nettodatum As String, c_ustidnr As String, c_urbelegid As String)
|
||||
|
||||
'Rechnung Betrag Positiv, Gutschrift Betrag negativ!typ
|
||||
|
||||
Reference in New Issue
Block a user