Zoeken, inlezen, parsen van factuurdetails van transporten via GLS, en KlantKost-items maken en bewaren. Specificatie van het GLS factuurdetails-bestand: http://services.gls-belgium.com/edifiles/invoice-flat-v1-0.htm N.B. GLS stuurt deze bestanden via FTP naar ftp://res.vanhoecke.be/GLS , met gebruikersnaam FTPGLS. Wellicht via Allway Sync naar MSMGATEWAY overgestuurd? N.B. Dit bestand wordt ook door GLS naar de boekhouding gestuurd via e-mail. 1 TECH.RegisteredObject APPS.TRANSP.GLS.impl.Validator 1 TECH.FileReader %String %ArrayOfDataTypes %ArrayOfDataTypes %ArrayOfDataTypes %Date %Date %String %ArrayOfDataTypes %ArrayOfDataTypes "S" = Verstuurd, "R" = Ontvangen, "A" = Andere %String S "F" = Factuur, "C" = Crediet, "A" = Andere %String F 1 1 %Status 1 %String FileName:%String %Boolean Path:%String %String 0 { Set ..Feedback = ..Feedback_..GefaaldeBonIDs.Count()_" bon(nen) konden niet gekoppeld worden."_$C(13,10) Set ..Feedback = ..Feedback_"Niet gekoppelde BonID's : "_##class(TECH.ListUtils).ListToPieces(..GefaaldeBonIDs,",")_$C(13,10) } } Quit ..Feedback ]]> Feedback:%String Path:%String,Map:%String 1 1 BonID:%String 1 0 { #dim GedeeldeKost As %Double = ($$$Trim(..Reader.Data("TransportKost")) / SubBonIDsInTransport.Count()) #dim SubBonIDIt As TECH.Iterator = ##class(TECH.ListIterator).%New(SubBonIDsInTransport) While SubBonIDIt.HasNext(){ #dim SubBonID As %String = SubBonIDIt.Next() $$$IfThen(..VerwerkViaBonID(SubBonID,GedeeldeKost,SubBonIDsInTransport),..VerwerkteBonIDs.SetAt(BonID,BonID),..GefaaldeBonIDs.SetAt(SubBonID,SubBonID)) } } }Catch { #dim Exceptie As TECH.Exceptions.Exception = ##class(TECH.ExceptionHandler).Catch() $$$IfThen(Exceptie.GeefOmschrijving() [ " is niet meer aanwezig.",..GefaaldeBonIDs.SetAt(SubBonID,SubBonID),##class(TECH.ExceptionHandler).Rethrow()) } ]]> BonID:%String 1 %ArrayOfDataTypes Path:%String 1 1 1 ..MaximumGLSDatum) ..MaximumGLSDatum = DatumAankomst } If (..MaximumGLSDatum - ..MinimumGLSDatum) > (9*31) { #dim Bericht As %String = "De periode van het ingegeven GLS bestand is te groot, de periode mag maximum 9 maanden bedragen." Set Bericht = Bericht_"Het bestand is gespreid over een periode van "_$zdt(..MinimumGLSDatum,4)_" tot "_$zdt(..MaximumGLSDatum,4)_"." Do ##class(TECH.ExceptionHandler).Throw(##class(TECH.Exceptions.InvalidInputException).%New(Bericht)) } Do ..Reader.BackToFirstRow() ]]> Reader:TECH.FileReader 1 %Boolean 1 %ArrayOfDataTypes DatumBegin:%Date,DatumEind:%Date 1 DatumBegin) && (Proforma.GeefDatum() < DatumEind){ #dim BonIt As TECH.Iterator = Proforma.GeefBonIterator() While BonIt.HasNext() { #dim Bon As DOM.VKP.Bon = BonIt.Next() Do ..BonIDOpProformaID.SetAt(Proforma.GeefID(),Bon.GeefID()) Do ..VerzendwijzeVoorBonID.SetAt(Bon.GeefVerzendwijze(), Bon.GeefID()) } } } ]]> DatumBegin:%Date,DatumEind:%Date 1 DatumBegin) && (Factuur.GeefFactuurDatum() < DatumEind){ #dim BonIt As TECH.Iterator = Factuur.GeefBonIterator() While BonIt.HasNext() { #dim Bon As DOM.VKP.Bon = BonIt.Next() Do ..BonIDOpFactuurID.SetAt(Factuur.GeefID(),Bon.GeefID()) Do ..VerzendwijzeVoorBonID.SetAt(Bon.GeefVerzendwijze(), Bon.GeefID()) } } } ]]> BonID:%String,GedeeldeKost:%Double,SubBonIDsInTransport:%ArrayOfDataTypes 1 %Boolean 0 ) } Quit IsGoedVerwerkt ]]> BonID:%String 1 Datum:%Date,KlantID:DOM.VKP.VanHoeckeKlantID,Kost:%Double,Info:%String,BonID:%String,ShipmentID:%String 1 %Numeric 0 { #dim VerpakkingEenheidType As DOM.TRANSP.enu.VerpakkingEenheidType = ##class(DOM.TRANSP.enu.VerpakkingEenheidType).Colli() Set GLSKostItem = ##class(APPS.TRANSP.GLS.Shipment.data.GLSTransportKostItem).%New(Datum,KlantID,Kost,VerpakkingEenheidType,Aantal,Info,BonID,ShipmentID) Set GLSKostItem.GLSBestand = ..GLSBestand Do GLSKostItem.Save() } quit Aantal ]]> Datum:%Date,KlantID:DOM.VKP.VanHoeckeKlantID,Kost:%Double,Info:%String,BonID:%String,ShipmentID:%String 1 %Numeric 0 { #dim VerpakkingEenheidType As DOM.TRANSP.enu.VerpakkingEenheidType = ##class(DOM.TRANSP.enu.VerpakkingEenheidType).EuroPallet() Set GLSKostItem = ##class(APPS.TRANSP.GLS.Shipment.data.GLSTransportKostItem).%New(Datum,KlantID,Kost,VerpakkingEenheidType,AantalPalletten,Info,BonID,ShipmentID) Set GLSKostItem.GLSBestand = ..GLSBestand Do GLSKostItem.Save() } quit AantalPalletten ]]> AfzenderReferentie:%String 1 %String