Code snippets for using the generalInvoiceRequestManager

 


Private Sub GeneralCreditRequestExampleButton_Click()

On Error GoTo Err_Trap

Dim bStatus As Boolean

'### init variables
Dim strFrom As String
strFrom = "2001001302112"
Dim strVia As String
strVia = "2001000012345"
Dim strTo As String
strTo = "2034567890000"
Dim dBirthdate As Date
dBirthdate = DateValue("1944-02-28")
Dim eSex As SexType
eSex = enMale
Dim eCanton As CantonType
eCanton = enBS
Dim eLaw As LawType
eLaw = enKVG
Dim eTreatType As TreatmentType
eTreatType = enAmbulatory
Dim dTreatmentStart As Date
dTreatmentStart = DateValue("2020-07-01")
Dim dTreatmentEnd As Date
dTreatmentEnd = DateValue("2020-07-20")
Dim strPatientInsID As String
strPatientInsID = "123.45.678-012"
Dim eTreatmentReason As TreatmentReasonType
eTreatmentReason = enDisease
Dim strEanProvider As String
strEanProvider = "2034567890111"
Dim strEanResponsible As String
strEanResponsible = "2034567890333"

'### create the main GeneralCreditRequestManager interface
Dim generalCreditRequestManagerEx As GENERALCREDITREQUESTMANAGER450Lib.GeneralCreditRequestManager
Set generalCreditRequestManagerEx = New GeneralCreditRequestManager

'### generate the dependent GeneralCreditRequest interface (allows to input data)
Dim generalCreditRequestEx As GENERALCREDITREQUESTMANAGER450Lib.GeneralCreditRequest
Set generalCreditRequestEx = generalCreditRequestManagerEx.GeneralCreditRequest

'### start the input of data
generalCreditRequestEx.Initialize(enGerman)
generalCreditRequestEx.SetRequest(enRolePhysiotherapist,enPlacePractice,  _
                                  "Physiotherapie am Knetweg",enNo,enNo,enNo,enNo);

'### generate some routing/transport as well as some identifying data (required for XML only)
bStatus = generalCreditRequestEx.SetTransport(strFrom, "", "", strVia, strTo, "")
bStatus = generalCreditRequestEx.SetPackage("GeneralCreditRequestExample", 10001, 4, "sumex1")

'###############################################################################
'### start with credit relevant data, followed by the various address data
'###############################################################################
'### set data triple of the credit object (required)
bStatus = generalCreditRequestEx.SetCreditObject("PhysioID20200707", dTreatmentStart, 0)

'### set the applicable law (required)
bStatus = generalCreditRequestEx.SetLaw(enKVG, 0, "", strPatientInsID)

'### create an address interface that is need to add all the following addresses
'### do not forget to initialize the IAddress interface befor using it
Dim addressEx As GENERALCREDITREQUESTMANAGER450Lib.Address
Set addressEx = generalCreditRequestEx.CreateAddress

'### define the biller of the general credit (required)
'### note that phone, fax and online data are optional
addressEx.Initialize
bStatus = addressEx.SetCompany("Biller AG", "Abteilung Inkasso", "")
bStatus = addressEx.SetPostal("Billerweg 128", "", "4414", "Frenkendorf", "", "")
bStatus = addressEx.AddPhone("956 99 00", "061", "", "")
bStatus = addressEx.SetFax("956 99 10", "061", "+41", "")
bStatus = addressEx.SetOnline("info@biller.ch", "")
bStatus = generalCreditRequestEx.SetBiller("2011234567890", "H-1211-11", "", "", addressEx)

'### define the provider of the nursing care data (required)
'### note that only the required parts are defined here
addressEx.Initialize
bStatus = addressEx.SetCompany("Spitex", "Region Liestal", "")
bStatus = addressEx.SetPostal("Spitexgasse 17b5", "", "4410", "Liestal", "", "")
bStatus = generalCreditRequestEx.SetProvider(strEanProvider,"P-1234-56","", _
                                             "", addressEx)

'### define the health insurance (required)
addressEx.Initialize
bStatus = addressEx.SetCompany("Krankenkasse AG", "Sektion Basel", "")
bStatus = addressEx.SetPostal("Kassengraben 222", "", "4000", "Basel", "", "")
bStatus = generalCreditRequestEx.SetInsurance("2034567890222", addressEx)

