Index: APPS/common/KlantKost/impl/data/EnkelvoudigeFactor.cls.xml =================================================================== diff -u --- APPS/common/KlantKost/impl/data/EnkelvoudigeFactor.cls.xml (revision 0) +++ APPS/common/KlantKost/impl/data/EnkelvoudigeFactor.cls.xml (revision 1384) @@ -0,0 +1,48 @@ + + + +persistent +1 +%Persistent +0 + + +%String + + + +Datum:%Date + + + + +%Library.CacheStorage +^APPS.commonB5C.Enkelvoudige741D +EnkelvoudigeFactorDefaultData +^APPS.commonB5C.Enkelvoudige741D +^APPS.commonB5C.Enkelvoudige741I +^APPS.commonB5C.Enkelvoudige741S + +listnode + + +%%CLASSNAME + + +Naam + + +Factor + + + + + Index: APPS/common/KlantKost/impl/BezoekKostCalculator.cls.xml =================================================================== diff -u --- APPS/common/KlantKost/impl/BezoekKostCalculator.cls.xml (revision 0) +++ APPS/common/KlantKost/impl/BezoekKostCalculator.cls.xml (revision 1384) @@ -0,0 +1,70 @@ + + + + +JBL + 2011-05-30 +1 +APPS.common.KlantKost.impl.KostCalculator +0 + + +Jaar:%Integer,Maand:%Integer + + + + + +Verwijderen van de kosten van dat specifiek jaar en maand voor alle klanten. +Jaar:%Integer,Maand:%Integer + + + + + +Factor waarde opzoeken voor specifieke regio en datum +1 +FactorNaam:%String,Regio:%Integer,Datum:%Date +%Float +1 + + + + Index: APPS/common/KlantKost/impl/data/Factor.cls.xml =================================================================== diff -u --- APPS/common/KlantKost/impl/data/Factor.cls.xml (revision 0) +++ APPS/common/KlantKost/impl/data/Factor.cls.xml (revision 1384) @@ -0,0 +1,109 @@ + + + +persistent +1 +%Persistent +0 + + +%Date + + + +%String + + + +%String + + + +%String + + + +%Float + + + +1 +1 +ClassName,ID,Naam,GeldigVanaf +1 + + + +ObjectOfPersistentClass:%Persistent,Naam:%String,Waarde:%Integer,GeldigVanaf:%Date +1 +1 +%Status + + + + + +Indien voor huidige periode de waarde moet blijven gelde, deze nog twee jaar in de toekomst laten gelden. +1 +Datum:%Date +%Date +1 + + + + + +Zoek waarde die geldig is op die specifieke datum. +%SQLQuery +ClassName:%String,ID:%Integer,Naam:%String,Datum:%Date += Factor1.GeldigVanaf + AND :Datum < APPS_common_KlantKost_impl_data.Factor_BepaalGeldigTot((Select MIN(Factor2.GeldigVanaf) FROM APPS_common_KlantKost_impl_data.Factor Factor2 Where Factor1.ClassName = Factor2.ClassName AND Factor1.ID = Factor2.ID AND Factor1.Naam = Factor2.Naam AND Factor2.GeldigVanaf > Factor1.GeldigVanaf)) + ORDER BY Factor1.GeldigVanaf]]> + + + +%Library.CacheStorage +^APPS.common.KlantKosB5C.FactorD +FactorDefaultData +^APPS.common.KlantKosB5C.FactorD +^APPS.common.KlantKosB5C.FactorI +^APPS.common.KlantKosB5C.FactorS + + +%%CLASSNAME + + +Bedrag + + +GeldigVanaf + + +Naam + + +Waarde + + + + + Index: Derde/Agenda/Agenda.cls.xml =================================================================== diff -u -r1133 -r1384 --- Derde/Agenda/Agenda.cls.xml (.../Agenda.cls.xml) (revision 1133) +++ Derde/Agenda/Agenda.cls.xml (.../Agenda.cls.xml) (revision 1384) @@ -21,6 +21,20 @@ %Date + +%Integer +1 + Set {*}=(##class(TECH.DateTime).Jaar({Datum})) +1 + + + +%Integer +1 + Set {*}=(##class(TECH.DateTime).Maand({Datum})) +1 + + Derde.Klant.Klant @@ -41,6 +55,15 @@ %Time + + +Duurtijd in uren. +%Integer +1 + Set {*}=((({TijdTot}-{TijdVan})/60)/60) +1 + + %String Index: APPS/common/KlantKost/impl/KlantKostService.cls.xml =================================================================== diff -u --- APPS/common/KlantKost/impl/KlantKostService.cls.xml (revision 0) +++ APPS/common/KlantKost/impl/KlantKostService.cls.xml (revision 1384) @@ -0,0 +1,136 @@ + + + + +JBL + 2011-05-30 +APPS.common.KlantKost.KlantKostService +0 + + +APPS.common.KlantKost.impl.MaandKostAggregator + + + +initvalue:%CacheString +1 +1 +%Status + + + + + +elke nacht (na backup) moeten de klantkosten van de voorbije kalendermaand herberekend worden + + + + +Jaar:%Integer,Maand:%Integer + + + + +Jaar:%Integer,Maand:%Integer + + + + + +Maak factoren éénmalig aan in cache databank voor het berekenen van kosten. +Dit moet slechts éénmalig worden uitgevoerd +1 +%Status + Totale kostprijs vertegenwoordiging per uur + Set ContactFactor = ##class(APPS.common.KlantKost.impl.data.MeervoudigeFactor).%New("Contact") + Set Status = ContactFactor.%Save() + If ($$$ISERR(Status)) w $$ParseStatus^vhLib(Status) + + /// KostprijsRestTijdFactor => ( Totale kostprijs v d vertegenwoordiging x (resterende tijd / totale werktijd ) ) / totaal aantal bezoeken in referentieperiode + Set KostprijsRestTijdFactor = ##class(APPS.common.KlantKost.impl.data.MeervoudigeFactor).%New("KostprijsResterendeTijd") + Set Status = KostprijsRestTijdFactor.%Save() + If ($$$ISERR(Status)) w $$ParseStatus^vhLib(Status) + + /// IP + For Regio = 2,3 { + Set Factor = ##class(APPS.common.KlantKost.impl.data.Factor).%New(ContactFactor,"Regio"_Regio,53.05,GeldigVanaf) + Do Factor.%Save() + + Set Factor = ##class(APPS.common.KlantKost.impl.data.Factor).%New(KostprijsRestTijdFactor,"Regio"_Regio,133.7315328791,GeldigVanaf) + Do Factor.%Save() + } + /// KS BE + For Regio = 11,12,14,15,16,17 { + Set Factor = ##class(APPS.common.KlantKost.impl.data.Factor).%New(ContactFactor,"Regio"_Regio,36.52,GeldigVanaf) + Do Factor.%Save() + + Set Factor = ##class(APPS.common.KlantKost.impl.data.Factor).%New(KostprijsRestTijdFactor,"Regio"_Regio,57.6405793977,GeldigVanaf) + Do Factor.%Save() + } + /// KS NL + For Regio = 21,22,23,24,25,26,27 { + Set Factor = ##class(APPS.common.KlantKost.impl.data.Factor).%New(ContactFactor,"Regio"_Regio,32.38,GeldigVanaf) + Do Factor.%Save() + + Set Factor = ##class(APPS.common.KlantKost.impl.data.Factor).%New(KostprijsRestTijdFactor,"Regio"_Regio,43.3604735424,GeldigVanaf) + Do Factor.%Save() + } + /// ARCH + For Regio = 30,31 { + Set Factor = ##class(APPS.common.KlantKost.impl.data.Factor).%New(ContactFactor,"Regio"_Regio,39.88,GeldigVanaf) + Do Factor.%Save() + + Set Factor = ##class(APPS.common.KlantKost.impl.data.Factor).%New(KostprijsRestTijdFactor,"Regio"_Regio,255.7984623719,GeldigVanaf) + Do Factor.%Save() + } + + Quit $$$OK +]]> + + + + +Maakt de task aan voor de scheduler van caché +Dit moet slechts éénmalig worden uitgevoerd +w ##class(APPS.common.KlantKost.impl.KlantKostService).InitTask() +1 +%Status + + + + Index: APPS/common/KlantKost/KlantKostService.cls.xml =================================================================== diff -u --- APPS/common/KlantKost/KlantKostService.cls.xml (revision 0) +++ APPS/common/KlantKost/KlantKostService.cls.xml (revision 1384) @@ -0,0 +1,52 @@ + + + + +JBL + 2011-05-30 +Interface naar de klantkosten. +N.B. Voorlopig wordt enkel het opbouwen opgeroepen van buitenaf. +Leze is voorlopig enkel voor de KPI klant-product, en zal low level gebeuren. + +De "Bereken..." methods gaan zowel individuele kost items berekenen als de betreffende aggregaten up-to-date brengen. +%RegisteredObject +0 + + + +elke nacht (na backup) moeten de klantkosten van de voorbije kalendermaand herberekend worden +1 + + + + +1 +Jaar:%Integer,Maand:%Integer + + + + +1 +Jaar:%Integer,Maand:%Integer + + + + +%Library.CacheStorage +^APPS.common7B4.KlantKostSer66CD +KlantKostServiceDefaultData +^APPS.common7B4.KlantKostSer66CD +^APPS.common7B4.KlantKostSer66CI +^APPS.common7B4.KlantKostSer66CS + +listnode + + +%%CLASSNAME + + + + + Index: APPS/common/KlantKost/impl/MonsterKostCalculator.cls.xml =================================================================== diff -u --- APPS/common/KlantKost/impl/MonsterKostCalculator.cls.xml (revision 0) +++ APPS/common/KlantKost/impl/MonsterKostCalculator.cls.xml (revision 1384) @@ -0,0 +1,26 @@ + + + + +JBL + 2011-05-30 + +1 +APPS.common.KlantKost.impl.KostCalculator +0 + + +Jaar:%Integer,Maand:%Integer + + + + +Jaar:%Integer,Maand:%Integer + + + + Index: APPS/common/KlantKost/enu/KostType.cls.xml =================================================================== diff -u --- APPS/common/KlantKost/enu/KostType.cls.xml (revision 0) +++ APPS/common/KlantKost/enu/KostType.cls.xml (revision 1384) @@ -0,0 +1,33 @@ + + + + +JBL + 2011-05-30 +datatype +1 +%String +0 + + +,Bezoek,Monster + + + +;Bezoek,Monster + + + +1 +expression + + + + +1 +expression + + + + Index: JBL KPI Klant Product Anlayse Kosten.prj.xml =================================================================== diff -u --- JBL KPI Klant Product Anlayse Kosten.prj.xml (revision 0) +++ JBL KPI Klant Product Anlayse Kosten.prj.xml (revision 1384) @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: vhUnitTest/APPS/common/KlantKost/TestFactor.cls.xml =================================================================== diff -u --- vhUnitTest/APPS/common/KlantKost/TestFactor.cls.xml (revision 0) +++ vhUnitTest/APPS/common/KlantKost/TestFactor.cls.xml (revision 1384) @@ -0,0 +1,73 @@ + + + + +JBL : testen van factoren +Do ##class(vhUnitTest.Manager).RunTest("/display=all","APPS.common.KlantKost.TestFactor") +1 +vhUnitTest.TestCase +0 + + +%Status + + + + +%Status + + + + + + + + Index: vhUnitTest/APPS/common/KlantKost/TestBezoekKosten.cls.xml =================================================================== diff -u --- vhUnitTest/APPS/common/KlantKost/TestBezoekKosten.cls.xml (revision 0) +++ vhUnitTest/APPS/common/KlantKost/TestBezoekKosten.cls.xml (revision 1384) @@ -0,0 +1,108 @@ + + + + + Do ##class(vhUnitTest.Manager).RunTest("/display=all","APPS.common.KlantKost.TestBezoekKosten") +1 +vhUnitTest.TestCase +0 + + +%String + + + +%String + + + +%String + + + +%Status + + + + +%Status + + + + + +Bezoekkosten voor één maand voor testklant1000 berekenen en vgl met maandkost. + + + + Index: APPS/common/KlantKost/impl/data/IndividueelKostItem.cls.xml =================================================================== diff -u --- APPS/common/KlantKost/impl/data/IndividueelKostItem.cls.xml (revision 0) +++ APPS/common/KlantKost/impl/data/IndividueelKostItem.cls.xml (revision 1384) @@ -0,0 +1,58 @@ + + + + +JBL + 2011-05-30 +persistent +1 +%Persistent +0 + + +%Date + + + +%Integer + + + +APPS.common.KlantKost.enu.KostType + + + +%Float + + + +%Library.CacheStorage +^APPS.commonB5C.IndividueelK7A2D +IndividueelKostItemDefaultData +^APPS.commonB5C.IndividueelK7A2D +^APPS.commonB5C.IndividueelK7A2I +^APPS.commonB5C.IndividueelK7A2S + +listnode + + +%%CLASSNAME + + +Datum + + +Klant + + +Kost + + +KostType + + +KlantNr + + + + + Index: Stat/OmzetKlantProductMaand.cls.xml =================================================================== diff -u -r1117 -r1384 --- Stat/OmzetKlantProductMaand.cls.xml (.../OmzetKlantProductMaand.cls.xml) (revision 1117) +++ Stat/OmzetKlantProductMaand.cls.xml (.../OmzetKlantProductMaand.cls.xml) (revision 1384) @@ -2,7 +2,7 @@ -Maandverkoop per klant en product per maand +Maandverkoop per klant en product per maand persistent VHOpslag %Library.Persistent @@ -178,7 +178,7 @@ 1 - + @@ -192,6 +192,12 @@ Set HuidigVan = $zdh(HuidigVan,3) Set HuidigTot = $zdh(HuidigTot,3) } + + Set %HorologVorigVan = VorigVan + Set %HorologVorigTot = VorigTot + Set %HorologHuidigVan = HuidigVan + Set %HorologHuidigTot = HuidigTot + Set %VOKLId=0 Set %VOVorigVan=$$EXTDATE^vhDTyp(VorigVan,"DM4")_" " @@ -320,6 +326,11 @@ Set Row=Row_IOmzetVorigList_IOmzetHuidigList_IMargeVorigList_IMargeHuidigList Set Row=Row_$LB(CatalogusInfo) + + /// Kosten toevoegen + Set KostprijsVertegenw = ..GeefKostprijsVertegenwKlant(KLNR,##class(APPS.common.KlantKost.enu.KostType).Bezoek(),%HorologHuidigVan,%HorologHuidigTot) + Set AlleKosten = ..GeefKostprijsVertegenwKlant(KLNR,,%HorologHuidigVan,%HorologHuidigTot) + Set Row=Row_$LB(KostprijsVertegenw,AlleKosten) Quit $$$OK ]]> @@ -377,8 +388,40 @@ ]]> + + +Geef voor de klant de kostprijs van de bezoeken (= kostprijs vergegenw klant) tussen de opgegeven data. +1 +KlantNr:%Integer,KostType:APPS.common.KlantKost.enu.KostType="",HuidigVan:%Date,HuidigTot:%Date +%Float += ?) OR (Jaar = ? AND MAAND <= ?)) AND KlantNr = ? ") + Do RSet.Execute(KostType,##class(TECH.DateTime).Jaar(+HuidigVan),MaandVan,##class(TECH.DateTime).Jaar(+HuidigVan),MaandTot,KlantNr) + } + /// Alle kosten berekenen + Else{ + Do RSet.Prepare("Select SUM(Kost) As Kostprijs from APPS_common_KlantKost_impl_data.MaandKost WHERE ((Jaar = ? AND MAAND >= ?) OR (Jaar = ? AND MAAND <= ?)) AND KlantNr = ? ") + Do RSet.Execute(##class(TECH.DateTime).Jaar(+HuidigVan),MaandVan,##class(TECH.DateTime).Jaar(+HuidigTot),MaandTot,KlantNr) + } + If (RSet.Next()){ + Set Kostprijs = RSet.Data("Kostprijs") + } + If (Kostprijs = "") Set Kostprijs = 0 + Quit Kostprijs +]]> + + +SQL kosten bezoek laatste 12 maand JBL + 2011-04-13 1 KorttekstPrefix:%String Index: APPS/common/KlantKost/impl/data/BezoekKostItem.cls.xml =================================================================== diff -u --- APPS/common/KlantKost/impl/data/BezoekKostItem.cls.xml (revision 0) +++ APPS/common/KlantKost/impl/data/BezoekKostItem.cls.xml (revision 1384) @@ -0,0 +1,47 @@ + + + + +JBL + 2011-05-30 +persistent +1 +APPS.common.KlantKost.impl.data.IndividueelKostItem +0 + + + +Verwijzing naar Derde.Agenda.Agenda.ID +%String + + + +Datum:%Date,KlantNr:%Integer,Kost:%Integer,BezoekID:%String +1 +1 +%Status + + + + +%Library.CacheStorage +BezoekKostItemDefaultData + +listnode +"BezoekKostItem" + +Bezoek + + +BezoekID + + + + + Index: APPS/common/KlantKost/impl/MaandKostAggregator.cls.xml =================================================================== diff -u --- APPS/common/KlantKost/impl/MaandKostAggregator.cls.xml (revision 0) +++ APPS/common/KlantKost/impl/MaandKostAggregator.cls.xml (revision 1384) @@ -0,0 +1,55 @@ + + + + +JBL + 2011-06-01 +1 +%RegisteredObject +0 + + +Jaar:%Integer,Maand:%Integer,KostType:APPS.common.KlantKost.enu.KostType + + + + +Jaar:%Integer,Maand:%Integer,KostType:APPS.common.KlantKost.enu.KostType + + + + +%SQLQuery +Jaar:%Integer,Maand:%Integer,KostType:APPS.common.KlantKost.enu.KostType + Select KlantNr, + KostType, + DatePart('yy',Datum) As Jaar, + DatePart('mm',Datum) As Maand, + Count(1) As AantalBezoeken, + SUM(Kost) As TotaalKost + FROM APPS_common_KlantKost_impl_data.IndividueelKostItem + WHERE DatePart('yy',Datum) = :Jaar + AND DatePart('mm',Datum) = :Maand + AND KostType = :KostType + GROUP BY KlantNr + + + Index: APPS/common/KlantKost/impl/data/MeervoudigeFactor.cls.xml =================================================================== diff -u --- APPS/common/KlantKost/impl/data/MeervoudigeFactor.cls.xml (revision 0) +++ APPS/common/KlantKost/impl/data/MeervoudigeFactor.cls.xml (revision 1384) @@ -0,0 +1,73 @@ + + + + +JBL + 2011-05-30 + +Voorbeeld : De vaste kost van één bezoek kan verschillen per regio. +persistent +1 +%Persistent +0 + + +%String + + + +1 +1 +Naam +1 + + + +Naam:%String +1 +1 +%Status + + + + + +Zoek FactorWaarde met Naam (subnaam) die geldig is op die datum +Naam:%String,Datum:%Date +%Float + + + + +%Library.CacheStorage +^APPS.commonB5C.MeervoudigeF6DBD +MeervoudigeFactorDefaultData +^APPS.commonB5C.MeervoudigeF6DBD +^APPS.commonB5C.MeervoudigeF6DBI +^APPS.commonB5C.MeervoudigeF6DBS + +listnode + + +%%CLASSNAME + + +Naam + + +Factor + + + + + Index: APPS/common/KlantKost/impl/KostCalculator.cls.xml =================================================================== diff -u --- APPS/common/KlantKost/impl/KostCalculator.cls.xml (revision 0) +++ APPS/common/KlantKost/impl/KostCalculator.cls.xml (revision 1384) @@ -0,0 +1,31 @@ + + + + +JBL + 2011-05-30 + +De calculator weet +- dde brondata te vinden +- welke formule toe te passen +- welke factoren te gebruiken in de formule + +Implementatie van de calculaties zal geval per geaval verschillen. +In het eenvoudigste geval kan een SQL-statement volstaan. + +1 +%RegisteredObject +0 + + +1 +Jaar:%Integer,Maand:%Integer + + + + +1 +Jaar:%Integer,Maand:%Integer + + + Index: APPS/common/KlantKost/impl/data/MaandKost.cls.xml =================================================================== diff -u --- APPS/common/KlantKost/impl/data/MaandKost.cls.xml (revision 0) +++ APPS/common/KlantKost/impl/data/MaandKost.cls.xml (revision 1384) @@ -0,0 +1,77 @@ + + + + +JBL + 2011-06-01 +persistent +1 +%Persistent +0 + + +%Integer + + + +%Integer + + + +%Integer + + + +APPS.common.KlantKost.enu.KostType + + + +%Float + + + +Jaar:%Integer,Maand:%Integer,KlantNr:%Integer,KostType:APPS.common.KlantKost.enu.KostType,Kost:%Float +1 +1 +%Status + + + + +%Library.CacheStorage +^APPS.common.KlantB5C.MaandKostD +MaandKostDefaultData +^APPS.common.KlantB5C.MaandKostD +^APPS.common.KlantB5C.MaandKostI +^APPS.common.KlantB5C.MaandKostS + +listnode + + +%%CLASSNAME + + +Jaar + + +KlantNr + + +Kost + + +KostType + + +Maand + + + + + Index: APPS/common/KlantKost/impl/data/IndividueelKostItem/BezoekKostItem.cls.xml =================================================================== diff -u --- APPS/common/KlantKost/impl/data/IndividueelKostItem/BezoekKostItem.cls.xml (revision 0) +++ APPS/common/KlantKost/impl/data/IndividueelKostItem/BezoekKostItem.cls.xml (revision 1384) @@ -0,0 +1,15 @@ + + + + +JBL + 2011-05-30 +persistent +1 +APPS.common.KlantKost.impl.data.IndividueelKostItem +0 + + +%String + + + Index: APPS/common/KlantKost/impl/data/MonsterKostItem.cls.xml =================================================================== diff -u --- APPS/common/KlantKost/impl/data/MonsterKostItem.cls.xml (revision 0) +++ APPS/common/KlantKost/impl/data/MonsterKostItem.cls.xml (revision 1384) @@ -0,0 +1,15 @@ + + + + +JBL + 2011-05-30 +persistent +1 +APPS.common.KlantKost.impl.data.IndividueelKostItem +0 + + +%String + + +