#include PRGACNTs #include APPS.TBXWeb #define RefStartNew "\\\START" #define IsAllowedBrowser(%v) (%v?1(.E1"MSIE".E,.E1"Firefox".E,.E1"Opera".E,.E1"Chrome".E,.E1"Trident".E)) #define IsAllowedMacBrowser(%v) (%v?1(.E1"Safari".E,.E1"Firefox".E,.E1"Opera".E)) OnPreHTTP() #define CSPPage ##class(%CSP.Page) New Ref,RefNew,RefArray,tmpRq,tmpTransfStatus,tmpBadQS,blnValidKlant,DefaultTaal Set %RemoteIP=$G(%request.CgiEnvs("REMOTE_ADDR")) Set %ClientIP=%RemoteIP ; IP voor DebugWindow // Spam Robots worden geblokkeerd Quit:($$RedirectSpamRobots^cspBasis.Library(%RemoteIP)) 0 Do ophInitLookups^cspBasis.TBX.DecodeURL.tmpDev Set:($D(%session.Data("TransfStatus")))&&($D(%request.Data("TRANSF",1))) tmpTransfStatus=%session.Data("TransfStatus") Kill %session.Data Set:($D(tmpTransfStatus)) %session.Data("TransfStatus")=tmpTransfStatus ;set $ztrap="OnError" Set TBXContext=##class(APPS.TBXWeb.TBXContext).InitFromHttpRequest() Set sDomain=TBXContext.GeefHttpRequestDomein() Set sDomCVT=TBXContext.GeefWebDomein() Set sDomVERW=TBXContext.GeefDomeinVerwerker() Set sDomKLNr=TBXContext.GeefDomeinKlantNummer() Set LadeDesignControleur=##class(APPS.TBXWeb.Utils.impl.LadeDesignControleur).%New(TBXContext) Set Taal="E" Set DefaultTaal=TBXContext.GeefDefaultTaal() Set blnNoAccess=TBXContext.IsOngeldigDomein() ; ONBEKEND DOMEIN - NIET TOEGELATEN !!! Quit:(blnNoAccess) 1 Set blnVHEPN=(sDomVERW="VHEPN") Set blnHEIN=(sDomVERW="HEIN") Set blnLMC=(sDomVERW="LMC") Set blnDUPO=(sDomVERW="DUPO") Set blnHELMY=(sDomVERW="HELMY") Set blnHFLE=(sDomVERW="HFLE") Set blnSFS=(sDomVERW="SFS") Set blnMBHO=(sDomVERW="MBHO") Set blnHFLB=(sDomVERW="HFLB") Set Taal=$G(%request.Data("Taal",1),DefaultTaal) If ($$$LCase(Taal)?1"http:".E) Do ; attempt to hack the website . Set tmpBadQS="Taal="_Taal . Set Taal="E" Do ##class(TECH.Context.RuntimeContext).Instance().ZetTaal(Taal) Set HIST=$G(%request.Data("HIST",1),0) Set blnHist=0 ; ($G(HIST)>0) Set MainMode=$G(MainMode,$$$mmToggleHistOrd) Set Ref=$G(%request.Data("REF",1)) Set RefNew=$G(%request.Data("REF",1),$$$RefStartNew) ; Als REF niet meegegeven is, StartNew (dfl) gebruiken Set %session.Data("BeursUser")=(TBXContext.IsDomeinVHEPN())&&##class(cspBasis.GAProdTBox).IsBeursUser() If 1,($$$LCase(Ref)?1"http:".E) Do ; attempt to hack the website . Set tmpBadQS="Ref="_Ref ; Convert QueryString to Array: tmpRq(name)=value Set name="" For Set name=$O(%request.Data(name)) Quit:(name="") Merge tmpRq(name)=%request.Data(name,1) Kill tmpRq("CSPToken") ; URL from OPTIMA (?) Do ophDataOPTIMA ; Analyse REF Set Ref=$$ophGetRef^cspBasis.TBX.DecodeURL.tmpDev(Ref) ; Get Ref decrypted If $L(Ref) Do . Do ophRefToArray^cspBasis.TBX.DecodeURL.tmpDev(Ref,.RefArray) . Set:($G(RefArray("VERW"))="") RefArray("VERW")=TBXContext.GeefDomeinVerwerker() . Set VERW=RefArray("VERW") . Set KLNr=$G(RefArray("KLNR")) . Set wsID=$G(RefArray("WSID")) . . Quit:($$$Not(TBXContext.KlantGegevensViaDataOpt())) ; :($$$Not(blnLMC||blnSFS||blnMBHO)) . . ; Alleen voor OPTIMA / SFS --> KlantNr from Data/Storage . If $L($G(KLNrOptima)) Do . . Set KLNr=KLNrOptima . . Set RefArray("KLNR")=KLNr . . Set Ref=$$ophArrayToRef^cspBasis.TBX.DecodeURL.tmpDev(.RefArray) . . Set:($L($G(tmpRq("REF")))) tmpRq("REF")=$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($LB(KLNr,VERW,wsID,$G(RefArray("MODE")))) . . Kill tmpRq("DATAOPT") . . ;Do ophBuildSwitchTLArray ; Once again, but with the NEW QueryString-values . Else If (TBXContext.IsKlantIDIngevuld(KLNr))&&($G(%request.Data("Taal",1))="") Do . . Set KLMini=##class(cspBasis.GAProdTBox).GetKlantData(TBXContext.GeefDomeinVerwerker(),KLNr, TBXContext, $LB("Stg","NoAction")) . . Set:($IsObject(KLMini))&&(KLMini.Taal?1(1"N",1"F",1"E",1"D")) Taal=KLMini.Taal . . Set KLMini="" Else Do . Set KLNr="" ; HRefs to switch Taal Set tmpRq("Taal")=Taal Set %session.Data("Taal")=Taal Do ophBuildSwitchTLArray Quit:($$ophWebSiteBlocked()) "" // Else continue... If ($L($G(tmpBadQS))) Do Quit 1 . Set blnNoAccess=1 . Set KLNr=$G(KLNr) . Set sMode=$G(sMode,"START") . Set wsID=$G(wsID) . Set VERW=TBXContext.GeefDomeinVerwerker() ; $G(VERW,sDomVERW) . Do ophAddToLog("!MAINPAGE!") . Set msg="Invalid request URL parameter."_$$$CRLF_"Bad QueryString: "_tmpBadQS_$$$CRLF_"Ref="_$G(%request.Data("REF",1))_$$$CRLF_"Taal="_$G(%request.Data("Taal",1))_$$$CRLF_"!!! Page blocked - No access !!!" . Do ophSendAlertMail(msg) set blnWSErrors = 0 Set WSOrd=$S($L($G(wsID)):##class(WS.TBX.OrderAbstract).%OpenId(wsID), 1:"") Set TBXOrdersDto=##class(APPS.TBXWeb.dto.TBXOrderLijst).%New($S($IsObject(WSOrd):##class(TECH.ListUtils).CreateListOfObjects(WSOrd),1:""),TBXContext) if ($IsObject(WSOrd))&&($$$Not(WSOrd.IsBonTypeGeldig())) { Set msg="WARNING : wrong BonType for TBX.Order ID="_wsID Set msg=msg_$$$CRLF Set msg=msg_$$$CRLF_" Het BonType van dit order moet manueel op OFF of BBON gezet worden. Mogelijk ook andere velden foutief (t.g.v. probleem met javascript)." Set msg=msg_$$$CRLF_" De gebruiker kan de MainPage wel bekijken, maar kan zijn order niet doorsturen. Andere acties zullen waarschijnlijk ook falen." Set msg=msg_$$$CRLF Do ophSendAlertMail(msg) } if ($IsObject(WSOrd))&&($$$Not(WSOrd.IsAankoopPrijsIngevuld())) { Set msg="WARNING : Inconsistent prices for TBX.Order ID="_wsID Set msg=msg_$$$CRLF Set msg=msg_$$$CRLF_" De prijzen in dit order zijn niet consistent. AankoopPrijs is leeg, maar VerkoopPrijs is wel ingevuld." ;Set msg=msg_$$$CRLF_" De gebruiker kan de MainPage wel bekijken, maar kan zijn order niet doorsturen. Andere acties zoals 'Wijzigen order' zijn wel mogelijk." Set msg=msg_$$$CRLF_" De gebruiker kan de MainPage wel bekijken en kan zijn order nog wel doorsturen. Andere acties zoals 'Wijzigen order' zijn ook mogelijk. Indien Haefele, dan zal import in hun SAP-systeem falen." Set msg=msg_$$$CRLF Do ophSendAlertMail(msg) Set:((blnHFLB || blnHFLE || blnVHEPN) && ($IsObject($G(%request)))) %request.Data("RECALC",1)="1" } ;Do ophSetHeaderLogo(WSOrd) Set:($G(VERW)="") VERW=TBXContext.GeefDomeinVerwerker() Kill arShow ; Analyse REF (part 2) Set blnNoAccess=0 Set sMode=$G(RefArray("MODE")) If sMode="" { Set blnNoAccess=1 } ElseIf sMode="START" { Do ophMMStart } ElseIf sMode="COMPLETE" { Do ophMMComplete(TBXOrdersDto) } ElseIf sMode="PROCESS" { Do ophMMProcess(TBXOrdersDto) } ElseIf sMode="VIEW" { Do ophMMView(TBXOrdersDto) } ElseIf sMode="CONFIRM" { Do ophMMConfirm } Else { Set blnNoAccess=1 } Quit:(blnNoAccess) 1 If %request.UserAgent?1(1.E1"Macintosh".E,1.E1"iPad;".E,1.E1"iPhone;".E) { Set blnAllowedBrowser=$$$IsAllowedMacBrowser(%request.UserAgent) } Else { Set blnAllowedBrowser=$$$IsAllowedBrowser(%request.UserAgent) ; Browser list : MSIE, Firefox, Opera, Chrome, Safari } If (TBXContext.IsDomeinSFS())&&($G(KLNr)=10001) { Set blnAllowedBrowser=1 ; Testklant van SFS } If 'blnAllowedBrowser Do . Set blnNoAccess=1 . New sUserAgent . Set sUserAgent=%request.UserAgent . For iWB="Chrome","Safari","MSIE","Firefox","Opera" Set sUserAgent=$$$Replace(sUserAgent,iWB,""_iWB_"") . Set NoAccessMsg="" . Set NoAccessMsg=NoAccessMsg_"This website is not accessible when using ""Google Chrome"" or ""Safari"" .

