Attribute VB_Name = "Budget" Option Compare Database Public dB As Database Public Inp, Out As Recordset Public xlApp, wb As Object Public PerBase As String Public PerCalc As String Public BgtYr1 As String Public BgtYr2 As String Public BgtYr3 As String Public ParKal As String Public ParOON As String Public Issue As String Public RecapText, Text As String Public OutQry As QueryDef Public FondH, DovD, DovH, DovHfcst, DovHbgt1, DovHbgt2, DovHbgt3, Devpp, Prom, Neoh As Currency Public i, j, k, Mth, CountTot, CountI, CountRecapStep, CountNewEmpl, InpRow As Integer Public KalDovP As Variant Public ParPr, ParNeoh, ParTinc, CitPoh, CitProdm, CitFomv, CitPr, OdprDh, CountOld, CitPriplNoc, CitPriplOs, CitPriplOst, CitPriplProst, CitPriplSmenn, CitPriplVed, CitPriplPsGe, CitPriplDvPr, CitPriplTrPr, CitPriplJIP, CitPriplPr25, CitPriplPr50, CitPriplPr50h, CitPriplSv, CitPriplMinMz, CitPriplNPZat, TaskPresc As Currency Public DfcstSumP, DbgtSumP As Double Public FcstUpd, NewRec As Boolean Public PerFrom, Repre, Kateg, Utvar, NS, Oscis, ZastRepre, ZastKateg, ZastUtvar, ZastNS, SitPar, SitZast, RunModel, TColor, Method, MethZdroj As String Public IndPriplSmenn, IndPriplOst, IndProdm, Ind_FvHodm, Ind_FvHodT, Ind_FvQodm, IndOON As Currency Public Vol, TarifNa, TarifO, TarifProc As Currency Public Pocet, Tarif, PocetOscis, TarifOscis, PocetZast, TarifZast, YoYkoef As Currency Public InpZast, InpOscis As Recordset Public NewOscis, Prac, Kat As String Public Sub BudgetProcessingSteps() CurrentDb.Execute "DELETE * FROM BgtRecap" CountRecapStep = 1 Budget.BudgetProcessingBase 'Defaultní plán (poslední známé stavy, poslední tarify, modelace z historických počtů, tarifů a složek mzdy, dopočet dovolené dle předpokladu čerpání, citlivost mzodvých složek na změnu tarifu) Budget.DoplnitSouhSlozky_Nahrady Issue = CountRecapStep & "_Defaultní plán" Budget.UpdateRecap CountRecapStep = CountRecapStep + 1 CurrentDb.Execute "DELETE * FROM BgtDetailAbsDefault" CurrentDb.Execute "INSERT INTO BgtDetailAbsDefault SELECT * FROM BgtDetailAbs" Budget.NavysovaniStupnu 'Navyšování stupňů za odpracované roky Budget.BudgetProcessingStupne Budget.DoplnitSouhSlozky_Nahrady Issue = CountRecapStep & "_Vyšší stupně" Budget.UpdateRecap CountRecapStep = CountRecapStep + 1 Budget.TarifTridyModel 'Navyšování tarifů různých skupin zaměstnanců v různých třídách dle varianty MZ Budget.DoplnitSouhSlozky_Nahrady Issue = CountRecapStep & "_Tarify ver. MZ od 202001" Budget.UpdateRecap CountRecapStep = CountRecapStep + 1 Budget.Priplatky 'Navyšování příplatků mimo směnnost Budget.DoplnitSouhSlozky_Nahrady Issue = CountRecapStep & "_Příplatky" Budget.UpdateRecap CountRecapStep = CountRecapStep + 1 Rem Budget.PriplZaSmennost 'Navyšování příplatků za směnnost Rem Budget.DoplnitSouhSlozky_Nahrady Rem Issue = CountRecapStep & "_Příplatek za směnnost" Rem Budget.UpdateRecap Rem CountRecapStep = CountRecapStep + 1 Budget.ProcessBgtInputFile 'Ruční změny (počty, mzdy) Budget.BudgetProcessingOdmeny 'Zpracování odměn - výpočet nároku pololetních odměn a zarovnání ostatních odměn na manuální vstup Budget.DoplnitSouhSlozky_Nahrady Issue = CountRecapStep & "_Korekce odměn" Budget.UpdateRecap Forms!MainForm.BgtProcessingInfo = "Mažu přechodné entity ..." CurrentDb.Execute "DELETE * FROM BgtDetailAbsNew" CurrentDb.Execute "DELETE * FROM BgtZmenaTrid" CurrentDb.Execute "DELETE * FROM TempPrumProNahr" Set dB = Nothing Set Inp = Nothing Set Out = Nothing Forms!MainForm.BgtProcessingInfo = "Provádím komprimaci databáze ..." CompactRepairDB ("FNOL_Personal_Bgt") Forms!MainForm.BgtProcessingInfo = "" End Sub Public Sub BudgetProcessingStepsNoDefaultNoRecap() CurrentDb.Execute "DELETE * FROM BgtRecap" CountRecapStep = 1 CurrentDb.Execute "DELETE * FROM BgtDetailAbs" CurrentDb.Execute "INSERT INTO BgtDetailAbs SELECT * FROM BgtDetailAbsDefault" Budget.NavysovaniStupnu 'Navyšování stupňů za odpracované roky Budget.BudgetProcessingStupne Budget.TarifTridyModel 'Navyšování tarifů různých skupin zaměstnanců v různých třídách dle varianty MZ Budget.Priplatky 'Navyšování příplatků mimo směnnost Rem Budget.PriplZaSmennost 'Navyšování příplatků za směnnost Budget.ProcessBgtInputFile 'Ruční změny (počty, mzdy) Budget.BudgetProcessingOdmeny 'Zpracování odměn - výpočet nároku pololetních odměn a zarovnání ostatních odměn na manuální vstup Budget.DoplnitSouhSlozky_Nahrady Issue = CountRecapStep & "_Korekce odměn" Budget.UpdateRecap Forms!MainForm.BgtProcessingInfo = "Mažu přechodné entity ..." CurrentDb.Execute "DELETE * FROM BgtDetailAbsNew" CurrentDb.Execute "DELETE * FROM BgtZmenaTrid" CurrentDb.Execute "DELETE * FROM TempPrumProNahr" Set dB = Nothing Set Inp = Nothing Set Out = Nothing Forms!MainForm.BgtProcessingInfo = "Provádím komprimaci databáze ..." CompactRepairDB ("FNOL_Personal_Bgt") Forms!MainForm.BgtProcessingInfo = "" End Sub Public Sub BudgetProcessingStepsNoDefaultYesRecap() CurrentDb.Execute "DELETE * FROM BgtRecap" CountRecapStep = 1 CurrentDb.Execute "DELETE * FROM BgtDetailAbs" CurrentDb.Execute "INSERT INTO BgtDetailAbs SELECT * FROM BgtDetailAbsDefault" Issue = CountRecapStep & "_Defaultní plán" Budget.UpdateRecap CountRecapStep = CountRecapStep + 1 Budget.NavysovaniStupnu 'Navyšování stupňů za odpracované roky Budget.BudgetProcessingStupne Budget.DoplnitSouhSlozky_Nahrady Issue = CountRecapStep & "_Vyšší stupně" Budget.UpdateRecap CountRecapStep = CountRecapStep + 1 Budget.TarifTridyModel 'Navyšování tarifů různých skupin zaměstnanců v různých třídách dle varianty MZ Budget.DoplnitSouhSlozky_Nahrady Issue = CountRecapStep & "_Tarify ver. MZ od 201901" Budget.UpdateRecap CountRecapStep = CountRecapStep + 1 Budget.Priplatky 'Navyšování příplatků mimo směnnost Budget.DoplnitSouhSlozky_Nahrady Issue = CountRecapStep & "_Příplatky" Budget.UpdateRecap CountRecapStep = CountRecapStep + 1 Rem Budget.PriplZaSmennost 'Navyšování příplatků za směnnost Rem Budget.DoplnitSouhSlozky_Nahrady Rem Issue = CountRecapStep & "_Příplatek za směnnost" Rem Budget.UpdateRecap Rem CountRecapStep = CountRecapStep + 1 Budget.ProcessBgtInputFile 'Ruční změny (počty, mzdy) Budget.BudgetProcessingOdmeny 'Zpracování odměn - výpočet nároku pololetních odměn a zarovnání ostatních odměn na manuální vstup Budget.DoplnitSouhSlozky_Nahrady Issue = CountRecapStep & "_Korekce odměn" Budget.UpdateRecap Forms!MainForm.BgtProcessingInfo = "Mažu přechodné entity ..." CurrentDb.Execute "DELETE * FROM BgtDetailAbsNew" CurrentDb.Execute "DELETE * FROM BgtZmenaTrid" CurrentDb.Execute "DELETE * FROM TempPrumProNahr" Forms!MainForm.BgtProcessingInfo = "Provádím komprimaci databáze ..." CompactRepairDB ("FNOL_Personal_Bgt") Forms!MainForm.BgtProcessingInfo = "" End Sub Public Sub UpdateRecap() Set dB = CurrentDb() Set Inp = dB.OpenRecordset("07_03FcstBgtReviewQ", dbOpenDynaset) Set Out = dB.OpenRecordset("BgtRecap", dbOpenDynaset) Do Until Inp.EOF Out.AddNew For i = 0 To Inp.Fields.Count - 1 Out(i).Value = Inp(i).Value Next i Out(0).Value = Issue Out.Update Inp.MoveNext Loop Set dB = Nothing Set Inp = Nothing Set Out = Nothing End Sub Public Sub BudgetProcessingBase() Set dB = CurrentDb() Forms!MainForm.BgtProcessingInfo = "Mažu tabulku s detailním plánem ..." 'Výmaz tabulky s výhledem, nahrání dat skutečnosti do forecastu aktuálního roku Set Inp = dB.OpenRecordset("03_81BgtProcessActQ", dbOpenDynaset) Set Out = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, [_OdmHVpol], " & _ "[_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, [_FvHodm], [_FvHodmT], " & _ "[_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, Comment, utv, repre, tyduvs, tyduvi, SocPoj, ZdravPoj, FKSP, NewPar, PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, " & _ "PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] " & _ "From BgtDetailAbs", dbOpenDynaset) Rem DBEngine.SetOption dbMaxLocksPerFile, 1000000 CurrentDb.Execute "DELETE * FROM BgtDetailAbs" Rem DBEngine.SetOption dbMaxLocksPerFile, 100000 Do Until Inp.EOF Out.AddNew For i = 0 To Inp.Fields.Count - 1 Out(i).Value = Inp(i).Value Next i Out.Update Inp.MoveNext Loop 'Zpracování výhledu pro aktuální zaměstnance nad již známými skutečnostmi, v první fázi bez navýšení mezd a objemových změn Set Inp = dB.OpenRecordset("03_90BgtProcessBaseQ", dbOpenDynaset) PerBase = DLookup("ValText", "Parameters", "[Parameter]= " & "'ReportPeriod'") BgtYr1 = CStr(Val(Left(PerBase, 4)) + 1) BgtYr2 = CStr(Val(Left(PerBase, 4)) + 2) BgtYr3 = CStr(Val(Left(PerBase, 4)) + 3) If Right(PerBase, 2) = "12" Then FcstUpd = False Else FcstUpd = True Set xlApp = New Excel.Application Set wb = xlApp.Workbooks.Open(DLookup("ValText", "Parameters", "[Parameter]= " & "'PathBgtInput'") & "\BgtInputs.xlsx") CitPr = wb.Sheets("Parametry").Range("B8").Value 'citlivost ceny za přesčas na změnu tarifu CitPoh = wb.Sheets("Parametry").Range("B5").Value 'citlivost pohotovostí na změnu tarifu CitProdm = wb.Sheets("Parametry").Range("B6").Value 'citlivost prémií a odměn na změnu tarifu CitFomv = wb.Sheets("Parametry").Range("B7").Value 'citlivost fondu vedoucího na změnu tarifu CitPriplNoc = wb.Sheets("Parametry").Range("B9").Value CitPriplOs = wb.Sheets("Parametry").Range("B10").Value CitPriplProst = wb.Sheets("Parametry").Range("B11").Value CitPriplSmenn = wb.Sheets("Parametry").Range("B12").Value CitPriplVed = wb.Sheets("Parametry").Range("B13").Value CitPriplPsGe = wb.Sheets("Parametry").Range("B14").Value CitPriplDvPr = wb.Sheets("Parametry").Range("B15").Value CitPriplTrPr = wb.Sheets("Parametry").Range("B16").Value CitPriplJIP = wb.Sheets("Parametry").Range("B17").Value CitPriplPr25 = wb.Sheets("Parametry").Range("B18").Value CitPriplPr50 = wb.Sheets("Parametry").Range("B19").Value CitPriplSv = wb.Sheets("Parametry").Range("B20").Value CitPriplMinMz = wb.Sheets("Parametry").Range("B21").Value CitPriplNPZat = wb.Sheets("Parametry").Range("B22").Value CitPriplPr50h = wb.Sheets("Parametry").Range("B23").Value CitPriplOst = wb.Sheets("Parametry").Range("B24").Value TaskPresc = wb.Sheets("Parametry").Range("H2").Value 'Parametry ze vstupního xls souboru uložené do proměnných DovD = wb.Sheets("Parametry").Range("B2").Value KalDovP = Array(wb.Sheets("Kalendarizace").Range("F3").Value, wb.Sheets("Kalendarizace").Range("G3").Value, wb.Sheets("Kalendarizace").Range("H3").Value, wb.Sheets("Kalendarizace").Range("I3").Value, wb.Sheets("Kalendarizace").Range("J3").Value, wb.Sheets("Kalendarizace").Range("K3").Value, wb.Sheets("Kalendarizace").Range("L3").Value, wb.Sheets("Kalendarizace").Range("M3").Value, wb.Sheets("Kalendarizace").Range("N3").Value, wb.Sheets("Kalendarizace").Range("O3").Value, wb.Sheets("Kalendarizace").Range("P3").Value, wb.Sheets("Kalendarizace").Range("Q3").Value) DbgtSumP = 0 DfcstSumP = 0 For i = 0 To 11 DbgtSumP = DbgtSumP + KalDovP(i) Next i For i = Val(Right(PerBase, 2)) To 11 DfcstSumP = DfcstSumP + KalDovP(i) Next i Inp.MoveLast CountTot = Inp.RecordCount Inp.MoveFirst CountI = 0 CountOld = 0 'Zpracování vstupních vět Do Until Inp.EOF CountI = CountI + 1 If CLng(CountI / CountTot * 100) <> CountOld Then Forms!MainForm.BgtProcessingInfo = "Zpracovávám masterfile s plánem ..." & CLng(CountI / CountTot * 100) & "%" CountOld = CLng(CountI / CountTot * 100) End If PerCalc = PerBase ParOON = False 'Pokud jde o dohodáře, plánování se řídí jinými mechanismy If Inp(6).Value = 0 And Inp(40).Value = Inp(44).Value Then ParOON = True End If 'Pokud zaměstnanec není stavem TD na daném NS v dané kategorii nejde o OON, výhled se neřeší If Inp(6).Value = 0 And ParOON = False Then GoTo SkipProc 'Výpočet parametrů dovolené DovHfcst = ((KalDnyYr(PerBase) - KalDnyYTM(PerBase)) * Inp(6).Value + Inp(7).Value) / KalDnyYr(PerBase) * DovD * (Inp(46).Value / 5) - Inp(13).Value If DovHfcst < 0 Then DovHfcst = 0 DovHbgt1 = (KalDnyYr(BgtYr1) * Inp(6).Value) / KalDnyYr(BgtYr1) * DovD * (Inp(46).Value / 5) DovHbgt2 = (KalDnyYr(BgtYr2) * Inp(6).Value) / KalDnyYr(BgtYr2) * DovD * (Inp(46).Value / 5) DovHbgt3 = (KalDnyYr(BgtYr3) * Inp(6).Value) / KalDnyYr(BgtYr3) * DovD * (Inp(46).Value / 5) If Inp(7).Value = 0 Then ParPr = 0 Else ParPr = Inp(12).Value / Inp(7).Value 'přesčas svázán s devpp If Inp(10).Value = 0 Then ParPr = 0 Else ParTinc = Inp(8).Value / Inp(10).Value - 1 'změna tarifu TD vs YTD If (Inp(11).Value + Inp(13).Value + Inp(14).Value) = 0 Then OdprDh = 1 Else OdprDh = (Inp(11).Value + Inp(13).Value) / (Inp(11).Value + Inp(13).Value + Inp(14).Value) 'podíl odpracované doby včetně dovolených na fondu prac.doby 'Přidání záznamu forecastu a plánu zaměstnance na daném NS v dané kategorii NewRec = True Do Until NewRec = False If Right(PerCalc, 2) = "12" Then PerCalc = Val(Left(PerCalc, 4)) + 1 & "01" Else If Val(Right(PerCalc, 2)) + 1 >= 10 Then PerCalc = Left(PerCalc, 4) & Val(Right(PerCalc, 2)) + 1 Else PerCalc = Left(PerCalc, 4) & "0" & Val(Right(PerCalc, 2)) + 1 End If If Val(Left(PerCalc, 4)) - Val(Left(PerBase, 4)) > 1 Then If Val(Left(PerCalc, 4)) - Val(Left(PerBase, 4)) < 4 Then PerCalc = Left(PerCalc, 4) & "12" Else NewRec = False End If Mth = Val(Right(PerCalc, 2)) If Left(PerCalc, 4) = Left(PerBase, 4) Then ParKal = "KalFcst" DovH = KalDovP(Mth - 1) / DfcstSumP * DovHfcst Devpp = KalDnyMth(PerCalc) * Inp(6).Value End If If Val(Left(PerCalc, 4)) - Val(Left(PerBase, 4)) = 1 Then ParKal = "KalBgt1" DovH = KalDovP(Mth - 1) / DbgtSumP * DovHbgt1 Devpp = KalDnyMth(PerCalc) * Inp(6).Value End If If Val(Left(PerCalc, 4)) - Val(Left(PerBase, 4)) = 2 Then ParKal = "Bgt2" DovH = DovHbgt2 Devpp = KalDnyYr(PerCalc) * Inp(6).Value End If If Val(Left(PerCalc, 4)) - Val(Left(PerBase, 4)) = 3 Then ParKal = "Bgt3" DovH = DovHbgt3 Devpp = KalDnyYr(PerCalc) * Inp(6).Value End If If Inp(7).Value = 0 Or Inp(14).Value = 0 Then ParNeoh = 0 Else ParNeoh = wb.Sheets("Parametry").Range("G" & Val(Right(PerCalc, 2)) + 4).Value 'procento neodpracovaných hodin vyjma dovolené z BgtInput If NewRec = True Then Out.AddNew For i = 0 To 8 Out(i).Value = Inp(i).Value Next i Out(2).Value = PerCalc Out(7).Value = Devpp If IsNull(Inp(8).Value) Then Out(8).Value = 0 If ParKal = "Bgt2" Or ParKal = "Bgt3" Then Neoh = Inp(46).Value / 5 * DnyBezSoNeFY(PerCalc) * Inp(6).Value * ParNeoh Else Neoh = Inp(46).Value / 5 * DnyBezSoNe(PerCalc) * Inp(6).Value * ParNeoh If ParOON = True Then Out(9).Value = 0 Else If ParKal = "Bgt2" Or ParKal = "Bgt3" Then Out(9).Value = Inp(46).Value / 5 * DnyBezSoNeFY(PerCalc) * Inp(6).Value - DovH - Neoh Else Out(9).Value = Inp(46).Value / 5 * DnyBezSoNe(PerCalc) * Inp(6).Value - DovH - Neoh If Out(9).Value < 0 Then Out(9).Value = 0 End If Out(10).Value = ParPr * Devpp * (1 - TaskPresc) Out(11).Value = DovH Out(12).Value = Neoh If ParOON = True Then 'Kód pro OON pracovníka, který má nulový devpp, hrubá mzda je celá ve složce OON (pracovníkem je myšleno oscis v kombinaci s pracv a kateg) For i = 13 To 37 If (i <> 17 And i <> 28 And i <> 33) Then Out(i).Value = 0 Next i Out(38).Value = 0 If ParKal = "Bgt2" Or ParKal = "Bgt3" Then Out(39).Value = Inp(40).Value / Val(Right(PerBase, 2)) * 12 Out(40).Value = Inp(41).Value / Val(Right(PerBase, 2)) * 12 Out(41).Value = Inp(42).Value / Val(Right(PerBase, 2)) * 12 Out(42).Value = Inp(43).Value / Val(Right(PerBase, 2)) * 12 Else Out(39).Value = Inp(40).Value / Val(Right(PerBase, 2)) Out(40).Value = Inp(41).Value / Val(Right(PerBase, 2)) Out(41).Value = Inp(42).Value / Val(Right(PerBase, 2)) Out(42).Value = Inp(43).Value / Val(Right(PerBase, 2)) End If For i = 53 To 66 Out(i).Value = 0 Next i Else 'Kód pro jiného, než OON pracovníka (pracovníkem je myšleno oscis v kombinaci s pracv a kateg) If ParKal = "Bgt2" Or ParKal = "Bgt3" Then If (Inp(11).Value = 0 Or Inp(9).Value = 0) Then Out(13).Value = 0 Else Out(13).Value = Inp(15).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc) * 12 Else If (Inp(11).Value = 0 Or Inp(9).Value = 0) Then Out(13).Value = 0 Else Out(13).Value = Inp(15).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc) End If If Inp(12).Value = 0 Then Out(14).Value = 0 Else Out(14).Value = Inp(16).Value / Inp(12).Value * Out(10).Value * (1 + ParTinc * CitPr) If ParKal = "Bgt2" Or ParKal = "Bgt3" Then If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(15).Value = 0 Else Out(15).Value = Inp(17).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplSmenn) * 12 If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(16).Value = 0 Else Out(16).Value = Inp(18).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplOst) * 12 Else If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(15).Value = 0 Else Out(15).Value = Inp(17).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplSmenn) If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(16).Value = 0 Else Out(16).Value = Inp(18).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplOst) End If For i = 18 To 27 If Inp(7).Value = 0 Then Out(i).Value = 0 Else Out(i).Value = Inp(i + 2).Value / Inp(7).Value * Devpp * (1 + ParTinc * CitProdm) Next i If CLng(Inp(14).Value) = 0 Then Out(30).Value = 0 Else Out(30).Value = Inp(31).Value / Inp(14).Value * Out(12).Value * (1 + ParTinc) If CLng(Inp(14).Value) = 0 Then Out(31).Value = 0 Else Out(31).Value = Inp(32).Value / Inp(14).Value * Out(12).Value * (1 + ParTinc) If Inp(7).Value = 0 Then Out(32).Value = 0 Else Out(32).Value = Inp(33).Value / Inp(7).Value * Devpp * (1 + ParTinc * CitPoh) For i = 34 To 37 If Inp(7).Value = 0 Then Out(i).Value = 0 Else Out(i).Value = Inp(i + 1).Value / Inp(7).Value * Devpp * (1 + ParTinc * CitFomv) Next i Out(38).Value = 0 For i = 39 To 42 If Inp(7).Value = 0 Then Out(i).Value = 0 Else Out(i).Value = Inp(i + 1).Value / Inp(7).Value * Devpp Next i If ParKal = "Bgt2" Or ParKal = "Bgt3" Then If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(53).Value = 0 Else Out(53).Value = Inp(53 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplPr25) * 12 * (1 - TaskPresc) If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(54).Value = 0 Else Out(54).Value = Inp(54 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplPr50) * 12 * (1 - TaskPresc) If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(55).Value = 0 Else Out(55).Value = Inp(55 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplDvPr) * 12 If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(56).Value = 0 Else Out(56).Value = Inp(56 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplTrPr) * 12 If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(57).Value = 0 Else Out(57).Value = Inp(57 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplSv) * 12 If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(58).Value = 0 Else Out(58).Value = Inp(58 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplPsGe) * 12 If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(59).Value = 0 Else Out(59).Value = Inp(59 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplJIP) * 12 If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(60).Value = 0 Else Out(60).Value = Inp(60 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplProst) * 12 If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(61).Value = 0 Else Out(61).Value = Inp(61 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplPr50h) * 12 If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(62).Value = 0 Else Out(62).Value = Inp(62 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplMinMz) * 12 If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(63).Value = 0 Else Out(63).Value = Inp(63 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplVed) * 12 If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(64).Value = 0 Else Out(64).Value = Inp(64 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplNoc) * 12 If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(65).Value = 0 Else Out(65).Value = Inp(65 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplOs) * 12 If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(66).Value = 0 Else Out(66).Value = Inp(66 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplNPZat) * 12 Else If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(53).Value = 0 Else Out(53).Value = Inp(53 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplPr25) * (1 - TaskPresc) If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(54).Value = 0 Else Out(54).Value = Inp(54 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplPr50) * (1 - TaskPresc) If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(55).Value = 0 Else Out(55).Value = Inp(55 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplDvPr) If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(56).Value = 0 Else Out(56).Value = Inp(56 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplTrPr) If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(57).Value = 0 Else Out(57).Value = Inp(57 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplSv) If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(58).Value = 0 Else Out(58).Value = Inp(58 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplPsGe) If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(59).Value = 0 Else Out(59).Value = Inp(59 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplJIP) If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(60).Value = 0 Else Out(60).Value = Inp(60 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplProst) If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(61).Value = 0 Else Out(61).Value = Inp(61 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplPr50h) If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(62).Value = 0 Else Out(62).Value = Inp(62 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplMinMz) If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(63).Value = 0 Else Out(63).Value = Inp(63 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplVed) If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(64).Value = 0 Else Out(64).Value = Inp(64 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplNoc) If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(65).Value = 0 Else Out(65).Value = Inp(65 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplOs) If (OdprDh = 0 Or Inp(9).Value = 0 Or Inp(11).Value = 0) Then Out(66).Value = 0 Else Out(66).Value = Inp(66 - 3).Value / Inp(11).Value * (Inp(11).Value + Inp(13).Value + Inp(14).Value) / Inp(9).Value / Val(Right(PerBase, 2)) * (Out(9).Value / (Out(9).Value + Out(11).Value + Out(12).Value)) * Inp(6).Value * (1 + ParTinc * CitPriplNPZat) End If End If Out.Fields("_FvIssOdm").Value = 0 Out.Fields("_FvIssExt").Value = 0 Out(45).Value = Inp(49).Value Out(46).Value = Inp(47).Value Out(47).Value = Inp(46).Value Out(48).Value = Inp(45).Value Out.Update End If Loop SkipProc: Inp.MoveNext Loop wb.Close Set xlApp = Nothing Set wb = Nothing Set Inp = Nothing Set Out = Nothing Set dB = Nothing End Sub Public Sub DoplnitSouhSlozky_Nahrady() Set dB = CurrentDb() Set Inp = dB.OpenRecordset("05_10BgtDetailUpdQ", dbOpenDynaset) Rem DBEngine.SetOption dbMaxLocksPerFile, 1000000 Forms!MainForm.BgtProcessingInfo = "Doplňuji souhrnné složky a náhrady za dovolenou ..." 'Dopočet prodm a fomv Do Until Inp.EOF Inp.Edit Inp.Fields("Prodm").Value = Inp(18).Value + Inp(19).Value + Inp(20).Value + Inp(21).Value + Inp(22).Value + Inp(23).Value + Inp(24).Value + Inp(25).Value + Inp(26).Value + Inp(27).Value Inp.Fields("FondVed").Value = Inp.Fields("_FvHodm").Value + Inp.Fields("_FvHodmT").Value + Inp.Fields("_FvQodm").Value + Inp.Fields("_FvIssOdm").Value + Inp.Fields("_FvIssExt").Value + Inp.Fields("_FvOstOdm").Value Inp.Update Inp.MoveNext Loop Set Inp = Nothing 'Uložení kvartálních průměrů pro náhrady do Temp tabulky Set Inp = dB.OpenRecordset("05_011ZastPrumNahQtrFinQ", dbOpenDynaset) 'Prozatím zjednodušení - výpočet ročního průměru, do budoucna nahradit dotazem 05_02PrumNahrQtrFinQ, který počítá přesně kvartál Set Out = dB.OpenRecordset("TempPrumProNahr", dbOpenDynaset) Rem DBEngine.SetOption dbMaxLocksPerFile, 1000000 CurrentDb.Execute "DELETE * FROM TempPrumProNahr" Rem DBEngine.SetOption dbMaxLocksPerFile, 100000 Do Until Inp.EOF Out.AddNew For i = 0 To Inp.Fields.Count - 1 Out(i).Value = Inp(i).Value Next i Out.Update Inp.MoveNext Loop Set Inp = Nothing Set Out = Nothing 'Dopočet náhrady za dovolenou, nah a hm celkem Set Inp = dB.OpenRecordset("05_11BgtUpdNahHmQ", dbOpenDynaset) Set Out = dB.OpenRecordset("05_12BgtDetailAbsSortUpdQ", dbOpenDynaset) Do Until Inp.EOF Out.Edit If Inp.Fields("dovceh").Value <> 0 Then If Inp.Fields("PrumNahr").Value = 0 Then 'Když není spočítán kvartální průměr pro náhrady za dané období If (Inp.Fields("odprh").Value + Inp.Fields("odprp").Value) = 0 Then Prom = 0 Else Prom = (Inp(10).Value + Inp(11).Value + Inp(12).Value + Inp(13).Value + Inp(14).Value + Inp(19).Value + Inp(20).Value + Inp(28).Value + Inp(29).Value + Inp(30).Value + Inp(31).Value + Inp(32).Value + Inp(33).Value + Inp(34).Value + Inp(35).Value + Inp(36).Value + Inp(37).Value + Inp(38).Value + Inp(39).Value + Inp(40).Value + Inp(41).Value) / (Inp.Fields("odprh").Value + Inp.Fields("odprp").Value) * Inp.Fields("dovceh").Value Else Prom = Inp.Fields("PrumNahr").Value * Inp.Fields("dovceh").Value End If Else Prom = 0 End If Out.Fields("_NahDov").Value = Prom Out.Fields("Nah").Value = Prom + Inp.Fields("_NahPN").Value + Inp.Fields("_NahOst").Value Out.Fields("HrMzda").Value = Inp(10).Value + Inp(11).Value + Inp(12).Value + Inp(13).Value + Inp(14).Value + (Prom + Inp(17).Value + Inp(18).Value) + Inp(19).Value + Inp(20).Value + Inp(21).Value + Inp(22).Value + Inp(28).Value + Inp(29).Value + Inp(30).Value + Inp(31).Value + Inp(32).Value + Inp(33).Value + Inp(34).Value + Inp(35).Value + Inp(36).Value + Inp(37).Value + Inp(38).Value + Inp(39).Value + Inp(40).Value + Inp(41).Value Out.Update Inp.MoveNext Out.MoveNext Loop 'Dopočet NULL náhrad za skutečnost Set Inp = dB.OpenRecordset("05_15CorrectActNullNahQ", dbOpenDynaset) Do Until Inp.EOF Inp.Edit Inp(5).Value = Inp(6).Value + Inp(7).Value + Inp(8).Value Inp.Update Inp.MoveNext Loop Set Inp = Nothing Set Out = Nothing Set dB = Nothing Rem DBEngine.SetOption dbMaxLocksPerFile, 100000 Forms!MainForm.BgtProcessingInfo = "" End Sub Public Sub NavysovaniStupnu() Dim TarBase As Currency Dim NextPrax, MaxSt As Integer Dim ActPrax, PraxTBDdny, NextPerDNy As Single Dim NextPer, ActPer As String Forms!MainForm.BgtProcessingInfo = "Počítám navyšování stupňů ..." Set dB = CurrentDb() Set Out = dB.OpenRecordset("BgtZmenaTrid", dbOpenDynaset) 'Vymazání a naplnění tabulky aktuálními daty CurrentDb.Execute "DELETE * FROM BgtZmenaTrid" Set Inp = dB.OpenRecordset("06_01PlaskuPlastuForBgtSubQ", dbOpenDynaset) Do Until Inp.EOF Out.AddNew For i = 0 To Inp.Fields.Count - 1 Out(i).Value = Inp(i).Value Next i Out.Update Inp.MoveNext Loop 'Výpočet navýšení mzdových stupňů na nejbližší tři období Set Inp = dB.OpenRecordset("06_02BgtTarifTridySortQ", dbOpenDynaset) Set Out = dB.OpenRecordset("BgtZmenaTrid", dbOpenDynaset) MaxSt = DMax("PlastuVal", "06_02BgtTarifTridySortQ") PerBase = DLookup("ValText", "Parameters", "[Parameter]= " & "'ReportPeriod'") Do Until Out.EOF ActPrax = Out(10).Value + Out(11).Value / 365 ActPer = Out(1).Value Inp.MoveFirst Do Until Inp.EOF If Inp(0).Value = Val(Out(9).Value) And Inp(2).Value = Out(5).Value Then Out.Edit For i = 0 To Inp.Fields.Count - 1 If Mid(Inp(i).Name, 2, 2) = Out(8).Value Then Out(12).Value = Inp(i).Value Next i For j = 0 To 2 If Inp(0).Value < MaxSt Then NextPrax = Inp(1).Value PraxTBDdny = (NextPrax - ActPrax) * 365 If PraxTBDdny < 30 Then PraxTBDdny = 30 NextPerDNy = DateSerial(Left(ActPer, 4), Val(Right(ActPer, 2)), 15) + PraxTBDdny If Val(Month(NextPerDNy)) < 10 Then NextPer = Year(NextPerDNy) & "0" & Month(NextPerDNy) Else NextPer = Year(NextPerDNy) & Month(NextPerDNy) If Val(Left(NextPer, 4)) - Val(Left(PerBase, 4)) >= 2 Then Out(13 + j * 3).Value = Left(NextPer, 4) & "12" Else Out(13 + j * 3).Value = NextPer Out(15 + j * 3) = Right(NextPer, 2) ActPrax = Inp(1).Value ActPer = NextPer Inp.MoveNext Inp.MoveNext Inp.MoveNext For i = 0 To Inp.Fields.Count - 1 If Mid(Inp(i).Name, 2, 2) = Out(8).Value Then Out(14 + j * 3).Value = Inp(i).Value Next i Else Out.Update GoTo SkipCycle End If Next j Out.Update GoTo SkipCycle End If Inp.MoveNext Loop SkipCycle: Out.MoveNext Loop Set dB = Nothing Set Inp = Nothing Set Out = Nothing End Sub Public Sub BudgetProcessingStupne() Dim NewOscis As String Dim Found As String Dim ParKal, IncrKoef, TarifBase As Currency Forms!MainForm.BgtProcessingInfo = "Aktualizuji navyšování stupňů ..." Set dB = CurrentDb() Set Inp = dB.OpenRecordset("06_20ZmenaTarifBgtInpQ", dbOpenDynaset) Set Out = dB.OpenRecordset("06_21ZmenaTarifBgtOutQ", dbOpenDynaset) PerBase = DLookup("ValText", "Parameters", "[Parameter]= " & "'ReportPeriod'") NewOscis = "" Found = "" Set xlApp = New Excel.Application Set wb = xlApp.Workbooks.Open(DLookup("ValText", "Parameters", "[Parameter]= " & "'PathBgtInput'") & "\BgtInputs.xlsx") CitPr = wb.Sheets("Parametry").Range("B8").Value 'citlivost ceny za přesčas na změnu tarifu CitPoh = wb.Sheets("Parametry").Range("B5").Value 'citlivost pohotovostí na změnu tarifu CitProdm = wb.Sheets("Parametry").Range("B6").Value 'citlivost prémií a odměn na změnu tarifu CitFomv = wb.Sheets("Parametry").Range("B7").Value 'citlivost fondu vedoucího na změnu tarifu CitPriplNoc = wb.Sheets("Parametry").Range("B9").Value CitPriplOs = wb.Sheets("Parametry").Range("B10").Value CitPriplProst = wb.Sheets("Parametry").Range("B11").Value CitPriplSmenn = wb.Sheets("Parametry").Range("B12").Value CitPriplVed = wb.Sheets("Parametry").Range("B13").Value CitPriplPsGe = wb.Sheets("Parametry").Range("B14").Value CitPriplDvPr = wb.Sheets("Parametry").Range("B15").Value CitPriplTrPr = wb.Sheets("Parametry").Range("B16").Value CitPriplJIP = wb.Sheets("Parametry").Range("B17").Value CitPriplPr25 = wb.Sheets("Parametry").Range("B18").Value CitPriplPr50 = wb.Sheets("Parametry").Range("B19").Value CitPriplSv = wb.Sheets("Parametry").Range("B20").Value CitPriplMinMz = wb.Sheets("Parametry").Range("B21").Value CitPriplNPZat = wb.Sheets("Parametry").Range("B22").Value CitPriplPr50h = wb.Sheets("Parametry").Range("B23").Value CitPriplOst = wb.Sheets("Parametry").Range("B24").Value wb.Close Do Until Inp.EOF 'Zjistění parametrů nárůstu If Inp(1).Value <> NewOscis Then NewOscis = Inp(1).Value Found = "" IncrKoef = 0 ParKal = 1 End If If Not IsNull(Inp(43).Value) Then NewOscis = Inp(1).Value Found = "T1" If Val(Left(Inp(44).Value, 4)) - Val(Left(PerBase, 4)) >= 2 Then ParKal = (12 - Inp(46).Value + 1) / 12 Else ParKal = 1 IncrKoef = Inp(45).Value / Inp(43).Value - 1 TarifBase = Inp(43).Value Else If Found = "T1" And Not IsNull(Inp(47).Value) Then Found = "T2" If Val(Left(Inp(47).Value, 4)) - Val(Left(PerBase, 4)) >= 2 Then ParKal = (12 - Inp(49).Value + 1) / 12 Else ParKal = 1 IncrKoef = Inp(48).Value / TarifBase - 1 Else If Found = "T2" And Not IsNull(Inp(50).Value) Then Found = "T3" If Val(Left(Inp(50).Value, 4)) - Val(Left(PerBase, 4)) >= 2 Then ParKal = (12 - Inp(52).Value + 1) / 12 Else ParKal = 1 IncrKoef = Inp(51).Value / TarifBase - 1 End If End If End If 'Promítnutí nárůstu do věty If Found <> "" Then Out.Edit Out(8).Value = Out(8).Value * (1 + IncrKoef) Out(13).Value = Out(13).Value * (1 + IncrKoef) Out(14).Value = Out(14).Value * (1 + IncrKoef * CitPr) Out(15).Value = Out(15).Value * (1 + IncrKoef * CitPriplSmenn) Out(16).Value = Out(16).Value * (1 + IncrKoef * CitPriplOst) For i = 17 To 27 Out(i).Value = Out(i).Value * (1 + IncrKoef * CitProdm) Next i Out(30).Value = Out(30).Value * (1 + IncrKoef) Out(31).Value = Out(31).Value * (1 + IncrKoef) Out(32).Value = Out(32).Value * (1 + IncrKoef * CitPoh) For i = 33 To 36 Out(i).Value = Out(i).Value * (1 + IncrKoef * CitFomv) Next i Out(44).Value = Out(44).Value * (1 + IncrKoef * CitPriplPr25) Out(45).Value = Out(45).Value * (1 + IncrKoef * CitPriplPr50) Out(46).Value = Out(46).Value * (1 + IncrKoef * CitPriplDvPr) Out(47).Value = Out(47).Value * (1 + IncrKoef * CitPriplTrPr) Out(48).Value = Out(48).Value * (1 + IncrKoef * CitPriplSv) Out(49).Value = Out(49).Value * (1 + IncrKoef * CitPriplPsGe) Out(50).Value = Out(50).Value * (1 + IncrKoef * CitPriplJIP) Out(51).Value = Out(51).Value * (1 + IncrKoef * CitPriplProst) Out(52).Value = Out(52).Value * (1 + IncrKoef * CitPriplPr50h) Out(53).Value = Out(53).Value * (1 + IncrKoef * CitPriplMinMz) Out(54).Value = Out(54).Value * (1 + IncrKoef * CitPriplVed) Out(55).Value = Out(55).Value * (1 + IncrKoef * CitPriplNoc) Out(56).Value = Out(56).Value * (1 + IncrKoef * CitPriplOs) Out(57).Value = Out(57).Value * (1 + IncrKoef * CitPriplNPZat) Out.Fields("_FvIssOdm").Value = 0 Out.Fields("_FvIssExt").Value = 0 Out.Update End If Inp.MoveNext Out.MoveNext Loop Set xlApp = Nothing Set wb = Nothing Set dB = Nothing Set Inp = Nothing Set Out = Nothing End Sub Public Sub BudgetProcessingOdmeny() Dim SumOdmFcst, SumOdmBgt As Currency Dim FfcstSumP, FbgtSumP, KalFondP As Double Dim NoPol, NoAct As Integer Dim Yr, Repre As String Forms!MainForm.BgtProcessingInfo = "Aktualizuji odměny ..." Set dB = CurrentDb() Set Inp = dB.OpenRecordset("06_12OdmenyFondSortInpQ", dbOpenDynaset) Set Out = dB.OpenRecordset("06_12OdmenyFondSortOutQ", dbOpenDynaset) Set xlApp = New Excel.Application Set wb = xlApp.Workbooks.Open(DLookup("ValText", "Parameters", "[Parameter]= " & "'PathBgtInput'") & "\BgtInputs.xlsx") PerBase = DLookup("ValText", "Parameters", "[Parameter]= " & "'ReportPeriod'") For k = 5 To 17 'Projde všechny kalendarizační matice (POZOR!!! pořadí prvků v Excel i Access musí odpovídat, názvy rovněž) FbgtSumP = 0 FfcstSumP = 0 KalFonP = Array(wb.Sheets("Kalendarizace").Range("F" & k).Value, wb.Sheets("Kalendarizace").Range("G" & k).Value, wb.Sheets("Kalendarizace").Range("H" & k).Value, wb.Sheets("Kalendarizace").Range("I" & k).Value, wb.Sheets("Kalendarizace").Range("J" & k).Value, wb.Sheets("Kalendarizace").Range("K" & k).Value, wb.Sheets("Kalendarizace").Range("L" & k).Value, wb.Sheets("Kalendarizace").Range("M" & k).Value, wb.Sheets("Kalendarizace").Range("N" & k).Value, wb.Sheets("Kalendarizace").Range("O" & k).Value, wb.Sheets("Kalendarizace").Range("P" & k).Value, wb.Sheets("Kalendarizace").Range("Q" & k).Value) For i = 0 To 11 FbgtSumP = FbgtSumP + KalFonP(i) Next i For i = Val(Right(PerBase, 2)) To 11 FfcstSumP = FfcstSumP + KalFonP(i) Next i For i = 1 To 1000 If wb.Sheets("Odměny_FondV").Cells(2, i).Value = "End" Then MsgBox ("Chyba!! Položka " & wb.Sheets("Kalendarizace").Range("A" & k).Value & " nenalezena na listu Odměny_FondV") GoTo SkipEnd End If If wb.Sheets("Odměny_FondV").Cells(2, i).Value = wb.Sheets("Kalendarizace").Range("A" & k).Value Then i = i + 1 Inp.MoveFirst Out.MoveFirst Do Until Inp.EOF Yr = Inp(6).Value If Inp(1).Value <> Repre Then Repre = Inp(1).Value For j = 5 To 31 If wb.Sheets("Odměny_FondV").Range("A" & j).Value = Repre Then SumOdmFcst = wb.Sheets("Odměny_FondV").Cells(j, i).Value - wb.Sheets("Odměny_FondV").Cells(j, i - 1).Value SumOdmBgt = wb.Sheets("Odměny_FondV").Cells(j, i).Value GoTo SkipFound End If Next j End If SkipFound: NoPol = 13 'Počet položek VLPOL plánovaných zvlášť NoAct = 7 + k - 5 'VLPOL položky začínají v Inp na 7.pozici Out.Edit If Yr = Left(PerBase, 4) Then If Inp(NoAct + NoPol * 2).Value = 0 Or FfcstSumP = 0 Then Out(NoAct).Value = 0 Else Out(NoAct).Value = Inp(NoAct + NoPol).Value / Inp(NoAct + NoPol * 2).Value * SumOdmFcst * (KalFonP(Val(Right(Inp(5).Value, 2)) - 1) / FfcstSumP) Else If Val(Left(Inp(5).Value, 4)) - Val(Left(PerBase, 4)) >= 2 Then If Inp(NoAct + NoPol * 2).Value = 0 Then Out(NoAct).Value = 0 Else Out(NoAct).Value = Inp(NoAct + NoPol).Value / Inp(NoAct + NoPol * 2).Value * SumOdmBgt Else If Inp(NoAct + NoPol * 2).Value = 0 Or FbgtSumP = 0 Then Out(NoAct).Value = 0 Else Out(NoAct).Value = Inp(NoAct + NoPol).Value / Inp(NoAct + NoPol * 2).Value * SumOdmBgt * (KalFonP(Val(Right(Inp(5).Value, 2)) - 1) / FbgtSumP) End If End If Out.Update Inp.MoveNext Out.MoveNext Loop GoTo NextK End If Next i NextK: Next k SkipEnd: wb.Close Set dB = Nothing Set Inp = Nothing Set Out = Nothing Set xlApp = Nothing Set wb = Nothing Budget.OdmenyIndividual End Sub Public Sub OdmenyIndividual() Forms!MainForm.BgtProcessingInfo = "Aktualizuji individuální odměny ..." Set dB = CurrentDb() 'Vymazání všech hodnot výhledu ve složce FHodmT (odměny přiznávané dle tarifu) Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, Obd, pracv, kateg, [_FvHodmT] FROM BgtDetailAbs WHERE Obd > " & "'" & DLookup("ValText", "Parameters", "[Parameter]= " & "'ReportPeriod'") & "'", dbOpenDynaset) Do Until Inp.EOF Inp.Edit Inp(5).Value = 0 Inp.Update Inp.MoveNext Loop 'Výpočet nároku tarifních odměn v daných měsících roku Set Inp = dB.OpenRecordset("06_136OdmTInpQ", dbOpenDynaset) Set Out = dB.OpenRecordset("06_135OdmTOutQ", dbOpenDynaset) Set xlApp = New Excel.Application Set wb = xlApp.Workbooks.Open(DLookup("ValText", "Parameters", "[Parameter]= " & "'PathBgtInput'") & "\BgtInputs.xlsx") Prom = wb.Sheets("Odměny_FondV").Range("AH3").Value 'Procento odměny z tarifu wb.Close Set xlApp = Nothing Set wb = Nothing Do Until Inp.EOF If Right(Inp(2).Value, 2) = "07" Then Out.Edit Out(6).Value = Prom * Inp(6).Value * 6 Out.Update End If If Right(Inp(2).Value, 2) = "11" Then Out.Edit Out(6).Value = Prom * Inp(7).Value * 6 Out.Update End If If Inp(8).Value <> 0 Then Out.Edit Out(6).Value = Prom * Inp(8).Value * 12 Out.Update End If Inp.MoveNext Out.MoveNext Loop Set dB = Nothing Set Inp = Nothing Set Out = Nothing End Sub Public Sub PriplZaSmennost() Dim Repre, PerFrom, tyduvs As String Dim Am As Currency Dim PripSmenEof As Boolean Set dB = CurrentDb() Set xlApp = New Excel.Application Set wb = xlApp.Workbooks.Open(DLookup("ValText", "Parameters", "[Parameter]= " & "'PathBgtInput'") & "\BgtInputs.xlsx") i = 27 If wb.Sheets("Parametry").Range("A" & i).Value = "" Then PripSmenEof = True Else PripSmenEof = False PerBase = DLookup("ValText", "Parameters", "[Parameter]= " & "'ReportPeriod'") Do Until PripSmenEof = True Prom = wb.Sheets("Parametry").Range("B" & i).Value Repre = wb.Sheets("Parametry").Range("C" & i).Value PerFrom = wb.Sheets("Parametry").Range("E" & i).Value tyduvs = wb.Sheets("Parametry").Range("D" & i).Value Forms!MainForm.BgtProcessingInfo = "Aktualizuji příplatek za směnnost ... " & Repre & " " & wb.Sheets("Parametry").Range("A" & i).Value Set Inp = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, devpp, KalDnyMth, KalDnyFY, odprh, neoh, PriplSmenn, repre, tyduvs From 06_15PriplZaSmennBgtQ WHERE kateg= " & "'" & Repre & "' AND obd >= " & "'" & PerFrom & "' AND tyduvs = " & "'" & tyduvs & "'", dbOpenDynaset) Do Until Inp.EOF If Val(Left(Obd, 4)) - Val(Left(PerBase, 4)) >= 2 Then Am = (Inp(5).Value / Inp(7).Value) * Prom * (Inp(8).Value / (Inp(8).Value + Inp(9).Value)) * 12 Else If (Inp(8).Value + Inp(9).Value) = 0 Then Am = 0 Else Am = (Inp(5).Value / Inp(6).Value) * Prom * (Inp(8).Value / (Inp(8).Value + Inp(9).Value)) End If Inp.Edit Inp(10).Value = Am Inp.Update Inp.MoveNext Loop i = i + 1 If wb.Sheets("Parametry").Range("A" & i).Value = "" Then PripSmenEof = True Else PripSmenEof = False Loop wb.Close Set dB = Nothing Set Inp = Nothing Set Out = Nothing Set xlApp = Nothing Set wb = Nothing End Sub Public Sub Priplatky() Dim PeriodFrom As String Set xlApp = New Excel.Application Set wb = xlApp.Workbooks.Open(DLookup("ValText", "Parameters", "[Parameter]= " & "'PathBgtInput'") & "\BgtInputs.xlsx") PeriodFrom = wb.Sheets("Priplatky").Range("Q1").Value wb.Close Set dB = CurrentDb() Set Inp = dB.OpenRecordset("06_17PriplatkyUpdInpQ", dbOpenDynaset) Set Out = dB.OpenRecordset("06_18PriplatkyUpdOutQ", dbOpenDynaset) PerBase = DLookup("ValText", "Parameters", "[Parameter]= " & "'ReportPeriod'") Do Until Inp.EOF Forms!MainForm.BgtProcessingInfo = "Aktualizuji individuální příplatky ... " If Inp(2).Value >= PeriodFrom Then If IsNull(Inp(19).Value) Then Out.Edit For i = 17 To 18 Out(i).Value = 0 Next i Out.Update Else Out.Edit If Val(Left(Inp(2).Value, 4)) - Val(Left(PerBase, 4)) >= 2 Then For i = 17 To 18 If Inp(6).Value + Inp(8).Value + Inp(9).Value = 0 Or Inp(19).Value = 0 Then Out(i).Value = 0 Else Out(i).Value = Inp(6).Value / (Inp(6).Value + Inp(8).Value + Inp(9).Value) * ((Inp(i + 10).Value * 12) / Inp(19).Value * Inp(5).Value) Next i Else For i = 17 To 18 If Inp(6).Value + Inp(8).Value + Inp(9).Value = 0 Or Inp(19).Value = 0 Then Out(i).Value = 0 Else Out(i).Value = Inp(6).Value / (Inp(6).Value + Inp(8).Value + Inp(9).Value) * ((Inp(i + 10).Value) / Inp(19).Value * Inp(5).Value) Next i End If Out.Update End If End If Inp.MoveNext Out.MoveNext Loop Set dB = Nothing Set Inp = Nothing Set Out = Nothing Set xlApp = Nothing Set wb = Nothing End Sub Public Sub AddAbsNewToAbs() Set dB = CurrentDb() Set Inp = dB.OpenRecordset("06_50ImportAbsNewToAbsQ", dbOpenDynaset) If Inp.EOF Then GoTo UpdRec Set Out = dB.OpenRecordset("06_51DetailAbsBgtLayoutQ", dbOpenDynaset) Do Until Inp.EOF Out.AddNew For i = 0 To Inp.Fields.Count - 1 Out(i).Value = Inp(i).Value Next i Out.Update Inp.MoveNext Loop CurrentDb.Execute "DELETE * FROM BgtDetailAbsNew" UpdRec: Budget.DoplnitSouhSlozky_Nahrady Issue = CountRecapStep & "_Změna Množ/Cena (do řádku " & InpRow - 1 & ")" Budget.UpdateRecap CountRecapStep = CountRecapStep + 1 End Sub Public Sub SocPojCalc() Dim SocPerc, ZdravPerc, FKSPperc, SocLimit, SocLimitBase, SocLimitYoY, SocOscisSum, SocPojMth, ZdravPojMth, SocOONzero As Currency Dim Oscis, Year As String CurrentDb.Execute "DELETE * FROM BgtFringeTemp" Set dB = CurrentDb() Set Inp = dB.OpenRecordset("07_50BgtForFringeQ", dbOpenDynaset) Set Out = dB.OpenRecordset("BgtFringeTemp", dbOpenDynaset) PerBase = DLookup("ValText", "Parameters", "[Parameter]= " & "'ReportPeriod'") SocPerc = DLookup("Val", "Parameters", "[Parameter]= " & "'SocPoj'") ZdravPerc = DLookup("Val", "Parameters", "[Parameter]= " & "'ZdravPoj'") FKSPperc = DLookup("Val", "Parameters", "[Parameter]= " & "'FKSP'") SocLimitBase = DLookup("Val", "Parameters", "[Parameter]= " & "'SocPojStrop'") SocLimitYoY = DLookup("Val", "Parameters", "[Parameter]= " & "'SocPojStropYoY'") SocOONzero = DLookup("Val", "Parameters", "[Parameter]= " & "'SocOONzero'") Oscis = "" Year = "" Do Until Inp.EOF If Year <> Left(Inp(2).Value, 4) Then SocLimit = SocLimitBase * (1 + SocLimitYoY ^ (Val(Left(Inp(2).Value, 4)) - Val(Left(PerBase, 4)))) If Inp(1).Value <> Oscis Or Year <> Left(Inp(2).Value, 4) Then Oscis = Inp(1).Value Year = Left(Inp(2).Value, 4) SocOscisSum = Inp(4).Value Else If Inp(4).Value < SocOONzero And Inp(3).Value > 0 Then SocOscisSum = SocOscisSum + (Inp(4).Value - Inp(3).Value) Else SocOscisSum = SocOscisSum + Inp(4).Value End If End If If Inp(4).Value < SocOONzero And Inp(3).Value > 0 Then SocPojMth = (Inp(4).Value - Inp(3).Value) * SocPerc ZdravPojMth = (Inp(4).Value - Inp(3).Value) * ZdravPerc Else If SocOscisSum > SocLimit Then If SocOscisSum - Inp(4).Value < SocLimit Then SocPojMth = (SocLimit - (SocOscisSum - Inp(4).Value)) * SocPerc Else SocPojMth = 0 ZdravPojMth = Inp(4).Value * ZdravPerc Else SocPojMth = Inp(4).Value * SocPerc ZdravPojMth = Inp(4).Value * ZdravPerc End If End If Out.AddNew Out(0).Value = Inp(0).Value Out(1).Value = Inp(1).Value Out(2).Value = Inp(2).Value Out(3).Value = Inp(6).Value Out(4).Value = Inp(7).Value If Left(Inp(1).Value, 3) = "New" Then Out(5).Value = SocPojMth * Inp(5).Value Else Out(5).Value = SocPojMth If Left(Inp(1).Value, 3) = "New" Then Out(6).Value = ZdravPojMth * Inp(5).Value Else Out(6).Value = ZdravPojMth Out(7).Value = Inp(7).Value * FKSPperc Out.Update Inp.MoveNext Loop Set Inp = dB.OpenRecordset("07_55BgtDetailAbsAllocFringeInpQ", dbOpenDynaset) Set Out = dB.OpenRecordset("07_56BgtDetailAbsAllocFringeOutQ", dbOpenDynaset) Do Until Inp.EOF Out.Edit If Inp(11).Value = 0 Then Out(5).Value = 0 Else Out(5).Value = Inp(9).Value / Inp(11).Value * Inp(5).Value If Inp(11).Value = 0 Then Out(6).Value = 0 Else Out(6).Value = Inp(9).Value / Inp(11).Value * Inp(6).Value If Inp(11).Value = 0 Then Out(7).Value = 0 Else Out(7).Value = Inp(9).Value / Inp(11).Value * Inp(7).Value Out.Update Inp.MoveNext Out.MoveNext Loop CurrentDb.Execute "DELETE * FROM BgtFringeTemp" Set Out = Nothing Set Inp = Nothing Set dB = Nothing End Sub Public Sub TarifTridyModel() Dim SelPeriod As Recordset Set dB = CurrentDb() Set SelPeriod = dB.OpenRecordset("06_70TarifModelObdGroupQ", dbOpenDynaset) Set xlApp = New Excel.Application Set wb = xlApp.Workbooks.Open(DLookup("ValText", "Parameters", "[Parameter]= " & "'PathBgtInput'") & "\BgtInputs.xlsx") CitPr = wb.Sheets("Parametry").Range("B8").Value 'citlivost ceny za přesčas na změnu tarifu CitPoh = wb.Sheets("Parametry").Range("B5").Value 'citlivost pohotovostí na změnu tarifu CitProdm = wb.Sheets("Parametry").Range("B6").Value 'citlivost prémií a odměn na změnu tarifu CitFomv = wb.Sheets("Parametry").Range("B7").Value 'citlivost fondu vedoucího na změnu tarifu CitPriplNoc = wb.Sheets("Parametry").Range("B9").Value CitPriplOs = wb.Sheets("Parametry").Range("B10").Value CitPriplProst = wb.Sheets("Parametry").Range("B11").Value CitPriplSmenn = wb.Sheets("Parametry").Range("B12").Value CitPriplVed = wb.Sheets("Parametry").Range("B13").Value CitPriplPsGe = wb.Sheets("Parametry").Range("B14").Value CitPriplDvPr = wb.Sheets("Parametry").Range("B15").Value CitPriplTrPr = wb.Sheets("Parametry").Range("B16").Value CitPriplJIP = wb.Sheets("Parametry").Range("B17").Value CitPriplPr25 = wb.Sheets("Parametry").Range("B18").Value CitPriplPr50 = wb.Sheets("Parametry").Range("B19").Value CitPriplSv = wb.Sheets("Parametry").Range("B20").Value CitPriplMinMz = wb.Sheets("Parametry").Range("B21").Value CitPriplNPZat = wb.Sheets("Parametry").Range("B22").Value CitPriplPr50h = wb.Sheets("Parametry").Range("B23").Value CitPriplOst = wb.Sheets("Parametry").Range("B24").Value wb.Close Do Until SelPeriod.EOF Set OutQry = dB.QueryDefs("06_71TarifModelSelPerQ") OutQry.Sql = "SELECT Obd, Plastu, PraxeDo, Skup1, [%T1], [%T2], [%T3], [%T4], [%T5], [%T6], [%T7], [%T8], [%T9], [%T10], [%T11], [%T12], " & _ "[%T13], [%T14], [%T15], [%T16] FROM BgtTarifTridyModel WHERE Obd = " & "'" & SelPeriod(0).Value & "'" Set Inp = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, tarifUprTD, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, [_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], " & _ "[_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, [_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], " & _ "[_OonPC], [_OonOst], HrMzda, PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, Tincr " & _ "FROM 06_72TarifIncrModelTarifTridInpQ WHERE obd >= " & "'" & SelPeriod(0).Value & "'", dbOpenDynaset) Set Out = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, tarifUprTD, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, [_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], " & _ "[_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, [_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], " & _ "[_OonPC], [_OonOst], HrMzda, PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat " & _ "FROM 06_73TarifIncrModelTarifTridOutQ WHERE obd >= " & "'" & SelPeriod(0).Value & "'", dbOpenDynaset) Do Until Inp.EOF If Inp(51).Value <> 0 Then Out.Edit Out(5).Value = Inp(5).Value * (1 + Inp(51).Value) 'tarifUprTD Out(6).Value = Inp(6).Value * (1 + Inp(51).Value) 'ZakMzda Out(7).Value = Inp(7).Value * (1 + Inp(51).Value * CitPr) 'Presc Out(8).Value = Inp(8).Value * (1 + Inp(51).Value * CitPriplSmenn) 'PriplSmenn Out(9).Value = Inp(9).Value * (1 + Inp(51).Value * CitPriplOst) 'PriplOst For i = 10 To 20 Out(i).Value = Inp(i).Value * (1 + Inp(51).Value * CitProdm) 'Prodm Next i For i = 21 To 24 Out(i).Value = Inp(i).Value * (1 + Inp(51).Value) 'Nah Next i Out(25).Value = Inp(25).Value * (1 + Inp(51).Value * CitPoh) 'Poh For i = 26 To 30 Out(i).Value = Inp(i).Value * (1 + Inp(51).Value * CitFomv) 'Fondv Next i For i = 37 To 50 Out(37).Value = Inp(37).Value * (1 + Inp(51).Value * CitPriplPr25) 'Pripl...detail Out(38).Value = Inp(38).Value * (1 + Inp(51).Value * CitPriplPr50) 'Pripl...detail Out(39).Value = Inp(39).Value * (1 + Inp(51).Value * CitPriplDvPr) 'Pripl...detail Out(40).Value = Inp(40).Value * (1 + Inp(51).Value * CitPriplTrPr) 'Pripl...detail Out(41).Value = Inp(41).Value * (1 + Inp(51).Value * CitPriplSv) 'Pripl...detail Out(42).Value = Inp(42).Value * (1 + Inp(51).Value * CitPriplPsGe) 'Pripl...detail Out(43).Value = Inp(43).Value * (1 + Inp(51).Value * CitPriplJIP) 'Pripl...detail Out(44).Value = Inp(44).Value * (1 + Inp(51).Value * CitPriplProst) 'Pripl...detail Out(45).Value = Inp(45).Value * (1 + Inp(51).Value * CitPriplPr50h) 'Pripl...detail Out(46).Value = Inp(46).Value * (1 + Inp(51).Value * CitPriplMinMz) 'Pripl...detail Out(47).Value = Inp(47).Value * (1 + Inp(51).Value * CitPriplVed) 'Pripl...detail Out(48).Value = Inp(48).Value * (1 + Inp(51).Value * CitPriplNoc) 'Pripl...detail Out(49).Value = Inp(49).Value * (1 + Inp(51).Value * CitPriplOs) 'Pripl...detail Out(50).Value = Inp(50).Value * (1 + Inp(51).Value * CitPriplNPZat) 'Pripl...detail Next i Out.Update End If Inp.MoveNext Out.MoveNext Loop SelPeriod.MoveNext Loop Set xlApp = Nothing Set wb = Nothing Set dB = Nothing Set SelPeriod = Nothing Set OutQry = Nothing Set Inp = Nothing Set Out = Nothing End Sub Public Sub ProcessBgtInputFile() Dim SitFin As String j = 1 TColor = "black" Set xlApp = CreateObject("Excel.Application") Set wb = xlApp.Workbooks.Open(DLookup("ValText", "Parameters", "[Parameter]= 'PathBgtInput'") & "\BgtInputs.xlsx") If RunModel = "Process" Then CurrentDb.Execute "DELETE * FROM BgtDetailAbsNew" CurrentDb.Execute "DELETE * FROM BgtManualZmenaInputBase" CurrentDb.Execute "INSERT INTO BgtManualZmenaInputBase SELECT * FROM 06_30ManualZmenaInpQ" PerBase = DLookup("ValText", "Parameters", "[Parameter]= " & "'ReportPeriod'") CitPr = wb.Sheets("Parametry").Range("B8").Value 'citlivost ceny za přesčas na změnu tarifu CitPoh = wb.Sheets("Parametry").Range("B5").Value 'citlivost pohotovostí na změnu tarifu CitProdm = wb.Sheets("Parametry").Range("B6").Value 'citlivost prémií a odměn na změnu tarifu CitFomv = wb.Sheets("Parametry").Range("B7").Value 'citlivost fondu vedoucího na změnu tarifu CitPriplNoc = wb.Sheets("Parametry").Range("B9").Value CitPriplOs = wb.Sheets("Parametry").Range("B10").Value CitPriplProst = wb.Sheets("Parametry").Range("B11").Value CitPriplSmenn = wb.Sheets("Parametry").Range("B12").Value CitPriplVed = wb.Sheets("Parametry").Range("B13").Value CitPriplPsGe = wb.Sheets("Parametry").Range("B14").Value CitPriplDvPr = wb.Sheets("Parametry").Range("B15").Value CitPriplTrPr = wb.Sheets("Parametry").Range("B16").Value CitPriplJIP = wb.Sheets("Parametry").Range("B17").Value CitPriplPr25 = wb.Sheets("Parametry").Range("B18").Value CitPriplPr50 = wb.Sheets("Parametry").Range("B19").Value CitPriplSv = wb.Sheets("Parametry").Range("B20").Value CitPriplMinMz = wb.Sheets("Parametry").Range("B21").Value CitPriplNPZat = wb.Sheets("Parametry").Range("B22").Value CitPriplPr50h = wb.Sheets("Parametry").Range("B23").Value CitPriplOst = wb.Sheets("Parametry").Range("B24").Value End If For InpRow = 2 To 1000 j = j + 1 If RunModel = "Process" Then Forms!MainForm.BgtProcessingInfo = "Provádím ruční korekce množství a ceny ... řádek " & InpRow Else Forms!MainForm.BgtProcessingInfo = "Prověřuji manuální změny ... řádek " & InpRow End If PerFrom = wb.Sheets("Změny").Range("S" & InpRow).Value Repre = wb.Sheets("Změny").Range("A" & InpRow).Value Kateg = wb.Sheets("Změny").Range("C" & InpRow).Value Utvar = wb.Sheets("Změny").Range("E" & InpRow).Value NS = wb.Sheets("Změny").Range("G" & InpRow).Value Oscis = wb.Sheets("Změny").Range("I" & InpRow).Value If wb.Sheets("Změny").Range("O" & InpRow).Value = "" Then Vol = 0 Else Vol = wb.Sheets("Změny").Range("O" & InpRow).Value ZastRepre = wb.Sheets("Změny").Range("U" & InpRow).Value ZastKateg = wb.Sheets("Změny").Range("V" & InpRow).Value ZastUtvar = wb.Sheets("Změny").Range("W" & InpRow).Value ZastNS = wb.Sheets("Změny").Range("X" & InpRow).Value If wb.Sheets("Změny").Range("P" & InpRow).Value = "" Then TarifNa = 0 Else TarifNa = wb.Sheets("Změny").Range("P" & InpRow).Value If wb.Sheets("Změny").Range("Q" & InpRow).Value = "" Then TarifO = 0 Else TarifO = wb.Sheets("Změny").Range("Q" & InpRow).Value If wb.Sheets("Změny").Range("R" & InpRow).Value = "" Then TarifProc = 0 Else TarifProc = wb.Sheets("Změny").Range("R" & InpRow).Value If RunModel = "Process" Then If wb.Sheets("Změny").Range("AA" & InpRow).Value = "" Then IndPriplSmenn = 0 Else IndPriplSmenn = wb.Sheets("Změny").Range("AA" & InpRow).Value If wb.Sheets("Změny").Range("AB" & InpRow).Value = "" Then IndPriplOst = 0 Else IndPriplOst = wb.Sheets("Změny").Range("AB" & InpRow).Value If wb.Sheets("Změny").Range("AC" & InpRow).Value = "" Then IndProdm = 0 Else IndProdm = wb.Sheets("Změny").Range("AC" & InpRow).Value If wb.Sheets("Změny").Range("AD" & InpRow).Value = "" Then Ind_FvHodm = 0 Else Ind_FvHodm = wb.Sheets("Změny").Range("AD" & InpRow).Value If wb.Sheets("Změny").Range("AE" & InpRow).Value = "" Then Ind_FvHodT = 0 Else Ind_FvHodT = wb.Sheets("Změny").Range("AE" & InpRow).Value If wb.Sheets("Změny").Range("AF" & InpRow).Value = "" Then Ind_FvQodm = 0 Else Ind_FvQodm = wb.Sheets("Změny").Range("AF" & InpRow).Value If wb.Sheets("Změny").Range("AG" & InpRow).Value = "" Then IndOON = 0 Else IndOON = wb.Sheets("Změny").Range("AG" & InpRow).Value If wb.Sheets("Změny").Range("AN" & InpRow).Value <> "" And InpRow <> 2 Then Budget.AddAbsNewToAbs End If Pocet = 0 Tarif = 0 PocetOscis = 0 TarifOscis = 0 Text = "" Set dB = CurrentDb() If Repre = "" And Kateg = "" And Utvar = "" And NS = "" And Oscis = "" And Vol = 0 And TarifNa = 0 And TarifO = 0 And TarifProc = 0 And wb.Sheets("Změny").Range("R" & InpRow).Value = "" Then GoTo SkipUpd SitPar = "" SitZast = "" If Repre <> "" Then SitPar = "Repre" If Repre <> "" And Utvar <> "" Then SitPar = "ReprePrim" If Kateg <> "" And Utvar <> "" Then SitPar = "KategPrim" If Repre <> "" And NS <> "" Then SitPar = "RepreNs" If Kateg <> "" And NS <> "" Then SitPar = "KategNs" If Kateg = "" And NS = "" And Repre = "" And Utvar <> "" Then SitPar = "Prim" If Kateg = "" And NS <> "" And Repre = "" And Utvar = "" Then SitPar = "Ns" If Oscis <> "" Then SitPar = "Oscis" If Oscis <> "" And Repre <> "" Then SitPar = "RepreOscis" If Oscis <> "" And Utvar <> "" Then SitPar = "PrimOscis" If Oscis <> "" And NS <> "" And Kateg = "" And Repre = "" Then SitPar = "NsOscis" If Oscis <> "" And NS = "" And Kateg <> "" And Repre = "" Then SitPar = "KategOscis" If Oscis <> "" And NS <> "" And Kateg = "" And Repre <> "" Then SitPar = "RepreNsOscis" If Oscis <> "" And NS = "" And Kateg <> "" Then SitPar = "KategNsOscis" If Oscis <> "" And NS = "" And Utvar <> "" And Kateg = "" And Repre <> "" Then SitPar = "ReprePrimOscis" If Oscis <> "" And NS = "" And Utvar <> "" And Kateg <> "" Then SitPar = "KategPrimOscis" If Repre = "" And Kateg = "" And Utvar = "" And NS = "" And Oscis = "" Then SitPar = "All" If ZastRepre <> "" And ZastKateg = "" And ZastUtvar = "" And ZastNS = "" Then SitZast = "Repre" If ZastRepre <> "" And ZastKateg = "" And ZastNS <> "" Then SitZast = "RepreNS" If ZastRepre <> "" And ZastKateg = "" And ZastUtvar <> "" And ZastNS = "" Then SitZast = "ReprePrim" If ZastRepre = "" And ZastKateg = "" And ZastUtvar <> "" And ZastNS = "" Then SitZast = "Prim" If ZastKateg <> "" And ZastUtvar <> "" And ZastNS = "" Then SitZast = "KategPrim" If ZastKateg <> "" And ZastNS <> "" Then SitZast = "KategNs" If ZastKateg <> "" And ZastUtvar = "" And ZastNS = "" Then SitZast = "Kateg" If ZastRepre = "" And ZastKateg = "" And ZastNS <> "" Then SitZast = "Ns" If SitPar = "" Then Text = "Kombinace není naprogramována, kontaktujte administrátora." TColor = "red" GoTo NextInpRow Else Text = "" End If If PerFrom = "" Then Text = "Nespecifikované období změny." TColor = "red" GoTo NextInpRow End If Method = "" MethZast = True MethZdroj = "" If Oscis <> "" And Vol < 0 Then 'Změna probíhá nad BgtDetailAbs, pokud není kombinace nalezena, zástupná kombinace není nepovolena Method = "OscisVolDecr" MethZast = False MethZdroj = "BgtDetailAbs" End If If Oscis <> "" And Vol = 0 And (TarifNa <> 0 Or TarifO <> 0 Or TarifProc <> 0) Then 'Změna probíhá nad BgtDetailAbs, pokud není kombinace nalezena, zástupná kombinace není nepovolena Method = "OscisTarifChng" MethZast = False MethZdroj = "BgtDetailAbs" End If If Oscis <> "" And Vol > 0 Then 'Nutno prověřit dále, zda repre existuje nebo ne, podle toho rozhodnout o BgtDetailAsb nebo New* a povolení zástupné kombinace Method = "OscisVolIncr" MethZast = True MethZdroj = "BgtDetailAbs" 'Pouze předběžně, bude upřesněno po vyhodnocení dále End If If Oscis <> "" And Vol = 0 And TarifNa = 0 And TarifO = 0 And TarifProc = 0 Then 'Pouze změna parametrů, probíhá nad BgtDetailAbs Method = "ParChng" MethZast = True MethZdroj = "BgtDetailAbs" End If If Oscis = "" And Vol = 0 Then 'Změna probíhá nad BgtDetailAbs, zástupná kombinace není povolena Method = "RepreTarifChng" MethZast = False MethZdroj = "BgtDetailAbs" End If If Oscis = "" And Vol > 0 Then 'Změna probíhá přidáním Repre, zástupná kombinace je povolena Method = "RepreVolIncr" MethZast = True MethZdroj = "Repre" End If If Oscis = "" And Vol < 0 Then 'Změna probíhá přidáním Repre, zástupná kombinace je povolena Method = "RepreVolDecr" MethZast = True MethZdroj = "Repre" End If If Right(SitPar, 5) = "Oscis" Then Set InpOscis = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM BgtMasterFile " & _ "WHERE oscis = " & "'" & Oscis & "'", dbOpenDynaset) Do Until InpOscis.EOF PocetOscis = PocetOscis + InpOscis(6).Value TarifOscis = TarifOscis + InpOscis(7).Value InpOscis.MoveNext Loop End If Budget.CheckSitPar 'Projde prvotní kombinace SitFin = "" If Inp.EOF Then 'Pokud není prvotní kombinace nalezena MethZdroj = "Repre" If SitPar <> "Oscis" And Left(Method, 5) = "Oscis" Then 'Pokud je zadáno osobní číslo (spolu s dalšími parametry), ale je nenalezeno, považuje se za nové osobní číslo a změna půjde přes reprezentanta zadaného zbývajícími parametry SitPar = Left(SitPar, Len(SitPar) - 5) 'Nastaví kombinaci s vyloučením nenalezeného Oscis (hledá Repre bez Oscis) Budget.CheckSitPar If Inp.EOF Then 'Pokud ani ostatní parametry zadané k osobnímu číslu nic neidentifikují, potom jdi přes zástupné prvky If MethZast = True Then 'Pokud jsou pro danou kombinaci povoleny zástupné prvky Budget.CheckZastPar If PocetZast = 0 Then SitFin = "OscisZastNeex" Else SitFin = "OscisZastOk" Else SitFin = "OscisRepreNeex" End If Else 'Pokud je Repre nalezen MethZast = False SitFin = "OscisRepreEx" End If End If If SitPar = "Oscis" Then Budget.CheckZastPar If PocetZast = 0 Then SitFin = "OscisZastNeex" Else SitFin = "OscisZastOk" End If If Left(Method, 5) = "Repre" And MethZast = True Then Budget.CheckZastPar If PocetZast = 0 Then SitFin = "ZastNeex" Else SitFin = "ZastOk" End If Else If Left(Method, 5) = "Oscis" Then SitFin = "OscisInputOk" Else SitFin = "RepreInputOk" End If If RunModel = "Process" Then Do Until Inp.EOF If Val(Left(PerFrom, 4)) - Val(Left(PerBase, 4)) >= 2 And Left(Inp(2).Value, 4) = Left(PerFrom, 4) Then If MethZdroj = "Repre" Then Pocet = Pocet + Inp(10).Value Else Pocet = Pocet + Inp(6).Value If MethZdroj = "Repre" Then Tarif = Tarif + Inp(12).Value Else Tarif = Tarif + Inp(8).Value Else If CStr(Inp(2).Value) = CStr(PerFrom) Then If MethZdroj = "Repre" Then Pocet = Pocet + Inp(10).Value Else Pocet = Pocet + Inp(6).Value If MethZdroj = "Repre" Then Tarif = Tarif + Inp(12).Value Else Tarif = Tarif + Inp(8).Value End If End If Inp.MoveNext Loop Else Do Until Inp.EOF Pocet = Pocet + Inp(6).Value Tarif = Tarif + Inp(7).Value Inp.MoveNext Loop End If If SitFin = "OscisRepreNeex" Then Text = Text & "Vstupní kombinace neexistuje (zástupná není možná). " If PocetOscis > 0 Then Text = Text & "Osobní číslo má úvazek " & Format(PocetOscis, "Standard") & ", tarif " & Format(CLng(TarifOscis / PocetOscis), "# ##0") & ". " Else If Vol > 0 Then Text = Text & "Jde o nový nástup. " Else Text = Text & "Výstup neexistujícího zaměstnance. " End If TColor = "red" GoTo NextInpRow End If If SitFin = "OscisZastNeex" Or SitFin = "ZastNeex" Then Text = Text & "Vstupní ani zástupný reprezentant neexistuje. " If PocetOscis > 0 Then Text = Text & "Osobní číslo má úvazek " & Format(PocetOscis, "Standard") & ", tarif " & Format(CLng(TarifOscis / PocetOscis), "# ##0") & ". " Else Text = Text & "Jde o nový nástup. " TColor = "red" GoTo NextInpRow End If If SitFin = "" Then Text = Text & "Nutno specifikovat zástupného reprezentanta, přes kterého bude změna provedna. " TColor = "red" GoTo NextInpRow End If Incr = 0 KoefVol = 0 If Vol > 0 Then If TarifNa = 0 And TarifO = 0 And TarifProc = 0 Then If SitFin = "RepreInputOk" Then If ParDoh = True Then Text = Text & "Nový nástup dohodáře. " Else Text = Text & "Nový nástup, tarif bude dle reprezentanta " & Format(CLng(Tarif / Pocet), "# ##0") & ". " End If If SitFin = "OscisInputOk" Then Text = Text & "Navýšení úvazku z " & Format(Pocet, "Standard") & " na " & Format(Pocet + Vol, "Standard") & ", tarif bude " & Format(Tarif / Pocet, "# ##0") & ". " If PocetOscis > 0 Then Text = Text & "Osobní číslo má úvazek " & Format(PocetOscis, "Standard") & ", tarif " & Format(TarifOscis, "# ##0") & ". " KoefVol = (Pocet + Vol) / Pocet End If If SitFin = "OscisRepreEx" Then KoefVol = (Pocet + Vol) / Pocet If PocetOscis > 0 Then Text = Text & "Nový úvazek v dané kombinaci, tarif bude " & Format(Tarif / Pocet * KoefVol, "# ##0") & ". Osobní číslo má úvazek " & Format(PocetOscis, "Standard") & ", tarif " & Format(CLng(TarifOscis), "# ##0") & ". " If PocetOscis = 0 Then If ParDoh = True Then Text = Text & "Nový nástup dohodáře. " Else Text = Text & "Nový nástup, tarif bude dle reprezentanta " & Format(CLng(Tarif / Pocet * Vol), "# ##0") & ". " End If End If If SitFin = "OscisZastOk" Then KoefVol = (PocetZast + Vol) / PocetZast If PocetOscis > 0 Then Text = Text & "Nový úvazek v dané zástupné kombinaci, tarif bude " & Format(TarifZast / PocetZast * KoefVol, "# ##0") & ". Osobní číslo má úvazek " & Format(PocetOscis, "Standard") & ", tarif " & Format(CLng(TarifOscis), "# ##0") & ". " If PocetOscis = 0 Then If ParDoh = True Then Text = Text & "Nový nástup dohodáře. " Else Text = Text & "Nový nástup, tarif bude dle zástupného reprezentanta " & Format(CLng(TarifZast / PocetZast * Vol), "# ##0") & ". " End If End If If SitFin = "ZastOk" Then If Vol < 1 Then Text = Text & "Navýšení úvazků, tarif dle zástupného reprezentanta bude " & Format(CLng(TarifZast / PocetZast * Vol), "# ##0") & ". " Else Text = Text & "Navýšení úvazků, tarif dle zástupného reprezentanta bude " & Format(CLng(TarifZast / PocetZast), "# ##0") & ". " End If TColor = "black" Incr = 0 End If If TarifNa > 0 And TarifO = 0 And TarifProc = 0 Then If SitFin = "RepreInputOk" Then If Vol < 1 Then Text = Text & "Nový nástup, tarif bude dle reprezentanta " & Format(CLng(Tarif / Pocet), "# ##0") & ", změna " & CLng((TarifNa / Vol) / (Tarif / Pocet) * 10000) / 100 - 100 & "%. " Else Text = Text & "Nový nástup, tarif reprezentanta je " & Format(CLng(Tarif / Pocet), "# ##0") & ", změna " & CLng(TarifNa / (Tarif / Pocet) * 10000) / 100 - 100 & "%. " If Vol < 1 Then Incr = (TarifNa / Vol) / (Tarif / Pocet) - 1 Else Incr = TarifNa / (Tarif / Pocet) - 1 End If If SitFin = "OscisInputOk" Then KoefVol = (Pocet + Vol) / Pocet Text = Text & "Navýšení úvazku z " & Format(Pocet, "Standard") & ", navýšení tarifu z " & Format(CLng(Tarif / Pocet), "# ##0") & " o " & CLng(TarifNa / Vol / (Tarif / Pocet) * 10000) / 100 - 100 & "%. " If PocetOscis > 0 Then Text = Text & "Osobní číslo má úvazek " & Format(PocetOscis, "Standard") & ", tarif " & Format(CLng(TarifOscis / PocetOscis), "# ##0") & ". " Incr = (TarifNa / Vol) / (Tarif / Pocet) - 1 End If If SitFin = "OscisRepreEx" Then If PocetOscis > 0 Then Text = Text & "Nový úvazek v dané kombinaci, navýšení tarifu o " & CLng(TarifNa / Vol / (Tarif / Pocet) * 10000) / 100 - 100 & ". Osobní číslo má úvazek " & Format(PocetOscis, "# ##0") & ", tarif " & Format(CLng(TarifOscis / PocetOscis), "# ##0") & ". " If PocetOscis = 0 Then Text = Text & "Nový nástup, změna tarifu oproti reprezentantu o " & CLng(TarifNa / Vol / (Tarif / Pocet) * 10000) / 100 - 100 & "%. " Incr = (TarifNa / Vol) / (Tarif / Pocet) - 1 KoefVol = (Pocet + Vol) / Pocet End If If SitFin = "OscisZastOk" Then If Vol < 1 Then Text = Text & "Nový nástup, tarif zástupného reprezentanta je " & Format(CLng(TarifZast / PocetZast), "# ##0") & ", změna o " & CLng(TarifNa / Vol / (TarifZast / PocetZast) * 10000) / 100 - 100 & "%. " Else Text = Text & "Nový nástup, tarif zástupného reprezentanta je " & Format(CLng(TarifZast / PocetZast), "# ##0") & ", změna o " & CLng(TarifNa / (TarifZast / PocetZast) * 10000) / 100 - 100 & "%. " If PocetOscis > 0 Then Text = Text & "Osobní číslo má úvazek " & Format(PocetOscis, "# ##0") & ", tarif " & Format(CLng(TarifOscis / PocetOscis), "# ##0") & ". " If Vol < 1 Then Incr = TarifNa / Vol / (TarifZast / PocetZast) - 1 Else Incr = TarifNa / (TarifZast / PocetZast) - 1 KoefVol = (PocetZast + Vol) / PocetZast End If If SitFin = "ZastOk" Then If Vol < 1 Then Text = Text & "Nový nástup, tarif zástupného reprezentanta je " & Format(CLng(TarifZast / PocetZast), "# ##0") & ", změna o " & CLng(TarifNa / Vol / (TarifZast / PocetZast) * 10000) / 100 - 100 & "%. " Else Text = Text & "Nový nástup, tarif zástupného reprezentanta je " & Format(CLng(TarifZast / PocetZast), "# ##0") & ", změna o " & CLng(TarifNa / (TarifZast / PocetZast) * 10000) / 100 - 100 & "%. " If Vol < 1 Then Incr = (TarifNa / Vol) / (TarifZast / PocetZast) - 1 Else Incr = TarifNa / (TarifZast / PocetZast) - 1 End If TColor = "black" End If If TarifNa = 0 And TarifO <> 0 And TarifProc = 0 Then If SitFin = "RepreInputOk" Then If Vol < 1 Then Text = Text & "Nový nástup, tarif bude dle reprezentanta " & Format(CLng(Tarif / Pocet), "# ##0") & ", změna o " & CLng((TarifO + Tarif) / (Pocet + Vol) / (Tarif / Pocet) * 10000) / 100 - 100 & "%. " Else Text = Text & "Nový nástup, tarif reprezentanta je " & Format(CLng(Tarif / Pocet), "# ##0") & ", změna o " & CLng((TarifO * Vol + Tarif) / (Pocet + Vol) / (Tarif / Pocet) * 10000) / 100 - 100 & "%. " If Vol < 1 Then Incr = (TarifO + Tarif) / (Pocet + Vol) / (Tarif / Pocet) - 1 Else Incr = (TarifO * Vol + Tarif) / (Pocet + Vol) / (Tarif / Pocet) - 1 End If If SitFin = "OscisInputOk" Then If Vol < 1 Then Text = Text & "Navýšení úvazku z " & Format(Pocet, "Standard") & ", navýšení tarifu z " & Format(CLng(Tarif / Pocet), "# ##0") & " o " & CLng((TarifO + Tarif) / (Pocet + Vol) / (Tarif / Pocet) * 10000) / 100 - 100 & "%. " Else Text = Text & "Navýšení úvazku z " & Format(Pocet, "Standard") & ", navýšení tarifu z " & Format(CLng(Tarif / Pocet), "# ##0") & " o " & CLng((TarifO * Vol + Tarif) / (Pocet + Vol) / (Tarif / Pocet) * 10000) / 100 - 100 & "%. " If PocetOscis > 0 Then Text = Text & "Osobní číslo má úvazek " & Format(PocetOscis, "# ##0") & ", tarif " & Format(CLng(Tarif / Pocet), "# ##0") & ". " If Vol < 1 Then Incr = (TarifO + Tarif) / (Pocet + Vol) / (Tarif / Pocet) - 1 Else Incr = (TarifO * Vol + Tarif) / (Pocet + Vol) / (Tarif / Pocet) - 1 KoefVol = (Pocet + Vol) / Pocet End If If SitFin = "OscisRepreEx" Then If PocetOscis > 0 Then Text = Text & "Nový úvazek v dané kombinaci, navýšení tarifu o " & CLng((TarifO + Tarif) / (Pocet + Vol) / (Tarif / Pocet) * 10000) / 100 - 100 & "%. Osobní číslo má úvazek " & Format(PocetOscis, "Standard") & ", tarif " & Format(CLng(TarifOscis / PocetOscis), "# ##0") & ". " If PocetOscis = 0 Then Text = Text & "Nový nástup, změna tarifu oproti reprezentantu o " & CLng((TarifO + Tarif) / (Pocet + Vol) / (Tarif / Pocet) * 10000) / 100 - 100 & "%. " Incr = (TarifO + Tarif) / (Pocet + Vol) / (Tarif / Pocet) - 1 KoefVol = (Pocet + Vol) / Pocet End If If SitFin = "OscisZastOk" Or SitFin = "ZastOk" Then If Vol < 1 Then Text = Text & "Nový nástup, tarif zástupného reprezentanta je " & Format(CLng(TarifZast / PocetZast), "# ##0") & ", změna o " & CLng((TarifO + TarifZast) / (PocetZast + Vol) / (TarifZast / PocetZast) * 10000) / 100 - 100 & "%. " Else Text = Text & "Nový nástup, tarif zástupného reprezentanta je " & Format(CLng(TarifZast / PocetZast), "# ##0") & ", změna o " & CLng((TarifO * Vol + TarifZast) / (PocetZast + Vol) / (TarifZast / PocetZast) * 10000) / 100 - 100 & "%. " If Vol < 1 Then Incr = (TarifO + TarifZast) / (PocetZast + Vol) / (TarifZast / PocetZast) - 1 Else Incr = (TarifO * Vol + TarifZast) / (PocetZast + Vol) / (TarifZast / PocetZast) - 1 KoefVol = (PocetZast + Vol) / PocetZast End If TColor = "black" End If If TarifNa = 0 And TarifO = 0 And TarifProc <> 0 Then If SitFin = "RepreInputOk" Then Text = Text & "Nový nástup, tarif bude dle reprezentanta " & Format(CLng((1 + TarifProc) * (Tarif / Pocet)), "# ##0") & " %. " End If If SitFin = "OscisInputOk" Then Text = Text & "Navýšení úvazku z " & Format(Pocet, "Standard") & ", tarif bude " & Format(CLng((1 + TarifProc) * (Tarif / Pocet)), "# ##0") & " %. " If PocetOscis > 0 Then Text = Text & "Osobní číslo má úvazek " & Format(PocetOscis, "Standard") & ", tarif " & Format(CLng(Tarif / Pocet), "# ##0") & ". " KoefVol = (Pocet + Vol) / Pocet End If If SitFin = "OscisRepreEx" Then If PocetOscis > 0 Then Text = Text & "Nový úvazek v dané kombinaci, tarif bude " & Format(CLng((1 + TarifProc) * (Tarif / Pocet)), "# ##0") & "%. Osobní číslo má úvazek " & Format(PocetOscis, "Standard") & ", tarif " & Format(CLng(TarifOscis / PocetOscis), "# ##0") & ". " If PocetOscis = 0 Then Text = Text & "Nový nástup, tarif bude dle reprezentanta " & Format(CLng(Tarif / Pocet), "# ##0") & ". " KoefVol = (Pocet + Vol) / Pocet End If If SitFin = "OscisZastOk" Or SitFin = "ZastOk" Then If Vol < 1 Then Text = Text & "Nový nástup, tarif odvozený ze zást.reprezentanta bude " & Format(CLng((1 + TarifProc) * (TarifZast / PocetZast)), "# ##0") & ". " If PocetOscis > 0 Then Text = Text & "Osobní číslo má úvazek " & Format(PocetOscis, "Standard") & ", tarif " & Format(CLng(TarifOscis / PocetOscis), "# ##0") & ". " KoefVol = (PocetZast + Vol) / PocetZast End If TColor = "black" Incr = TarifProc End If End If If Vol < 0 Then If TarifNa = 0 And TarifO = 0 And TarifProc = 0 Then If SitFin = "RepreInputOk" Then Text = Text & "Snížení úvazku, úvazky reprezentantů jsou " & Format(Pocet, "Standard") & ". " TColor = "black" End If If SitFin = "OscisInputOk" Then If Pocet <= Abs(Vol) Then Text = Text & "Zrušení celého prac.poměru. " TColor = "black" Else Text = Text & "Snížení části úvazku, stávající úvazek vstupní kombinace je " & Format(Pocet, "Standard") & ". " TColor = "orange" End If End If If SitFin = "OscisRepreEx" Then Text = Text & "Snížení úvazku v dané kombinaci, úvazky reprezentantů jsou " & Format(Pocet, "Standard") & ". " If PocetOscis > 0 Then Text = Text & "Osobní číslo má úvazek " & Format(PocetOscis, "Standard") & ", tarif " & Format(CLng(TarifOscis / PocetOscis), "# ##0") & ". " TColor = "orange" End If If SitFin = "OscisZastOk" Or SitFin = "ZastOk" Then Text = Text & "Snížení úvazku, úvazky reprezentantů jsou " & Format(PocetZast, "Standard") & ". " If PocetOscis > 0 Then Text = Text & "Osobní číslo má úvazek " & Format(PocetOscis, "Standard") & ", tarif " & Format(CLng(TarifOscis / PocetOscis), "# ##0") & ". " TColor = "orange" End If Incr = 0 End If If TarifNa <> 0 Or TarifO <> 0 Or TarifProc <> 0 Then Text = Text & "Nekonzistentní vstup. Nelze snižovat úvazek ani měnit tarif. " TColor = "red" End If End If If Vol = 0 Then If TarifNa = 0 And TarifO = 0 And TarifProc = 0 Then If Method = "ParChng" Then If Kateg = "" Or NS = "" Then Text = Text & "Po doplnění NS a Kateg bude osobní číslo bude přepsané na uvedené parametry. " TColor = "red" Else Text = Text & "Celé osobní číslo bude přepsané na uvedené parametry. " TColor = "black" End If Else Text = Text & "Nekonzistentní vstup. " TColor = "red" End If Incr = 0 End If If TarifNa > 0 And TarifO = 0 And TarifProc = 0 Then If SitFin = "RepreInputOk" Or SitFin = "OscisInputOk" Or SitFin = "OscisRepreEx" Then Text = Text & "Změna tarifu o " & CLng(TarifNa / (Tarif / Pocet) * 10000) / 100 - 100 & "%. " Incr = TarifNa / (Tarif / Pocet) - 1 End If If SitFin = "OscisZastOk" Or SitFin = "ZastOk" Then Text = Text & "Změna tarifu o " & CLng(TarifNa / (TarifZast / PocetZast) * 10000) / 100 - 100 & "%. " Incr = TarifNa / (TarifZast / PocetZast) - 1 End If TColor = "black" End If If TarifNa = 0 And TarifO <> 0 And TarifProc = 0 Then If SitFin = "RepreInputOk" Then Text = Text & "Tarif po změně bude " & Format(CLng(TarifO + (Tarif / Pocet)), "# ##0") & ", tj. změna o " & CLng((TarifO + (Tarif / Pocet)) / (Tarif / Pocet) * 10000) / 100 - 100 & "%. " Incr = (TarifO + (Tarif / Pocet)) / (Tarif / Pocet) - 1 End If If SitFin = "OscisRepreEx" Then Text = Text & "Tarif po změně bude " & Format(CLng(TarifO + (Tarif / Pocet)), "# ##0") & ", tj. změna o " & CLng((TarifO + (Tarif / Pocet)) / (Tarif / Pocet) * 10000) / 100 - 100 & "%. " Incr = (TarifO + (Tarif / Pocet)) / (Tarif / Pocet) - 1 End If If SitFin = "OscisInputOk" Then Text = Text & "Tarif po změně bude " & Format(CLng(TarifO + Tarif), "# ##0") & ", tj. změna o " & CLng((TarifO + Tarif) / Tarif * 10000) / 100 - 100 & "%. " Incr = (TarifO + Tarif) / Tarif - 1 End If If SitFin = "OscisZastOk" Or SitFin = "ZastOk" Then Text = Text & "Tarif po změně bude " & Format(CLng(TarifO + (TarifZast / PocetZast)), "# ##0") & ", tj. změna o " & CLng((TarifO + (TarifZast / PocetZast)) / (TarifZast / PocetZast) * 10000) / 100 - 100 & "%. " Incr = (TarifO + (TarifZast / PocetZast)) / (TarifZast / PocetZast) - 1 End If TColor = "black" End If If TarifNa = 0 And TarifO = 0 And TarifProc <> 0 Then If SitFin = "RepreInputOk" Or SitFin = "OscisInputOk" Or SitFin = "OscisRepreEx" Then Text = Text & "Tarif po změně bude " & Format(CLng((1 + TarifProc) * Tarif / Pocet), "# ##0") & ". " End If If SitFin = "OscisZastOk" Or SitFin = "ZastOk" Then Text = Text & "Tarif po změně bude " & Format(CLng((1 + TarifProc) * TarifZast / PocetZast), "# ##0") & ". " End If TColor = "black" Incr = TarifProc End If KoefVol = 1 End If If RunModel = "Check" Then GoTo NextInpRow If Vol < 1 And Vol > 0 Then IndInpVol = 1 Else IndInpVol = Vol 'Následuje vlastní kód pro promítnutí změn do plánu If MethZdroj = "BgtDetailAbs" Then 'Větev změn přímo do BgtDetailAbs Inp.MoveFirst Do Until Inp.EOF If Vol < 0 Then If Pocet <= Abs(Vol) Then KoefVol = 0 Else KoefVol = (Inp(9).Value + Vol) / Pocet End If If TarifO <> 0 Then 'změna tarifu o hodnotu musí probíhat nad každým oscis zvlášť If Inp(8).Value = 0 Then Incr = 0 Else Incr = (Inp(8).Value + (TarifO * Inp(6).Value)) / Inp(8).Value - 1 End If Inp.Edit If KoefVol = 0 Then Inp(5).Value = 0 'pevp Inp(6).Value = Inp(6).Value * KoefVol 'prevp Inp(7).Value = Inp(7).Value * KoefVol 'devpp Inp(8).Value = Inp(8).Value * KoefVol * (1 + Incr) 'tarifUprTD Inp(9).Value = Inp(9).Value * KoefVol 'odprh Inp(10).Value = Inp(10).Value * KoefVol 'odprp Inp(11).Value = Inp(11).Value * KoefVol 'dovceh Inp(12).Value = Inp(12).Value * KoefVol 'neoh Inp(13).Value = Inp(13).Value * KoefVol * (1 + Incr) 'zakl_mzda Inp(14).Value = Inp(14).Value * KoefVol * (1 + Incr * CitPr) 'prescas If IndPriplSmenn = 0 Or Inp(9).Value + Inp(11).Value + Inp(12).Value = 0 Then Inp(15).Value = Inp(15).Value * KoefVol * (1 + Incr * CitPriplSmenn) Else Inp(15).Value = Inp(9).Value / (Inp(9).Value + Inp(11).Value + Inp(12).Value) * IndPriplSmenn * KoefVol 'PriplSmenn If IndPriplOst = 0 Or Inp(9).Value + Inp(11).Value + Inp(12).Value = 0 Then Inp(16).Value = Inp(16).Value * KoefVol * (1 + Incr * CitPriplOst) Else Inp(16).Value = Inp(9).Value / (Inp(9).Value + Inp(11).Value + Inp(12).Value) * IndPriplOst * KoefVol 'PriplOst Inp(17).Value = Inp(17).Value * KoefVol * (1 + Incr * CitProdm) 'Prodm Inp(18).Value = Inp(18).Value * KoefVol * (1 + Incr * CitProdm) Inp(19).Value = Inp(19).Value * KoefVol * (1 + Incr * CitProdm) Inp(20).Value = Inp(20).Value * KoefVol * (1 + Incr * CitProdm) Inp(21).Value = Inp(21).Value * KoefVol * (1 + Incr * CitProdm) Inp(22).Value = Inp(22).Value * KoefVol * (1 + Incr * CitProdm) Inp(23).Value = Inp(23).Value * KoefVol * (1 + Incr * CitProdm) Inp(24).Value = Inp(24).Value * KoefVol * (1 + Incr * CitProdm) Inp(25).Value = Inp(25).Value * KoefVol * (1 + Incr * CitProdm) Inp(26).Value = Inp(26).Value * KoefVol * (1 + Incr * CitProdm) If IndProdm = 0 Or Inp(9).Value + Inp(11).Value + Inp(12).Value = 0 Then Inp(27).Value = Inp(27).Value * KoefVol * (1 + Incr * CitProdm) Else Inp(27).Value = Inp(9).Value / (Inp(9).Value + Inp(11).Value + Inp(12).Value) * IndProdm * KoefVol 'Prodm _OdmOst Inp(28).Value = Inp(28).Value * KoefVol * (1 + Incr) Inp(29).Value = Inp(29).Value * KoefVol * (1 + Incr) Inp(30).Value = Inp(30).Value * KoefVol * (1 + Incr) Inp(31).Value = Inp(31).Value * KoefVol * (1 + Incr) Inp(32).Value = Inp(32).Value * KoefVol * (1 + Incr * CitPoh) Inp(33).Value = Inp(33).Value * KoefVol * (1 + Incr * CitFomv) If Ind_FvHodm = 0 Or Inp(9).Value + Inp(11).Value + Inp(12).Value = 0 Then Inp(34).Value = Inp(34).Value * KoefVol * (1 + Incr * CitFomv) Else Inp(34).Value = Inp(9).Value / (Inp(9).Value + Inp(11).Value + Inp(12).Value) * Ind_FvHodm * KoefVol 'Ind_FvHodm If Ind_FvHodT = 0 Or Inp(9).Value + Inp(11).Value + Inp(12).Value = 0 Then Inp(35).Value = Inp(35).Value * KoefVol * (1 + Incr * CitFomv) Else Inp(35).Value = Inp(9).Value / (Inp(9).Value + Inp(11).Value + Inp(12).Value) * Ind_FvHodT * KoefVol 'Ind_FvHodT If Ind_FvQodm = 0 Or Inp(9).Value + Inp(11).Value + Inp(12).Value = 0 Then Inp(36).Value = Inp(36).Value * KoefVol * (1 + Incr * CitFomv) Else Inp(36).Value = Inp(9).Value / (Inp(9).Value + Inp(11).Value + Inp(12).Value) * Ind_FvQodm * KoefVol 'Ind_FvQodm Inp(37).Value = Inp(37).Value * KoefVol * (1 + Incr * CitFomv) Inp(38).Value = Inp(38).Value * KoefVol * (1 + Incr) Inp(39).Value = Inp(39).Value * KoefVol * (1 + Incr) Inp(40).Value = Inp(40).Value * KoefVol * (1 + Incr) Inp(41).Value = Inp(41).Value * KoefVol * (1 + Incr) If IndOON = 0 Or Inp(9).Value + Inp(11).Value + Inp(12).Value = 0 Then Inp(42).Value = Inp(42).Value * KoefVol * (1 + Incr) Else Inp(42).Value = Inp(9).Value / (Inp(9).Value + Inp(11).Value + Inp(12).Value) * IndOON * KoefVol 'OON Inp(43).Value = Inp(43).Value * KoefVol * (1 + Incr) Inp(44).Value = Inp(44).Value & "InpRow " & InpRow & ", " Inp(49).Value = Inp(49).Value * KoefVol * (1 + Incr * CitPriplPr25) Inp(50).Value = Inp(50).Value * KoefVol * (1 + Incr * CitPriplPr50) Inp(51).Value = Inp(51).Value * KoefVol * (1 + Incr * CitPriplDvPr) Inp(52).Value = Inp(52).Value * KoefVol * (1 + Incr * CitPriplTrPr) Inp(53).Value = Inp(53).Value * KoefVol * (1 + Incr * CitPriplSv) Inp(54).Value = Inp(54).Value * KoefVol * (1 + Incr * CitPriplPsGe) Inp(55).Value = Inp(55).Value * KoefVol * (1 + Incr * CitPriplJIP) Inp(56).Value = Inp(56).Value * KoefVol * (1 + Incr * CitPriplProst) Inp(57).Value = Inp(57).Value * KoefVol * (1 + Incr * CitPriplPr50h) Inp(58).Value = Inp(58).Value * KoefVol * (1 + Incr * CitPriplMinMz) Inp(59).Value = Inp(59).Value * KoefVol * (1 + Incr * CitPriplVed) Inp(60).Value = Inp(60).Value * KoefVol * (1 + Incr * CitPriplNoc) Inp(61).Value = Inp(61).Value * KoefVol * (1 + Incr * CitPriplOs) Inp(62).Value = Inp(62).Value * KoefVol * (1 + Incr * CitPriplNPZat) Inp.Fields("_FvIssOdm").Value = 0 Inp.Fields("_FvIssExt").Value = 0 Inp.Update Inp.MoveNext Loop End If If MethZdroj = "Repre" Then 'Větev vytvoření nových vět reprezentantů Set Out = dB.OpenRecordset("SELECT Loc, Oscis, obd, repre, kateg, utv, pracv, tyduvs, tyduvi, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, " & _ "PriplOst , Prodm, [_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvIssOdm], [_FvIssExt],[_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, Comment, NewPar, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat FROM BgtDetailAbsNew", dbOpenDynaset) 'Pokud byla zachycena primární sada, proběhne zpracování nad Inp záznamy (druhá větev vychází z InpZast záznamů) If SitFin = "ZastOk" Or SitFin = "OscisZastOk" Then InpZast.MoveFirst Do Until InpZast.EOF If Val(Left(InpZast(2).Value, 4)) - Val(Left(PerBase, 4)) >= 2 Then KoefVol = (KalDnyYr(InpZast(2).Value) * Vol) * (InpZast(11).Value / InpZast(48).Value) / InpZast(11).Value YoYkoef = 12 Else KoefVol = (KalDnyMth(InpZast(2).Value) * Vol) * (InpZast(11).Value / InpZast(48).Value) / InpZast(11).Value YoYkoef = 1 End If Out.AddNew Out(0).Value = InpZast(0).Value 'Loc If Oscis <> "" Then Out(1).Value = Oscis Else Out(1).Value = "New" & j Out(2).Value = InpZast(2).Value 'obd If Repre <> "" Then Out(3).Value = Repre Else Out(3).Value = InpZast(3).Value 'repre If Kateg <> "" Then Out(4).Value = Kateg Else Out(4).Value = InpZast(4).Value 'kateg If Utvar <> "" Then Out(5).Value = Utvar Else Out(5).Value = InpZast(5).Value 'utv If NS = "" Then Out(6).Value = InpZast(6).Value Else Out(6).Value = NS 'ns Out(7).Value = InpZast(7).Value 'tyduvs Out(8).Value = (InpZast(10).Value * KoefVol) * InpZast(7).Value 'tyduvi Out(9).Value = Int(wb.Sheets("Změny").Range("O" & InpRow).Value + 0.99) * (InpZast(11).Value / InpZast(48).Value) 'pevp Out(10).Value = InpZast(10).Value * KoefVol 'prevp Out(11).Value = InpZast(11).Value * KoefVol 'devpp Out(12).Value = InpZast(12).Value / InpZast(10).Value * (InpZast(10).Value * KoefVol) * (1 + Incr) 'tarifUprTD Out(13).Value = InpZast(13).Value * KoefVol 'odprh Out(14).Value = InpZast(14).Value * KoefVol 'odprp Out(15).Value = InpZast(15).Value * KoefVol 'dovceh Out(16).Value = InpZast(16).Value * KoefVol 'neoh Out(17).Value = InpZast(17).Value * KoefVol * (1 + Incr) Out(18).Value = InpZast(18).Value * KoefVol * (1 + Incr * CitPr) If IndPriplSmenn = 0 Or InpZast(13).Value + InpZast(15).Value + InpZast(16).Value = 0 Then Out(19).Value = InpZast(19).Value * KoefVol * (1 + Incr * CitPriplSmenn) Else Out(19).Value = InpZast(13).Value / (InpZast(13).Value + InpZast(15).Value + InpZast(16).Value) * IndPriplSmenn * IndInpVol * YoYkoef 'PriplSmenn If IndPriplOst = 0 Or InpZast(13).Value + InpZast(15).Value + InpZast(16).Value = 0 Then Out(20).Value = InpZast(20).Value * KoefVol * (1 + Incr * CitPriplOst) Else Out(20).Value = InpZast(13).Value / (InpZast(13).Value + InpZast(15).Value + InpZast(16).Value) * IndPriplOst * IndInpVol * YoYkoef 'PriplOst Out(21).Value = InpZast(21).Value * KoefVol * (1 + Incr * CitProdm) 'Prodm Out(22).Value = InpZast(22).Value * KoefVol * (1 + Incr * CitProdm) Out(23).Value = InpZast(23).Value * KoefVol * (1 + Incr * CitProdm) Out(24).Value = InpZast(24).Value * KoefVol * (1 + Incr * CitProdm) Out(25).Value = InpZast(25).Value * KoefVol * (1 + Incr * CitProdm) Out(26).Value = InpZast(26).Value * KoefVol * (1 + Incr * CitProdm) Out(27).Value = InpZast(27).Value * KoefVol * (1 + Incr * CitProdm) Out(28).Value = InpZast(28).Value * KoefVol * (1 + Incr * CitProdm) Out(29).Value = InpZast(29).Value * KoefVol * (1 + Incr * CitProdm) Out(30).Value = InpZast(30).Value * KoefVol * (1 + Incr * CitProdm) If IndProdm = 0 Or InpZast(13).Value + InpZast(15).Value + InpZast(16).Value = 0 Then Out(31).Value = InpZast(31).Value * KoefVol * (1 + Incr * CitProdm) Else Out(31).Value = InpZast(13).Value / (InpZast(13).Value + InpZast(15).Value + InpZast(16).Value) * IndProdm * IndInpVol * YoYkoef Out(32).Value = InpZast(32).Value * KoefVol * (1 + Incr) 'OON Out(33).Value = InpZast(33).Value * KoefVol * (1 + Incr) Out(34).Value = InpZast(34).Value * KoefVol * (1 + Incr) Out(35).Value = InpZast(35).Value * KoefVol * (1 + Incr) Out(36).Value = InpZast(36).Value * KoefVol * (1 + Incr) 'Poh Out(37).Value = InpZast(37).Value * KoefVol * (1 + Incr * CitFomv) If Ind_FvHodm = 0 Or InpZast(13).Value + InpZast(15).Value + InpZast(16).Value = 0 Then Out(38).Value = InpZast(38).Value * KoefVol * (1 + Incr * CitFomv) Else Out(38).Value = InpZast(13).Value / (InpZast(13).Value + InpZast(15).Value + InpZast(16).Value) * Ind_FvHodm * IndInpVol * YoYkoef If Ind_FvHodT = 0 Or InpZast(13).Value + InpZast(15).Value + InpZast(16).Value = 0 Then Out(39).Value = InpZast(39).Value * KoefVol * (1 + Incr * CitFomv) Else Out(39).Value = InpZast(13).Value / (InpZast(13).Value + InpZast(15).Value + InpZast(16).Value) * Ind_FvHodT * IndInpVol * YoYkoef If Ind_FvQodm = 0 Or InpZast(13).Value + InpZast(15).Value + InpZast(16).Value = 0 Then Out(40).Value = InpZast(41).Value * KoefVol * (1 + Incr * CitFomv) Else Out(40).Value = InpZast(13).Value / (InpZast(13).Value + InpZast(15).Value + InpZast(16).Value) * Ind_FvQodm * IndInpVol * YoYkoef Out(41).Value = InpZast(41).Value * KoefVol * (1 + Incr * CitFomv) Out(42).Value = InpZast(42).Value * KoefVol * (1 + Incr) 'MzdyOst Out(43).Value = InpZast(43).Value * KoefVol * (1 + Incr) 'OON Out(44).Value = InpZast(44).Value * KoefVol * (1 + Incr) Out(45).Value = InpZast(45).Value * KoefVol * (1 + Incr) If IndOON = 0 Or InpZast(13).Value + InpZast(15).Value + InpZast(16).Value = 0 Then Out(46).Value = InpZast(46).Value * KoefVol * (1 + Incr) Else Out(46).Value = InpZast(13).Value / (InpZast(13).Value + InpZast(15).Value + InpZast(16).Value) * IndOON * IndInpVol * YoYkoef Out(47).Value = InpZast(47).Value * KoefVol * (1 + Incr) 'HM 'Out(48).Value = Out(48).Value & "InpRow " & InpRow & ", " Out(49).Value = "New" & j Out(50).Value = InpZast(50 - 1).Value * KoefVol * (1 + Incr * CitPriplPr25) Out(51).Value = InpZast(51 - 1).Value * KoefVol * (1 + Incr * CitPriplPr50) Out(52).Value = InpZast(52 - 1).Value * KoefVol * (1 + Incr * CitPriplDvPr) Out(53).Value = InpZast(53 - 1).Value * KoefVol * (1 + Incr * CitPriplTrPr) Out(54).Value = InpZast(54 - 1).Value * KoefVol * (1 + Incr * CitPriplSv) Out(55).Value = InpZast(55 - 1).Value * KoefVol * (1 + Incr * CitPriplPsGe) Out(56).Value = InpZast(56 - 1).Value * KoefVol * (1 + Incr * CitPriplJIP) Out(57).Value = InpZast(57 - 1).Value * KoefVol * (1 + Incr * CitPriplProst) Out(58).Value = InpZast(58 - 1).Value * KoefVol * (1 + Incr * CitPriplPr50h) Out(59).Value = InpZast(59 - 1).Value * KoefVol * (1 + Incr * CitPriplMinMz) Out(60).Value = InpZast(60 - 1).Value * KoefVol * (1 + Incr * CitPriplVed) Out(61).Value = InpZast(61 - 1).Value * KoefVol * (1 + Incr * CitPriplNoc) Out(62).Value = InpZast(62 - 1).Value * KoefVol * (1 + Incr * CitPriplOs) Out(63).Value = InpZast(63 - 1).Value * KoefVol * (1 + Incr * CitPriplNPZat) Out.Fields("_FvIssOdm").Value = 0 Out.Fields("_FvIssExt").Value = 0 Out.Update InpZast.MoveNext Loop Else Inp.MoveFirst Do Until Inp.EOF If Val(Left(Inp(2).Value, 4)) - Val(Left(PerBase, 4)) >= 2 Then KoefVol = ((KalDnyYr(Inp(2).Value) * Vol) * (Inp(11).Value / Inp(48).Value)) / Inp(11).Value YoYkoef = 12 Else KoefVol = ((KalDnyMth(Inp(2).Value) * Vol) * (Inp(11).Value / Inp(48).Value)) / Inp(11).Value YoYkoef = 1 End If Out.AddNew Out(0).Value = Inp(0).Value 'Loc If Oscis <> "" Then Out(1).Value = Oscis Else Out(1).Value = "New" & j Out(2).Value = Inp(2).Value 'obd If Repre <> "" Then Out(3).Value = Repre Else Out(3).Value = Inp(3).Value 'repre If Kateg <> "" Then Out(4).Value = Kateg Else Out(4).Value = Inp(4).Value 'kateg If Utvar <> "" Then Out(5).Value = Utvar Else Out(5).Value = Inp(5).Value 'utv If NS = "" Then Out(6).Value = Inp(6).Value Else Out(6).Value = NS 'ns Out(7).Value = Inp(7).Value 'tyduvs Out(8).Value = (Inp(10).Value * KoefVol) * Inp(7).Value 'tyduvi Out(9).Value = Int(wb.Sheets("Změny").Range("O" & InpRow).Value + 0.99) * (Inp(11).Value / Inp(48).Value) 'pevp Out(10).Value = Inp(10).Value * KoefVol 'prevp Out(11).Value = Inp(11).Value * KoefVol 'devpp Out(12).Value = Inp(12).Value / Inp(10).Value * (Inp(10).Value * KoefVol) * (1 + Incr) 'tarifUprTD Out(13).Value = Inp(13).Value * KoefVol 'odprh Out(14).Value = Inp(14).Value * KoefVol 'odprp Out(15).Value = Inp(15).Value * KoefVol 'dovceh Out(16).Value = Inp(16).Value * KoefVol 'neoh Out(17).Value = Inp(17).Value * KoefVol * (1 + Incr) Out(18).Value = Inp(18).Value * KoefVol * (1 + Incr * CitPr) If IndPriplSmenn = 0 Or Inp(13).Value + Inp(15).Value + Inp(16).Value = 0 Then Out(19).Value = Inp(19).Value * KoefVol * (1 + Incr * CitPripl) Else Out(19).Value = Inp(13).Value / (Inp(13).Value + Inp(15).Value + Inp(16).Value) * IndPriplSmenn * IndInpVol * YoYkoef 'PriplSmenn If IndPriplOst = 0 Or Inp(13).Value + Inp(15).Value + Inp(16).Value = 0 Then Out(20).Value = Inp(20).Value * KoefVol * (1 + Incr * CitPripl) Else Out(20).Value = Inp(13).Value / (Inp(13).Value + Inp(15).Value + Inp(16).Value) * IndPriplOst * IndInpVol * YoYkoef 'PriplOst Out(21).Value = Inp(21).Value * KoefVol * (1 + Incr * CitProdm) 'Prodm Out(22).Value = Inp(22).Value * KoefVol * (1 + Incr * CitProdm) Out(23).Value = Inp(23).Value * KoefVol * (1 + Incr * CitProdm) Out(24).Value = Inp(24).Value * KoefVol * (1 + Incr * CitProdm) Out(25).Value = Inp(25).Value * KoefVol * (1 + Incr * CitProdm) Out(26).Value = Inp(26).Value * KoefVol * (1 + Incr * CitProdm) Out(27).Value = Inp(27).Value * KoefVol * (1 + Incr * CitProdm) Out(28).Value = Inp(28).Value * KoefVol * (1 + Incr * CitProdm) Out(29).Value = Inp(29).Value * KoefVol * (1 + Incr * CitProdm) Out(30).Value = Inp(30).Value * KoefVol * (1 + Incr * CitProdm) If IndProdm = 0 Or Inp(13).Value + Inp(15).Value + Inp(16).Value = 0 Then Out(31).Value = Inp(31).Value * KoefVol * (1 + Incr * CitProdm) Else Out(31).Value = Inp(13).Value / (Inp(13).Value + Inp(15).Value + Inp(16).Value) * IndProdm * IndInpVol * YoYkoef Out(32).Value = Inp(32).Value * KoefVol * (1 + Incr) 'OON Out(33).Value = Inp(33).Value * KoefVol * (1 + Incr) Out(34).Value = Inp(34).Value * KoefVol * (1 + Incr) Out(35).Value = Inp(35).Value * KoefVol * (1 + Incr) Out(36).Value = Inp(36).Value * KoefVol * (1 + Incr) 'Poh Out(37).Value = Inp(37).Value * KoefVol * (1 + Incr * CitFomv) If Ind_FvHodm = 0 Or Inp(13).Value + Inp(15).Value + Inp(16).Value = 0 Then Out(38).Value = Inp(38).Value * KoefVol * (1 + Incr * CitFomv) Else Out(38).Value = Inp(13).Value / (Inp(13).Value + Inp(15).Value + Inp(16).Value) * Ind_FvHodm * IndInpVol * YoYkoef If Ind_FvHodT = 0 Or Inp(13).Value + Inp(15).Value + Inp(16).Value = 0 Then Out(39).Value = Inp(39).Value * KoefVol * (1 + Incr * CitFomv) Else Out(39).Value = Inp(13).Value / (Inp(13).Value + Inp(15).Value + Inp(16).Value) * Ind_FvHodT * IndInpVol * YoYkoef If Ind_FvQodm = 0 Or Inp(13).Value + Inp(15).Value + Inp(16).Value = 0 Then Out(40).Value = Inp(41).Value * KoefVol * (1 + Incr * CitFomv) Else Out(40).Value = Inp(13).Value / (Inp(13).Value + Inp(15).Value + Inp(16).Value) * Ind_FvQodm * IndInpVol * YoYkoef Out(41).Value = Inp(41).Value * KoefVol * (1 + Incr * CitFomv) Out(42).Value = Inp(42).Value * KoefVol * (1 + Incr) 'MzdyOst Out(43).Value = Inp(43).Value * KoefVol * (1 + Incr) 'OON Out(44).Value = Inp(44).Value * KoefVol * (1 + Incr) Out(45).Value = Inp(45).Value * KoefVol * (1 + Incr) If IndOON = 0 Or Inp(13).Value + Inp(15).Value + Inp(16).Value = 0 Then Out(46).Value = Inp(46).Value * KoefVol * (1 + Incr) Else Out(46).Value = Inp(13).Value / (Inp(13).Value + Inp(15).Value + Inp(16).Value) * IndOON * IndInpVol * YoYkoef Out(47).Value = Inp(47).Value * KoefVol * (1 + Incr) 'HM Out(48).Value = Out(48).Value & "InpRow " & InpRow & ", " Out(49).Value = "New" & j Out(50).Value = Inp(50 - 1).Value * KoefVol * (1 + Incr * CitPriplPr25) Out(51).Value = Inp(51 - 1).Value * KoefVol * (1 + Incr * CitPriplPr50) Out(52).Value = Inp(52 - 1).Value * KoefVol * (1 + Incr * CitPriplDvPr) Out(53).Value = Inp(53 - 1).Value * KoefVol * (1 + Incr * CitPriplTrPr) Out(54).Value = Inp(54 - 1).Value * KoefVol * (1 + Incr * CitPriplSv) Out(55).Value = Inp(55 - 1).Value * KoefVol * (1 + Incr * CitPriplPsGe) Out(56).Value = Inp(56 - 1).Value * KoefVol * (1 + Incr * CitPriplJIP) Out(57).Value = Inp(57 - 1).Value * KoefVol * (1 + Incr * CitPriplProst) Out(58).Value = Inp(58 - 1).Value * KoefVol * (1 + Incr * CitPriplPr50h) Out(59).Value = Inp(59 - 1).Value * KoefVol * (1 + Incr * CitPriplMinMz) Out(60).Value = Inp(60 - 1).Value * KoefVol * (1 + Incr * CitPriplVed) Out(61).Value = Inp(61 - 1).Value * KoefVol * (1 + Incr * CitPriplNoc) Out(62).Value = Inp(62 - 1).Value * KoefVol * (1 + Incr * CitPriplOs) Out(63).Value = Inp(63 - 1).Value * KoefVol * (1 + Incr * CitPriplNPZat) Out.Fields("_FvIssOdm").Value = 0 Out.Fields("_FvIssExt").Value = 0 Out.Update Inp.MoveNext Loop End If End If NextInpRow: wb.Sheets("Změny").Range("AO" & InpRow).Value = Text If TColor = "black" Then wb.Sheets("Změny").Range("AO" & InpRow).Font.Color = RGB(0, 0, 0) If TColor = "red" Then wb.Sheets("Změny").Range("AO" & InpRow).Font.Color = RGB(255, 0, 0) If TColor = "orange" Then wb.Sheets("Změny").Range("AO" & InpRow).Font.Color = RGB(233, 148, 23) Next InpRow SkipUpd: wb.Save wb.Close Forms!MainForm.BgtProcessingInfo = "" If RunModel = "Process" Then Budget.AddAbsNewToAbs CurrentDb.Execute "DELETE * FROM BgtManualZmenaInputBase" End If Set dB = Nothing Set Inp = Nothing Set wb = Nothing Set xlApp = Nothing Set Out = Nothing End Sub Public Sub CheckSitPar() If RunModel = "Check" Then 'Model verifikace ručních vstupů změn If SitPar = "Repre" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE repre = " & "'" & Repre & "'", dbOpenDynaset) End If If SitPar = "ReprePrim" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE repre = " & "'" & Repre & "' AND utv = " & "'" & Utvar & "'", dbOpenDynaset) End If If SitPar = "KategPrim" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE kateg = " & "'" & Kateg & "' AND utv = " & "'" & Utvar & "'", dbOpenDynaset) End If If SitPar = "RepreNs" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE repre = " & "'" & Repre & "' AND pracv = " & "'" & NS & "'", dbOpenDynaset) End If If SitPar = "KategNs" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE kateg = " & "'" & Kateg & "' AND pracv = " & "'" & NS & "'", dbOpenDynaset) End If If SitPar = "Prim" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE utv = " & "'" & Utvar & "'", dbOpenDynaset) End If If SitPar = "Ns" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE pracv = " & "'" & NS & "'", dbOpenDynaset) End If If SitPar = "Oscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE oscis = " & "'" & Oscis & "'", dbOpenDynaset) End If If SitPar = "RepreOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE repre = " & "'" & Repre & "' AND oscis = " & "'" & Oscis & "'", dbOpenDynaset) End If If SitPar = "PrimOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE utv = " & "'" & Utvar & "' AND oscis = " & "'" & Oscis & "'", dbOpenDynaset) End If If SitPar = "NsOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE pracv = " & "'" & NS & "' AND oscis = " & "'" & Oscis & "'", dbOpenDynaset) End If If SitPar = "KategOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE kateg = " & "'" & Kateg & "' AND oscis = " & "'" & Oscis & "'", dbOpenDynaset) End If If SitPar = "RepreNsOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE pracv = " & "'" & NS & "' AND repre = " & "'" & Repre & "' AND oscis = " & "'" & Oscis & "'", dbOpenDynaset) End If If SitPar = "KategNsOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE pracv = " & "'" & NS & "' AND kateg = " & "'" & Kateg & "' AND oscis = " & "'" & Oscis & "'", dbOpenDynaset) End If If SitPar = "ReprePrimOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE utv = " & "'" & Utvar & "' AND repre = " & "'" & Repre & "' AND oscis = " & "'" & Oscis & "'", dbOpenDynaset) End If If SitPar = "KategPrimOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE utv = " & "'" & Utvar & "' AND kateg = " & "'" & Kateg & "' AND oscis = " & "'" & Oscis & "'", dbOpenDynaset) End If If SitPar = "All" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ", dbOpenDynaset) End If End If If RunModel = "Process" Then 'Model zpracování plánů If MethZdroj = "BgtDetailAbs" Then 'Větev BgtDetailAbs If SitPar = "KategPrim" Then Set Inp = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, " & _ "[_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, Comment, utv, repre, tyduvs, tyduvi, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM BgtDetailAbs " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND kateg = " & "'" & Kateg & "' AND utv = " & "'" & Utvar & "'", dbOpenDynaset) End If If SitPar = "ReprePrim" Then Set Inp = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, " & _ "[_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, Comment, utv, repre, tyduvs, tyduvi, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM BgtDetailAbs " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND repre = " & "'" & Repre & "' AND utv =" & "'" & Utvar & "'", dbOpenDynaset) End If If SitPar = "Repre" Then Set Inp = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, " & _ "[_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, Comment, utv, repre, tyduvs, tyduvi, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM BgtDetailAbs " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND repre = " & "'" & Repre & "'", dbOpenDynaset) End If If SitPar = "Prim" Then Set Inp = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, " & _ "[_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, Comment, utv, repre, tyduvs, tyduvi, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM BgtDetailAbs " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND utv = " & "'" & Utvar & "'", dbOpenDynaset) End If If SitPar = "RepreNs" Then Set Inp = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, " & _ "[_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, Comment, utv, repre, tyduvs, tyduvi, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM BgtDetailAbs " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND repre = " & "'" & Repre & "' AND pracv = " & "'" & NS & "'", dbOpenDynaset) End If If SitPar = "Ns" Then Set Inp = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, " & _ "[_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, Comment, utv, repre, tyduvs, tyduvi, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM BgtDetailAbs " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND pracv = " & "'" & NS & "'", dbOpenDynaset) End If If SitPar = "KategNs" Then Set Inp = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, " & _ "[_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, Comment, utv, repre, tyduvs, tyduvi, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM BgtDetailAbs " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND kateg = " & "'" & Kateg & "' AND pracv = " & "'" & NS & "'", dbOpenDynaset) End If If SitPar = "Oscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, " & _ "[_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, Comment, utv, repre, tyduvs, tyduvi, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM BgtDetailAbs " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND oscis = " & "'" & Oscis & "'", dbOpenDynaset) End If If SitPar = "NsOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, " & _ "[_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, Comment, utv, repre, tyduvs, tyduvi, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM BgtDetailAbs " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND oscis = " & "'" & Oscis & "' AND pracv = " & "'" & NS & "' AND oscis = " & "'" & Oscis & "'", dbOpenDynaset) End If If SitPar = "RepreOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, " & _ "[_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, Comment, utv, repre, tyduvs, tyduvi, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM BgtDetailAbs " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND repre = " & "'" & Repre & "' AND oscis = " & "'" & Oscis & "'", dbOpenDynaset) End If If SitPar = "PrimOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, " & _ "[_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, Comment, utv, repre, tyduvs, tyduvi, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM BgtDetailAbs " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND utv = " & "'" & Utvar & "' AND oscis = " & "'" & Oscis & "'", dbOpenDynaset) End If If SitPar = "KategOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, " & _ "[_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, Comment, utv, repre, tyduvs, tyduvi, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM BgtDetailAbs " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND kateg = " & "'" & Kateg & "' AND oscis = " & "'" & Oscis & "'", dbOpenDynaset) End If If SitPar = "RepreNsOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, " & _ "[_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, Comment, utv, repre, tyduvs, tyduvi, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat FROM BgtDetailAbs " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND repre = " & "'" & Repre & "' AND pracv = " & "'" & NS & "' AND oscis = " & "'" & Oscis & "'", dbOpenDynaset) End If If SitPar = "KategNsOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, " & _ "[_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, Comment, utv, repre, tyduvs, tyduvi, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM BgtDetailAbs " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND kateg = " & "'" & Kateg & "' AND pracv = " & "'" & NS & "' AND oscis = " & "'" & Oscis & "'", dbOpenDynaset) End If If SitPar = "ReprePrimOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, " & _ "[_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, Comment, utv, repre, tyduvs, tyduvi, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat FROM BgtDetailAbs " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND utv = " & "'" & Utvar & "' AND repre = " & "'" & Repre & "' AND oscis = " & "'" & Oscis & "'", dbOpenDynaset) End If If SitPar = "KategPrimOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, " & _ "[_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, Comment, utv, repre, tyduvs, tyduvi, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM BgtDetailAbs " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND utv = " & "'" & Utvar & "' AND kateg = " & "'" & Kateg & "' AND oscis = " & "'" & Oscis & "'", dbOpenDynaset) End If If SitPar = "All" Then Set Inp = dB.OpenRecordset("SELECT Loc, oscis, obd, pracv, kateg, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, PriplOst, Prodm, " & _ "[_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, Comment, utv, repre, tyduvs, tyduvi, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM BgtDetailAbs " & _ "WHERE Obd >= " & " '" & PerFrom & "'", dbOpenDynaset) End If End If If MethZdroj = "Repre" Then 'Větev Repre If SitPar = "KategPrim" Or SitPar = "PrimKategOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, obd, repre, kateg, utv, pracv, tyduvs, tyduvi, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, " & _ "PriplOst , Prodm, [_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, GroupDevpp, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM 06_31KatPrimInpQ " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND kateg =" & "'" & Kateg & "' AND utv = " & "'" & Utvar & "'", dbOpenDynaset) End If If SitPar = "Kateg" Or SitPar = "KategOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, obd, repre, kateg, utv, pracv, tyduvs, tyduvi, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, " & _ "PriplOst , Prodm, [_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, GroupDevpp, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM 06_32KatInpQ " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND kateg = " & "'" & Kateg & "'", dbOpenDynaset) End If If SitPar = "ReprePrim" Or SitPar = "ReprePrimOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, obd, repre, kateg, utv, pracv, tyduvs, tyduvi, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, " & _ "PriplOst , Prodm, [_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, GroupDevpp, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM 06_33ReprePrimInpQ " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND repre = " & "'" & Repre & "' AND utv = " & "'" & Utvar & "'", dbOpenDynaset) End If If SitPar = "Repre" Or SitPar = "RepreOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, obd, repre, kateg, utv, pracv, tyduvs, tyduvi, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, " & _ "PriplOst , Prodm, [_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, GroupDevpp, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM 06_34RepreInpQ " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND repre = " & "'" & Repre & "'", dbOpenDynaset) End If If SitPar = "RepreNs" Or SitPar = "RepreNsOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, obd, repre, kateg, utv, pracv, tyduvs, tyduvi, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, " & _ "PriplOst , Prodm, [_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, GroupDevpp, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM 06_35RepreNsInpQ " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND repre = " & "'" & Repre & "' AND pracv = " & "'" & NS & "'", dbOpenDynaset) End If If SitPar = "Ns" Or SitPar = "NsOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, obd, repre, kateg, utv, pracv, tyduvs, tyduvi, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, " & _ "PriplOst , Prodm, [_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, GroupDevpp, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM 06_36NsInpQ " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND pracv = " & "'" & NS & "'", dbOpenDynaset) End If If SitPar = "Prim" Or SitPar = "PrimOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, obd, repre, kateg, utv, pracv, tyduvs, tyduvi, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, " & _ "PriplOst , Prodm, [_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, GroupDevpp, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM 06_37PrimInpQ " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND utv = " & "'" & Utvar & "'", dbOpenDynaset) End If If SitPar = "KategNs" Or SitPar = "KategNsOscis" Then Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, obd, repre, kateg, utv, pracv, tyduvs, tyduvi, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, " & _ "PriplOst , Prodm, [_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, GroupDevpp, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM 06_38NsKatInpQ " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND pracv = " & "'" & NS & "' AND kateg = " & "'" & Kateg & "'", dbOpenDynaset) End If End If End If End Sub Public Sub CheckZastPar() PocetZast = 0 TarifZast = 0 If RunModel = "Check" Then 'Model verifikace ručních vstupů změn If SitZast = "Repre" Then Set InpZast = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE repre = " & "'" & ZastRepre & "'", dbOpenDynaset) End If If SitZast = "RepreNs" Then Set InpZast = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE repre = " & "'" & ZastRepre & "'" & " AND pracv = " & "'" & ZastNS & "'", dbOpenDynaset) End If If SitZast = "ReprePrim" Then Set InpZast = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE repre = " & "'" & ZastRepre & "'" & " AND utv = " & "'" & ZastUtvar & "'", dbOpenDynaset) End If If SitZast = "Prim" Then Set InpZast = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE utv = " & "'" & ZastUtvar & "'", dbOpenDynaset) End If If SitZast = "KategPrim" Then Set InpZast = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE utv = " & "'" & ZastUtvar & "' AND kateg = " & "'" & ZastKateg & "'", dbOpenDynaset) End If If SitZast = "KategNs" Then Set InpZast = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE pracv = " & "'" & ZastNS & "' AND kateg = " & "'" & ZastKateg & "'", dbOpenDynaset) End If If SitZast = "Kateg" Then Set InpZast = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE kateg = " & "'" & ZastKateg & "'", dbOpenDynaset) End If If SitZast = "Ns" Then Set InpZast = dB.OpenRecordset("SELECT Loc, Oscis, repre, kateg, utv, pracv, PrEvStavTD, tarifUprTD FROM 06_80CheckBgtImportFileQ " & _ "WHERE pracv = " & "'" & ZastNS & "'", dbOpenDynaset) End If If SitZast = "" Then Exit Sub Do Until InpZast.EOF PocetZast = PocetZast + InpZast(6).Value TarifZast = TarifZast + InpZast(7).Value InpZast.MoveNext Loop End If If RunModel = "Process" Then 'Model zpracování plánů If SitZast = "KategPrim" Or SitZast = "PrimKategOscis" Then Set InpZast = dB.OpenRecordset("SELECT Loc, Oscis, obd, repre, kateg, utv, pracv, tyduvs, tyduvi, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, " & _ "PriplOst , Prodm, [_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, GroupDevpp, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM 06_31KatPrimInpQ " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND kateg = " & "'" & ZastKateg & "' AND utv = " & "'" & ZastUtvar & "'", dbOpenDynaset) End If If SitZast = "Kateg" Or SitZast = "KategOscis" Then Set InpZast = dB.OpenRecordset("SELECT Loc, Oscis, obd, repre, kateg, utv, pracv, tyduvs, tyduvi, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, " & _ "PriplOst , Prodm, [_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, GroupDevpp, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM 06_32KatInpQ " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND kateg = " & "'" & ZastKateg & "'", dbOpenDynaset) End If If SitZast = "ReprePrim" Or SitZast = "ReprePrimOscis" Then Set InpZast = dB.OpenRecordset("SELECT Loc, Oscis, obd, repre, kateg, utv, pracv, tyduvs, tyduvi, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, " & _ "PriplOst , Prodm, [_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, GroupDevpp, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM 06_33ReprePrimInpQ " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND repre = " & "'" & ZastRepre & "' AND utv = " & "'" & ZastUtvar & "'", dbOpenDynaset) End If If SitZast = "Repre" Or SitZast = "RepreOscis" Then Set InpZast = dB.OpenRecordset("SELECT Loc, Oscis, obd, repre, kateg, utv, pracv, tyduvs, tyduvi, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, " & _ "PriplOst , Prodm, [_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, GroupDevpp, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM 06_34RepreInpQ " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND repre = " & "'" & ZastRepre & "'", dbOpenDynaset) End If If SitZast = "RepreNs" Or SitZast = "RepreNsOscis" Then Set InpZast = dB.OpenRecordset("SELECT Loc, Oscis, obd, repre, kateg, utv, pracv, tyduvs, tyduvi, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, " & _ "PriplOst , Prodm, [_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, GroupDevpp, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM 06_35RepreNsInpQ " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND repre = " & "'" & ZastRepre & "' AND pracv = " & "'" & ZastNS & "'", dbOpenDynaset) End If If SitZast = "Ns" Or SitZast = "NsOscis" Then Set InpZast = dB.OpenRecordset("SELECT Loc, Oscis, obd, repre, kateg, utv, pracv, tyduvs, tyduvi, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, " & _ "PriplOst , Prodm, [_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, GroupDevpp, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM 06_36NsInpQ " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND pracv = " & "'" & ZastNS & "'", dbOpenDynaset) End If If SitZast = "Prim" Or SitZast = "PrimOscis" Then Set InpZast = dB.OpenRecordset("SELECT Loc, Oscis, obd, repre, kateg, utv, pracv, tyduvs, tyduvi, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, " & _ "PriplOst , Prodm, [_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, GroupDevpp, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM 06_37PrimInpQ " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND utv = " & "'" & ZastUtvar & "'", dbOpenDynaset) End If If SitZast = "KategNs" Or SitZast = "KategNsOscis" Then Set InpZast = dB.OpenRecordset("SELECT Loc, Oscis, obd, repre, kateg, utv, pracv, tyduvs, tyduvi, pevp, prevp, devpp, tarifUprTD, odprh, odprp, dovceh, neoh, ZakMzda, Presc, PriplSmenn, " & _ "PriplOst , Prodm, [_OdmHVpol], [_OdmDoplD], [_OdmMim], [_OdmPrisVyk], [_OdmPris], [_OdmVed], [_OdmVedOs], [_OdmZast], [_OdmOdb], [_OdmOst], Nah, [_NahDov], [_NahPN], [_NahOst], Poh, FondVed, " & _ "[_FvHodm], [_FvHodmT], [_FvQodm], [_FvOstOdm], MzdyOst, OON, [_OonPP], [_OonPC], [_OonOst], HrMzda, GroupDevpp, " & _ "PriplPr25, PriplPr50, PriplDvPr, PriplTrPr, PriplSv, PriplPsGe, PriplJIP, PriplProst, PriplPr50H, PriplMinMz, PriplVed, PriplNoc, PriplOs, PriplNPZat, [_FvIssOdm], [_FvIssExt] FROM 06_38NsKatInpQ " & _ "WHERE Obd >= " & " '" & PerFrom & "' AND pracv = " & "'" & ZastNS & "' AND kateg = " & "'" & ZastKateg & "'", dbOpenDynaset) End If If SitZast = "" Then Exit Sub Do Until InpZast.EOF If CStr(InpZast(2).Value) = CStr(PerFrom) Then PocetZast = PocetZast + InpZast(10).Value TarifZast = TarifZast + InpZast(12).Value End If InpZast.MoveNext Loop End If End Sub Public Sub CasoveRozliseni() Dim Par As Recordset Set dB = CurrentDb() Set Par = dB.OpenRecordset("SELECT AkronCode FROM 05_51NahCasRozlFinQ", dbOpenDynaset) Set Out = dB.OpenRecordset("TempCasRozl", dbOpenDynaset) PerBase = DLookup("ValText", "Parameters", "[Parameter]= " & "'ReportPeriod'") CurrentDb.Execute "DELETE * FROM TempCasRozl" k = 0 Do Until Par.EOF k = k + 1 Set Inp = dB.OpenRecordset("SELECT [05_50NahCasRozlQ].Loc, [05_50NahCasRozlQ].oscis, [05_50NahCasRozlQ].obd, [05_50NahCasRozlQ].pracv, [05_50NahCasRozlQ].kateg, [05_51NahCasRozlFinQ].CasRozlMth, [05_51NahCasRozlFinQ].CasRozlStart, [05_51NahCasRozlFinQ].AkronCode, " & _ "[05_50NahCasRozlQ].FvHodm, [05_50NahCasRozlQ].FvHodmT, [05_50NahCasRozlQ].FvQodm " & _ "FROM 05_50NahCasRozlQ, 05_51NahCasRozlFinQ " & _ "WHERE [05_51NahCasRozlFinQ].AkronCode = " & "'" & Par(0).Value & "'", dbOpenDynaset) Inp.MoveFirst Do Until Inp.EOF If (k = 1 And Inp(8).Value = 0) Or (k = 2 And Inp(9).Value = 0) Or (k = 3 And Inp(10).Value = 0) Then GoTo NextInp PerCalc = Inp(2).Value If Val(Left(PerCalc, 4)) - Val(Left(PerBase, 4)) >= 2 Then Out.AddNew Out(0).Value = Inp(0).Value Out(1).Value = Inp(1).Value Out(2).Value = PerCalc Out(3).Value = Inp(3).Value Out(4).Value = Inp(4).Value If k = 1 Then Out(5).Value = Inp(8).Value Out(6).Value = 0 Out(7).Value = 0 End If If k = 2 Then Out(5).Value = 0 Out(6).Value = Inp(9).Value Out(7).Value = 0 End If If k = 3 Then Out(5).Value = 0 Out(6).Value = 0 Out(7).Value = Inp(10).Value End If Out.Update Else For i = 1 To Inp(5).Value Out.AddNew Out(0).Value = Inp(0).Value Out(1).Value = Inp(1).Value Out(2).Value = PerCalc Out(3).Value = Inp(3).Value Out(4).Value = Inp(4).Value If k = 1 Then Out(5).Value = Inp(8).Value / Inp(5).Value Out(6).Value = 0 Out(7).Value = 0 End If If k = 2 Then Out(5).Value = 0 Out(6).Value = Inp(9).Value / Inp(5).Value Out(7).Value = 0 End If If k = 3 Then Out(5).Value = 0 Out(6).Value = 0 Out(7).Value = Inp(10).Value / Inp(5).Value End If Out.Update If Right(PerCalc, 2) = "12" Then PerCalc = Val(Left(PerCalc, 4)) + 1 & "01" Else If Val(Right(PerCalc, 2)) < 9 Then PerCalc = Left(PerCalc, 4) & "0" & Val(Right(PerCalc, 2)) + 1 Else PerCalc = Left(PerCalc, 4) & Val(Right(PerCalc, 2)) + 1 End If If Val(Left(PerCalc, 4)) - Val(Left(PerBase, 4)) >= 2 Then GoTo NextInp Next i End If NextInp: Inp.MoveNext Loop Par.MoveNext Loop Set Par = Nothing Set Inp = Nothing Set Out = Nothing Set dB = Nothing End Sub Public Sub AdjustOON() Set dB = CurrentDb() Set Inp = dB.OpenRecordset("SELECT Loc, Oscis, obd, pracv, kateg, OON, [_OonPP], [_OonPC], [_OonOst], OONbase, OONupd FROM 07_71AdjustOonInpQ", dbOpenDynaset) Set Out = dB.OpenRecordset("SELECT Loc, Oscis, obd, pracv, kateg, OON, [_OonPP], [_OonPC], [_OonOst] FROM 07_72AdjustOonOutQ", dbOpenDynaset) Do Until Inp.EOF If Not IsNull(Inp.Fields("OONbase").Value) Then If Inp.Fields("OONbase").Value <> 0 Then ParOON = Inp.Fields("OONupd").Value / Inp.Fields("OONbase").Value Out.Edit Out.Fields("OON").Value = Out.Fields("OON").Value * ParOON Out.Fields("_OonPP").Value = Out.Fields("_OonPP").Value * ParOON Out.Fields("_OonPC").Value = Out.Fields("_OonPC").Value * ParOON Out.Fields("_OonOst").Value = Out.Fields("_OonOst").Value * ParOON Out.Update End If End If Inp.MoveNext Out.MoveNext Loop Set Inp = Nothing Set Out = Nothing Set dB = Nothing Budget.DoplnitSouhSlozky_Nahrady Issue = Val(Left(DMax("BgtIssue", "07_04FcstBgtRecapSumQ"), 3)) + 1 & "_Korekce OON" Budget.UpdateRecap MsgBox ("Hotovo") End Sub