var accountsReceivable = {
    settings: {
        patient_autocompleteUrl: '',
        health_facility_autocomplete_url: '',
        company_autocomplete_url: ''
    },
    init: function() {
        jQ('#billingBranches').bind('change', function () {
            var val = jQ(this).val();
            jQ('#form-branch-id').val(val);
        });

        jQ('#billingBranchAddress').bind('change', function () {
            var val = jQ(this).val();
            jQ('#form-branch-address-id').val(val);
        });

        this.bindAutoComplete();
    },
    bindAutoComplete: function() {
        global.autocomplete.bind(accountsReceivable.settings.patient_autocompleteUrl, '#form-patient-fullName', '#form-patient-id');
        global.autocomplete.bind(accountsReceivable.settings.health_facility_autocomplete_url, '#form-branch', '#form-branch-id');
        global.autocomplete.bind(accountsReceivable.settings.health_facility_autocomplete_url, '#form-branch-address', '#form-branch-address-id');
        global.autocomplete.bind(accountsReceivable.settings.company_autocomplete_url, '#form-company', '#form-company-id');

    }
};