"_$$$CRLF . Set NoAccessMsg=NoAccessMsg_"  The web browser you are using is:
  "_sUserAgent_"

"_$$$CRLF . Set NoAccessMsg=NoAccessMsg_$$$CRLF_"  Please use ""Internet Explorer"", ""Firefox"" or ""Opera"" as web browser." . Do ophAddToLog("!MAINPAGE!") . Else If (TBXContext.KlantGegevensViaDataOpt())&&($L($G(%request.Data("DATAOPT",1))))&&($G(KLNrOptima)="") Do ; Bad encryption for Optima/SFS customer . Set blnNoAccess=1 . Do ophAddToLog("!MAINPAGE!") Quit:(blnNoAccess) 1 Set blnNoAccess=$$$Not(TBXContext.IsVerwerkerToegelaten(VERW)) Quit:(blnNoAccess) 1 Do ophAnalyseWSOrdKLNr(WSOrd,KLNr,.blnNoAccess,.NoAccessMsg) ; andere parameters globaal doorgeven Set:($L($G(NoAccessMsg)))&&(sMode'="PROCESS") NoAccessMsg="" ; Enkel tonen indien sMode="PROCESS" Quit:(blnNoAccess) 1 ; Else Do ophAlgVoorw Do ophAddToLog() Quit 1 OnError set $ztrap="" // Domein kon niet geconverteerd worden - NIET TOEGELATEN !!! Set sDomVERW="" Set sMode="" Set Taal="E" Set blnNoAccess=1 Quit 1 ophAddToLog(Actie) ; meestal gebruikt via Default Set Actie=$G(Actie,"MAINPAGE") Set:(sMode="START")&&($G(blnHist)) sMode="HIST" ; &&(MainMode=$$$mmToggleHistOrd) Set lbExtras="" Set:('$G(blnAllowedBrowser,1)) lbExtras=lbExtras_$LB("WebBrowser="_%request.UserAgent) Do ##class(cspBasis.GAProdTBox).AddToLog(Actie,sDomain,KLNr,sMode,wsID,VERW,Taal,"",lbExtras) ; Actie="MAINPAGE" Quit ophWebSiteBlocked() If '$$AppIsEnabled^cspBasis.Library("WWW-TBX","MAIN"_$S(TBXContext.IsDomeinSFS():"-SFS",1:""),%RemoteIP) Do Quit 1 . Set KLNr=$G(KLNr), sMode=$G(sMode), wsID=$G(wsID), VERW=$G(VERW) . Do ophAddToLog("#MAINPAGE#") . Do RedirectPage^cspBasis.Library("/Under_Construction.htm") Quit 0 ophBuildSwitchTLArray New TL,tmpAr Merge tmpAr=tmpRq For TL="N","F","E","D" Do . If TL=Taal Do Quit .. Set arUrl("SwitchTL",TL)=TL . ; Else . Set tmpAr("Taal")=TL . Set arUrl("SwitchTL",TL)=""_TL_"" Quit ophSetHeaderLogo(WSOrd) Quit:('$IsObject(WSOrd)) Set WSLn=WSOrd.Lijnen.GetNext("") Set:($IsObject(WSLn))&&(##class(BL.PR.GA.TandemBox).DesignCodeFromDS(WSLn.ItemDS)="I") HeaderLogo="" ; "I" Quit ophDataOPTIMA Quit:('TBXContext.KlantGegevensViaDataOpt()) Quit:($G(%request.Data("DATAOPT",1))="") New KLMini,tmpTaal,msg,sDomVERW Kill %OptimaMsg Set KLMini=##class(cspBasis.GAProdTBox).GetKlantData(TBXContext.GeefDomeinVerwerker(),"",TBXContext,$LB("Ext","CleanSave")) ; In case of "Bad Encryption", try getting KLData from storage If '$IsObject(KLMini) Do . Set KLNr=$G(%OptimaVar("KLNr")) . Set:(TBXContext.IsKlantIDIngevuld(KLNr)) KLMini=##class(cspBasis.GAProdTBox).GetKlantData(TBXContext.GeefDomeinVerwerker(),KLNr,TBXContext,$LB("Stg","NoAction")) . Set sDomVERW=TBXContext.GeefDomeinVerwerker() . Set msg="WARNING : Bad encryption for "_$S(sDomVERW="LMC":"Optima",1:sDomVERW)_" customer (n° "_$G(KLNr)_")" . Set msg=msg_$$$CRLF_"Ref : "_($$ophGetRef^cspBasis.TBX.DecodeURL.tmpDev(Ref))_$$$CRLF_"Enc. Data : "_$G(%OptimaVar("EncData"))_$$$CRLF_"Decrypted Data : "_$G(%OptimaVar("Data"))_$$$CRLF_"KLNr via Lookup: "_$G(%OptimaVar("KLNrViaLookup")) . Set msg=msg_$$$CRLF_"Client IP : "_$G(%RemoteIP)_$S(TBXContext.IsIPvanOptima($G(%RemoteIP)):" (Optima)", 1:"") . Set msg=msg_$$$CRLF_$$$CRLF_"Data retrieved from storage: "_$S($IsObject(KLMini):"YES", 1:"NO") . Do ophSendAlertMail(msg_$$$CRLF,$S($IsObject(KLMini):$LB("ICT_Meldingen@vanhoecke.be"), 1:$LB("wv@vanhoecke.be"))) . Set KLNr=$S($IsObject(KLMini):KLMini.Nummer, 1:"") . Kill %OptimaVar If $IsObject(KLMini) Do . Set KLNrOptima=KLMini.Nummer . Set tmpTaal=KLMini.Taal Else Do . Set blnShow=TBXContext.HeeftToegangTotFixOptimaPage($G(%RemoteIP)) ; $$$OptimaAccess . Do MShowFixOptima(blnShow) Set:($G(tmpTaal)?1(1"N",1"F",1"E",1"D")) Taal=tmpTaal Set KLMini="" Quit MShowFixOptima(Visible) Quit:('Visible) Kill arShow2 New tmpAr Merge tmpAr=tmpRq Kill tmpAr("HIST") Set arShow2("FixOptima","BTN")=Visible Set arShow2("FixOptima","HREF")="FixOPTIMA.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) Quit ophAnalyseWSOrdKLNr(WSOrd,MatchKLNr,blnNoAccess,ErrMsg) ; blnNoAccess en ErrMsg als .local doorgeven New arValues,msg Quit:($$ophCheckWSOrdKLNr(.WSOrd,.MatchKLNr,.arValues)) 1 ; OK ; Else ; Not OK ==> Log NoAccess + Send Mail Set blnNoAccess=1 Set ErrMsg=$G(arValues(0,"ERROR")) Do ophAddToLog("!MAINPAGE!") Set msg="De main.csp pagina heeft een ongeldige code gedetecteerd."_$$$CRLF Set msg=msg_"De gegevens worden niet getoond."_$$$CRLF Set msg=msg_""_$$$CRLF Set msg=msg_$$$ArrayTT("Var",.arValues)_$$$CRLF Do ophSendAlertMail(msg) Quit 0 ophCheckWSOrdKLNr(WSOrd,MatchKLNr,arValues) Quit:('$IsObject($G(WSOrd))) 1 New blnOK,OrdDomVERW,OrdKLNr,msg Kill arValues Set OrdDomVERW=$LG(##class(WS.TBX.Order).DomainLookUp($$TBXDomainCVT^cspBasis.Library(WSOrd.WebDomain),$LB("VERW")),1) Set arValues("WSOrder","Domain")=WSOrd.WebDomain Set arValues("WSOrder","DomVERW")=OrdDomVERW Set arValues("WSOrder","KLNr")=WSOrd.KLNummer Set arValues("WSOrder","ID")=WSOrd.%Id() Set arValues("WSOrder","IngaveTS")=WSOrd.IngaveTijdStip Set arValues("REF","Domain")=sDomain Set arValues("REF","DomVERW")=TBXContext.GeefDomeinVerwerker()_" ("_TBXContext.GeefDomeinKlantNummer()_")" Set arValues("REF","KLNr")=MatchKLNr Set arValues("REF","WSID")=wsID Set arValues("REF","MODE")=sMode Set arValues("REF","VERW")=VERW Set arValues("REF","RqData")=$G(%request.Data("REF",1)) Set arValues(1,"ClientIP")=$G(%RemoteIP) Set arValues(1,"blnHist")=$G(blnHist) ;d WL^vhDBG($$$LCVT($LB(WSOrd.WebDomain,$$TBXDomainCVT^cspBasis.Library(WSOrd.WebDomain),OrdDomVERW,TBXContext.GeefDomeinVerwerker()))) If TBXContext.GeefDomeinVerwerker()'=OrdDomVERW Do Quit 0 . // Onbekend of foutief domein - GEEN TOEGANG !!! WSOrder moet steeds binnen WebDomein blijven !!! . Set arValues(0,"ERROR")="Onbekend of foutief domein" ; Else ; ==> sDomVERW=OrdDomVERW Quit:($$IsInternIPAdres^cspBasis.Library(%RemoteIP))&&(MatchKLNr=1000) 1 Set OrdKLNr=WSOrd.KLNummer Set blnOK=0 If TBXContext.IsDomeinVHEPN() Do Quit blnOK . If OrdKLNr>0 Do . . Set blnOK=$S(MatchKLNr>0:(OrdKLNr=MatchKLNr),1:(sMode="PROCESS")&&(VERW="VHEPN")) . Else Do ; OrdKLNr="" . . Set blnOK=$S(MatchKLNr>0:((sMode="PROCESS")&&(VERW="VHEPN")), 1:1) . Set arValues(0,"ERROR")="KlantNummers komen niet overeen (VH)." Else If TBXContext.IsDomeinHEIN() Do Quit blnOK . Set blnOK=(OrdKLNr=MatchKLNr) . Set arValues(0,"ERROR")="KlantNummers komen niet overeen (HEIN)." Else If TBXContext.KlantGegevensViaDataOpt() Do Quit blnOK . Set blnOK = (OrdKLNr=MatchKLNr) || (MatchKLNr="") || ((sMode="PROCESS")&&(VERW="VHEPN")&&(TBXContext.GeefDomeinKlantNummer()=MatchKLNr)) . Set arValues(0,"ERROR")="KlantNummers komen niet overeen (DataOpt)." Else If TBXContext.AlleenToegangZonderLogin() Do Quit blnOK . Set blnOK=(OrdKLNr=MatchKLNr) . Set arValues(0,"ERROR")="KlantNummers komen niet overeen (Anon)." ; Else Set arValues(0,"ERROR")="Onbekende controle!." Quit 0 ophSendAlertMail(msg,lbToSpecial) // Send mail to ICT_SupportTBX@vanhoecke.be New From,lbTo,Subject,Body,ServerPrefix,sc Set ServerPrefix="" ; Set ServerPrefix="["_$$$UCase($$$Server)_"] " --> wordt nu opgelost in de lib SendMiniMail^... () Set From="""TBX Alert"" " Set lbTo=$G(lbToSpecial,$LB("wv@vanhoecke.be")) ; "ICT_SupportTBX@vanhoecke.be") Set Subject=ServerPrefix_"TandemBOX - No Access - "_$ZDT($H,4) Set Body="" Set Body=Body_"TandemBOX MainPage ALERT"_$$$CRLF Set Body=Body_""_$$$CRLF If $L($G(msg)) Do . Set Body=Body_msg_$$$CRLF . Set Body=Body_""_$$$CRLF Set Body=Body_"--- End of message ---"_$$$CRLF Set sc=$$SendMiniMailXtd^cspBasis.Library(From,lbTo,Subject,Body,0,0) Quit ophBuildToggleHistAndOrder(wsIDNew) #define KLNrClean $S(KLNr=$$$KLNrListAll:"", 1:KLNr) Quit:(KLNr="") New tmpAr,blnNew,blnOrder,blnProcess Set blnHist=($G(HIST)>0) ; Globale variabele !!! Set blnProcess=(sMode="PROCESS") ;Quit:(blnProcess)&&(blnHist=0) Set blnNew=(sMode="START") Set blnOrder=(sMode="COMPLETE")||(sMode="VIEW") ;d WL^vhDBG("hist: "_blnNew_" "_blnOrder_" "_blnHist_" "_KLNr) If blnNew && 'blnHist Do . ; New --> Show Hist . Merge tmpAr=tmpRq . Kill tmpAr("HIST") . Set tmpAr("HIST")=1 . If KLNr=$$$KLNrListAll Do . . Kill tmpAr("REF") . . Set tmpAr("REF")=$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($LB(KLNr,VERW,,"COMPLETE")) . Set arUrl("ToggleHist")="?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) . ;d WL^vhDBG(blnNew_" "_blnOrder_" "_blnHist_$$$ArrayTT("arUrl")) If blnNew && blnHist Do . ; Hist + New --> Hide Hist . Merge tmpAr=tmpRq . Kill tmpAr("HIST") . Set tmpAr("HIST")=0 . Set arUrl("ToggleHist")="?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) . ; Hist + New --> Show Order . Merge tmpAr=tmpRq . Kill tmpAr("REF") . ;Set tmpAr("REF")=$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($LB($$$KLNrClean,VERW,wsIDNew,"COMPLETE")) ; ,WizMode)) . Set tmpAr("REF")=$$$QSREFReplace ; String to be replaced by a calculated value . Kill tmpAr("HIST") . Set tmpAr("HIST")=$S(MainMode=$$$mmToggleHistOrd:0, 1:1) . Set arUrl("ShowOrder")="?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) . ;d WL^vhDBG(blnNew_" "_blnOrder_" "_blnHist_$$$ArrayTT("arUrl")) If blnOrder && blnHist Do . ; Hist + Order + New --> Hide Hist . Merge tmpAr=tmpRq . Kill tmpAr("HIST") . Set tmpAr("HIST")=0 . If KLNr=$$$KLNrListAll Do . . Kill tmpAr("REF") . . Set tmpAr("REF")=$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($LB(KLNr,VERW,,$S(sMode="COMPLETE":"START", 1:sMode))) . Set arUrl("ToggleHist")="?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) . ; Hist + Order + New --> Hide Order . Merge tmpAr=tmpRq . Kill tmpAr("REF") . Set tmpAr("REF")=$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($LB($$$KLNrClean,VERW,,$S(sMode="COMPLETE":"START", 1:sMode))) . Kill tmpAr("HIST") . Set tmpAr("HIST")=1 . Set arUrl("HideOrder")="?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) . ; Hist + Order + New --> Show Order . Merge tmpAr=tmpRq . Kill tmpAr("REF") . ;Set tmpAr("REF")=$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($LB($$$KLNrClean,VERW,wsIDNew,"COMPLETE")) . Set tmpAr("REF")=$$$QSREFReplace ; String to be replaced by a calculated value . Kill tmpAr("HIST") . Set tmpAr("HIST")=$S(MainMode=$$$mmToggleHistOrd:0, 1:1) . Set arUrl("ShowOrder")="?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) If blnOrder && 'blnHist Do . ; Order + New --> Show Hist [1] . Merge tmpAr=tmpRq . If MainMode=$$$mmToggleHistOrd Do .. Kill tmpAr("REF") .. Set tmpAr("REF")=$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($LB($$$KLNrClean,VERW,,$S(sMode="COMPLETE":"START", 1:sMode))) . Kill tmpAr("HIST") . Set tmpAr("HIST")=1 . Set arUrl("ToggleHist")="?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) . ; Order + New --> Show Hist [2] --> New+Hist . ; --> implemented in Show Hist [1] . ; Order + New --> Hide Order --> New . Merge tmpAr=tmpRq . Kill tmpAr("REF") . Set tmpAr("REF")=$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($LB($$$KLNrClean,VERW,,$S(sMode="COMPLETE":"START", 1:sMode))) . Kill tmpAr("HIST") . Set tmpAr("HIST")=0 . Set arUrl("HideOrder")="?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) . ;d WL^vhDBG(blnNew_" "_blnOrder_" "_blnHist_$$$ArrayTT("arUrl")) If blnProcess && blnHist Do . ; Hist --> Show Order . Merge tmpAr=tmpRq . Kill tmpAr("REF") . Set tmpAr("REF")=$$$QSREFReplace ; String to be replaced by a calculated value . Kill tmpAr("HIST") . Set tmpAr("HIST")=0 . Set arUrl("ShowOrder")="?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) . ; Hist --> Hide Hist ; in MainHist.csp a second condition will prevent the user from hiding the History List. . Merge tmpAr=tmpRq . Kill tmpAr("HIST") . Set tmpAr("HIST")=0 . Set arUrl("ToggleHist")="?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) If blnProcess && 'blnHist Do . ; Order --> Show Hist [1] . Merge tmpAr=tmpRq . Kill tmpAr("HIST") . Set tmpAr("HIST")=1 . Kill tmpAr("REF") . Set tmpAr("REF")=$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($LB($$$KLNrClean,VERW,,sMode)) . Set arUrl("ToggleHist")="?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) ;d WL^vhDBG(blnNew_" "_blnOrder_" "_blnProcess_" "_blnHist_$$$ArrayTT("arUrl")) If 'blnNew Do . Merge tmpAr=tmpRq . Kill tmpAr("REF") . Set tmpAr("REF")=$$$QSREFReplace ; String to be replaced by a calculated value . Kill tmpAr("HIST") . Set tmpAr("HIST")=0 . Set arUrl("TemplateUrlVoorGroepOrder")="?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) Quit ophMMStart ; Main - Mode - Start ; Info NotRegUserInfo Do MShowNotRegUser Do MShowKnownCustomer(1) ; Button NewOrder Do MShowNewOrder(1) Do ophBuildToggleHistAndOrder() Do MShowGroepBestellen((blnHist=1),$G(KLNr)) Quit MShowNotRegUser Set arShow("NotRegUserInfo","INFO")=(TBXContext.IsDomeinVHEPN())&&(KLNr="") Set arShow("NotRegUserInfoOPTIMA","INFO")=(TBXContext.KlantGegevensViaDataOpt())&&(KLNr="") ; &&('$D(%session.Data("DA TAOPT")))) Quit ophMMComplete(TBXOrdersDto) New WSOrd,blnDynaplugERR,IsDesignBeschikbaar,DS Set WSOrd=$S($L(wsID):##class(WS.TBX.OrderAbstract).%OpenId(wsID), 1:0) ; Show Order Details Set arShow("DisplayOrder","DTL")=$IsObject(WSOrd) Do MShowKnownCustomer(1) ; Info BrutoPrijsHein / NotRegUserInfo Set arShow("BrutoPrijsHein","INFO")=(TBXContext.IsDomeinHEIN()) Set arShow("ToonPrijsNietMeeCPVoorStdHein","INFO")=0 If $IsObject(WSOrd) { Set arShow("ToonPrijsNietMeeCPVoorStdHein","INFO")=(TBXContext.IsDomeinHEIN())&&(WSOrd.GeefNietMeeleveren("CorpusProfiel"))&&(WSOrd.HeeftStandaardLaden()) } Set arShow("ToonMeldingExtraKost40EurPerPallet","INFO")=(TBXContext.IsDomeinHEIN()) Set blnDynaplug=0 /*($IsObject(WSOrd))&&(WSOrd.WebURL="DYNAPLUG IMPORT") */ If blnDynaplug Do . Set blnDynaplugERR=(''$G(blnWSErrors,0)) Else Do . Set blnDynaplugERR=0 New IsAankoopPrijsIngevuld,blnQuit Set IsDesignBeschikbaar=('$IsObject(WSOrd))||(WSOrd.IsLadeDesignBeschikbaar(.DS,LadeDesignControleur)) Set ZijnAlleGeleidersBeschikbaar=('$IsObject(WSOrd))||(WSOrd.ZijnAlleGeleidersBeschikbaar()) Set IsAankoopPrijsIngevuld=($IsObject(WSOrd))&&(WSOrd.IsAankoopPrijsIngevuld()) Set blnOFFVervallen=($IsObject(WSOrd))&&(WSOrd.IsOfferteVervallen($H,.RedenVervallen)) If blnOFFVervallen || ($$$Not(IsAankoopPrijsIngevuld)) Do Quit:($G(blnQuit,0)) . // Als de "Recalc"-flag (via QueryString) op "1" staat, dan worden de prijzen van het WSOrd herberekend tijdens deze OnPreHTTP() . // In deze situatie wordt dan een page-reload gestuurd. . Set blnQuit=$$ophMMCompleteRecalcOfferte() ; Else Prepare buttons Do MShowNotRegUser Do:(IsDesignBeschikbaar) MShowVervaldagOFFText(TBXOrdersDto,Taal) ; Positie van de tekst t.o.v. de buttons Set TextPos=$S($IsObject(WSOrd)&&(WSOrd.IsSubmitted()):"LEFT", KLNr=$$$KLNrListAll:"LEFT", 1:"RIGHT") ; Button RecalcOrder Do MShowRecalcOrder(blnOFFVervallen,$G(RedenVervallen)) ; Button PrintPage Do MShowPrintPage(1,blnOFFVervallen||blnDynaplugERR||$$$Not(IsDesignBeschikbaar)||$$$Not(ZijnAlleGeleidersBeschikbaar)) ; Button BookmarkPage Do MShowBookmarkPage((KLNr=""),WSOrd) ; Button Show XML Do MShowExportXML((TBXContext.IsBeschikbaarExportXML())&&((KLNr=$$$TBoxWebKlantNrVHEPN)||(KLNr=$$$TBoxWebKlantNrHEIN)) ) ; Button Submit Do MShowSubmit(1,WSOrd,(blnOFFVervallen||blnDynaplugERR),TBXOrdersDto,Taal) ; Button Modify Order Do MShowModifyOrder(1,"COMPLETE") ; Button Create New from Order Do MShowNewFromOrder('blnDynaplug) ; Info InvalidWSID Set arShow("InvalidWSID","INFO")=('wsID) ; Button NewOrder Do MShowNewOrder(0) Do MShowSwitchToStartMode('blnDynaplug) Do ophBuildToggleHistAndOrder() Do MShowGroepBestellen(1,KLNr) Set WSOrd="" Quit ophMMCompleteRecalcOfferte() #define IsTextOnly(%v) (%v'?.E1C.E) New lbResult,tmpAr,sc If $G(%request.Data("RECALC",1))="1" Do Quit 1 . Set blnNoAccess=1 ; Globale variabele !!! . Merge tmpAr=tmpRq . Kill tmpAr("RECALC") . Quit:(wsID="") . Do ophOrdToAdminSetSesData . // RECALC ORDER : . Set %session.Data("RecalcOFFStatus")="ACTIVE" . d WL^vhDBG("Start RecalcOFF(). Status: "_$G(%session.Data("RecalcOFFStatus"))) . Set lbResult=##class(cspBasis.GAProdTBox).WSOrdRecalc(wsID) ; $LB("",$$$ERROR($$$GeneralError,"MyMessage")) ; . Set %session.Data("RecalcOFFStatus")="DONE" . d WL^vhDBG("Finished RecalcOFF(). Status: "_$G(%session.Data("RecalcOFFStatus"))) . If ($LG(lbResult,1)="") Do .. Set sc=$LG(lbResult,2) ; Kan %Status, TextOnly of $LB() zijn .. Set arJSExec(1)="alert("_$$$QuoteJS("Recalc OFF:")_"+'\n'+"_$$$QuoteJS($S(sc="":"No message.", $$$IsTextOnly($TR(sc,$$$CRLF,"")):sc, $$$ISERR(sc):$$ParseStatus^vhLib(sc), 1:$$$LCVT(sc)))_");" .. Set arJSExec(2)="document.location.replace("_$$$QuoteJS("main.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr))_");" . Else Do .. Set %response.Redirect="main.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) ; Use %response.Redirect() instead of js:location.replace() ; Else Quit 0 ophMMProcess(TBXOrdersDto) New WSOrd,blnProcessVH,blnQuit,blnAllowBulk,IsDesignBeschikbaar,DS Set blnProcessVH=(TBXContext.IsDomeinVHEPN())||(VERW="VHEPN") If blnProcessVH Do Quit:($G(blnQuit,0)) . Set blnQuit=$$ophMMProcessFlowVHEPN ;Else : prepare buttons/info Do MShowKnownCustomer(1) Do ophBuildToggleHistAndOrder() Set WSOrd=$S($L(wsID):##class(WS.TBX.OrderAbstract).%OpenId(wsID), 1:0) Quit:('$IsObject(WSOrd)) ; Show Order Details Set arShow("DisplayOrder","DTL")=$IsObject(WSOrd) Set IsDesignBeschikbaar=(WSOrd.IsLadeDesignBeschikbaar(.DS,LadeDesignControleur)) Do MShowVervaldagOFFText(TBXOrdersDto,Taal) ; Positie van de tekst t.o.v. de buttons Set TextPos="RIGHT" ; $S($IsObject(WSOrd)&&(WSOrd.IsSubmitted()):"LEFT", 1:"RIGHT") Set lbBulkConfig=TBXContext.BulkConfigOptiesUitbreiden(TBXContext.GeefBulkConfigOpties(KLNr)) Set blnAllowBulk=1 ; Button SwitchToViewMode Do MShowSwitchToViewMode(('TBXContext.IsDomeinVHEPN())&& 1) ; &&(WSOrd.BonType="INKP") ; Button PrintPage Do MShowPrintPage(1,$$$Not(IsDesignBeschikbaar)) ;VERW="VHEPN") ; Button Show XML Do MShowExportXML(VERW="VHEPN") ; Button Calculate Order Do MShowCalcOrder((VERW'="HEIN")&&(WSOrd.BonType="OFFAV")) ; Button Modify Order Do MShowModifyOrder(WSOrd.BonType'?1(1"INKP",1"BBON")) ; Button Process --> SubmitToVHEPN / SubmitToAdmin) If blnProcessVH Do . ; Button SubmitToAdmin . Do:($$IsInternIPAdres^cspBasis.Library(%RemoteIP)) MShowSubmitAdminVerw(blnProcessVH&&(WSOrd.BonType'="OFFAV"),WSOrd) . ; Button ChangeBulk . Set arShow("ChangeBulk","BTN")=($$IsInternIPAdres^cspBasis.Library(%RemoteIP)) . If arShow("ChangeBulk","BTN") Do . . Do ophOrdToAdminSetSesData . . ;Set arShow("ChangeBulk","EXPAND")=0 Else Do . ; Button SubmitToVHEPN . Do MShowSubmitToVHEPN(TBXContext.SubmitToVHviaCspPage(),WSOrd) . ; URL voor overzichtslijst AANKOOP: . ; - http://www.tandem-box.com/VHISIE/TBX/Main.csp?Taal=N&HIST=1&REF=qF8LH5lEjVrpq_S/iFYEjapyttl87p0Y2mRRqi9B3i4- . ; - http://tbx.destil.nl/VHISIE/TBX/Main.csp?Taal=N&HIST=1&REF=_KoQNXLGoSL1UjEAean5dapyttl87p0Y2mRRqi9B3i4- . ; - http://tbx.du-pont.be/VHISIE/TBX/Main.csp?Taal=N&HIST=1&REF=wpkU0aPBib2L8HVjJIlrUPVgilNucnVjd1bJfJG4BO0- . ; - http://tandembox.hafele.nl/VHISIE/TBX/Main.csp?Taal=N&HIST=1&REF=O905FsBp8_pRmRTFnHNy_/VgilNucnVjd1bJfJG4BO0- . ; - http://tbx.sfsunimarket.biz/VHISIE/TBX/main.csp?Taal=D&HIST=1&REF=8H9XyVmkVvtSXca7DjMJpAFknWUyneyi4koTLULFuSk- Set WSOrd="" Quit ophMMProcessFlowVHEPN() New lbResult,tmpAr,sc ;d:($D(%request.Data("TRANSF",1))) WL^vhDBG("ProcessVH QS(""TRANSF"")="_%request.Data("TRANSF",1)_" TransfStatus="_$G(%session.Data("TransfStatus"))) If $G(%request.Data("TRANSF",1))="AGAIN;ADM" Do Quit 1 . New TransfAgainYES,TransfAgainNO,msgAgain . Set blnNoAccess=1 ; Globale variabele !!! . Merge tmpAr=tmpRq . Kill tmpAr("TRANSF") . Set TransfAgainNO="main.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) ; Back to Orig page . Set tmpAr("TRANSF")="ADM2" . Set TransfAgainYES="main.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) ; Navigate to "TRANSF=ADM" page . Set msgAgain="Opnieuw naar ADMIN?" . Set arJSExec(2)="if (confirm("_$$$QuoteJS(msgAgain)_")) { document.location.replace("_$$$QuoteJS(TransfAgainYES)_"); } else { document.location.replace("_$$$QuoteJS(TransfAgainNO)_"); }" . Kill %session.Data("TransfStatus") ; Else If $G(%request.Data("TRANSF",1))?1(1"ADM",1"ADM2") Do Quit 1 . Set blnNoAccess=1 ; Globale variabele !!! . Merge tmpAr=tmpRq . Kill tmpAr("TRANSF") . Quit:(wsID="") . . Do ophOrdToAdminSetSesData . Set blnBusy=##class(WS.TBX.Order).TransfStatusCheckBusy(wsID) . If (blnBusy) Do Quit ; ($G(%session.Data("TransfStatus"))'="") . . Set arJSExec(1)="alert("_$$$QuoteJS("Transfer in progress. Even geduld of contacteer ICT.")_"+'\n');" . . Set arJSExec(2)="document.location.replace("_$$$QuoteJS("main.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr))_");" . Set %session.Data("TransfStatus")="ACTIVE" . Set scStatus=##class(WS.TBX.Order).TransfStatusSetByID(wsID,"ACTIVE") . set $ztrap="onTransferError" . new OrderService set OrderService = ##class(APPS.TBXWeb.OrderService).%New() . do OrderService.Transfereer(wsID) . set $ztrap="" . Do oxxAddToLog("TRANSF") . Set %session.Data("TransfStatus")="DONE" . Set scStatus=##class(WS.TBX.Order).TransfStatusSetByID(wsID,"") . Set %response.Redirect="main.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) ; Use %response.Redirect() instead of js:location.replace() Quit 0 onTransferError set $ztrap="" new Exception set Exception = ##class(TECH.ExceptionHandler).Catch() new TransfStatus Do oxxAddToLog("!TRANSF!") If Exception.GeefExceptionCode()=##class(TECH.enu.ExceptionCode).InvalidInput() { do ##class(vhLib.Logger).%New("TBXWeb").WarningMail("Exceptie bij Transfereer (=OrderToAdmin) "_$G(wsID)_". ",Exception.ToString()) Set TransfStatus="DONE" } Else { do ##class(vhLib.Logger).%New("TBXWeb").ErrorMail("Error bij Transfereer (=OrderToAdmin) "_$G(wsID)_". ",Exception.ToString()) Set TransfStatus="ERROR" } Set %session.Data("TransfStatus")=TransfStatus Set scStatus=##class(WS.TBX.Order).TransfStatusSetByID($G(wsID),"") set arJSExec(1)="alert("_$$$QuoteJS("Transfer to ADMIN:")_"+'\n'+"_$$$QuoteJS(Exception.GeefOmschrijving())_");" set arJSExec(2)="document.location.replace("_$$$QuoteJS("main.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr))_");" quit oxxAddToLog(Actie) New sDomain,lbExtras Set lbExtras="" Set:($L($G(%Location))) lbExtras=lbExtras_$LB("SoapServer="_%Location) Set:($L($G(%Action)) ) lbExtras=lbExtras_$LB("SoapAction="_%Action) Set:($L($G(OptiePRS))) lbExtras=lbExtras_$LB("Opties="_OptiePRS) Set:($L($G(SoapErrorMsg))) lbExtras=lbExtras_$LB("Msg="_SoapErrorMsg) If '$IsObject($G(%request)) Do . Set %request=##class(%CSP.Request).%New() . Do ##class(cspBasis.GAProdTBox).AddToLog(Actie,$G(arData("DOMAIN")),$G(arData("KLNR")),$G(arData("MODE")),wsID,$G(arData("VERW")),,,lbExtras) . Set %request="" k %request Else Do . Do ##class(cspBasis.GAProdTBox).AddToLog(Actie,$G(%session.Data("DOMAIN")),$G(%session.Data("KLNR")),$G(%session.Data("MODE")),wsID,$G(%session.Data("VERW")),,,lbExtras) Quit ophMMView(TBXOrdersDto) New WSOrd Do ophBuildToggleHistAndOrder() Do MShowNotRegUser Set WSOrd=$S($L(wsID):##class(WS.TBX.Order).%OpenId(wsID), 1:0) Quit:('$IsObject(WSOrd)) ; Show Order Details Set arShow("DisplayOrder","DTL")=$IsObject(WSOrd) Set arShow("BrutoPrijsHein","INFO")=(TBXContext.IsDomeinHEIN()) Do MShowVervaldagOFFText(TBXOrdersDto,Taal) ; Button PrintPage Do MShowPrintPage(1) Set WSOrd="" Quit ophMMConfirm Set blnNoAccess=1 Quit ophBuildQS(lbRefNew) Set lbRefNew=$G(lbRefNew) New tmpRq,tmpRefAr,KLNr,VERW,wsID,sMode,QS Do ophRefToArray^cspBasis.TBX.DecodeURL.tmpDev(Ref,.tmpRefAr) Set KLNr=$LG(lbRefNew,1,$G(tmpRefAr("KLNR"))) Set VERW=$LG(lbRefNew,2,$G(tmpRefAr("VERW"))) Set wsID=$LG(lbRefNew,3,$G(tmpRefAr("WSID"))) Set sMode=$LG(lbRefNew,4,$G(tmpRefAr("MODE"))) Merge tmpRq=%request.Data Kill tmpRq("CSPToken") Kill:(TBXContext.KlantGegevensViaDataOpt()) tmpRq("DATAOPT") Kill tmpRq("HIST") Kill tmpRq("REF") Set tmpRq("REF")=$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($LB(KLNr,VERW,wsID,sMode)) Set QS=##class(cspBasis.GAProdTBox).CQueryString(.tmpRq) ; $$$CSPPage.Link("Main.csp",.tmpRq) Quit $TR($TR($system.Encryption.Base64Encode(QS),$$$CRLF,""),"+=","_-") ophAlgVoorw Quit:('TBXContext.ToonAlgemeneVoorwaarden()) New Intern,VTL Set Intern="AlgVoorw"_$CASE(TBXContext.GeefDomeinVerwerker(), "VHEPN":"VH", :TBXContext.GeefDomeinVerwerker()) Set arShow("AlgVoorw","INFO")=##class(cspBasis.GAProdTBox).WebTextValue(Intern,Taal,"L") Quit ophOrdToAdminSetSesData Set %session.Data("DOMAIN")=sDomCVT ; TBXContext.GeefWebDomein() Set %session.Data("VERW")=VERW Set %session.Data("KLNR")=KLNr Set %session.Data("WSID")=wsID Set %session.Data("MODE")=sMode Quit MShowGroepBestellen(Visible,KLNr) Quit:('TBXContext.ToonKnopGegroepeerdBestellen(KLNr)) New tmpAr Merge tmpAr=tmpRq Kill tmpAr("REF") Set tmpAr("Taal")=Taal Set tmpAr("IsGroepBestelling")=1 Set arShow("SubmitGroep","BTN")=Visible Set arShow("SubmitGroep","HREF")="MailSend.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) Set arShow("SubmitGroep","TEXT")=##class(cspBasis.GAProdTBox).WebTextValue("GroepVerzenden",Taal,"L") Set %session.Data("VERW")=VERW Set %session.Data("KLNR")=KLNr ;Set %session.Data("IsGroepBestelling")=1 quit MShowNewOrder(Visible) Quit:((TBXContext.AlleenToegangMetLogin())&&('TBXContext.IsKlantIDIngevuld(KLNr))) Quit:(KLNr=$$$KLNrListAll)&&($$$Not((sMode="START")&&(TBXContext.AlleenToegangZonderLogin()))) Quit:('$G(blnValidKlant,1)) New tmpAr Merge tmpAr=tmpRq Kill tmpAr("HIST") Kill tmpAr("REF") Set tmpAr("REF")=$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($LB($S(KLNr=$$$KLNrListAll:"", 1:KLNr),VERW,,"A")) Set tmpAr("REFMN")=$$ophBuildQS($S(KLNr=$$$KLNrListAll:$LB(""),1:$LB())_$LB(,,"COMPLETE")) ; Create REFMN (to pass to Wizard.csp) Kill:(TBXContext.KlantGegevensViaDataOpt()) tmpAr("DATAOPT") Set arShow("NewOrder","BTN")=Visible ;d WL^vhDBG("NewOrder tmpAr:"_$$$ArrayTT("tmpAr")) Set arShow("NewOrder","HREF")="Access.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) Quit MShowSwitchToStartMode(Visible) New tmpAr Merge tmpAr=tmpRq Kill tmpAr("HIST") Kill tmpAr("REF") Set tmpAr("REF")=$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($LB(KLNr,VERW,"","START")) If $L($G(Taal)) Do . Kill tmpAr("Taal") . Set tmpAr("Taal")=Taal Set arShow("SwitchStartMode","BTN")=Visible Set arShow("SwitchStartMode","HREF")="?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) Quit MShowSwitchToViewMode(Visible) New tmpAr Merge tmpAr=tmpRq Kill tmpAr("HIST") Kill tmpAr("REF") Set tmpAr("REF")=$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($LB(KLNr,VERW,wsID,"VIEW")) If $L($G(Taal)) Do . Kill tmpAr("Taal") . Set tmpAr("Taal")=Taal Set arShow("SwitchViewMode","BTN")=Visible Set arShow("SwitchViewMode","HREF")="?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) Quit MShowPrintPage(Visible,blnOFFVervallen) New tmpAr,blnShowAKP If $G(blnOFFVervallen,0) Do Quit . Set arShow("PrintPage","BTN")=Visible . Set arShow("PrintPage","HREF")="" ; Else Merge tmpAr=tmpRq Kill tmpAr("HIST") Kill tmpAr("REF") Set tmpAr("REF")=$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($LB(KLNr,VERW,wsID,"P")) Set blnShowAKP=(sMode="PROCESS")&&('TBXContext.IsDomeinVHEPN())&&(VERW'?1(1"LMC")) Set %session.Data("ALLOWAKP")=blnShowAKP Set:(blnShowAKP) tmpAr("SHAKP")=1 If $L($G(Taal)) Do . Kill tmpAr("Taal") . Set tmpAr("Taal")=Taal Set arShow("PrintPage","BTN")=Visible Set arShow("PrintPage","HREF")="Access.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) Quit MShowBookmarkPage(Visible,WSOrd) New BookmTxt Set BookmTxt="TandemBOX - "_$S($IsObject(WSOrd):WSOrd.OrderNr_" - "_WSOrd.GeefOrderReferentie(), 1:"") ; WSOrd.OrderNrCalc() Set arShow("BookmarkPage","BTN")=Visible Set arShow("BookmarkPage","HREF")="javascript:window.external.AddFavorite(location.href,'"_BookmTxt_"');" Quit MShowSubmit(Visible,WSOrd,IsErrorOfVervallen,TBXOrdersDto,Taal) Quit:('$IsObject(WSOrd)) Quit:('$G(blnValidKlant,1)) Quit:($$$Not(WSOrd.IsBonTypeGeldig())) New IsSubmitBtnDisabled,OnvoldoendeBestelhoeveelheid New tmpAr,InternText,InternInfo,blnIsSubmitted Merge tmpAr=tmpRq Set tmpAr("Taal")=Taal Set tmpAr("KLNR")=KLNr Set tmpAr("IsGroepBestelling")=0 Set:(WSOrd.BonType="OFF")&&('TBXContext.VerzendOfferteAlsAanvraag()) tmpAr("OFFTOBBON")=1 ; OFFTOBBON in de betekenis van "Goed voor order" Set %session.Data("Taal")=Taal Set %session.Data("WSID")=wsID Set %session.Data("KLNR")=KLNr Set %session.Data("VERW")=VERW Set %session.Data("VERW")=VERW ;Set %session.Data("IsGroepBestelling")=0 Kill tmpAr("REF") Set OnvoldoendeBestelhoeveelheid=$$$Not(TBXOrdersDto.HeeftVoldoendeBestelhoeveelheid()) If OnvoldoendeBestelhoeveelheid { Set arShow("Submit","JS_MSGBOX_TITEL")=TBXOrdersDto.BestellingNietGeplaatstJsTitel(Taal) Set arShow("Submit","JS_MSGBOX_TEKST")=TBXOrdersDto.BestellingNietGeplaatstJsTekst(Taal) } Set IsSubmitBtnDisabled=(IsErrorOfVervallen)||(OnvoldoendeBestelhoeveelheid) If IsSubmitBtnDisabled { Set arShow("Submit","BTN")=Visible Set arShow("Submit","HREF")="" Set arShow("Submit","TEXT")=##class(cspBasis.GAProdTBox).WebTextValue("VerzendenBBON",Taal,"L") Set arShow("Submit","INFO")="" Set arShow("SubmitAgain","BTN")=0 } else { Set blnIsSubmitted=(WSOrd.IsSubmitted()) ; (WSOrd.SubmitTS>0) ; Set arShow("Submit","BTN") =(Visible)&&('blnIsSubmitted) Set arShow("SubmitAgain","BTN")=(Visible)&&(blnIsSubmitted) if Visible { Set arShow("Submit","HREF")="MailSend.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) Set InternText=$S((WSOrd.BonType="OFF")&&('TBXContext.VerzendOfferteAlsAanvraag()):"VerzendenBBON", 1:"Verzenden"_WSOrd.BonType) Set InternInfo=$S((WSOrd.BonType="OFF")&&('TBXContext.VerzendOfferteAlsAanvraag()):"VerzendInfoBBON", 1:"VerzendInfo"_WSOrd.BonType) Set arShow("Submit","TEXT")=##class(cspBasis.GAProdTBox).WebTextValue(InternText,Taal,"L") Set arShow("Submit","INFO")=##class(cspBasis.GAProdTBox).WebTextValue(InternInfo,Taal,"L") Set:(arShow("Submit","INFO")="~") arShow("Submit","INFO")="" Set arShow("SubmitAgain","INFO")=##class(cspBasis.GAProdTBox).WebTextValue("GevegensVerzonden",Taal,"O")_", "_arShow("Submit","INFO")_"." Set arShow("SubmitAgain","HREF")="MailSend.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) } } Quit MShowRecalcOrder(Visible,RedenVervallen) Quit:('Visible) Quit:('$G(blnValidKlant,1)) Quit:(RedenVervallen=##class(APPS.TBXWeb.enu.RedenOfferteVervallen).DesignNietBeschikbaar()) New tmpAr Merge tmpAr=tmpRq Kill tmpAr("RECALC") Set tmpAr("RECALC")="1" Kill tmpAr("HIST") Set arShow("RecalcOrder","BTN")=Visible Set arShow("RecalcOrder","HREF")="main.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) Quit MShowCalcOrder(Visible) quit /* New tmpAr Merge tmpAr=tmpRq Kill tmpAr("HIST") Kill tmpAr("REF") Set tmpAr("REF")=$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($LB(KLNr,VERW,wsID,"W")) Set tmpAr("REFMN")=$$ophBuildQS("") ; Create REFMN (to pass to Wizard.csp) Set arShow("CalcOrder","BTN")=Visible Set arShow("CalcOrder","HREF")="Access.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) */ Quit MShowModifyOrder(Visible,tmpMode) #define blnComplete $G(tmpMode)="COMPLETE" Quit:('$G(blnValidKlant,1)) Quit:('$IsObject(WSOrd)) Quit:($$$blnComplete)&&(WSOrd.IsSubmitted()) ; (WSOrd.SubmitTS>0) New tmpAr Merge tmpAr=tmpRq Kill tmpAr("HIST") Kill tmpAr("REF") Set tmpAr("REF")=$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($S($$$blnComplete:$LB(KLNr,"-",wsID,"A"), 1:$LB(KLNr,VERW,wsID,"W"))) Set tmpAr("REFMN")=$$ophBuildQS("") ; Create REFMN (to pass to Wizard.csp) Set arShow("ModifyOrder","BTN")=Visible Set arShow("ModifyOrder","HREF")="Access.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) Quit MShowNewFromOrder(Visible) Quit:('TBXContext.ToonKnopDupliceerEnWijzig()) Quit:('$G(blnValidKlant,1)) Quit:('$IsObject(WSOrd)) New tmpAr Merge tmpAr=tmpRq Kill tmpAr("HIST") Kill tmpAr("REF") Set tmpAr("NEWFROMORD")=wsID Set tmpAr("REF")=$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($LB(KLNr,VERW,,"A")) Set tmpAr("REFMN")=$$ophBuildQS($LB(,,,"COMPLETE")) ; Create REFMN (to pass to Wizard.csp) Set arShow("NewFromOrder","BTN")=Visible Set arShow("NewFromOrder","HREF")="Access.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) ; "#" ; "main.csp?"_ Quit MShowReplyCustomer(Visible) Quit MShowSubmitToVHEPN(Visible,WSOrd) // Is alleen bestemd voor de Inkoop-afdeling van extern domein (destil / hafele / sfs / ...) Quit:('Visible) Quit:('$IsObject(WSOrd)) Quit:($$$Not(WSOrd.IsBonTypeGeldig())) Quit:(WSOrd.BonType'?1(1"OFF",1"BBON",1"INKP")) Quit:(WSOrd.IsTransferredToAdmin()) ; Eenmaal door VH in Admin geïmporteerd, SubmitToVHEPN() niet meer mogelijk via website. Quit:(WSOrd.IsOnderdeelVanGroepOrder()) New tmpAr,lbLog,tmpLbl Merge tmpAr=tmpRq Set tmpAr("Taal")=Taal Set tmpAr("KLNR")=KLNr Set tmpAr("WSID")=wsID Set tmpAr("MODE")=sMode Set:(WSOrd.BonType="OFF")&&('TBXContext.VerzendOfferteAlsAanvraag()) tmpAr("OFFTOBBON")=1 ; OFFTOBBON in de betekenis van "Goed voor order" Set %session.Data("Taal")=Taal Set %session.Data("WSID")=wsID Set %session.Data("KLNR")=KLNr Set %session.Data("MODE")=sMode Kill tmpAr("WSID") Kill tmpAr("REF") Set arShow("SubmitToVHEPN","BTN")=Visible Set arShow("SubmitToVHEPN","HREF")="MailSend.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) Set arShow("Submit","HREF")=arShow("SubmitToVHEPN","HREF") Set arShow("SubmitToVHEPN","TEXT")=##class(cspBasis.GAProdTBox).WebTextValue("VerzendenBBON",Taal,"L") Set arShow("SubmitToVHEPN","INFO")=##class(cspBasis.GAProdTBox).WebTextValue("VerzendToVH",Taal,"L") Set:(arShow("SubmitToVHEPN","INFO")="~") arShow("SubmitToVHEPN","INFO")="" Set lbLog=$LG(WSOrd.SubmitToVHLog,1) If ($L(lbLog))&&($LG(lbLog,2)>0) Do . Set tmpLbl=##class(cspBasis.GAProdTBox).WebTextValue("Verzonden",Taal,"L",$LB("L")) . Set arShow("SubmitToVHEPNAgain","INFO")=$$$Replace(""_tmpLbl_": "_$$mssFormatTime($LG(lbLog,1),0)," "," ") Else Do . Set arShow("SubmitToVHEPNAgain","INFO")="" Quit MShowSubmitAdminVerw(Visible,WSOrd) Quit:('Visible) New tmpAr,lbLog,SubmitAdminHREF,SubmitAdminAgainHREF If (WSOrd.IsOnderdeelVanGroepOrder()) { Set msg="Dit order is onderdeel van GroepOrder "_WSOrd.OrderNrCalc(WSOrd.GeefIDVanParentGroepOrder())_". "_$$$CRLF_"Order-To-Admin is alleen mogelijk voor het GroepOrder (via Historiek)." Set SubmitAdminHREF="javascript:alert("_$$$QuoteJS(msg)_")" Set SubmitAdminAgainHREF=SubmitAdminHREF } Else { Merge tmpAr=tmpRq Kill tmpAr("TRANSF") Set tmpAr("TRANSF")="ADM" Set SubmitAdminHREF="main.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) Set tmpAr("TRANSF")="AGAIN;ADM" Set SubmitAdminAgainHREF="main.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) } Set arShow("SubmitAdmin","BTN")=Visible Set arShow("SubmitAdmin","HREF")=SubmitAdminHREF If WSOrd.IsTransferredToAdmin() Do . Set lbLog=$LG(WSOrd.TransferLog,1) . Set arShow("SubmitAdminAgain","HREF")=SubmitAdminAgainHREF . Set arShow("SubmitAdminAgain","INFO")="offerte: "_$LG(lbLog,2)_" "_$$mssSubmitAdminTime($LG(lbLog,1))_" +++klantnr "_$S(TBXContext.IsDomeinVHEPN():KLNr, 1:TBXContext.GeefDomeinKlantNummer())_"+++" . Set arShow("SubmitAdminAgain","INFO")=$$$Replace(arShow("SubmitAdminAgain","INFO")," "," ") Else Do . Set arShow("SubmitAdminAgain","INFO")="" Quit mssSubmitAdminTime(TStamp) #define RecentSec 300 New tmp Set tmp=$$mssFormatTime(TStamp,$$$RecentSec) Quit $S($L(tmp):"("_tmp_")", 1:"") mssFormatTime(TStamp,RecentSec) #define cDate(%v) $P(%v,",",1) #define cTime(%v) $P(%v,",",2) Quit:(TStamp="") "" Quit:($$$cDate(TStamp)'=$$$cDate($H)) "op "_$ZD(TStamp,4)_" "_$ZT($$$cTime(TStamp),2)_"u" Quit:($G(RecentSec)'>0)||($$$cTime($H)-$$$cTime(TStamp)>RecentSec) "om "_$ZT($$$cTime(TStamp),2)_"u" Quit "" MShowForwardTo(Visible) Quit MShowExportXML(Visible) New tmpAr Merge tmpAr=tmpRq Kill tmpAr("HIST") Kill tmpAr("REF") Set tmpAr("REF")=$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($LB(KLNr,VERW,wsID,"P")) Set tmpAr("VSRC")=1 Set arShow("ExportXML","BTN")=Visible Set arShow("ExportXML","HREF")="Access.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) Quit MShowKnownCustomer(Visible) #define KLNrClean $S(KLNr=$$$KLNrListAll:"", 1:KLNr) New KLNaam,KLMini If TBXContext.HeeftToegangMetLogin() Do . Quit:($$$KLNrClean="") . Set KLMini=##class(cspBasis.GAProdTBox).GetKlantData(TBXContext.GeefDomeinVerwerker(),KLNr,TBXContext) . ; If KLMini Do . ;. Set KLNaam=KLMini.Naam . Set:(KLMini) KLNaam=KLMini.Naam . Set KLMini="" . Set blnValidKlant=($G(KLNaam)'="") . Set:($G(KLNaam)="") KLNaam="?"_KLNr_"?" . Do MShowKnownCustomerText Else If (KLNr=$$$KLNrListAll)&&(sMode="START") Do . Set arShow("KnownCustomer","LBL")=Visible . Set arShow("KnownCustomer","INFO")=""_""_##class(cspBasis.GAProdTBox).WebTextValue("",Taal,"L")_"VERKOOP Algemeen"_"" Quit MShowKnownCustomerText Set arShow("KnownCustomer","LBL")=Visible Set arShow("KnownCustomer","INFO")=""_##class(cspBasis.GAProdTBox).WebTextValue("Klant",Taal,"L",$LB("L"))_" "_""_KLNaam_"" Quit MShowVervaldagOFFText(TBXOrdersDto,Taal) New Melding Set Melding=TBXOrdersDto.GeefMeldingOfferteGeldig(Taal,"HTML") If $L(Melding) { Set arShow("VervaldagOFF","INFO")=1 Set arShow("VervaldagOFF","TEXT")=Melding } Else { Set arShow("VervaldagOFF","INFO")=0 } Quit PrepareWSOrdVTL(TBXContext,WSOrd) #define pg ##class(cspBasis.GAProdTBox) quit:'$IsObject(WSOrd) Kill arWSVTL New i,WSLn,SomAKPrijs,BonType,Munt,MuntCalc,blnIsBeursUser Set Munt="EUR" Set Munt=TBXContext.GeefUserMuntEenheid($G(VERW)) ; $$GetUserMunt^cspBasis.Library(TBXContext.GeefDomeinVerwerker(),$G(VERW)) ; if sMode=PROCESS, then enable switch between EUR and CHF, by setting VERW="SFS" or VERW="VHEPN" Set blnIsBeursUser=(''$G(%session.Data("BeursUser"))) Set BonType=$$$pg.ConvertBonType(WSOrd.BonType,VERW,sMode) Set arWSVTL("BonType")=$S($L(BonType):$$$pg.WebTextValue("FT_"_BonType,Taal,"L",$LB("U")), 1:"") Set arWSVTL("NietMee")=$$pwoTransNietMee(WSOrd.NietMeeleveren) ; $S($L(WSOrd.NietMeeleveren):"corpusprofielen, afdekkappen", 1:"") ; "De corpusprofielen / afdekkappen worden niet meegeleverd.", 1:"") Set blnShowAKPrijs=(sMode="PROCESS")&&('TBXContext.IsDomeinVHEPN()) ; &&(BonType="INKP") If TBXContext.GeefDomeinVerwerker()="SFS" Do . ; Aankoopprijzen in EUR berekend en getoond . ; Verkoopprijzen in CHF berekend en getoond . ; ==> m.a.w. Munt moet correct ingevuld worden (EUR of CHF); prijzen van WSOrd niet meer omrekenen, dus MuntCalc="EUR" . Set Munt=$S(blnShowAKPrijs:"EUR",1:"CHF") . Set MuntCalc="EUR" Else Do . Set MuntCalc=Munt Set arWSVTL("Munt")=Munt if 'WSOrd.IsGroepOrder() { Set SomAKPrijs=0 Set WSLn=WSOrd.Lijnen.GetNext("") If $IsObject(WSLn) { Set dcID=##class(BL.PR.GA.TandemBox).DesignCodeFromDS(WSLn.ItemDS) Set:(dcID="") dcID="S" Set HeaderLogo = dcID Do pwoZetTekstenWSLijnKleurkeuze(WSLn,.arWSVTL,dcID,Taal) } Set blnContainsGlas=0 Set blnWSErrors=0 Set i="" For Set WSLn=WSOrd.Lijnen.GetNext(.i) Quit:(i="") Do . For Key="LT","CB","WD","LD","DK","FB","BM","SB","OPVL","STDL" Do . . Set arWSVTL("LN",i,Key)=$$pwoTransItemValue($zobjproperty(WSLn,"Item"_Key),Key) . Set arWSVTL("LN",i,"BX")=$$pwoTransItemVerhoogdeZijwand(WSLn.ItemBX,WSLn.ItemKV) . Set arWSVTL("LN",i,"DIV")=$$pwoTransItemValue(WSLn.ItemDIVToLB(),"DIV") ; ..ItemDIVToLB() ; Returns $LB() . Set arWSVTL("LN",i,"AANT")=$$pwoTransItemValue(WSLn.Qty,"AANT") ; _$$pwoTransItemValue(WSLn.ItemVPK,"VPK") . Set arWSVTL("LN",i,"PRIJS")=$$pwoTransItemValue($S(blnIsBeursUser:99.99, blnShowAKPrijs:WSLn.AKPrijs, 1:WSLn.KostPrijs),"PRIJS") . Set blnContainsGlas=(blnContainsGlas)||(WSLn.LadeBevatGlasOfInschuifElement()) . Set:(WSLn.KostPrijs["ERROR") blnWSErrors=1 . Set:(blnShowAKPrijs) SomAKPrijs=SomAKPrijs+(WSLn.AKPrijs*WSLn.Qty) If 'blnContainsGlas Set arWSVTL("KLR_KV")="" } else { set SomAKPrijs = 0 } If blnIsBeursUser Do . Set:(blnShowAKPrijs) arWSVTL("AKPrijsTot")=99.99 . Set arWSVTL("TotPrijs")=$$pwoTransTotPrijs(99.99) Else Do . Set:(blnShowAKPrijs) arWSVTL("AKPrijsTot")=$$PrijsConvert^cspBasis.Library(MuntCalc,SomAKPrijs) . Set arWSVTL("TotPrijs")=$$pwoTransTotPrijs($$PrijsConvert^cspBasis.Library(MuntCalc,$S(blnShowAKPrijs:SomAKPrijs, 1:WSOrd.TotPrijs))) Quit pwoZetTekstenWSLijnKleurkeuze(WSLn,arWSVTL,dcID,Taal) ; arWSVTL als .local doorgeven New DCSuffix Set DCSuffix="" Set:($L(WSLn.ItemDS)) DCSuffix=$$$Replace($$$pg.WebTextValue("DC_Suffix_"_dcID,Taal,"L"),"~","") Set:($L(DCSuffix)) DCSuffix=""_DCSuffix_"" Set arWSVTL("KLR_DS")=$S($L(WSLn.ItemDS):$$$pg.WebTextValue("DS_"_WSLn.ItemDS,Taal,"L")_DCSuffix, 1:"") Set arWSVTL("KLR_KL")=$S($L(WSLn.ItemDS):$$$pg.WebTextValue("DS_"_WSLn.ItemDS,Taal,"L"), 1:"") ; arWSVTL("KLR_DS") Set arWSVTL("KLR_KB")=$S($L(WSLn.ItemKB):$$$pg.WebTextValue("KL_"_WSLn.ItemKB_$S(WSLn.ItemKB?1(1"WI",1"BE"):"_KB", 1:""),Taal,"L"), 1:"") Set arWSVTL("KLR_RK")=$S($L(WSLn.ItemRK):$$$pg.WebTextValue("KL_"_WSLn.ItemRK,Taal,"L"), 1:"") Set arWSVTL("KLR_KX")=$S($L(WSLn.ItemKX):$$$pg.WebTextValue("KL_"_WSLn.ItemKX,Taal,"L"), 1:"") Set arWSVTL("KLR_KV")=$S($L(WSLn.ItemKV):$$$pg.WebTextValue("KLV_"_WSLn.ItemKV,Taal,"L"), 1:"") Quit pwoTransTotPrijs(Val) Quit:(Val>0) $J(Val,0,2)_" "_Munt Quit "" pwoTransItemValue(Val,Key) New str Quit:(Val="") " " Quit:(Key="CB") Val_" mm" If Key="WD" Do Quit str . If '$IsValidNum(Val) Set str="
"_$S(Val="B":"|←→|", 1:Val)_"
" . Else Set str=Val_" mm" Quit:(Key="LD") Val_" mm" Quit:(Key="DK") Val_" kg" Quit:(Key="FB") $S(Val="NM":"-", Val="Z":" ", (Val="S")&&(Taal="F"):"Vis", 1:Val) ; Quit:(Key="BX") $$pwoTransItemVerhoogdeZijwand(Val,"") Quit:(Key="SB") $S(Val:"v", 1:" ") Quit:(Key="OPVL") $S(Val="LR":"L+R", 1:Val) Quit:(Key="DIV") $$LCVTSimple^vhLib(Val,"
") Quit:(Key="AANT") Val Quit:(Key="VPK") $S(Val="P":" ("_$$$pg.WebTextValue("VerpakBulkKort",Taal,"L")_")", Val'="S":Val, 1:"") If Key="PRIJS" Do Quit str . If $$$UCase(Val)="ERROR" Set str="
# "_$$$pg.WebTextValue("jsFout",Taal,"L",$LB("U"))_" #
" . Else Set str=$J($$PrijsConvert^cspBasis.Library(MuntCalc,Val),0,2)_" "_Munt Quit Val pwoTransItemVerhoogdeZijwand(ItemBX,VulstukKleur) Quit $S(ItemBX="DR":"==", ItemBX="ER":"---", ItemBX="ZR":" ", ItemBX?1(1"BG",1"xCOV",1"INSCHF"):$$pwoGeefVerhoogdeZijwandInfoVoorVulstukKleur(ItemBX,$G(VulstukKleur)), 1:ItemBX ) pwoGeefVerhoogdeZijwandInfoVoorVulstukKleur(ItemBX,VulstukKleur) Quit ItemBX ;Quit $S(VulstukKleur="ZV":" ", VulstukKleur="": ItemBX_"..", 1:VulstukKleur) pwoTransNietMee(NMKeys) #define LowerCaseExceptBS $S(NietMeeKey="NM_BS":"",1:$LB("L")) New str Set str="" For i=1:1:$L(NMKeys,";") Do . Set NietMeeKey=($P(NMKeys,";",i)) . Set:($E(NietMeeKey,1,2)="NM")&&($E(NietMeeKey,3)'="_") $E(NietMeeKey,1,2)="NM_" . Set:($L(NietMeeKey)) str=str_$S($L(str):", ", 1:"")_$$$pg.WebTextValue(NietMeeKey,Taal,"L",$$$LowerCaseExceptBS) Quit str PrepareHistVTL #define KLNrClean $S(KLNr=$$$KLNrListAll:"", 1:KLNr) ;s:('$D(ClientIP)) ClientIP="192.168.1.97" New tmpAr,KLNrSel,i,wsID,Ref,WizMode,sDomain2,tmpKLNr,blnListALL,tmpNaam,BonType,Munt,ClientHostIP,MinShowH,MaxShowH,blnListHidden,blnListHiddenOnly,KLNrIsTestKlant,blnIsBeursUser Kill arHistVTL Set KLNrIsTestKlant=0 If (TBXContext.IsDomeinVHEPN()) && ( (KLNr?1(1"4682",1"1000",1"4645"))||($$$ValIsBetween(KLNr,15827,15836)) ) { Set KLNrIsTestKlant=1 } Set blnShowComplete = $get(blnShowComplete,1) Set blnListHidden=($G(%request.Data("SHOWALL",1))="1") If (##class(TECH.Config.ConfigMgr).Instance().GetBoolean("csp.vhisie.TBX.Main_ToonHistoriekVoorTestklanten")){ Set blnListHidden=(blnListHidden || KLNrIsTestKlant) } Set blnListHiddenOnly=0 Set blnListALL=(KLNr=$$$KLNrListAll) Set blnIsBeursUser=(''$G(%session.Data("BeursUser"))) Set KLNrSel=$$$KLNrClean ; $S(KLNr=$$$KLNrListAll:"", 1:KLNr) Set WizMode=$S(sMode?1(1"VIEW",1"PROCESS",1"COMPLETE"):sMode, 1:"COMPLETE") Set sDomain2=$$TBXDomainCVT^cspBasis.Library(sDomain) Set Munt=TBXContext.GeefUserMuntEenheid() Do phvBuildColHeader Set MinShowH=$$$shShownForKlant Set MaxShowH=$$$shShownForAll-1 If blnListHidden Do . Set MinShowH=$$$shHiddenForAll . Set:(blnListHiddenOnly) MaxShowH=$$$shShownForVHEPN-1 Else If (sMode="PROCESS")||(blnListALL) Do . Set MinShowH=$S(VERW'="VHEPN":$$$shShownForVERW, 1:$$$shShownForVHEPN) Else If KLNrIsTestKlant Do . Set MinShowH=$$$shShownForVHEPN Else If 0 && $$IsInternIPAdres^cspBasis.Library($G(%RemoteIP)) Do . Set MinShowH=$$$shShownForVHEPN set Query = "SELECT Top 1000 KLNummer, KLNaam, BonType, ID, IngaveTijdStip, TotAantal, TotPrijs, OrderReferentie As Commissie , SubmitTS, ShowInHist" _ " FROM "_$select(blnShowComplete:"WS_TBX.OrderAbstract",1:"WS_TBX.WebOrder") _ " WHERE ( WebDomain = ? ) AND ( ShowInHist BETWEEN ? AND ? )" _ $select(blnListALL:"",1:"AND ( KLNummer = ? ) ") _ $select(blnShowComplete:"AND ( IsInGroepOrder = 0 )",1: " AND ( BonType = ? ) AND ( IsOfferteVervallen = 0 )") _ " ORDER BY IngaveTijdstip DESC , ID" set lbParams = $listbuild(sDomain2,MinShowH,MaxShowH) if 'blnListALL set lbParams = lbParams _ $listbuild(KLNrSel) if 'blnShowComplete { set lbParams = lbParams _ $listbuild("OFF") #define AantalDagen 7 //set lbParams = lbParams _ $listbuild(##class(TECH.DateTime).HorologToTimeStamp(+$H-$$$AantalDagen)) } set rsOrders = $$ExecDynQuery^vhQUERYLIB(Query,lbParams) set i = 0 set AantalSelecteerbareOrders = 0 while rsOrders.Next() { kill tmpAr if rsOrders.GetDataByName("KLNummer")="" { set arKLnrs("I-Empty",0)="" } else { set arKLNrs("I",rsOrders.GetDataByName("KLNummer"))="" set AantalSelecteerbareOrders = AantalSelecteerbareOrders + 1 } set tmpAr("KLNr")=rsOrders.GetDataByName("KLNummer") set tmpAr("KLNaam")=rsOrders.GetDataByName("KLNaam") set tmpAr("BonType")=rsOrders.GetDataByName("BonType") set tmpAr("wsID")=rsOrders.GetDataByName("ID") set tmpAr("OrdTime")=rsOrders.GetDataByName("IngaveTijdStip") set tmpAr("TotQty")=rsOrders.GetDataByName("TotAantal") set tmpAr("TotPrs")=rsOrders.GetDataByName("TotPrijs") set tmpAr("Commissie")=rsOrders.GetDataByName("Commissie") set tmpAr("SubmitTS")=rsOrders.GetDataByName("SubmitTS") set tmpAr("ShowInHist")=rsOrders.GetDataByName("ShowInHist") Set tmpAr("Munt")=Munt Do phvBuildHistArray ; lijn opbouwen } Do phvBuildKLNrColumn Do phvBuildHistSort Quit phvBuildColHeader Quit phvBuildHistSort Quit phvBuildKLNrColumn New KLKey,WizMode2 Set WizMode2=$S(WizMode="COMPLETE":"START", 1:WizMode) Set CntKL=0 ; Globale variabele Set:($D(arKLNrs("I-Empty",0))) CntKL=1 Set KLKey="" For Set KLKey=$O(arKLNrs("I",KLKey)) Quit:(KLKey="") Do . Set CntKL=CntKL+1 . Set arKLNrs("U",KLKey)="?HIST=1&REF="_$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($LB(KLKey,VERW,,WizMode2)) Quit phvBuildHistArray Set i=i+1 Set:(blnIsBeursUser)&&(tmpAr("TotPrs")) tmpAr("TotPrs")=99.99 Merge arHistVTL("LN",i)=tmpAr Set wsID=$G(tmpAr("wsID")) new OrderData set OrderData = ##class(UI.TBXWeb.OrderData).%New(wsID) Set tmpKLNr=$S(KLNr=$$$KLNrListAll:$G(tmpAr("KLNr")), 1:KLNr) Set arHistVTL("LN",i,"KLNr")=$G(tmpAr("KLNr")) Set arHistVTL("LN",i,"KLNaam")=$G(tmpAr("KLNaam")) Set arHistVTL("LN",i,"Munt")=$S($G(tmpAr("Munt"))="":"EUR", 1:tmpAr("Munt")) Set arHistVTL("LN",i,"MuntCalc")=arHistVTL("LN",i,"Munt") If TBXContext.IsDomeinSFS() Do . Set arHistVTL("LN",i,"Munt")="CHF" . Set arHistVTL("LN",i,"MuntCalc")="EUR" Set arHistVTL("LN",i,"OrderNr")=##class(WS.TBX.Order).OrderNrCalc(wsID) Set arHistVTL("LN",i,"TimeCust")=$S($G(arHistVTL("LN",i,"OrdTime"))="":"", 1:$TR($ZD($ZDTH(arHistVTL("LN",i,"OrdTime"),3),4),"/","-")) Set arHistVTL("LN",i,"OrderDCM_DSP") = OrderData.GeefDesignCodeOmschrijvingen() Set arHistVTL("LN",i,"OrderDCM_ALT") = OrderData.GeefDesignCodeToolTips() set arHistVTL("LN",i,"VerpakkingsType")= OrderData.GeefVerpakkingType() set arHistVTL("LN",i,"IsGroepOrder")= OrderData.Order.IsGroepOrder() Do phvManageBonType Set Ref(i)=$$CreateHashedRef^cspBasis.TBX.DecodeURL.tmpDev($LB(tmpKLNr,VERW,wsID,WizMode)) Set arHistVTL("LN",i,"UrlOrd")=$$$Replace(arUrl("ShowOrder"),$$$QSREFReplace,Ref(i)) Kill tmpAr Quit phvManageBonType Set BonType=$$$pg.ConvertBonType(arHistVTL("LN",i,"BonType"),TBXContext.GeefDomeinVerwerker(),WizMode) Set:(TBXContext.KlantGegevensViaDataOpt()) arHistVTL("LN",i,"BonType")=BonType Set arHistVTL("LN",i,"BonTypeVTL")=$$$pg.WebTextValue("FT_"_BonType,Taal,"L") Quit