VB code snippet for using the generalCreditRequestManager


Private Sub DoPhysio_Click()

On Error GoTo Err_Trap

'### Note: if you encounter a namespace problem with a variable declaration you have to
'###       put GENERALCREDITREQUESTMANAGER430Lib in front of the variable declaration
'###       for example instead of declaring:
'###           Dim address As IAddress
'###       you write:
'###           Dim address As GENERALCREDITREQUESTMANAGER430Lib.IAddress

Dim bStatus As Boolean

Dim today As Date
today = DateTime.Now

'### GeneralCreditRequestManager interface
Dim generalCreditManager As GENERALCREDITREQUESTMANAGER430Lib.GeneralCreditRequestManager
Set generalCreditManager = New GeneralCreditRequestManager

'### GeneralCreditRequestManager interface
Dim generalCreditRequest As GENERALCREDITREQUESTMANAGER430Lib.IGeneralCreditRequest
Set generalCreditRequest = generalCreditManager.generalCreditRequest

'### initialize the credit request
bStatus = generalCreditRequest.Initialize(enGerman)

'### set request
bStatus = generalCreditRequest.SetRequest(enRolePhysiotherapist, enPlacePractice, "Physio Knetzentrum", enNo, enNo)

'### set modus type
generalCreditManager.Modus = enTest

'### set package
bStatus = generalCreditRequest.SetPackage("GeneralCreditRequest430Ex", 10001, 4, "sumex1")

'### set transport
bStatus = generalCreditRequest.SetTransport("2012345678901", "", "", "", "7612345678901", "")

'### Address interface
Dim address As GENERALCREDITREQUESTMANAGER430Lib.IAddress
Set address = generalCreditRequest.CreateAddress()
      
'### credit parameters
Dim creditID As String
creditID = "200001001"
Dim lRequestCreditTimestamp As Long
lRequestCreditTimestamp = 1304495926
Dim requestCreditDate As Date
requestCreditDate = DateValue("2011-05-04")
bStatus = generalCreditRequest.SetCredit(enCreditNew, creditID, requestCreditDate, lRequestCreditTimestamp, enNo)

'### requestor
bStatus = address.Initialize()
bStatus = address.SetCompany("Physio Knetzentrum", "", "")
bStatus = address.SetPostal("Mustermusterstrasse 128", "", "4410", "Liestal", "", "")
bStatus = address.AddPhone("956 99 00", "061", "", "")
bStatus = address.SetFax("956 99 10", "061", "", "")
bStatus = address.SetOnline("info@company.ch", "")
bStatus = generalCreditRequest.SetRequestor("2011234567890", "H-1211-11", "", "", address)

'### contact
bStatus = address.SetPerson("Meier", "Anna", "Frau", "", "")
bStatus = address.AddPhone("956 99 23", "061", "", "")
bStatus = address.SetFax("956 99 10", "061", "", "")
bStatus = address.SetOnline("anna.meier@company.ch", "")
bStatus = generalCreditRequest.SetContact("2011234567890", address)

'### provider
bStatus = address.Initialize()
bStatus = address.SetPerson("Gerber", "Stefan", "Herr", "", "")
bStatus = address.SetPostal("Ribigasse 3-5", "", "4434", "Hoelstein", "", "")
bStatus = address.AddPhone("956 99 00", "061", "", "")
bStatus = address.SetFax("956 99 10", "061", "", "")
Dim eanProvider As String
eanProvider = "2034567890111"
bStatus = generalCreditRequest.SetProvider(eanProvider, "P-1234-56", "", "Dipl. Physio", address)

'### cost bearer
bStatus = address.Initialize()
bStatus = address.SetCompany("Krankenkasse Basel", "", "")
bStatus = address.SetPostal("Kassenallee 128", "", "4000", "Basel", "", "")
bStatus = address.AddPhone("810 00 00", "061", "", "")
bStatus = address.SetFax("810 00 99", "061", "", "")
bStatus = address.SetOnline("info@krankenkasse.ch", "")
bStatus = generalCreditRequest.SetCostBearer("7600000000000", address)