'### define the patient (required)
'### note that more data are needed here (sex, birthdate,ssn). data from the insurance 
'### card can be supplied as well 
addressEx.Initialize
bStatus = addressEx.SetPerson("Muster", "Peter", "Herr", "", "c/o Mieter Karl")
bStatus = addressEx.SetPostal("Musterstrasse 5", "", "7304", "Maienfeld", "", "")
bStatus = generalCreditRequestEx.SetPatient(eSex, dBirthdate, "756.1234.5678.90",  _
                                         enDisabilityNone, enIncontinenceNone, addressEx)

bStatus = generalCreditRequestEx.SetCard("12345678901234567890", DateValue("2019-12-31"), _
                                         DateValue("2016-02-01"), "", "")

'### define a referrer if any (optional)
addressEx.Initialize
bStatus = addressEx.SetPerson("Ueberweiser", "Herbert", "Herr", "Dr. med.", "")
bStatus = addressEx.SetPostal("Referrerstrasse 11", "", "5000", "Aarau", "", "")
bStatus = generalCreditRequestEx.SetReferrer("2034567890333", "R-2345-67", "", "", addressEx)

'###############################################################################
'### define some treatment data for an ambulatory case and supply some services
'###############################################################################
'### set treatment information (required)
bStatus = generalCreditRequestEx.SetTreatment(dTreatmentStart, dTreatmentEnd, eCanton, _
                                              eTreatmentReason)

bStatus = generalCreditRequestEx.AddService("311","7320","", _
                "Sitzungspauschale fuer Elektro- und Thermotherapie/Instruktion bei Geraetevermietung", _
                6,dTreatmentStart, 1.0, 25.0, 1.0, "")

bStatus = generalCreditRequestEx.AddService("311","7350","", _
                "Zuschlagsposition fuer die erste Behandlung eines Patienten", _
                1,dTreatmentStart, 1.0, 24.0, 1.0, "")

bStatus = generalCreditRequestEx.AddService("311","7320","", _
                "Sitzungspauschale fuer Elektro- und Thermotherapie/Instruktion bei Geraetevermietung", _
                6,dTreatmentEnd, 1.0, 10.0, 1.0, "")

bStatus = generalCreditRequestEx.AddService("452","10.01.01.00.1","","Kruecken fuer Erwachsene, Kauf", _
                 1,dTreatmentEnd, 0.92, 10.0, 1.0, "")

'### define the measures  - required
bStatus = generalCreditRequestEx.SetSubstantiation("Lorem ipsum dolor sit amet, consetetur....", _
                "this is an optional remark, basically to express something apart from the measures")

'### finalize the input
bStatus = generalCreditRequestEx.Finalize()

'### print the general credit request out as defined by the data 
Dim lTimestamp As Integer
Dim generalCreditResultEx As CARECREDITREQUESTMANAGER450Lib.CareCreditResult
bStatus = generalCreditRequestManagerEx.Print("",0,enNo,"",lTimestamp,   _
                                              generalCreditResultEx)
Set generalCreditResultEx = Nothing

'### finally produce the XML infoset
'### note that the interface generalCreditResultEx is returned by the method
'### if the call was successful - it must not be created! 
Dim lGenerationAttribute As Long
lGenerationAttribute = 0
Dim lValidationError As Long
Dim strXMLFile As String
Dim strUsedXSDSchema As String
bStatus = generalCreditRequestManagerEx.GetXML(lGenerationAttribute, strXMLFile, lValidationError, _
                                                lTimestamp, strUsedXSDSchema, generalCreditResultEx)


'### copy the XML infoset away
Dim strTargetFile As String
strTargetFile = "C:\\GeneralCreditRequestExample.xml"
FileCopy strXMLFile, strTargetFile


'### relase all resources
Set addressEx = Nothing
Set generalCreditResultEx = Nothing
Set generalCreditRequestEx = Nothing
Set generalCreditRequestManagerEx = Nothing

Exit Sub

'### error situation
Err_Trap:
    MsgBox "Error: " & Err.Description, vbCritical, _
           "Opps! Error" & Str$(Err.Number)

'### release all resources
Set addressEx = Nothing
Set generalCreditResultEx = Nothing
Set generalCreditRequestEx = Nothing
Set generalCreditRequestManagerEx = Nothing

End Sub



