Index: csp/vhisie/TBX/Main/tmpDev.mac.rou =================================================================== diff -u -r319 -r320 --- csp/vhisie/TBX/Main/tmpDev.mac.rou (.../tmpDev.mac.rou) (revision 319) +++ csp/vhisie/TBX/Main/tmpDev.mac.rou (.../tmpDev.mac.rou) (revision 320) @@ -19,7 +19,8 @@ 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() @@ -29,8 +30,9 @@ 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") @@ -44,6 +46,9 @@ 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) @@ -103,19 +108,21 @@ . 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 WSOrd=$S($L($G(wsID)):##class(WS.TBX.Order).%OpenId(wsID), 1:"") + 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) - Do ophSetHeaderLogo(WSOrd) - If ($IsObject(WSOrd))&&($$$Not(WSOrd.IsBonTypeGeldig())) { + 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) - } - + } + + ;Do ophSetHeaderLogo(WSOrd) Set:($G(VERW)="") VERW=TBXContext.GeefDomeinVerwerker() Kill arShow ; Analyse REF (part 2) @@ -129,17 +136,17 @@ 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 @@ -163,7 +170,18 @@ ; Else Do ophAlgVoorw Do ophAddToLog() - Quit 1 + 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) @@ -413,28 +431,29 @@ ; 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.Order).%OpenId(wsID), 1:0) + 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 blnDynaplug=($IsObject(WSOrd))&&(WSOrd.WebURL="DYNAPLUG IMPORT") + Set blnDynaplug=0/*($IsObject(WSOrd))&&(WSOrd.WebURL="DYNAPLUG IMPORT") */ If blnDynaplug Do - . ;Set WSOrd.WebDomain="www.tandem-box.com" - . ;Set WSOrd.WebURL="" . Set blnDynaplugERR=(''$G(blnWSErrors,0)) Else Do . Set blnDynaplugERR=0 + + Set IsDesignBeschikbaar=('$IsObject(WSOrd))||(WSOrd.IsLadeDesignBeschikbaar(.DS)) Set blnOFFVervallen=($IsObject(WSOrd))&&(WSOrd.IsOfferteVervallen($H,.RedenVervallen)) If blnOFFVervallen Do Quit:($G(blnQuit,0)) @@ -468,6 +487,7 @@ Do MShowNewOrder(0) Do MShowSwitchToStartMode('blnDynaplug) Do ophBuildToggleHistAndOrder() + Do MShowGroepBestellen(1,KLNr) Set WSOrd="" Quit ophMMCompleteRecalcOfferte() @@ -502,7 +522,7 @@ ;Else : prepare buttons/info Do MShowKnownCustomer(1) Do ophBuildToggleHistAndOrder() - Set WSOrd=$S($L(wsID):##class(WS.TBX.Order).%OpenId(wsID), 1:0) + 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) @@ -511,7 +531,7 @@ 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(##class(cspBasis.GAProdTBox).GetKlantBulk(TBXContext.GeefDomeinVerwerker(),KLNr)) + Set lbBulkConfig=TBXContext.BulkConfigOptiesUitbreiden(TBXContext.GeefBulkConfigOpties(KLNr)) Set blnAllowBulk=1 ; Button SwitchToViewMode Do MShowSwitchToViewMode(('TBXContext.IsDomeinVHEPN())&& 1) ; &&(WSOrd.BonType="INKP") @@ -524,9 +544,10 @@ ; 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(TBXContext.IsDomeinVHEPN()||(VERW="VHEPN"),WSOrd) + . Do:($$IsInternIPAdres^cspBasis.Library(%RemoteIP)) MShowSubmitAdminVerw(blnProcessVH,WSOrd) . ; Button ChangeBulk . Set arShow("ChangeBulk","BTN")=($$IsInternIPAdres^cspBasis.Library(%RemoteIP)) . If arShow("ChangeBulk","BTN") Do @@ -545,7 +566,7 @@ Quit ophMMProcessFlowVHEPN() -#define IsTextOnly(%v) (%v'?.E1C.E) + New lbResult,tmpAr,sc ;d:($D(%request.Data("TRANSF",1))) WL^vhDBG("ProcessVH QS(""TRANSF"")="_%request.Data("TRANSF",1)_" TransfStatus="_$G(%session.Data("TransfStatus"))) @@ -559,7 +580,6 @@ . 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)_"); }" - . ;d WL^vhDBG("Transfert again. current Status: "_$G(%session.Data("TransfStatus"))_" ... will be killed.") . Kill %session.Data("TransfStatus") ; Else If $G(%request.Data("TRANSF",1))?1(1"ADM",1"ADM2") Do Quit 1 @@ -568,36 +588,49 @@ . Kill tmpAr("TRANSF") . Quit:(wsID="") . - . ;Lock +WSTBXORD(wsID):0 Else Do Quit - . . ; Log this incident - . . - . . Do ophOrdToAdminSetSesData - . Set OFFToAdmin=$S('TBXContext.StatusInkoopAlsOrderToVH():"BBON", 1:"INKP") ; Set:(WSOrd.BonType="OFF") ... . Set blnBusy=##class(WS.TBX.Order).TransfStatusCheckBusy(wsID) . If (blnBusy) Do Quit ; ($G(%session.Data("TransfStatus"))'="") - . . ;d WL^vhDBG("Msg: transfert not allowed. status="_$G(%session.Data("TransfStatus"))) - . . ;Lock -WSTBXORD(wsID) . . Set arJSExec(1)="alert("_$$$QuoteJS("Transfer in progress. Prease wait...")_"+'\n');" . . Set arJSExec(2)="document.location.replace("_$$$QuoteJS("main.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr))_");" - . ; Else - . // TRANSFER ORDER TO ADMIN: . Set %session.Data("TransfStatus")="ACTIVE" . Set scStatus=##class(WS.TBX.Order).TransfStatusSetByID(wsID,"ACTIVE") - . ;d WL^vhDBG("Start WSOrdToAdmin(). Status: "_$G(%session.Data("TransfStatus"))) - . Set lbResult=##class(cspBasis.GAProdTBox).WSOrdToAdmin(wsID,$G(OFFToAdmin)) ; $LB("",$$$ERROR($$$GeneralError,"MyMessage")) ; + . 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,"") - . ;d WL^vhDBG("Finished WSOrdToAdmin(). Status: "_$G(%session.Data("TransfStatus"))) - . If ($LG(lbResult,1)="") Do - . . Set sc=$LG(lbResult,2) ; Kan %Status, TextOnly of $LB() zijn - . . Set arJSExec(1)="alert("_$$$QuoteJS("Transfer to ADMIN:")_"+'\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() - . ;Lock -WSTBXORD(wsID) - ; Else + . 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 + Do oxxAddToLog("TRANSF") + 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() @@ -644,7 +677,19 @@ 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("KLNR")=KLNr + 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") + quit MShowNewOrder(Visible) Quit:((TBXContext.AlleenToegangMetLogin())&&('TBXContext.IsKlantIDIngevuld(KLNr))) Quit:(KLNr=$$$KLNrListAll)&&($$$Not((sMode="START")&&(TBXContext.AlleenToegangZonderLogin()))) @@ -710,51 +755,55 @@ Set arShow("BookmarkPage","HREF")="javascript:window.external.AddFavorite(location.href,'"_BookmTxt_"');" Quit MShowSubmit(Visible,WSOrd,IsErrorOfVervallen,TBXOrdersDto,Taal) -#If ($$$NSpace="DEMO") - Quit ; Only on namespace "DEMO" -#EndIf Quit:('$IsObject(WSOrd)) Quit:('$G(blnValidKlant,1)) Quit:($$$Not(WSOrd.IsBonTypeGeldig())) New IsSubmitBtnDisabled,OnvoldoendeBestelhoeveelheid - 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 Do Quit - . Set arShow("Submit","BTN")=Visible - . Set arShow("SubmitAgain","BTN")=0 - . Set arShow("Submit","HREF")="" - . Set arShow("Submit","TEXT")=##class(cspBasis.GAProdTBox).WebTextValue("VerzendenBBON",Taal,"L") - . Set arShow("Submit","INFO")="" - ; Else New tmpAr,InternText,InternInfo,blnIsSubmitted Merge tmpAr=tmpRq Set tmpAr("Taal")=Taal Set tmpAr("KLNR")=KLNr - Set tmpAr("WSID")=wsID 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 - Kill tmpAr("WSID") Kill tmpAr("REF") - Set blnIsSubmitted=(WSOrd.IsSubmitted()) ; (WSOrd.SubmitTS>0) ; - Set arShow("Submit","BTN") =(Visible)&&('blnIsSubmitted) - Set arShow("SubmitAgain","BTN")=(Visible)&&(blnIsSubmitted) - Quit:('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(InternInfo,Taal,"L") - 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) + Set tmpAr("IsGroepBestelling")=0 + + 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) @@ -800,8 +849,6 @@ Quit:('$G(blnValidKlant,1)) Quit:('$IsObject(WSOrd)) New tmpAr - ;New wsIDnew - ;Set wsIDnew=wsID ; Construct Clone from current WSOrd Merge tmpAr=tmpRq Kill tmpAr("HIST") Kill tmpAr("REF") @@ -847,18 +894,15 @@ . Set arShow("SubmitToVHEPNAgain","INFO")="" Quit MShowSubmitAdminVerw(Visible,WSOrd) -#If ($$$NSpace="DEMO") - Quit ; Only on namespace "DEMO" -#EndIf Quit:('Visible) New tmpAr,lbLog Merge tmpAr=tmpRq Kill tmpAr("TRANSF") Set tmpAr("TRANSF")="ADM" Set arShow("SubmitAdmin","BTN")=Visible Set arShow("SubmitAdmin","HREF")="main.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) - Set lbLog=$LG(WSOrd.TransferLog,1) - If ($L(lbLog))&&($LG(lbLog,2)>0) Do + If WSOrd.IsTransferredToAdmin() Do + . Set lbLog=$LG(WSOrd.TransferLog,1) . Set tmpAr("TRANSF")="AGAIN;ADM" . Set arShow("SubmitAdminAgain","HREF")="main.csp?"_##class(cspBasis.GAProdTBox).CQueryString(.tmpAr) . Set arShow("SubmitAdminAgain","INFO")="offerte: "_$LG(lbLog,2)_" "_$$mssSubmitAdminTime($LG(lbLog,1))_" +++klantnr "_$S(TBXContext.IsDomeinVHEPN():KLNr, 1:TBXContext.GeefDomeinKlantNummer())_"+++" @@ -923,29 +967,10 @@ } Quit - /* - - - - - - - - - - - - - - - - */ - - -PrepareWSOrdVTL(TBXContext) +PrepareWSOrdVTL(TBXContext,WSOrd) #define pg ##class(cspBasis.GAProdTBox) + quit:'$IsObject(WSOrd) Kill arWSVTL - Quit:('$IsObject($G(WSOrd))) 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" @@ -964,46 +989,39 @@ . Set MuntCalc=Munt Set arWSVTL("Munt")=Munt - ;Set:(blnLMC)&&(sMode'="PROCESS")&&(BonType="INKP") BonType="BBON" ; Specifiek voor OPTIMA - ;Set:(blnSFS)&&(sMode'="PROCESS")&&(BonType="INKP") BonType="BBON" ; Specifiek voor ... - ;Set:(blnMBHO)&&(sMode'="PROCESS")&&(BonType="INKP") BonType="BBON" ; Specifiek voor ... - ;Set:(BonType="INKP")&&(sMode'="PROCESS") BonType="BBON" - ;Set arWSVTL("BonType")=$S($L(BonType):$$$pg.WebTextValue("FT_"_BonType,Taal,"L",$LB("U")), 1:"") - ;Set blnShowAKPrijs=(sMode="PROCESS")&&('blnVHEPN)&&(VERW'?1(1"HEIN",1"LMC")) ; ? SFS - Set SomAKPrijs=0 - Set WSLn=WSOrd.Lijnen.GetNext("") - If WSLn Do - . Set dcID=##class(BL.PR.GA.TandemBox).DesignCodeFromDS(WSLn.ItemDS) - . Set:(dcID="") dcID="S" - . Set HeaderLogo = dcID - . //Set:(dcID="I") HeaderLogo="I" - . 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_KL")=$S($L(WSLn.ItemKL):$$$pg.WebTextValue("KL_"_WSLn.ItemKL_$S(WSLn.ItemKL?1(1"WI",1"BE",1"BA"):"_DS",1:""),Taal,"L"), 1:"") - . 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:"") - . ;Set arWSVTL("FBevest")=$S($L(WSLn.ItemFB):$$$pg.WebTextValue("FB_"_WSLn.ItemFB,Taal,"L"), 1:"") - 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.ItemBX?1(1"BG",1"COV",1"INSCHF"))||(WSLn.ItemBGRP?1(1"V")) - . Set:(WSLn.KostPrijs["ERROR") blnWSErrors=1 - . Set:(blnShowAKPrijs) SomAKPrijs=SomAKPrijs+(WSLn.AKPrijs*WSLn.Qty) - - If 'blnContainsGlas Set arWSVTL("KLR_KV")="" - ;Set:(blnShowAKPrijs) arWSVTL("AKPrijsTot")=$S($G(%session.Data("BeursUser")):99.99, 1:SomAKPrijs) - ;Set arWSVTL("TotPrijs")=$$pwoTransTotPrijs($S($G(%session.Data("BeursUser")):99.99, blnShowAKPrijs:arWSVTL("AKPrijsTot"),1:WSOrd.TotPrijs)) + if 'WSOrd.IsGroepOrder() { + Set SomAKPrijs=0 + Set WSLn=WSOrd.Lijnen.GetNext("") + If WSLn Do + . Set dcID=##class(BL.PR.GA.TandemBox).DesignCodeFromDS(WSLn.ItemDS) + . Set:(dcID="") dcID="S" + . Set HeaderLogo = dcID + . 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:"") + + 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.ItemBX?1(1"BG",1"COV",1"INSCHF"))||(WSLn.ItemBGRP?1(1"V")) + . 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) @@ -1024,7 +1042,6 @@ 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="BM") $CASE(Val, "T":"T", "I":"v", "LR":"v", "Z":" ", :Val) ; Quit:(Key="BX") $$pwoTransItemVerhoogdeZijwand(Val,"") Quit:(Key="SB") $S(Val:"v", 1:" ") Quit:(Key="OPVL") $S(Val="LR":"L+R", 1:Val) @@ -1062,9 +1079,9 @@ 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")) - { + If (##class(TECH.Config.ConfigMgr).Instance().GetBoolean("csp.vhisie.TBX.Main_ToonHistoriekVoorTestklanten")){ Set blnListHidden=(blnListHidden || KLNrIsTestKlant) } Set blnListHiddenOnly=0 @@ -1073,7 +1090,6 @@ 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="EUR" Set Munt=TBXContext.GeefUserMuntEenheid() Do phvBuildColHeader @@ -1089,26 +1105,57 @@ Else If 0 && $$IsInternIPAdres^cspBasis.Library($G(%RemoteIP)) Do . Set MinShowH=$$$shShownForVHEPN - &SQL(DECLARE crsHist CURSOR FOR - SELECT Top 1000 KLNummer, KLNaam, BonType, ID, IngaveTijdStip, TotAantal Qty, TotPrijs Prijs, Commissie, SubmitTS, ShowInHist - INTO :tmpAr("KLNr"), :tmpAr("KLNaam"), :tmpAr("BonType"), :tmpAr("wsID"), :tmpAr("OrdTime"), :tmpAr("TotQty"), :tmpAr("TotPrs"), :tmpAr("Commissie"), :tmpAr("SubmitTS"), :tmpAr("ShowInHist") - FROM WS_TBX.WebOrder OrdHfd - WHERE (WebDomain=:sDomain2) AND ((KLNummer=:KLNrSel)OR(:blnListALL=1)) AND (ShowInHist BETWEEN :MinShowH AND :MaxShowH) - ORDER BY IngaveTijdStip DESC, ID - ) - &SQL(OPEN crsHist) - Set i=0 - For &SQL(FETCH crsHist) Quit:(SQLCODE) Do - . If $G(tmpAr("KLNr"))="" Set arKLNrs("I-Empty",0)="" ; Index for Empty KLKey - . Else Set arKLNrs("I",tmpAr("KLNr"))="" ; Index - . Set tmpAr("Munt")=Munt - . Do phvBuildHistArray ; lijn opbouwen - &SQL(CLOSE crsHist) + set Query = "SELECT Top 1000 KLNummer, KLNaam, BonType, ID, IngaveTijdStip, TotAantal, TotPrijs, 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 - ; d WL^vhDBG("arKLNrs"_$$$ArrayTT("arKLNrs")) Quit + phvBuildColHeader Quit phvBuildHistSort @@ -1128,6 +1175,7 @@ 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")) @@ -1138,14 +1186,18 @@ . 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")=##class(WS.TBX.Order).DCMCalc(wsID) + Set arHistVTL("LN",i,"OrderDCM_DSP") = OrderData.GeefDesignCodeOmschrijvingen() + Set arHistVTL("LN",i,"OrderDCM_ALT") = OrderData.GeefDesignCodeToolTips() + set arHistVTL("LN",i,"VerpakkingsType")= OrderData.GeefVerpakkingType() 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"),VERW,WizMode) + 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 \ No newline at end of file + Quit + + \ No newline at end of file