'### patient
bStatus = address.Initialize()
bStatus = address.SetPerson("Eggenberger", "Rolf", "Herr", "Dr.", "")
bStatus = address.SetPostal("Ribigasse 3-5", "", "4434", "Hoelstein", "", "")
Dim birthdate As Date
birthdate = DateTime.DateValue("28.2.1964")
Dim eSex As SexType
eSex = enMale
Dim ssn As String
ssn = ""
bStatus = generalCreditRequest.SetPatient(enMale, birthdate, ssn, address)

'### no referrer here

'### no employer here

'### treatment
Dim caseID As String
caseID = "2005.01001-1"
Dim eCanton As CantonType
eCanton = enBL
Dim strTreatmentUnits, strPatientID As String
strPatientID = "123456"
strTreatmentUnits = "4 Sitzungen insgesamt - 1 pro Woche"
bStatus = generalCreditRequest.SetTreatment(today + 10, strTreatmentUnits, eCanton, _
                                            enDisease, strPatientID, caseID)

'### intended therapy (service part)
Dim tariffCode, tariffText, tariffType As String
tariffType = "311"
tariffCode = "7301"
tariffText = "Sitzungspauschale und weitere Therapie"
Dim dTaxPoints7301 As Double
dTaxPoints7301 = 48
Dim dTaxPointValueBL As Double
dTaxPointValueBL = 0.95
Dim dBaseAmount As Double
dBaseAmout = dTaxPointValueBL * dTaxPoints7301
Dim dScaleFactor As Double
dScaleFactor = 1
bStatus = generalCreditRequest.AddService(tariffType, tariffCode, tariffText, 4, dBaseAmout, _
                                          dScaleFactor, strRemark)

'### Substantiation
Dim substantiation As String
substantiation = "Lorem ipsum per nostra mi fune torectum mi konstradiloru si limus mer fin"
bStatus = generalCreditRequest.SetSubstantiation(substantiation, "")

'### law
bStatus = generalCreditRequest.SetLaw(enKVG, DateTime.DateValue("2011-05-01"), caseID, _
                                      "Insured ID", "")

'### diagnosis
bStatus = generalCreditRequest.AddDiagnosis(enDiagnosisByContract, "A1", "A1 Text", enSideBoth, "")
bStatus = generalCreditRequest.AddDiagnosis(enDiagnosisByContract, "B2", "", enSideBoth, "")

'### produce xml
Dim lXMLGenerationAttribute As Long
lXMLGenerationAttribute = 0
Dim lValidationError As Long
Dim lTimestamp As Long
Dim generalCreditResult As GENERALCREDITREQUESTMANAGER430Lib.generalCreditResult
Dim strXmlFile As String
Dim strUsedSchema As String

bStatus = generalCreditManager.GetXML(lXMLGenerationAttribute, strXmlFile, lValidationError,  _
                                      lTimestamp, strUsedSchema, generalCreditResult)
'### GetXML produces a tmp file that needs to be copied
Dim strTargetFile As String
strTargetFile = "GeneralCreditRequestExample430.xml"
FileCopy strXmlFile, strTargetFile
Set generalCreditResult = Nothing

'### print
bStatus = generalCreditManager.Print("", enYes, enYes, "", Nothing, lTimestamp, strUsedSchema, _
                                     generalCreditResult)
Set generalCreditResult = Nothing

'### relase resources
Set address = Nothing
Set generalCreditRequest = Nothing
Set generalCreditManager = Nothing

Exit Sub

Err_Trap:
    MsgBox "Error: " & Err.Description, vbCritical, _
           "Opps! Error" & Str$(Err.Number)
'### relase resources
Set address = Nothing
Set generalCreditRequest = Nothing
Set generalCreditManager = Nothing

End Sub