private void generalCreditRequestExampleButton_Click()
{
    ServiceExInput serviceInputEx;
    CARECREDITREQUESTMANAGER450Lib.Address addressEx;
    CARECREDITREQUESTMANAGER450Lib.CareCreditRequest generalCreditRequestEx;
    CARECREDITREQUESTMANAGER450Lib.CareCreditRequestManager generalCreditRequestManagerEx;
    CARECREDITREQUESTMANAGER450Lib.CareCreditResult generalCreditResultEx;

    try
    {
        bool bStatus;
        // ### init variables
        string strFrom = "2001001302112";
        string strVia = "2001000012345";
        string strTo = "2034567890000";
        DateTime dBirthdate = DateTime.ParseExact("1944-02-28", "yyyy-MM-dd", 
                                                  System.Globalization.CultureInfo.InvariantCulture);
        SexType eSex = SexType.enMale;
        CantonType eCanton = CantonType.enBS;
        LawType eLaw = LawType.enKVG;
        TreatmentType eTreatType = TreatmentType.enAmbulatory;
        DateTime dTreatmentStart = DateTime.ParseExact("2020-07-01", "yyyy-MM-dd", 
                                                       System.Globalization.CultureInfo.InvariantCulture);
        DateTime dTreatmentEnd = DateTime.ParseExact("2020-07-20", "yyyy-MM-dd", 
                                                     System.Globalization.CultureInfo.InvariantCulture);
        string strPatientInsID = "123.45.678-012";
        TreatmentReasonType eTreatmentReason = TreatmentReasonType.enDisease;
        string strEanProvider = "2034567890111";
        string strEanResponsible = "2034567890333";

        // ### create the main CareCreditRequestManager interface
        generalCreditRequestManagerEx = new CareCreditRequestManager();
		generalCreditRequestManagerEx.SetModuleLanguage(LanguageType.enGerman);

        // ### generate the dependent CareCreditRequest interface (allows to input data)
        generalCreditRequestEx = generalCreditRequestManagerEx.CareCreditRequest;

        // ### start the input of data
        generalCreditRequestEx.Initialize(LanguageType.enGerman);
        generalCreditRequestEx.SetRequest(YesNoType.enNo,YesNoType.enNo,OrdinanceType.enFirstOrdinance,"");
		generalCreditRequestEx.SetRequest(RoleType.enRolePhysiotherapist,PlaceType.enPlacePractice,
                                          "Physiotherapie am Knetweg",YesNoType.enNo,YesNoType.enNo,
                                          YesNoType.enNo,YesNoType.enNo);

        // ### generate some routing/transport  as well as some identifying data (required for XML only)
        bStatus = generalCreditRequestEx.SetTransport(strFrom, "", "", strVia, strTo, "");
        bStatus = generalCreditRequestEx.SetPackage("CareCreditRequestExample", 10001, 4, "sumex1");

        // ###############################################################################
        // ### start with credit relevant data, followed by the various address data
        // ###############################################################################
        // ### set data triple of the credit object (required)
        bStatus = generalCreditRequestEx.SetCreditObject("PhysioID20200707", dTreatmentStart, 0);

        // ### set the applicable law (required)
        bStatus = generalCreditRequestEx.SetLaw(LawType.enKVG, DateTime.MinValue, "", strPatientInsID);

        // ### create an address interface that is need to add all the following addresses
        // ### do not forget to initialize the IAddress interface befor using it
        addressEx = generalCreditRequestEx.CreateAddress;

        // ### define the biller of the nursing care credit (required)
        // ### note that phone, fax and online data are optional
        addressEx.Initialize();
        bStatus = addressEx.SetCompany("Biller AG", "Abteilung Inkasso", "");
        bStatus = addressEx.SetPostal("Billerweg 128", "", "4414", "Frenkendorf", "", "");
        bStatus = addressEx.AddPhone("956 99 00", "061", "", "");
        bStatus = addressEx.SetFax("956 99 10", "061", "+41", "");
        bStatus = addressEx.SetOnline("info@biller.ch", "");
        bStatus = generalCreditRequestEx.SetBiller("2011234567890", "H-1211-11", "", "", addressEx);

        // ### define the provider of the nursing care data (required)
        // ### note that only the required parts are defined here
        addressEx.Initialize();
        bStatus = addressEx.SetCompany("Spitex", "Region Liestal", "");
        bStatus = addressEx.SetPostal("Spitexgasse 17b5", "", "4410", "Liestal", "", "");
        bStatus = generalCreditRequestEx.SetProvider(strEanProvider, "", "", "", addressEx);

        // ### define the health insurance (required)
        addressEx.Initialize();
        bStatus = addressEx.SetCompany("Krankenkasse AG", "Sektion Basel", "");
        bStatus = addressEx.SetPostal("Kassengraben 222", "", "4000", "Basel", "", "");
        bStatus = generalCreditRequestEx.SetInsurance("2034567890222", addressEx);

        // ### define the patient (required)
        // ### note that more data are needed here (sex, birthdate,ssn) as well as insurance card data
        addressEx.Initialize();
        bStatus = addressEx.SetPerson("Muster", "Peter", "Herr", "", "c/o Mieter Karl");
        bStatus = addressEx.SetPostal("Musterstrasse 5", "", "7304", "Maienfeld", "", "");
        bStatus = generalCreditRequestEx.SetPatient(eSex, dBirthdate, "756.1234.5678.90", 
		                                         DisabilityAllowanceType.enDisabilityNone,
		                                         IncontinenceDegreeType.enIncontinenceNone, addressEx);
        bStatus = generalCreditRequestEx.SetCard("12345678901234567890", DateTime.ParseExact("2019-12-31", 
                                                  "yyyy-MM-dd", 
                                                  System.Globalization.CultureInfo.InvariantCulture), 
                                                  DateTime.ParseExact("2019-02-01", "yyyy-MM-dd", 
                                                  System.Globalization.CultureInfo.InvariantCulture), 
                                                  "", "");

        // ### define a referrer if any (optional)
        addressEx.Initialize();
        bStatus = addressEx.SetPerson("Ueberweiser", "Herbert", "Herr", "Dr. med.", "Allgemeinmedizin FMH");
        bStatus = addressEx.SetPostal("Referrerstrasse 11", "", "5000", "Aarau", "", "");
        bStatus = generalCreditRequestEx.SetReferrer("2034567890333", "R-2345-67", "", "", addressEx);

        // ###############################################################################
        // ### define some treatment data for an ambulatory case and supply some services
        // ###############################################################################
        // ### set treatment information (required)
        bStatus = generalCreditRequestEx.SetTreatment(dTreatmentStart, dTreatmentEnd,  
                                                   eCanton, eTreatmentReason);

		bStatus = generalCreditRequestEx.AddService("311","7320","",
                "Sitzungspauschale fuer Elektro- und Thermotherapie/Instruktion bei Geraetevermietung",
                6,dTreatmentStart, 1.0, 25.0, 1.0, "")

		bStatus = generalCreditRequestEx.AddService("311","7350","",
                "Zuschlagsposition fuer die erste Behandlung eines Patienten",
                1,dTreatmentStart, 1.0, 24.0, 1.0, "")

		bStatus = generalCreditRequestEx.AddService("311","7320","",
                "Sitzungspauschale fuer Elektro- und Thermotherapie/Instruktion bei Geraetevermietung",
                6,dTreatmentEnd, 1.0, 10.0, 1.0, "")

		bStatus = generalCreditRequestEx.AddService("452","10.01.01.00.1","",
                "Kruecken fuer Erwachsene, Kauf",1,dTreatmentEnd, 0.92, 10.0, 1.0, "")


		// ### define the measures  - required
		bStatus = generalCreditRequestEx.SetSubstantiation("Lorem ipsum dolor sit amet, cosetur....",
                "this is an optional remark, basically to express something apart from the measures")

        // ### finalize the input
        bStatus = generalCreditRequestEx.Finalize();

        // ### finally produce the XML infoset
        // ### note that the interface generalCreditResultEx is returned by the method
        // ### if the call was successful - it must not be created! 
        int lGenerationAttribute = 0;
        int lValidationError;
        int lTimestamp = 0;

        string strXMLFile;
        string strUsedXSDSchema;
        bStatus = generalCreditRequestManagerEx.GetXML(lGenerationAttribute, out strXMLFile, 
                                                        out lValidationError, out lTimestamp,
                                                        out strUsedXSDSchema, out generalCreditResultEx);
														
        // ### copy the XML infoset away
        string strTargetFile = "GeneralCreditRequestExample.xml";
        System.IO.File.Copy(strXMLFile, strTargetFile);
    }
    catch (Exception ex)
    {
        MessageBox.Show("Opps! Error " + ex.ToString(), "OK");
    }

    finally
    {
        // ### relase all resources
        serviceInputEx = null;
        addressEx = null;
        generalCreditResultEx = null;
        generalCreditRequestEx = null;
        generalCreditRequestManagerEx = null;

    }
}