Location: PHPKode > projects > Homeless Mangement Information System > hmis/include/setup_questions.inc
<?php
//*Client Data System, Copyright (C) 2000, 2001, 2002, 2003 Tedd Kelleher.  This is free software, subject to the 
//*GNU GENERAL PUBLIC LICENSE, Version 2, June 1991 (in file named gpl.txt), which should accompany 
//*any distribution of this file.  Tedd Kelleher can be contacted at hide@address.com





///////////\\\\\\\\\\\\\\\\\////////////// END OF THE TABLE CREATION SECTION ///////////\\\\\\\\\\\\\\\\\//////////////	

echo "Inserting questions... ";

    ///Menu Items Setup
	$sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('index_link',  'Home Page', 'index.php', '10')";
	run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('index_link', 'all', 'all')";
	    run_query ($sql, "menu item insertion");

	$sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('add_groups', 'Add ".$group_term."', 'add_groups.php', '20')";
	run_query ($sql, "menu item insertion");

        $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('add_groups', 'all', '10')";
        run_query ($sql, "menu item insertion");

	$sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('edit_groups', 'Edit ".$group_term."', 'edit_user_info.php', '30')";
	run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('edit_groups', 'all', '10')";
	    run_query ($sql, "menu item insertion");

	$sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('query_clients', 'Query Clients', 'query.php', '40')";
	run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('query_clients', 'all', 'all')";
	    run_query ($sql, "menu item insertion");

  	$sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('reports', 'View Reports', 'query_report.php', '50')";
	run_query ($sql, "menu item insertion"); 

        $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('reports', 'all', 'all')";
	    run_query ($sql, "menu item insertion");
  
    $sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('edit_forms', 'Edit Forms', 'edit_questions.php', '70')";
    run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('edit_forms', 'all', '10')";
	    run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('edit_forms', 'all', '20')";
	    run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('edit_forms', 'all', '30')";
	    run_query ($sql, "menu item insertion");

	$sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('change_id', 'Change to Another Login ID', 'change_id.php', '80')";
	run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('change_id', 'all', '10')";
	    run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('change_id', 'all', '20')";
	    run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('change_id', 'all', '30')";
	    run_query ($sql, "menu item insertion");

////Removed per Safe Harbors Deficiency 57
/*
 	$sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('system_critique', 'Report a Bug/Request a Feature', '#system_critique', '100')";
	run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('system_critique', 'all', '10')";
	    run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('system_critique', 'all', '20')";
	    run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('system_critique', 'all', '30')";
	    run_query ($sql, "menu item insertion");
*/

    $sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('logoff', 'Log Off', 'index.php?logoff=yes', '110')";
	run_query ($sql, "menu item insertion");

        $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('logoff', 'all', 'all')";
        run_query ($sql, "menu item insertion");
   
    $sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('add_organizations', 'Add ".$organization_term."', 'add_organizations.php', '15')";
	run_query ($sql, "menu item insertion");

        $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('add_organizations', 'all', '20')";
        run_query ($sql, "menu item insertion");

	$sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('edit_organization', 'Edit ".$organization_term."', 'edit_user_info.php', '25')";
	run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('edit_organization', 'all', '20')";
	    run_query ($sql, "menu item insertion");

    $sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('referral', 'Referrals/ Vacancy Report', 'vacancies.php', '45')";
	run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('referral', 'all', '20')";
	    run_query ($sql, "menu item insertion");

        $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('referral', 'all', '30')";
	    run_query ($sql, "menu item insertion");
        
        $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('referral',
        'all', '40')";
	    run_query ($sql, "menu item insertion");

	$sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('add_users', 'Add Users', 'add_users.php', '17')";
	run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('add_users', 'all', '30')";
	    run_query ($sql, "menu item insertion");

	$sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('edit_users', 'Edit Users', 'edit_user_info.php', '25')";
	run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('edit_users', 'all', '30')";
	    run_query ($sql, "menu item insertion");

    $sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('permissions', 'Set Permissions', 'permissions.php', '75')";
	run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('permissions', 'all', '30')";
	    run_query ($sql, "menu item insertion"); 

    $sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('new_clients', 'Add Clients', 'createclients.php?report_name=client_profile&empty_form=yes', '18')";
	run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('new_clients', 'all', '40')";
	    run_query ($sql, "menu item insertion");

    //$sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('client_lookup', 'Look-Up Clients', 'client_lookup.php', '15')";
	//run_query ($sql, "menu item insertion");

	    //$sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('client_lookup', 'all', '40')";
	    //run_query ($sql, "menu item insertion");

	$sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('add_household_form', 'Households', 'household.php?report_name=options_household&clear_results=1', '26')";
	run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('add_household_form', 'all', '40')";
        run_query ($sql, "menu item insertion");

    $sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('add_client_form', 'Clients', 'clients.php?report_name=options_client&clear_results=1', '24')";
	run_query ($sql, "menu item insertion");

	    $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('add_client_form', 'all', '40')";
        run_query ($sql, "menu item insertion");

    $sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('refer_client', 'Refer Clients', 'vacancies.php', '28')";
//    run_query ($sql, "menu item insertion");

        $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('refer_client', 'all', '40')";
//	    run_query ($sql, "menu item insertion");
 
    $sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('referrals', 'View Referrals', 'referrals.php', '43')";
    run_query ($sql, "menu item insertion"); 

        $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('referrals', 'all', '40')";
        run_query ($sql, "menu item insertion");
    
    $sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('consolidate', 'Consolidate reports', 'consolidate_report.php?report_type[1]=client_profile&report_type[2]=household_intake&report_type[3]=household_exit_followup&report_type[4]=client_assessment&report_type[5]=client_chronic&report_type[6]=client_income&report_type[7]=client_income_exit_followup&report_type[8]=client_service&report_type[9]=intake_exit_events', '43')";
    run_query ($sql, "menu item insertion"); 

        $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('consolidate',
        'all', '10')";
        run_query ($sql, "menu item insertion");

    $sql = "INSERT INTO menu (menu_element_id, menu_title, menu_link, menu_order) VALUES ('change_passowrd', 'Change Password', 'edit_user_login.php', '100')";
    run_query ($sql, "menu item insertion"); 

        $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('change_passowrd',
        'all', '20')";
        run_query ($sql, "menu item insertion");
        $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('change_passowrd',
        'all', '30')";
        run_query ($sql, "menu item insertion");
        $sql = "INSERT INTO menu_permissions (menu_element_id, menu_permissions_page_id, menu_permissions_level) VALUES ('change_passowrd',
        'all', '40')";
        run_query ($sql, "menu item insertion");

////Relationships --  -- INTAKE

run_query("INSERT INTO report_type_profile (report_type_id, report_title, report_description, report_instructions, report_on_unit, report_on_timeperiod, report_that_follows, report_edit_access_levels) VALUES ('INTAKE', 'Relationships', '', '', 'NONE', 'no', 'none', ':10:')", "Error inserting question report profile #");

////ALL FORMS -- ALL -- ALL

run_query("INSERT INTO report_type_profile (report_type_id, report_title, report_description, report_instructions, report_on_unit, report_on_timeperiod, report_that_follows, report_edit_access_levels) VALUES ('ALL', 'ALL FORMS', 'ALL', '', 'ALL', 'no', 'ALL', ':10:')", "Error inserting question report profile #");

////Client Profile -- Collects identifying information and basic attributes. -- client_profile

run_query("INSERT INTO report_type_profile (report_type_id, report_title, report_description, report_instructions, report_on_unit, report_on_timeperiod, report_that_follows, report_edit_access_levels) VALUES ('client_profile', 'Client Profile', 'Collects identifying information and basic attributes.', '', 'client_identifier', 'no', 'none', ':10:20:30:')", "Error inserting question report profile #");

    //Status
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('98', 'Status', 'dropdown', '1', '1', '0', '0', '0', '100', 'yes', NULL, 'yes', NULL, '0', '0', '0', NULL)", "Error inserting question #98");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '98', 'client_profile' )", "Error inserting report_type_ids for question #98");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('339', '98', 'No Status Set', '1', NULL, NULL)", "Error inserting question element #98");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('340', '98', 'Active', '2', NULL, NULL)", "Error inserting question element #98");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('341', '98', 'Inactive/Dormant', '3', NULL, NULL)", "Error inserting question element #98");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('342', '98', 'Exited', '4', NULL, NULL)", "Error inserting question element #98");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('343', '98', 'Followup Required', '5', NULL, NULL)", "Error inserting question element #98");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('344', '98', 'Followup Required - 3 month', '6', NULL, NULL)", "Error inserting question element #98");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('345', '98', 'Followup Required - 6 month', '7', NULL, NULL)", "Error inserting question element #98");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('346', '98', 'Followup Required - 9 month', '8', NULL, NULL)", "Error inserting question element #98");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('347', '98', 'Followup Required - 12 month', '9', NULL, NULL)", "Error inserting question element #98");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('348', '98', 'Deceased', '10', NULL, NULL)", "Error inserting question element #98");

    //Year Born
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('100', 'Year Born', 'number', '1', '1', '4', '1900', '2050', '104', 'yes', NULL, 'yes', NULL, '4', NULL, '5', NULL)", "Error inserting question #100");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '100', 'client_profile' )", "Error inserting report_type_ids for question #100");


    //Gender
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('101', 'Gender', 'radio', '1', '1', NULL, NULL, NULL, '105', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #101");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '101', 'client_profile' )", "Error inserting report_type_ids for question #101");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('1', '101', 'Male', 'male', NULL, NULL)", "Error inserting question element #101");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('2', '101', 'Female', 'female', NULL, NULL)", "Error inserting question element #101");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('3', '101', 'Transgender Male', 'transgender_male', NULL, NULL)", "Error inserting question element #101");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('4', '101', 'Transgender Female', 'transgender_female', NULL, NULL)", "Error inserting question element #101");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('5', '101', 'Transgender', 'transgender', NULL, NULL)", "Error inserting question element #101");

    //Race (select one or more)
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('102', 'Race (select one or more)', 'checkboxes', '1', '1', NULL, NULL, NULL, '106', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #102");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '102', 'client_profile' )", "Error inserting report_type_ids for question #102");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('6', '102', 'Indian/Alaskan Native', 'indian_alaskan_native', NULL, NULL)", "Error inserting question element #102");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('7', '102', 'Asian', 'asian', NULL, NULL)", "Error inserting question element #102");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('8', '102', 'Black/African-American', 'black_african_american', NULL, NULL)", "Error inserting question element #102");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('9', '102', 'Native Hawaiian/Other-Pacific Islander', 'native_hawaiian_other_pacific_islander', NULL, NULL)", "Error inserting question element #102");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('10', '102', 'White', 'white', NULL, NULL)", "Error inserting question element #102");

    //Ethnicity - Hispanic or Latino?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('103', 'Ethnicity - Hispanic or Latino?', 'radio', '1', '1', NULL, NULL, NULL, '107', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #103");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '103', 'client_profile' )", "Error inserting report_type_ids for question #103");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('11', '103', 'No', 'no', NULL, NULL)", "Error inserting question element #103");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('12', '103', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #103");

    //Sexual Orientation
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id,
    question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value,
    question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute)
    VALUES ('104', 'Sexual Orientation', 'radio', '1000000', '1', NULL, NULL, NULL, '108', 'no', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #104");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '104', 'client_profile' )", "Error inserting report_type_ids for question #104");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('13', '104', 'Lesbian', 'lesbian', NULL, NULL)", "Error inserting question element #104");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('14', '104', 'Gay', 'gay', NULL, NULL)", "Error inserting question element #104");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('15', '104', 'Bisexual', 'bisexual', NULL, NULL)", "Error inserting question element #104");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('16', '104', 'Heterosexual', 'heterosexual', NULL, NULL)", "Error inserting question element #104");

    //Ever served on active duty in US military
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('105', 'Ever served on active duty in US military', 'radio', '1', '1', NULL, NULL, NULL, '109', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #105");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '105', 'client_profile' )", "Error inserting report_type_ids for question #105");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('17', '105', 'No', 'no', NULL, NULL)", "Error inserting question element #105");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('18', '105', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #105");

    //Clients ability to understand English?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('106', 'Clients ability to understand English?', 'dropdown', '1', '1', NULL, NULL, NULL, '110', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #106");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '106', 'client_profile' )", "Error inserting report_type_ids for question #106");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('19', '106', 'No Interpreter Needed', 'no_interpreter_needed', NULL, NULL)", "Error inserting question element #106");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('20', '106', 'Interpreter Needed', 'interpreter_needed', NULL, NULL)", "Error inserting question element #106");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('21', '106', 'Unknown', 'unknown', NULL, NULL)", "Error inserting question element #106");

    //Alias/Street Name
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('108', 'Alias/Street Name', 'text', '1', '1', '50', NULL, NULL, '112', 'no', NULL, 'yes', NULL, '30', NULL, NULL, NULL)", "Error inserting question #108");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '108', 'client_profile' )", "Error inserting report_type_ids for question #108");


    //Case manager assigned
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('109', 'Case manager assigned', 'text', '1', '1', '50', NULL, NULL, '114', 'no', NULL, 'yes', NULL, '30', NULL, NULL, NULL)", "Error inserting question #109");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '109', 'client_profile' )", "Error inserting report_type_ids for question #109");


    //Phone Number
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('214', 'Phone Number', 'text', '1', '1', '50', NULL, NULL, '113', 'no', NULL, 'yes', NULL, '30', NULL, NULL, NULL)", "Error inserting question #214");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '214', 'client_profile' )", "Error inserting report_type_ids for question #214");


////Client Assessment -- Collects information for assessing the client. -- client_assessment

run_query("INSERT INTO report_type_profile (report_type_id, report_title, report_description, report_instructions, report_on_unit, report_on_timeperiod, report_that_follows, report_edit_access_levels) VALUES ('client_assessment', 'Client Assessment', 'Collects information for assessing the client.', '', 'client', 'no', 'none', ':10:20:30:')", "Error inserting question report profile #");

    //Do you have a physical disability?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('111', 'Do you have a physical disability?', 'radio', '1', '1', NULL, NULL, NULL, '104', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #111");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '111', 'client_assessment' )", "Error inserting report_type_ids for question #111");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('22', '111', 'No', 'no', NULL, NULL)", "Error inserting question element #111");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('23', '111', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #111");

    //Received benefits or services for developmental disability?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('112', 'Received benefits or services for developmental disability?', 'radio', '1', '1', NULL, NULL, NULL, '105', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #112");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '112', 'client_assessment' )", "Error inserting report_type_ids for question #112");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('24', '112', 'No', 'no', NULL, NULL)", "Error inserting question element #112");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('25', '112', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #112");

    //Compared to others how would you say your health is?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('113', 'Compared to others how would you say your health is?', 'dropdown', '1', '1', NULL, NULL, NULL, '106', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #113");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '113', 'client_assessment' )", "Error inserting report_type_ids for question #113");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('26', '113', 'Excellent', 'excellent', NULL, NULL)", "Error inserting question element #113");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('27', '113', 'Very Good', 'very_good', NULL, NULL)", "Error inserting question element #113");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('28', '113', 'Good', 'good', NULL, NULL)", "Error inserting question element #113");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('29', '113', 'Fair', 'fair', NULL, NULL)", "Error inserting question element #113");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('30', '113', 'Poor', 'poor', NULL, NULL)", "Error inserting question element #113");

    //Treated for alcoholism?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('114', 'Treated for alcoholism?', 'radio', '1', '1', NULL, NULL, NULL, '107', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #114");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '114', 'client_assessment' )", "Error inserting report_type_ids for question #114");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('31', '114', 'No', 'no', NULL, NULL)", "Error inserting question element #114");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('32', '114', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #114");

    //Do you feel you have an alcohol problem?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('115', 'Do you feel you have an alcohol problem?', 'radio', '1', '1', NULL, NULL, NULL, '108', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #115");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '115', 'client_assessment' )", "Error inserting report_type_ids for question #115");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('33', '115', 'No', 'no', NULL, NULL)", "Error inserting question element #115");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('34', '115', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #115");

    //Treated for drug dependency?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('116', 'Treated for drug dependency?', 'radio', '1', '1', NULL, NULL, NULL, '109', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #116");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '116', 'client_assessment' )", "Error inserting report_type_ids for question #116");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('35', '116', 'No', 'no', NULL, NULL)", "Error inserting question element #116");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('36', '116', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #116");

    //Do you feel you have a drug problem?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('117', 'Do you feel you have a drug problem?', 'radio', '1', '1', NULL, NULL, NULL, '110', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #117");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '117', 'client_assessment' )", "Error inserting report_type_ids for question #117");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('37', '117', 'No', 'no', NULL, NULL)", "Error inserting question element #117");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('38', '117', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #117");

    //Treated for a psychiatric problem?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('118', 'Treated for a psychiatric problem?', 'radio', '1', '1', NULL, NULL, NULL, '111', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #118");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '118', 'client_assessment' )", "Error inserting report_type_ids for question #118");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('39', '118', 'No', 'no', NULL, NULL)", "Error inserting question element #118");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('40', '118', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #118");

    //Do you feel you have any psychiatric or emotional problems?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('119', 'Do you feel you have any psychiatric or emotional problems?', 'radio', '1', '1', NULL, NULL, NULL, '112', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #119");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '119', 'client_assessment' )", "Error inserting report_type_ids for question #119");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('41', '119', 'No', 'no', NULL, NULL)", "Error inserting question element #119");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('42', '119', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #119");

    //Have you experienced Domestic Violence?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('120', 'Have you experienced Domestic Violence?', 'radio', '1', '1', NULL, NULL, NULL, '113', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #120");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '120', 'client_assessment' )", "Error inserting report_type_ids for question #120");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('43', '120', 'No', 'no', NULL, NULL)", "Error inserting question element #120");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('44', '120', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #120");

    //If you have experienced Domestic Violence when?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('121', 'If you have experienced Domestic Violence when?', 'dropdown', '1', '1', NULL, NULL, NULL, '114', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #121");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '121', 'client_assessment' )", "Error inserting report_type_ids for question #121");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('45', '121', 'Within the past 3 months', 'within_the_past_3_months', NULL, NULL)", "Error inserting question element #121");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('46', '121', '3 to 6 months ago', '3_to_6_months_ago', NULL, NULL)", "Error inserting question element #121");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('47', '121', '6 to 12 months ago', '6_to_12_months_ago', NULL, NULL)", "Error inserting question element #121");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('48', '121', 'More than a year ago', 'more_than_a_year_ago', NULL, NULL)", "Error inserting question element #121");

    //Are you pregnant?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('122', 'Are you pregnant?', 'radio', '1', '1', NULL, NULL, NULL, '115', 'yes', NULL, 'yes', NULL, NULL, NULL, '7', NULL)", "Error inserting question #122");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '122', 'client_assessment' )", "Error inserting report_type_ids for question #122");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('49', '122', 'No', 'no', NULL, NULL)", "Error inserting question element #122");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('50', '122', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #122");

    //If you are pregnant due date?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('123', 'If you are pregnant due date?', 'date', '1', '1', NULL, NULL, NULL, '116', 'no', NULL, 'yes', NULL, NULL, NULL, '7', 'mjY')", "Error inserting question #123");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '123', 'client_assessment' )", "Error inserting report_type_ids for question #123");


    //Do  you have AIDS or are you HIV positive?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('124', 'Do  you have AIDS or are you HIV positive?', 'radio', '1', '1', NULL, NULL, NULL, '117', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #124");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '124', 'client_assessment' )", "Error inserting report_type_ids for question #124");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('51', '124', 'No', 'no', NULL, NULL)", "Error inserting question element #124");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('52', '124', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #124");

////Client Income -- Collects information regarding the clients income. -- client_income

run_query("INSERT INTO report_type_profile (report_type_id, report_title, report_description, report_instructions, report_on_unit, report_on_timeperiod, report_that_follows, report_edit_access_levels) VALUES ('client_income', 'Client Income', 'Collects information regarding the clients income.', '', 'client', 'no', 'none', ':10:20:30:')", "Error inserting question report profile #");

    //Monthly Income
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('151', 'Monthly Income', 'table', '1', '1', '7', NULL, NULL, '104', 'yes', NULL, 'yes', NULL, NULL, NULL, NULL, NULL)", "Error inserting question #151");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '151', 'client_income' )", "Error inserting report_type_ids for question #151");

     run_query("INSERT INTO table_profiles (question_id, x_axis_title, y_axis_title, table_type) VALUES ('151', NULL, NULL, 'number')", "Error inserting table profile #151");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('1', '151', 'x', 'Amount', 'default', '5', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #151");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('2', '151', 'y', 'Employment', 'default', '10', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #151");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('3', '151', 'y', 'Unemployment Ins.', 'default', '15', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #151");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('4', '151', 'y', 'SSI', 'default', '20', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #151");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('5', '151', 'y', 'SSDI', 'default', '25', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #151");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('6', '151', 'y', 'Veterans Disability', 'default', '30', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #151");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('7', '151', 'y', 'Private Disability', 'default', '35', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #151");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('8', '151', 'y', 'Workers Comp', 'default', '40', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #151");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('9', '151', 'y', 'TANF', 'default', '45', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #151");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('10', '151', 'y', 'GA', 'default', '50', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #151");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('11', '151', 'y', 'Retirement for SS', 'default', '55', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #151");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('12', '151', 'y', 'Veterans Pension', 'default', '60', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #151");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('13', '151', 'y', 'Pension', 'default', '65', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #151");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('14', '151', 'y', 'Child support', 'default', '70', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #151");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('15', '151', 'y', 'Alimony or spousal support', 'default', '75', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #151");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('16', '151', 'y', 'Other Sources', 'default', '80', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #151");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('17', '151', 'y', '<b>TOTAL</b>', 'total', '85', '1', '1', 'none', '0', '0', 'visible')", "Error inserting question element #151");

    //Are you receiving Medicare?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('152', 'Are you receiving Medicare?', 'radio', '1', '1', NULL, NULL, NULL, '105', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #152");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '152', 'client_income' )", "Error inserting report_type_ids for question #152");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('127', '152', 'No', 'no', NULL, NULL)", "Error inserting question element #152");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('128', '152', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #152");

    //Are you receiving Medicaid?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('153', 'Are you receiving Medicaid?', 'radio', '1', '1', NULL, NULL, NULL, '106', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #153");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '153', 'client_income' )", "Error inserting report_type_ids for question #153");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('129', '153', 'No', 'no', NULL, NULL)", "Error inserting question element #153");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('130', '153', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #153");

    //Are you receiving Food Stamps or money for food on a benefits card?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('154', 'Are you receiving Food Stamps or money for food on a benefits card?', 'radio', '1', '1', NULL, NULL, NULL, '107', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #154");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '154', 'client_income' )", "Error inserting report_type_ids for question #154");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('131', '154', 'No', 'no', NULL, NULL)", "Error inserting question element #154");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('132', '154', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #154");

    //Are you receiving State Childrens Health Insurance Program?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('155', 'Are you receiving State Childrens Health Insurance Program?', 'radio', '1', '1', NULL, NULL, NULL, '108', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #155");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '155', 'client_income' )", "Error inserting report_type_ids for question #155");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('133', '155', 'No', 'no', NULL, NULL)", "Error inserting question element #155");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('134', '155', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #155");

    //Are you receiving WIC?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('156', 'Are you receiving WIC?', 'radio', '1', '1', NULL, NULL, NULL, '109', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #156");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '156', 'client_income' )", "Error inserting report_type_ids for question #156");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('135', '156', 'No', 'no', NULL, NULL)", "Error inserting question element #156");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('136', '156', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #156");

    //Are you receiving Veterans Administration Medical Services?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('157', 'Are you receiving Veterans Administration Medical Services?', 'radio', '1', '1', NULL, NULL, NULL, '110', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #157");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '157', 'client_income' )", "Error inserting report_type_ids for question #157");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('137', '157', 'No', 'no', NULL, NULL)", "Error inserting question element #157");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('138', '157', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #157");

    //Are you receiving TANF child care services?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('158', 'Are you receiving TANF child care services?', 'radio', '1', '1', NULL, NULL, NULL, '111', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #158");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '158', 'client_income' )", "Error inserting report_type_ids for question #158");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('139', '158', 'No', 'no', NULL, NULL)", "Error inserting question element #158");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('140', '158', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #158");

    //Are you receiving TANF transportation services?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('159', 'Are you receiving TANF transportation services?', 'radio', '1', '1', NULL, NULL, NULL, '112', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #159");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '159', 'client_income' )", "Error inserting report_type_ids for question #159");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('141', '159', 'No', 'no', NULL, NULL)", "Error inserting question element #159");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('142', '159', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #159");

    //Are you receiving other TANF funded services?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('160', 'Are you receiving other TANF funded services?', 'radio', '1', '1', NULL, NULL, NULL, '113', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #160");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '160', 'client_income' )", "Error inserting report_type_ids for question #160");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('143', '160', 'No', 'no', NULL, NULL)", "Error inserting question element #160");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('144', '160', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #160");

    //Are you receiving rental assistance, such as Section 8 vouchers or public housing?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('161', 'Are you receiving rental assistance, such as Section 8 vouchers or public housing?', 'radio', '1', '1', NULL, NULL, NULL, '114', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #161");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '161', 'client_income' )", "Error inserting report_type_ids for question #161");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('145', '161', 'No', 'no', NULL, NULL)", "Error inserting question element #161");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('146', '161', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #161");

////Client Employment/Education -- Collects information regarding the clients employment and education. -- client_employment_education

run_query("INSERT INTO report_type_profile (report_type_id, report_title, report_description, report_instructions, report_on_unit, report_on_timeperiod, report_that_follows, report_edit_access_levels) VALUES ('client_employment_education', 'Client Employment/Education', 'Collects information regarding the clients employment and education.', '', 'client', 'no', 'none', ':10:20:30:')", "Error inserting question report profile #");

    //Currently employed?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('141', 'Currently employed?', 'radio', '1', '1', NULL, NULL, NULL, '104', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #141");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '141', 'client_employment_education' )", "Error inserting report_type_ids for question #141");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('99', '141', 'No', 'no', NULL, NULL)", "Error inserting question element #141");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('100', '141', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #141");

    //Employer Name
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('142', 'Employer Name', 'text', '1', '1', '50', NULL, NULL, '105', 'no', NULL, 'yes', NULL, '30', NULL, '5', NULL)", "Error inserting question #142");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '142', 'client_employment_education' )", "Error inserting report_type_ids for question #142");


    //Date Employed
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('143', 'Date Employed', 'date', '1', '1', NULL, NULL, NULL, '106', 'no', NULL, 'yes', NULL, NULL, NULL, '5', 'mjY')", "Error inserting question #143");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '143', 'client_employment_education' )", "Error inserting report_type_ids for question #143");


    //Job Title
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('144', 'Job Title', 'text', '1', '1', '50', NULL, NULL, '107', 'no', NULL, 'yes', NULL, '30', NULL, '5', NULL)", "Error inserting question #144");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '144', 'client_employment_education' )", "Error inserting report_type_ids for question #144");


    //How many hours did you work last week?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('145', 'How many hours did you work last week?', 'number', '1', '1', '4', '-1', '169', '108', 'no', NULL, 'yes', NULL, '4', NULL, '5', NULL)", "Error inserting question #145");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '145', 'client_employment_education' )", "Error inserting report_type_ids for question #145");


    //Type of employment?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('146', 'Type of employment?', 'dropdown', '1', '1', NULL, NULL, NULL, '109', 'no', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #146");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '146', 'client_employment_education' )", "Error inserting report_type_ids for question #146");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('101', '146', 'Permanent', 'permanent', NULL, NULL)", "Error inserting question element #146");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('102', '146', 'Temporary', 'temporary', NULL, NULL)", "Error inserting question element #146");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('103', '146', 'Seasonal', 'seasonal', NULL, NULL)", "Error inserting question element #146");

    //Currently looking for work?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('147', 'Currently looking for work?', 'dropdown', '1', '1', NULL, NULL, NULL, '110', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #147");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '147', 'client_employment_education' )", "Error inserting report_type_ids for question #147");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('104', '147', 'No', 'no', NULL, NULL)", "Error inserting question element #147");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('105', '147', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #147");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('106', '147', 'Disabled', 'disabled', NULL, NULL)", "Error inserting question element #147");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('107', '147', 'Retired', 'retired', NULL, NULL)", "Error inserting question element #147");

    //Are you in school now?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('148', 'Are you in school now?', 'radio', '1', '1', NULL, NULL, NULL, '111', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #148");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '148', 'client_employment_education' )", "Error inserting report_type_ids for question #148");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('108', '148', 'No', 'no', NULL, NULL)", "Error inserting question element #148");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('109', '148', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #148");

    //Vocational training?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('149', 'Have you received any vocational training?', 'radio', '1', '1', NULL, NULL, NULL, '112', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #149");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '149', 'client_employment_education' )", "Error inserting report_type_ids for question #149");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('110', '149', 'No', 'no', NULL, NULL)", "Error inserting question element #149");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('111', '149', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #149");

    //Highest schooling achieved?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('150', 'Highest schooling achieved?', 'dropdown', '1', '1', NULL, NULL, NULL, '113', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #150");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '150', 'client_employment_education' )", "Error inserting report_type_ids for question #150");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('112', '150', 'No schooling completed', 'no_schooling_completed', NULL, NULL)", "Error inserting question element #150");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('113', '150', 'Nursery school to 4th grade', 'nursery_school_to_4th_grade', NULL, NULL)", "Error inserting question element #150");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('114', '150', '5th or 6th grade', '5th_or_6th_grade', NULL, NULL)", "Error inserting question element #150");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('115', '150', '7th or 8th grade', '7th_or_8th_grade', NULL, NULL)", "Error inserting question element #150");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('116', '150', '9th grade', '9th_grade', NULL, NULL)", "Error inserting question element #150");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('117', '150', '10th', '10th', NULL, NULL)", "Error inserting question element #150");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('118', '150', '11th', '11th', NULL, NULL)", "Error inserting question element #150");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('119', '150', '12th grade no diploma', '12th_grade_no_diploma', NULL, NULL)", "Error inserting question element #150");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('120', '150', 'High School diploma', 'high_school_diploma', NULL, NULL)", "Error inserting question element #150");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('121', '150', 'GED', 'ged', NULL, NULL)", "Error inserting question element #150");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('122', '150', 'Associates', 'associates', NULL, NULL)", "Error inserting question element #150");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('123', '150', 'Bachelors', 'bachelors', NULL, NULL)", "Error inserting question element #150");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('124', '150', 'Masters', 'masters', NULL, NULL)", "Error inserting question element #150");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('125', '150', 'PhD', 'phd', NULL, NULL)", "Error inserting question element #150");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('126', '150', 'Other graduate', 'other_graduate', NULL, NULL)", "Error inserting question element #150");

////Client Income Exit/Followup -- Collects information regarding the clients income at the time of exit or followup. -- client_income_exit_followup

run_query("INSERT INTO report_type_profile (report_type_id, report_title, report_description, report_instructions, report_on_unit, report_on_timeperiod, report_that_follows, report_edit_access_levels) VALUES ('client_income_exit_followup', 'Client Income Exit/Followup', 'Collects information regarding the clients income at the time of exit or followup.', '', 'client', 'no', 'none', ':10:20:30:')", "Error inserting question report profile #");

    //Is this an exit or followup?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('162', 'Is this an exit or followup?', 'radio', '1', '1', NULL, NULL, NULL, '104', 'yes', NULL, 'yes', NULL, NULL, NULL, NULL, NULL)", "Error inserting question #162");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '162', 'client_income_exit_followup' )", "Error inserting report_type_ids for question #162");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('147', '162', 'Exit', 'exit', NULL, NULL)", "Error inserting question element #162");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('148', '162', 'Followup', 'followup', NULL, NULL)", "Error inserting question element #162");

    //Monthly Income
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('163', 'Monthly Income', 'table', '1', '1', '7', NULL, NULL, '105', 'yes', NULL, 'yes', NULL, NULL, NULL, NULL, NULL)", "Error inserting question #163");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '163', 'client_income_exit_followup' )", "Error inserting report_type_ids for question #163");

     run_query("INSERT INTO table_profiles (question_id, x_axis_title, y_axis_title, table_type) VALUES ('163', NULL, NULL, 'number')", "Error inserting table profile #163");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('18', '163', 'x', 'Amount', 'default', '5', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #163");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('19', '163', 'y', 'Employment', 'default', '10', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #163");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('20', '163', 'y', 'Unemployment Ins.', 'default', '15', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #163");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('21', '163', 'y', 'SSI', 'default', '20', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #163");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('22', '163', 'y', 'SSDI', 'default', '25', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #163");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('23', '163', 'y', 'Veterans Disability', 'default', '30', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #163");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('24', '163', 'y', 'Private Disability', 'default', '35', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #163");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('25', '163', 'y', 'Workers Comp', 'default', '40', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #163");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('26', '163', 'y', 'TANF', 'default', '45', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #163");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('27', '163', 'y', 'GA', 'default', '50', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #163");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('28', '163', 'y', 'Retirement for SS', 'default', '55', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #163");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('29', '163', 'y', 'Veterans Pension', 'default', '60', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #163");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('30', '163', 'y', 'Pension', 'default', '65', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #163");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('31', '163', 'y', 'Child support', 'default', '70', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #163");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('32', '163', 'y', 'Alimony or spousal support', 'default', '75', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #163");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('33', '163', 'y', 'Other Sources', 'default', '80', '1', '1', 'none', '0', '9999', 'visible')", "Error inserting question element #163");
          run_query("INSERT INTO table_elements (axis_id, question_id, axis_type, axis_label, axis_special_type, axis_display_order, axis_owner_group_id, axis_owner_org_id, axis_required, axis_range_bottom, axis_range_top, axis_visible) VALUES ('34', '163', 'y', '<b>TOTAL</b>', 'total', '85', '1', '1', 'none', '0', '0', 'visible')", "Error inserting question element #163");

    //Are you receiving Medicare?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('164', 'Are you receiving Medicare?', 'radio', '1', '1', NULL, NULL, NULL, '106', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #164");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '164', 'client_income_exit_followup' )", "Error inserting report_type_ids for question #164");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('149', '164', 'No', 'no', NULL, NULL)", "Error inserting question element #164");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('150', '164', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #164");

    //Are you receiving Medicaid?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('165', 'Are you receiving Medicaid?', 'radio', '1', '1', NULL, NULL, NULL, '107', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #165");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '165', 'client_income_exit_followup' )", "Error inserting report_type_ids for question #165");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('151', '165', 'No', 'no', NULL, NULL)", "Error inserting question element #165");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('152', '165', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #165");

    //Are you receiving Food Stamps or money for food on a benefits card?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('166', 'Are you receiving Food Stamps or money for food on a benefits card?', 'radio', '1', '1', NULL, NULL, NULL, '108', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #166");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '166', 'client_income_exit_followup' )", "Error inserting report_type_ids for question #166");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('153', '166', 'No', 'no', NULL, NULL)", "Error inserting question element #166");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('154', '166', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #166");

    //Are you receiving State Childrens Health Insurance Program?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('167', 'Are you receiving State Childrens Health Insurance Program?', 'radio', '1', '1', NULL, NULL, NULL, '109', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #167");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '167', 'client_income_exit_followup' )", "Error inserting report_type_ids for question #167");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('155', '167', 'No', 'no', NULL, NULL)", "Error inserting question element #167");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('156', '167', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #167");

    //Are you receiving WIC?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('168', 'Are you receiving WIC?', 'radio', '1', '1', NULL, NULL, NULL, '110', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #168");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '168', 'client_income_exit_followup' )", "Error inserting report_type_ids for question #168");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('157', '168', 'No', 'no', NULL, NULL)", "Error inserting question element #168");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('158', '168', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #168");

    //Are you receiving Veterans Administration Medical Services?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('169', 'Are you receiving Veterans Administration Medical Services?', 'radio', '1', '1', NULL, NULL, NULL, '111', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #169");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '169', 'client_income_exit_followup' )", "Error inserting report_type_ids for question #169");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('159', '169', 'No', 'no', NULL, NULL)", "Error inserting question element #169");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('160', '169', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #169");

    //Are you receiving TANF child care services?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('170', 'Are you receiving TANF child care services?', 'radio', '1', '1', NULL, NULL, NULL, '112', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #170");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '170', 'client_income_exit_followup' )", "Error inserting report_type_ids for question #170");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('161', '170', 'No', 'no', NULL, NULL)", "Error inserting question element #170");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('162', '170', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #170");

    //Are you receiving TANF transportation services?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('171', 'Are you receiving TANF transportation services?', 'radio', '1', '1', NULL, NULL, NULL, '113', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #171");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '171', 'client_income_exit_followup' )", "Error inserting report_type_ids for question #171");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('163', '171', 'No', 'no', NULL, NULL)", "Error inserting question element #171");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('164', '171', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #171");

    //Are you receiving other TANF funded services?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('172', 'Are you receiving other TANF funded services?', 'radio', '1', '1', NULL, NULL, NULL, '114', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #172");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '172', 'client_income_exit_followup' )", "Error inserting report_type_ids for question #172");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('165', '172', 'No', 'no', NULL, NULL)", "Error inserting question element #172");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('166', '172', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #172");

    //Are you receiving rental assistance, such as Section 8 vouchers or public housing?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('173', 'Are you receiving rental assistance, such as Section 8 vouchers or public housing?', 'radio', '1', '1', NULL, NULL, NULL, '115', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #173");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '173', 'client_income_exit_followup' )", "Error inserting report_type_ids for question #173");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('167', '173', 'No', 'no', NULL, NULL)", "Error inserting question element #173");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('168', '173', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #173");

////Client Employment/Education Exit/Followup -- Collects information regarding the clients employment and education at the time of exit or followup. -- client_employ_ed_exit_followup

run_query("INSERT INTO report_type_profile (report_type_id, report_title, report_description, report_instructions, report_on_unit, report_on_timeperiod, report_that_follows, report_edit_access_levels) VALUES ('client_employ_ed_exit_followup', 'Client Employment/Education Exit/Followup', 'Collects information regarding the clients employment and education at the time of exit or followup.', '', 'client', 'no', 'none', ':10:20:30:')", "Error inserting question report profile #");

    //Is this an exit or followup?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('130', 'Is this an exit or followup?', 'radio', '1', '1', NULL, NULL, NULL, '104', 'yes', NULL, 'yes', NULL, NULL, NULL, NULL, NULL)", "Error inserting question #130");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '130', 'client_employ_ed_exit_followup' )", "Error inserting report_type_ids for question #130");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('69', '130', 'Exit', 'exit', NULL, NULL)", "Error inserting question element #130");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('70', '130', 'Followup', 'followup', NULL, NULL)", "Error inserting question element #130");

    //Currently employed?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('131', 'Currently employed?', 'radio', '1', '1', NULL, NULL, NULL, '105', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #131");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '131', 'client_employ_ed_exit_followup' )", "Error inserting report_type_ids for question #131");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('71', '131', 'No', 'no', NULL, NULL)", "Error inserting question element #131");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('72', '131', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #131");

    //Employer Name
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('132', 'Employer Name', 'text', '1', '1', '50', NULL, NULL, '106', 'no', NULL, 'yes', NULL, '30', NULL, '5', NULL)", "Error inserting question #132");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '132', 'client_employ_ed_exit_followup' )", "Error inserting report_type_ids for question #132");


    //Date Employed
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('133', 'Date Employed', 'date', '1', '1', NULL, NULL, NULL, '107', 'no', NULL, 'yes', NULL, NULL, NULL, '5', 'mjY')", "Error inserting question #133");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '133', 'client_employ_ed_exit_followup' )", "Error inserting report_type_ids for question #133");


    //Job Title
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('134', 'Job Title', 'text', '1', '1', '50', NULL, NULL, '108', 'no', NULL, 'yes', NULL, '30', NULL, '5', NULL)", "Error inserting question #134");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '134', 'client_employ_ed_exit_followup' )", "Error inserting report_type_ids for question #134");


    //How many hours did you work last week?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('135', 'How many hours did you work last week?', 'number', '1', '1', '4', '-1', '169', '109', 'no', NULL, 'yes', NULL, '4', NULL, '5', NULL)", "Error inserting question #135");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '135', 'client_employ_ed_exit_followup' )", "Error inserting report_type_ids for question #135");


    //Type of employment?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('136', 'Type of employment?', 'dropdown', '1', '1', NULL, NULL, NULL, '110', 'no', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #136");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '136', 'client_employ_ed_exit_followup' )", "Error inserting report_type_ids for question #136");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('73', '136', 'Permanent', 'permanent', NULL, NULL)", "Error inserting question element #136");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('74', '136', 'Temporary', 'temporary', NULL, NULL)", "Error inserting question element #136");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('75', '136', 'Seasonal', 'seasonal', NULL, NULL)", "Error inserting question element #136");

    //Currently looking for work?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('137', 'Currently looking for work?', 'dropdown', '1', '1', NULL, NULL, NULL, '111', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #137");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '137', 'client_employ_ed_exit_followup' )", "Error inserting report_type_ids for question #137");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('76', '137', 'No', 'no', NULL, NULL)", "Error inserting question element #137");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('77', '137', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #137");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('78', '137', 'Disabled', 'disabled', NULL, NULL)", "Error inserting question element #137");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('79', '137', 'Retired', 'retired', NULL, NULL)", "Error inserting question element #137");

    //Are you in school now?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('138', 'Are you in school now?', 'radio', '1', '1', NULL, NULL, NULL, '112', 'yes', NULL, 'yes', NULL, NULL, NULL, '7', NULL)", "Error inserting question #138");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '138', 'client_employ_ed_exit_followup' )", "Error inserting report_type_ids for question #138");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('80', '138', 'No', 'no', NULL, NULL)", "Error inserting question element #138");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('81', '138', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #138");

    //Have you received any vocational training?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('139', 'Have you received any vocational training?', 'radio', '1', '1', NULL, NULL, NULL, '113', 'yes', NULL, 'yes', NULL, NULL, NULL, '7', NULL)", "Error inserting question #139");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '139', 'client_employ_ed_exit_followup' )", "Error inserting report_type_ids for question #139");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('82', '139', 'No', 'no', NULL, NULL)", "Error inserting question element #139");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('83', '139', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #139");

    //Highest level of school completed?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('140', 'Highest level of school completed?', 'dropdown', '1', '1', NULL, NULL, NULL, '114', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #140");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '140', 'client_employ_ed_exit_followup' )", "Error inserting report_type_ids for question #140");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('84', '140', 'No schooling completed', 'no_schooling_completed', NULL, NULL)", "Error inserting question element #140");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('85', '140', 'Nursery school to 4th grade', 'nursery_school_to_4th_grade', NULL, NULL)", "Error inserting question element #140");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('86', '140', '5th or 6th grade', '5th_or_6th_grade', NULL, NULL)", "Error inserting question element #140");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('87', '140', '7th or 8th grade', '7th_or_8th_grade', NULL, NULL)", "Error inserting question element #140");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('88', '140', '9th grade', '9th_grade', NULL, NULL)", "Error inserting question element #140");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('89', '140', '10th', '10th', NULL, NULL)", "Error inserting question element #140");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('90', '140', '11th', '11th', NULL, NULL)", "Error inserting question element #140");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('91', '140', '12th grade no diploma', '12th_grade_no_diploma', NULL, NULL)", "Error inserting question element #140");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('92', '140', 'High School diploma', 'high_school_diploma', NULL, NULL)", "Error inserting question element #140");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('93', '140', 'GED', 'ged', NULL, NULL)", "Error inserting question element #140");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('94', '140', 'Associates', 'associates', NULL, NULL)", "Error inserting question element #140");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('95', '140', 'Bachelors', 'bachelors', NULL, NULL)", "Error inserting question element #140");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('96', '140', 'Masters', 'masters', NULL, NULL)", "Error inserting question element #140");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('97', '140', 'PhD', 'phd', NULL, NULL)", "Error inserting question element #140");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('98', '140', 'Other graduate', 'other_graduate', NULL, NULL)", "Error inserting question element #140");

////Client Background -- Collects information about a clients background. -- client_background

run_query("INSERT INTO report_type_profile (report_type_id, report_title, report_description, report_instructions, report_on_unit, report_on_timeperiod, report_that_follows, report_edit_access_levels) VALUES ('client_background', 'Client Background', 'Collects information about a clients background.', '', 'client', 'no', 'none', ':10:20:30:')", "Error inserting question report profile #");

    //Background check submitted to WSP?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('125', 'Background check submitted to WSP?', 'radio', '1', '1', NULL, NULL, NULL, '104', 'yes', NULL, 'yes', NULL, NULL, NULL, NULL, NULL)", "Error inserting question #125");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '125', 'client_background' )", "Error inserting report_type_ids for question #125");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('53', '125', 'No', 'no', NULL, NULL)", "Error inserting question element #125");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('54', '125', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #125");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('55', '125', 'Pending', 'pending', NULL, NULL)", "Error inserting question element #125");

    //Credit history?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('126', 'Credit history?', 'dropdown', '1', '1', NULL, NULL, NULL, '105', 'yes', NULL, 'yes', NULL, NULL, NULL, NULL, NULL)", "Error inserting question #126");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '126', 'client_background' )", "Error inserting report_type_ids for question #126");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('56', '126', 'Extremely Poor', 'extremely_poor', NULL, NULL)", "Error inserting question element #126");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('57', '126', 'Poor', 'poor', NULL, NULL)", "Error inserting question element #126");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('58', '126', 'Good', 'good', NULL, NULL)", "Error inserting question element #126");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('59', '126', 'Excellent', 'excellent', NULL, NULL)", "Error inserting question element #126");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('60', '126', 'Unknown', 'unknown', NULL, NULL)", "Error inserting question element #126");

    //Criminal history?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('127', 'Criminal history?', 'dropdown', '1', '1', NULL, NULL, NULL, '106', 'yes', NULL, 'yes', NULL, NULL, NULL, NULL, NULL)", "Error inserting question #127");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '127', 'client_background' )", "Error inserting report_type_ids for question #127");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('61', '127', 'None', 'none', NULL, NULL)", "Error inserting question element #127");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('62', '127', 'Sex Crime', 'sex_crime', NULL, NULL)", "Error inserting question element #127");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('63', '127', 'Drug Crime', 'drug_crime', NULL, NULL)", "Error inserting question element #127");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('64', '127', 'Violence', 'violence', NULL, NULL)", "Error inserting question element #127");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('65', '127', 'Felony', 'felony', NULL, NULL)", "Error inserting question element #127");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('66', '127', 'Other', 'other', NULL, NULL)", "Error inserting question element #127");

    //Criminal history description
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('128', 'Criminal history description', 'text', '1', '1', '50', NULL, NULL, '107', 'no', NULL, 'yes', NULL, '30', NULL, NULL, NULL)", "Error inserting question #128");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '128', 'client_background' )", "Error inserting report_type_ids for question #128");


    //Owes rent?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('129', 'Owes rent?', 'radio', '1', '1', NULL, NULL, NULL, '108', 'yes', NULL, 'yes', NULL, NULL, NULL, NULL, NULL)", "Error inserting question #129");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '129', 'client_background' )", "Error inserting report_type_ids for question #129");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('67', '129', 'No', 'no', NULL, NULL)", "Error inserting question element #129");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('68', '129', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #129");

    //Owes Rent to Whom
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('215', 'Owes Rent to Whom', 'text', '1', '1', '50', NULL, NULL, '109', 'no', NULL, 'yes', NULL, '30', NULL, NULL, NULL)", "Error inserting question #215");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '215', 'client_background' )", "Error inserting report_type_ids for question #215");


////Client Veteran Information -- Collects information about a clients veteran information. -- client_veteran_information

run_query("INSERT INTO report_type_profile (report_type_id, report_title, report_description, report_instructions, report_on_unit, report_on_timeperiod, report_that_follows, report_edit_access_levels) VALUES ('client_veteran_information', 'Client Veteran Information', 'Collects information about a clients veteran information.', '', 'client', 'no', 'none', ':10:20:30:')", "Error inserting question report profile #");

    //In which military service eras did you serve?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('174', 'In which military service eras did you serve?', 'checkboxes', '1', '1', NULL, NULL, NULL, '104', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #174");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '174', 'client_veteran_information' )", "Error inserting report_type_ids for question #174");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('169', '174', 'WWI (April 1917-Nov 1918)', 'wwi', NULL, NULL)", "Error inserting question element #174");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('170', '174', 'Between WWI and WWII (Dec 1918-Aug 1940)', 'between_wwi_and_wwii', NULL, NULL)", "Error inserting question element #174");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('171', '174', 'WWII (Sept 1940-July 1947)', 'wwii', NULL, NULL)", "Error inserting question element #174");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('172', '174', 'Between WWII and Korean War (Aug 1947-May 1950)', 'between_wwii_and_korean_war', NULL, NULL)", "Error inserting question element #174");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('173', '174', 'Korean War (June 1950-Jan 1955)', 'korean_war', NULL, NULL)", "Error inserting question element #174");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('174', '174', 'Between Korean and Vietnam War (Feb 1955-July 1964)', 'between_korean_and_vietnam_war', NULL, NULL)", "Error inserting question element #174");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('175', '174', 'Vietnam Era (Aug 1964-April 1975)', 'vietnam_era', NULL, NULL)", "Error inserting question element #174");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('176', '174', 'Post Vietnam (May 1975-July 1991)', 'post_vietnam', NULL, NULL)", "Error inserting question element #174");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('177', '174', 'Persian Gulf Era (Aug 1991-Present)', 'persian_gulf_era', NULL, NULL)", "Error inserting question element #174");

    //How many months did you serve on active duty in the military?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('175', 'How many months did you serve on active duty in the military?', 'number', '1', '1', '4', '-1', '1000', '105', 'yes', NULL, 'yes', NULL, '4', NULL, '5', NULL)", "Error inserting question #175");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '175', 'client_veteran_information' )", "Error inserting report_type_ids for question #175");


    //Did you serve in a war zone?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('176', 'Did you serve in a war zone?', 'radio', '1', '1', NULL, NULL, NULL, '106', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #176");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '176', 'client_veteran_information' )", "Error inserting report_type_ids for question #176");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('178', '176', 'No', 'no', NULL, NULL)", "Error inserting question element #176");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('179', '176', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #176");

    //If you served in a war zone what zones?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('177', 'If you served in a war zone what zones?', 'checkboxes', '1', '1', NULL, NULL, NULL, '107', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #177");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '177', 'client_veteran_information' )", "Error inserting report_type_ids for question #177");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('180', '177', 'Europe', 'europe', NULL, NULL)", "Error inserting question element #177");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('181', '177', 'North Africa', 'north_africa', NULL, NULL)", "Error inserting question element #177");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('182', '177', 'Vietnam', 'vietnam', NULL, NULL)", "Error inserting question element #177");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('183', '177', 'Laos and Cambodia', 'laos_and_cambodia', NULL, NULL)", "Error inserting question element #177");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('184', '177', 'South China Sea', 'south_china_sea', NULL, NULL)", "Error inserting question element #177");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('185', '177', 'China, Burma, India', 'china_burma_india', NULL, NULL)", "Error inserting question element #177");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('186', '177', 'Korea', 'korea', NULL, NULL)", "Error inserting question element #177");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('187', '177', 'South Pacific', 'south_pacific', NULL, NULL)", "Error inserting question element #177");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('188', '177', 'Persian Gulf', 'persian_gulf', NULL, NULL)", "Error inserting question element #177");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('189', '177', 'Other', 'other', NULL, NULL)", "Error inserting question element #177");

    //Number of months served in war zones?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('178', 'Number of months served in war zones?', 'number', '1', '1', '4', '-1', '1000', '108', 'yes', NULL, 'yes', NULL, '4', NULL, '5', NULL)", "Error inserting question #178");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '178', 'client_veteran_information' )", "Error inserting report_type_ids for question #178");


    //Did you ever receive hostile or friendly fire in a war zone?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('179', 'Did you ever receive hostile or friendly fire in a war zone?', 'radio', '1', '1', NULL, NULL, NULL, '109', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #179");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '179', 'client_veteran_information' )", "Error inserting report_type_ids for question #179");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('190', '179', 'No', 'no', NULL, NULL)", "Error inserting question element #179");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('191', '179', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #179");

    //What branch of the military did you serve in?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('180', 'What branch of the military did you serve in?', 'dropdown', '1', '1', NULL, NULL, NULL, '110', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #180");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '180', 'client_veteran_information' )", "Error inserting report_type_ids for question #180");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('192', '180', 'Army', 'army', NULL, NULL)", "Error inserting question element #180");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('193', '180', 'Air Force', 'air_force', NULL, NULL)", "Error inserting question element #180");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('194', '180', 'Navy', 'navy', NULL, NULL)", "Error inserting question element #180");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('195', '180', 'Marines', 'marines', NULL, NULL)", "Error inserting question element #180");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('196', '180', 'Other', 'other', NULL, NULL)", "Error inserting question element #180");

    //What type of discharge did you receive?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('181', 'What type of discharge did you receive?', 'dropdown', '1', '1', NULL, NULL, NULL, '111', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #181");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '181', 'client_veteran_information' )", "Error inserting report_type_ids for question #181");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('197', '181', 'Honorable', 'honorable', NULL, NULL)", "Error inserting question element #181");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('198', '181', 'General', 'general', NULL, NULL)", "Error inserting question element #181");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('199', '181', 'Medical', 'medical', NULL, NULL)", "Error inserting question element #181");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('200', '181', 'Bad Conduct', 'bad_conduct', NULL, NULL)", "Error inserting question element #181");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('201', '181', 'Dishonorable', 'dishonorable', NULL, NULL)", "Error inserting question element #181");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('202', '181', 'Other', 'other', NULL, NULL)", "Error inserting question element #181");

////Household Intake -- Collects information about a household. -- household_intake

run_query("INSERT INTO report_type_profile (report_type_id, report_title, report_description, report_instructions, report_on_unit, report_on_timeperiod, report_that_follows, report_edit_access_levels) VALUES ('household_intake', 'Household Intake', 'Collects information about a household.', '', 'household', 'yes_begin_only', 'none', ':10:20:30:')", "Error inserting question report profile #");

    //Reasons for homelessness
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('191', 'Reasons for homelessness', 'checkboxes', '1', '1', NULL, NULL, NULL, '104', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #191");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '191', 'household_intake' )", "Error inserting report_type_ids for question #191");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('240', '191', 'Mental Illness', 'mental_illness', NULL, NULL)", "Error inserting question element #191");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('241', '191', 'Alcoholism', 'alcoholism', NULL, NULL)", "Error inserting question element #191");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('242', '191', 'Substance abuse', 'substance_abuse', NULL, NULL)", "Error inserting question element #191");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('243', '191', 'Medical Problems', 'medical_problems', NULL, NULL)", "Error inserting question element #191");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('244', '191', 'Transient on the road', 'transient_on_the_road', NULL, NULL)", "Error inserting question element #191");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('245', '191', 'Domestic abuse/violence', 'domestic_abuse_violence', NULL, NULL)", "Error inserting question element #191");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('246', '191', 'Family crisis', 'family_crisis', NULL, NULL)", "Error inserting question element #191");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('247', '191', 'Runaway youth', 'runaway_youth', NULL, NULL)", "Error inserting question element #191");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('248', '191', 'Primarily economic reasons', 'primarily_economic_reasons', NULL, NULL)", "Error inserting question element #191");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('249', '191', 'Eviction/displacement', 'eviction_displacement', NULL, NULL)", "Error inserting question element #191");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('250', '191', 'New arrival', 'new_arrival', NULL, NULL)", "Error inserting question element #191");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('251', '191', 'Other', 'other', NULL, NULL)", "Error inserting question element #191");

    //Residence prior to program entry
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('192', 'Residence prior to program entry', 'dropdown', '1', '1', NULL, NULL, NULL, '105', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #192");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '192', 'household_intake' )", "Error inserting report_type_ids for question #192");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('252', '192', 'Emergency shelter', 'emergency_shelter', NULL, NULL)", "Error inserting question element #192");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('253', '192', 'Transitional housing for homeless', 'transitional_housing_for_homeless', NULL, NULL)", "Error inserting question element #192");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('254', '192', 'Permanent housing for formerly homeless', 'permanent_housing_for_formerly_homeless', NULL, NULL)", "Error inserting question element #192");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('255', '192', 'Psychiatric facility', 'psychiatric_facility', NULL, NULL)", "Error inserting question element #192");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('256', '192', 'Substance abuse treatment', 'substance_abuse_treatment', NULL, NULL)", "Error inserting question element #192");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('257', '192', 'Hospital', 'hospital', NULL, NULL)", "Error inserting question element #192");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('258', '192', 'Jail', 'jail', NULL, NULL)", "Error inserting question element #192");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('259', '192', 'Prison', 'prison', NULL, NULL)", "Error inserting question element #192");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('260', '192', 'Hotel or motel', 'hotel_or_motel', NULL, NULL)", "Error inserting question element #192");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('261', '192', 'Foster care home', 'foster_care_home', NULL, NULL)", "Error inserting question element #192");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('262', '192', 'Own Room, apartment, or house', 'own_room_apartment_or_house', NULL, NULL)", "Error inserting question element #192");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('263', '192', 'Living with someone else', 'living_with_someone_else', NULL, NULL)", "Error inserting question element #192");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('264', '192', 'A car or other vehicle', 'a_car_or_other_vehicle', NULL, NULL)", "Error inserting question element #192");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('265', '192', 'An abandoned building', 'an_abandoned_building', NULL, NULL)", "Error inserting question element #192");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('266', '192', 'At a transportation site', 'at_a_transportation_site', NULL, NULL)", "Error inserting question element #192");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('267', '192', 'Anywhere outside', 'anywhere_outside', NULL, NULL)", "Error inserting question element #192");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('268', '192', 'Other', 'other', NULL, NULL)", "Error inserting question element #192");

    //Zip code of last permanent residence
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('193', 'Zip code of last permanent residence', 'number', '1', '1', '5', '-1', '100000', '106', 'yes', NULL, 'yes', NULL, '4', NULL, '5', NULL)", "Error inserting question #193");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '193', 'household_intake' )", "Error inserting report_type_ids for question #193");


    //Address of last permanent residence
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('194', 'Address of last permanent residence', 'text', '1', '1', '50', NULL, NULL, '107', 'no', NULL, 'yes', NULL, '30', NULL, '5', NULL)", "Error inserting question #194");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '194', 'household_intake' )", "Error inserting report_type_ids for question #194");


    //City of last permanent residence
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('195', 'City of last permanent residence', 'text', '1', '1', '50', NULL, NULL, '108', 'yes', NULL, 'yes', NULL, '30', NULL, '5', NULL)", "Error inserting question #195");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '195', 'household_intake' )", "Error inserting report_type_ids for question #195");


    //Was last permanent address within city limits?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('196', 'Was last permanent address within city limits?', 'radio', '1', '1', NULL, NULL, NULL, '109', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #196");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '196', 'household_intake' )", "Error inserting report_type_ids for question #196");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('269', '196', 'No', 'no', NULL, NULL)", "Error inserting question element #196");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('270', '196', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #196");

    //Was last permanent address in unincorporated King County?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('197', 'Was last permanent address in unincorporated King County?', 'radio', '1', '1', NULL, NULL, NULL, '110', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #197");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '197', 'household_intake' )", "Error inserting report_type_ids for question #197");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('271', '197', 'No', 'no', NULL, NULL)", "Error inserting question element #197");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('272', '197', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #197");

    //State of last permanent residence
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('198', 'State of last permanent residence', 'dropdown', '1', '1', NULL, NULL, NULL, '111', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #198");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '198', 'household_intake' )", "Error inserting report_type_ids for question #198");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('273', '198', 'Alabama', 'alabama', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('274', '198', 'Alaska', 'alaska', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('275', '198', 'Arizona', 'arizona', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('276', '198', 'Arkansas', 'arkansas', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('277', '198', 'California', 'california', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('278', '198', 'Colorado', 'colorado', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('279', '198', 'Connecticut', 'connecticut', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('280', '198', 'Delaware', 'delaware', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('281', '198', 'District of Columbia', 'district_of_columbia', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('282', '198', 'Florida', 'florida', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('283', '198', 'Georgia', 'georgia', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('284', '198', 'Hawaii', 'hawaii', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('285', '198', 'Idaho', 'idaho', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('286', '198', 'Illinois', 'illinois', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('287', '198', 'Indiana', 'indiana', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('288', '198', 'Iowa', 'iowa', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('289', '198', 'Kansas', 'kansas', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('290', '198', 'Kentucky', 'kentucky', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('291', '198', 'Louisiana', 'louisiana', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('292', '198', 'Maine', 'maine', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('293', '198', 'Maryland', 'maryland', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('294', '198', 'Massachusetts', 'massachusetts', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('295', '198', 'Michigan', 'michigan', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('296', '198', 'Minnesota', 'minnesota', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('297', '198', 'Mississippi', 'mississippi', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('298', '198', 'Missouri', 'missouri', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('299', '198', 'Montana', 'montana', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('300', '198', 'Nebraska', 'nebraska', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('301', '198', 'Nevada', 'nevada', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('302', '198', 'New Hampshire', 'new_hampshire', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('303', '198', 'New Jersey', 'new_jersey', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('304', '198', 'New Mexico', 'new_mexico', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('305', '198', 'New York', 'new_york', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('306', '198', 'North Carolina', 'north_carolina', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('307', '198', 'North Dakota', 'north_dakota', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('308', '198', 'Ohio', 'ohio', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('309', '198', 'Oklahoma', 'oklahoma', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('310', '198', 'Oregon', 'oregon', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('311', '198', 'Pennsylvania', 'pennsylvania', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('312', '198', 'Rhode Island', 'rhode_island', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('313', '198', 'South Carolina', 'south_carolina', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('314', '198', 'South Dakota', 'south_dakota', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('315', '198', 'Tennessee', 'tennessee', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('316', '198', 'Texas', 'texas', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('317', '198', 'Utah', 'utah', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('318', '198', 'Vermont', 'vermont', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('319', '198', 'Virginia', 'virginia', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('320', '198', 'Washington', 'washington', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('321', '198', 'West Virginia', 'west_virginia', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('322', '198', 'Wisconsin', 'wisconsin', NULL, NULL)", "Error inserting question element #198");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('323', '198', 'Wyoming', 'wyoming', NULL, NULL)", "Error inserting question element #198");

    //How long did you live at your last permanent residence?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('199', 'How long did you live at your last permanent residence?', 'dropdown', '1', '1', NULL, NULL, NULL, '112', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #199");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '199', 'household_intake' )", "Error inserting report_type_ids for question #199");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('324', '199', 'Less than one week', 'less_than_one_week', NULL, NULL)", "Error inserting question element #199");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('325', '199', 'One to two weeks', 'one_to_two_weeks', NULL, NULL)", "Error inserting question element #199");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('326', '199', 'Three weeks to one month', 'three_weeks_to_one_month', NULL, NULL)", "Error inserting question element #199");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('327', '199', 'Two to three months', 'two_to_three_months', NULL, NULL)", "Error inserting question element #199");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('328', '199', 'Four to Six months', 'four_to_six_months', NULL, NULL)", "Error inserting question element #199");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('329', '199', 'Seven months to one year', 'seven_months_to_one_year', NULL, NULL)", "Error inserting question element #199");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('330', '199', 'More than one year', 'more_than_one_year', NULL, NULL)", "Error inserting question element #199");

////Household Exit/Followup -- Collects information about a household at the time of exit or followup. -- household_exit_followup

run_query("INSERT INTO report_type_profile (report_type_id, report_title, report_description, report_instructions, report_on_unit, report_on_timeperiod, report_that_follows, report_edit_access_levels) VALUES ('household_exit_followup', 'Household Exit/Followup', 'Collects information about a household at the time of exit or followup.', '', 'household', 'yes_begin_only', 'none', ':10:20:30:')", "Error inserting question report profile #");

    //Is this an exit or followup?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('182', 'Is this an exit or followup?', 'radio', '1', '1', NULL, NULL, NULL, '104', 'yes', NULL, 'yes', NULL, NULL, NULL, NULL, NULL)", "Error inserting question #182");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '182', 'household_exit_followup' )", "Error inserting report_type_ids for question #182");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('203', '182', 'Exit', 'exit', NULL, NULL)", "Error inserting question element #182");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('204', '182', 'Followup', 'followup', NULL, NULL)", "Error inserting question element #182");

    //Primary reason for leaving
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('183', 'Primary reason for leaving', 'dropdown', '1', '1', NULL, NULL, NULL, '105', 'yes', NULL, 'yes', NULL, NULL, NULL, NULL, NULL)", "Error inserting question #183");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '183', 'household_exit_followup' )", "Error inserting report_type_ids for question #183");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('205', '183', 'Completed program', 'completed_program', NULL, NULL)", "Error inserting question element #183");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('206', '183', 'Left for a housing opportunity before completing program', 'left_for_a_housing_opportunity_before_completing_program', NULL, NULL)", "Error inserting question element #183");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('207', '183', 'Non-payment of rent/occupancy charge', 'non_payment_of_rent_occupancy_charge', NULL, NULL)", "Error inserting question element #183");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('208', '183', 'Non-compliance with program', 'non_compliance_with_program', NULL, NULL)", "Error inserting question element #183");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('209', '183', 'Criminal activity/violence/destruction of property', 'criminal_activity_violence_destruction_of_property', NULL, NULL)", "Error inserting question element #183");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('210', '183', 'Needs could not be met by program', 'needs_could_not_be_met_by_program', NULL, NULL)", "Error inserting question element #183");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('211', '183', 'Disagreement with rules', 'disagreement_with_rules', NULL, NULL)", "Error inserting question element #183");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('212', '183', 'Death', 'death', NULL, NULL)", "Error inserting question element #183");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('213', '183', 'Other', 'other', NULL, NULL)", "Error inserting question element #183");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('214', '183', 'Unknown/Disappeared', 'unknown_disappeared', NULL, NULL)", "Error inserting question element #183");

    //Are all members of household living with you now?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('184', 'Are all members of household living with you now?', 'radio', '1', '1', NULL, NULL, NULL, '106', 'yes', NULL, 'yes', NULL, NULL, NULL, '7', NULL)", "Error inserting question #184");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '184', 'household_exit_followup' )", "Error inserting report_type_ids for question #184");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('215', '184', 'No', 'no', NULL, NULL)", "Error inserting question element #184");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('216', '184', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #184");

    //Does anyone else live with you now?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('185', 'Does anyone else live with you now?', 'radio', '1', '1', NULL, NULL, NULL, '107', 'yes', NULL, 'yes', NULL, NULL, NULL, '7', NULL)", "Error inserting question #185");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '185', 'household_exit_followup' )", "Error inserting report_type_ids for question #185");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('217', '185', 'No', 'no', NULL, NULL)", "Error inserting question element #185");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('218', '185', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #185");

    //If others live with you now how many are adults?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('186', 'If others live with you now how many are adults?', 'number', '1', '1', '4', '-1', '100', '108', 'no', NULL, 'yes', NULL, '4', NULL, NULL, NULL)", "Error inserting question #186");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '186', 'household_exit_followup' )", "Error inserting report_type_ids for question #186");


    //If others live with you now how many are children?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('187', 'If others live with you now how many are children?', 'number', '1', '1', '4', '-1', '100', '109', 'no', NULL, 'yes', NULL, '4', NULL, NULL, NULL)", "Error inserting question #187");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '187', 'household_exit_followup' )", "Error inserting report_type_ids for question #187");


    //Where will you be living after leaving the program?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('188', 'Where will you be living after leaving the program?', 'dropdown', '1', '1', NULL, NULL, NULL, '110', 'yes', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #188");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '188', 'household_exit_followup' )", "Error inserting report_type_ids for question #188");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('219', '188', 'Emergency shelter', 'emergency_shelter', NULL, NULL)", "Error inserting question element #188");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('220', '188', 'Transitional housing for homeless', 'transitional_housing_for_homeless', NULL, NULL)", "Error inserting question element #188");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('221', '188', 'Permanent housing for formerly homeless', 'permanent_housing_for_formerly_homeless', NULL, NULL)", "Error inserting question element #188");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('222', '188', 'Psychiatric facility', 'psychiatric_facility', NULL, NULL)", "Error inserting question element #188");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('223', '188', 'Substance abuse treatment', 'substance_abuse_treatment', NULL, NULL)", "Error inserting question element #188");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('224', '188', 'Hospital', 'hospital', NULL, NULL)", "Error inserting question element #188");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('225', '188', 'Jail', 'jail', NULL, NULL)", "Error inserting question element #188");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('226', '188', 'Prison', 'prison', NULL, NULL)", "Error inserting question element #188");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('227', '188', 'Hotel or motel', 'hotel_or_motel', NULL, NULL)", "Error inserting question element #188");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('228', '188', 'Foster care home', 'foster_care_home', NULL, NULL)", "Error inserting question element #188");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('229', '188', 'Own Room, apartment, or house', 'own_room_apartment_or_house', NULL, NULL)", "Error inserting question element #188");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('230', '188', 'Living with someone else', 'living_with_someone_else', NULL, NULL)", "Error inserting question element #188");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('231', '188', 'A car or other vehicle', 'a_car_or_other_vehicle', NULL, NULL)", "Error inserting question element #188");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('232', '188', 'An abandoned building', 'an_abandoned_building', NULL, NULL)", "Error inserting question element #188");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('233', '188', 'At a transportation site', 'at_a_transportation_site', NULL, NULL)", "Error inserting question element #188");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('234', '188', 'Anywhere outside', 'anywhere_outside', NULL, NULL)", "Error inserting question element #188");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('235', '188', 'Other', 'other', NULL, NULL)", "Error inserting question element #188");

    //Is this move permanent or temporary?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('189', 'Is this move permanent or temporary?', 'radio', '1', '1', NULL, NULL, NULL, '111', 'no', NULL, 'yes', NULL, NULL, NULL, '5', NULL)", "Error inserting question #189");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '189', 'household_exit_followup' )", "Error inserting report_type_ids for question #189");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('236', '189', 'Permanent', 'permanent', NULL, NULL)", "Error inserting question element #189");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('237', '189', 'Temporary', 'temporary', NULL, NULL)", "Error inserting question element #189");

    //Did your agency provide assistance for this move?
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('190', 'Did your agency provide assistance for this move?', 'radio', '1', '1', NULL, NULL, NULL, '112', 'yes', NULL, 'yes', NULL, NULL, NULL, NULL, NULL)", "Error inserting question #190");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '190', 'household_exit_followup' )", "Error inserting report_type_ids for question #190");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('238', '190', 'No', 'no', NULL, NULL)", "Error inserting question element #190");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('239', '190', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #190");

////Client Service -- Collects information about a service for a client. -- client_service

run_query("INSERT INTO report_type_profile (report_type_id, report_title, report_description, report_instructions, report_on_unit, report_on_timeperiod, report_that_follows, report_edit_access_levels) VALUES ('client_service', 'Client Service', 'Collects information about a service for a client.', '', 'client_service', 'yes', 'none', ':10:20:30:')", "Error inserting question report profile #");


    //Services
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('99', 'Services', 'dropdown', '1', '1', '0', '0', '0', '100', 'yes', NULL, 'yes', NULL, '0', '0', '0', '#services_list')", "Error inserting question #99");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '99', 'client_service' )", "Error inserting report_type_ids for question #99");
    

    //Notes
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('110', 'Notes', 'textarea', '1', '1', '8', NULL, NULL, '104', 'no', NULL, 'yes', NULL, '28', NULL, NULL, NULL)", "Error inserting question #110");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '110', 'client_service' )", "Error inserting report_type_ids for question #110");


    //Quantity
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('205', 'Quantity', 'number', '1', '1', '3', '0', '999', '104', 'no', NULL, 'yes', NULL, '2', NULL, NULL, NULL)", "Error inserting question #205");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '205', 'client_service' )", "Error inserting report_type_ids for question #205");


    //Status
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('206', 'Status', 'radio', '1', '1', NULL, NULL, NULL, '104', 'yes', NULL, 'yes', NULL, NULL, NULL, NULL, NULL)", "Error inserting question #206");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '206', 'client_service' )", "Error inserting report_type_ids for question #206");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('331', '206', 'One Time', 'one_time', NULL, NULL)", "Error inserting question element #206");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('332', '206', 'Active', 'active', NULL, NULL)", "Error inserting question element #206");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('333', '206', 'Inactive', 'inactive', NULL, NULL)", "Error inserting question element #206");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('334', '206', 'Exited', 'exited', NULL, NULL)", "Error inserting question element #206");

////Household Service -- Collects information about a service for a household. -- household_service

run_query("INSERT INTO report_type_profile (report_type_id, report_title, report_description, report_instructions, report_on_unit, report_on_timeperiod, report_that_follows, report_edit_access_levels) VALUES ('household_service', 'Household Service', 'Collects information about a service for a household.', '', 'household_service', 'yes', 'none', ':10:20:30:')", "Error inserting question report profile #");

    //Services
    
    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '99', 'household_service' )", "Error inserting report_type_ids for question #99");


    //Notes
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('200', 'Notes', 'textarea', '1', '1', '8', NULL, NULL, '104', 'no', NULL, 'yes', NULL, '28', NULL, NULL, NULL)", "Error inserting question #200");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '200', 'household_service' )", "Error inserting report_type_ids for question #200");


    //Quantity
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('209', 'Quantity', 'number', '1', '1', '3', '0', '999', '104', 'no', NULL, 'yes', NULL, '2', NULL, NULL, NULL)", "Error inserting question #209");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '209', 'household_service' )", "Error inserting report_type_ids for question #209");


    //Status
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('210', 'Status', 'radio', '1', '1', NULL, NULL, NULL, '104', 'yes', NULL, 'yes', NULL, NULL, NULL, NULL, NULL)", "Error inserting question #210");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '210', 'household_service' )", "Error inserting report_type_ids for question #210");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('335', '210', 'One Time', 'one_time', NULL, NULL)", "Error inserting question element #210");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('336', '210', 'Active', 'active', NULL, NULL)", "Error inserting question element #210");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('337', '210', 'Inactive', 'inactive', NULL, NULL)", "Error inserting question element #210");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('338', '210', 'Exited', 'exited', NULL, NULL)", "Error inserting question element #210");

////Referral -- Information collected as part of a referral. -- referral_basic

/* REMOVED FOR NOW

run_query("INSERT INTO report_type_profile (report_type_id, report_title, report_description, report_instructions, report_on_unit, report_on_timeperiod, report_that_follows, report_edit_access_levels) VALUES ('referral_basic', 'Referral', 'Information collected as part of a referral.', '', 'referral', 'no', 'none', ':10:20:30:')", "Error inserting question report profile #");

    //Notes
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('201', 'Notes', 'textarea', '1', '1', '8', NULL, NULL, '104', 'no', NULL, 'yes', NULL, '28', NULL, NULL, NULL)", "Error inserting question #201");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '201', 'referral_basic' )", "Error inserting report_type_ids for question #201");
*/

////Vacancies -- Vacancy information. -- vacancies

run_query("INSERT INTO report_type_profile (report_type_id, report_title, report_description, report_instructions, report_on_unit, report_on_timeperiod, report_that_follows, report_edit_access_levels) VALUES ('vacancies', 'Vacancies', 'Vacancy information.', '', 'vacancy', 'yes', 'none', ':10:20:')", "Error inserting question report profile #");

    //Notes
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('202', 'Notes', 'textarea', '1', '1', '8', NULL, NULL, '950', 'no', NULL, 'yes', NULL, '28', '0', '0', NULL)", "Error inserting question #202");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '202', 'vacancies' )", "Error inserting report_type_ids for question #202");


    //Total Bed Capacity
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('216', 'Total Bed Capacity', 'number', '1', '1', '4', '-1', '100', '900', 'yes', NULL, 'yes', NULL, '3', '0', '0', NULL)", "Error inserting question #216");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '216', 'vacancies' )", "Error inserting report_type_ids for question #216");


    //Available Beds
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('217', 'Available Beds', 'number', '1', '1', '4', '-1', '1000', '905', 'yes', NULL, 'yes', NULL, '3', '0', '0', NULL)", "Error inserting question #217");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '217', 'vacancies' )", "Error inserting report_type_ids for question #217");


    //Contact information
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('218', 'Contact information', 'textarea', '1', '1', '10', NULL, NULL, '1000', 'yes', NULL, 'yes', NULL, '30', '0', '0', NULL)", "Error inserting question #218");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '218', 'vacancies' )", "Error inserting report_type_ids for question #218");


    //Populations served
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('219', 'Populations served', 'checkboxes', '1', '1', NULL, NULL, NULL, '1000', 'yes', NULL, 'yes', NULL, NULL, '0', '0', NULL)", "Error inserting question #219");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '219', 'vacancies' )", "Error inserting report_type_ids for question #219");

          run_query("INSERT INTO question_elements (question_element_rowid, question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('353', '353', '219', 'Single men', 'single_men', NULL, NULL)", "Error inserting question element #219");
          run_query("INSERT INTO question_elements (question_element_rowid, question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('354', '354', '219', 'Single women', 'single_women', NULL, NULL)", "Error inserting question element #219");
          run_query("INSERT INTO question_elements (question_element_rowid, question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('355', '355', '219', 'Women with children', 'wo_with_children', NULL, NULL)", "Error inserting question element #219");
          run_query("INSERT INTO question_elements (question_element_rowid, question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('356', '356', '219', 'Men with children', 'men_with_children', NULL, NULL)", "Error inserting question element #219");
          run_query("INSERT INTO question_elements (question_element_rowid, question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('357', '357', '219', 'Couples with children', 'couples_with_children', NULL, NULL)", "Error inserting question element #219");
          run_query("INSERT INTO question_elements (question_element_rowid, question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('358', '358', '219', 'Couples', 'couples', NULL, NULL)", "Error inserting question element #219");
          run_query("INSERT INTO question_elements (question_element_rowid, question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('359', '359', '219', 'Youth', 'youth', NULL, NULL)", "Error inserting question element #219");


////Client Chronically Homeless -- Certification that client is chronically homeless -- client_chronic

run_query("INSERT INTO report_type_profile (report_type_id, report_title, report_description, report_instructions, report_on_unit, report_on_timeperiod, report_that_follows, report_edit_access_levels) VALUES ('client_chronic', 'Client Chronically Homeless', 'Certification that client is chronically homeless', 'To be considered chronically homeless, an individual must have both of the following characteristics', 'client', 'no', 'none', ':10:')", "Error inserting question report profile #");

    //Client has a diagnosable  substance abuse disorder, serious mental illness, developmental disability, or chronic physical illness or disbability.
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('211', 'Client has a diagnosable  substance abuse disorder, serious mental illness, developmental disability, or chronic physical illness or disbability.', 'checkboxes', '1', '1', NULL, NULL, NULL, '1000', 'yes', NULL, 'yes', NULL, NULL, '0', '0', NULL)", "Error inserting question #211");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '211', 'client_chronic' )", "Error inserting report_type_ids for question #211");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('349', '211', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #211");

    //Client has been:
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('212', 'Client has been:', 'radio', '1', '1', NULL, NULL, NULL, '1000', 'yes', NULL, 'yes', NULL, NULL, '0', '0', NULL)", "Error inserting question #212");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '212', 'client_chronic' )", "Error inserting report_type_ids for question #212");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('350', '212', 'Continuously homeless for a year or more', 'homeless_year_or_more', NULL, NULL)", "Error inserting question element #212");
          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('351', '212', 'At least four episodes of homelessness in the past 3 years', 'homeless_four_episodes', NULL, NULL)", "Error inserting question element #212");

    //Client is unaccompanied
    run_query("INSERT INTO questions (question_id, question_title, question_type, question_owner_group_id, question_owner_org_id, question_field_size, question_range_bottom, question_range_top, question_display_order, question_required, question_default_value, question_visible, question_ecma, question_display_size, question_encrypted, question_no_answer_options, question_special_attribute) VALUES ('213', 'Client is unaccompanied', 'checkboxes', '1', '1', NULL, NULL, NULL, '1000', 'yes', NULL, 'yes', NULL, NULL, '0', '0', NULL)", "Error inserting question #213");

    run_query("INSERT INTO question_report_type_ids ( question_id, report_type_id ) VALUES ( '213', 'client_chronic' )", "Error inserting report_type_ids for question #213");

          run_query("INSERT INTO question_elements (question_element_id, question_id, question_element_title, question_element_value, question_element_checked, question_element_attribute) VALUES ('352', '213', 'Yes', 'yes', NULL, NULL)", "Error inserting question element #213");

///////////
////APR////
///////////

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('adults_in_families_entering', 'SELECT SUM(a.z) 
FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id), cnsl_household_intake.total_adults AS z 
FROM cnsl_household_intake, cnsl_household_exit_followup 
WHERE 
cnsl_household_intake.total_clients > 1 
AND cnsl_household_exit_followup.total_adults > 0
AND cnsl_household_intake.report_date_begin > {date_begin} AND cnsl_household_intake.report_date_begin < {date_end} {cnsl_household_intake}  
 ) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'adults_in_families_entering'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('adults_in_families_exiting', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z FROM cnsl_household_exit_followup WHERE cnsl_household_exit_followup.total_adults > 0 AND cnsl_household_exit_followup.total_clients > 1 AND cnsl_household_exit_followup.report_date_begin > {date_begin} AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
 ) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'adults_in_families_exiting'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('adults_in_families_first_day', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z 
FROM cnsl_household_intake LEFT JOIN cnsl_household_exit_followup ON (cnsl_household_intake.lead_client_id = cnsl_household_exit_followup.lead_client_id) 
WHERE 
cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.total_clients > 1 
AND cnsl_household_intake.report_date_begin <= {date_begin} 
AND ( 
    cnsl_household_exit_followup.report_date_begin >= {date_begin}  
    OR cnsl_household_exit_followup.report_date_begin IS NULL 
)
{cnsl_household_intake} {cnsl_household_exit_followup_NULL} ) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'adults_in_families_first_day'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('adults_in_families_last_day', 'SELECT SUM(a.z) 
FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),
cnsl_household_intake.total_adults AS z 
FROM cnsl_household_intake 
LEFT JOIN cnsl_household_exit_followup ON (cnsl_household_intake.lead_client_id = cnsl_household_exit_followup.lead_client_id) 
WHERE   
cnsl_household_intake.total_clients > 1 
AND cnsl_household_intake.report_date_begin < {date_end} 
AND ( cnsl_household_exit_followup.report_date_begin >= {date_end}
OR cnsl_household_exit_followup.report_date_begin IS NULL ) 
{cnsl_household_intake} {cnsl_household_exit_followup_NULL} ) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'adults_in_families_last_day'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('chronic_homeless', 'SELECT COUNT(DISTINCT(cnsl_client_chronic.client_id)) FROM cnsl_household_intake 
INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) 
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake}', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'chronic_homeless'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_dont_know', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND (
    cnsl_household_exit_followup.q_188 LIKE \'#88#\'
)
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_dont_know'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_dont_know_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND (
    cnsl_household_exit_followup.q_188 LIKE \'#88#\'
)
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_dont_know_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_dont_know_hidden', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND (
    cnsl_household_exit_followup.q_188 LIKE \'#88#\'
)
) AS a', 'hidden', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_dont_know_hidden'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_dont_know_hidden_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND (
    cnsl_household_exit_followup.q_188 LIKE \'#88#\'
)
) AS a', 'hidden', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_dont_know_hidden_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_emergency_shelter', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_188 LIKE \'emergency_shelter\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_emergency_shelter'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_emergency_shelter_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_188 LIKE \'emergency_shelter\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_emergency_shelter_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_jail_prison', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND (
    cnsl_household_exit_followup.q_188 LIKE \'jail\'
    OR cnsl_household_exit_followup.q_188 LIKE \'prison\'
)
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_jail_prison'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_jail_prison_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND (
    cnsl_household_exit_followup.q_188 LIKE \'jail\'
    OR cnsl_household_exit_followup.q_188 LIKE \'prison\'
    )
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_jail_prison_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_other', '{CALC-destination_total} - 
{CALC-destination_dont_know_hidden} - 
{CALC-destination_emergency_shelter} - 
{CALC-destination_jail_prison} - 
{CALC-destination_psychiatric_facility} - 
{CALC-destination_substance_abuse_treatment} - 
{CALC-destination_transitional_housing_for_homeless} -
{CALC-destination_place_not_for_humans}', 'cross_query_calculation', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_other'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_other_chronic', '{CALC-destination_total_chronic} - 
{CALC-destination_dont_know_hidden_chronic} - 
{CALC-destination_emergency_shelter_chronic} - 
{CALC-destination_jail_prison_chronic} - 
{CALC-destination_psychiatric_facility_chronic} - 
{CALC-destination_substance_abuse_treatment_chronic} - 
{CALC-destination_transitional_housing_for_homeless_chronic} -
{CALC-destination_place_not_for_humans_chronic}', 'cross_query_calculation', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_other_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_permanent_housing_for_formerly_homeless', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_188 LIKE \'permanent_housing_for_formerly_homeless\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_permanent_housing_for_formerly_homeless'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_permanent_housing_for_formerly_homeless_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_188 LIKE \'permanent_housing_for_formerly_homeless\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_permanent_housing_for_formerly_homeless_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_place_not_for_humans', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND (
    cnsl_household_exit_followup.q_188 LIKE \'a_car_or_other_vehicle\'
    OR cnsl_household_exit_followup.q_188 LIKE \'an_abandoned_building\'
    OR cnsl_household_exit_followup.q_188 LIKE \'at_a_transportation_site\'
    )
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_place_not_for_humans'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_place_not_for_humans_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND (
    cnsl_household_exit_followup.q_188 LIKE \'a_car_or_other_vehicle\'
    OR cnsl_household_exit_followup.q_188 LIKE \'an_abandoned_building\'
    OR cnsl_household_exit_followup.q_188 LIKE \'at_a_transportation_site\'
    )
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_place_not_for_humans_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_psychiatric_facility', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_188 LIKE \'psychiatric_facility\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_psychiatric_facility'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_ psychiatric_facility_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_188 LIKE \'psychiatric_facility\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_ psychiatric_facility_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_psychiatric_facility_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_188 LIKE \'psychiatric_facility\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_psychiatric_facility_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_substance_abuse_treatment', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_188 LIKE \'substance_abuse_treatment\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_substance_abuse_treatment'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_substance_abuse_treatment_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_188 LIKE \'substance_abuse_treatment\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_substance_abuse_treatment_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_total', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND (
    cnsl_household_exit_followup.q_188 IS NOT NULL
    )
) AS a', 'hidden', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_total'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_total_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND (
    cnsl_household_exit_followup.q_188 IS NOT NULL
    )
) AS a', 'hidden', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_total_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_transitional_housing_for_homeless', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_188 LIKE \'transitional_housing_for_homeless\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_transitional_housing_for_homeless'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('destination_transitional_housing_for_homeless_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_188 LIKE \'transitional_housing_for_homeless\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'destination_transitional_housing_for_homeless_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('familes_last_day', 'SELECT DISTINCT(cnsl_household_intake.lead_client_id) FROM cnsl_household_intake LEFT JOIN cnsl_household_exit_followup ON (cnsl_household_intake.lead_client_id = cnsl_household_exit_followup.lead_client_id) WHERE cnsl_household_intake.total_clients > 1 
AND cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin < {date_end} 
AND ( cnsl_household_exit_followup.report_date_begin > {date_end}
OR cnsl_household_exit_followup.report_date_begin IS NULL ) 
{cnsl_household_intake} {cnsl_household_exit_followup_NULL}', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'familes_last_day'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('families_entering', 'SELECT DISTINCT(cnsl_household_intake.lead_client_id) FROM cnsl_household_intake WHERE cnsl_household_intake.total_adults > 0 AND cnsl_household_intake.total_clients > 1 AND cnsl_household_intake.report_date_begin > {date_begin} AND cnsl_household_intake.report_date_begin < {date_end} {cnsl_household_intake}', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'families_entering'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('families_exiting', 'SELECT DISTINCT(cnsl_household_exit_followup.lead_client_id) FROM cnsl_household_exit_followup WHERE cnsl_household_exit_followup.total_adults > 0 AND cnsl_household_exit_followup.total_clients > 1 AND cnsl_household_exit_followup.report_date_begin > {date_begin} AND cnsl_household_exit_followup.report_date_begin < {date_end} 
{cnsl_household_exit_followup}', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'families_exiting'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('families_first_day', 'SELECT DISTINCT(cnsl_household_intake.lead_client_id) 
FROM 
cnsl_household_intake 
INNER JOIN cnsl_household_exit_followup ON (cnsl_household_intake.lead_client_id = cnsl_household_exit_followup.lead_client_id) 
WHERE 
cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.total_clients > 1 
AND cnsl_household_intake.report_date_begin <= {date_begin} 
AND ( 
    cnsl_household_exit_followup.report_date_begin >= {date_begin} 
    OR cnsl_household_exit_followup.report_date_begin IS NULL 
    )
{cnsl_household_intake} {cnsl_household_exit_followup_NULL}', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'families_first_day'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('families_last_day', 'SELECT DISTINCT(cnsl_household_intake.lead_client_id) 
FROM cnsl_household_intake 
LEFT JOIN cnsl_household_exit_followup ON (cnsl_household_intake.lead_client_id = cnsl_household_exit_followup.lead_client_id) 
WHERE 
cnsl_household_intake.total_clients > 1 
AND cnsl_household_intake.total_adults > 0
AND cnsl_household_intake.report_date_begin < {date_end} 
AND ( cnsl_household_exit_followup.report_date_begin >= {date_end}
OR cnsl_household_exit_followup.report_date_begin IS NULL ) 
{cnsl_household_intake} {cnsl_household_exit_followup_NULL}', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'families_last_day'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('hispanic_no', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_103 NOT LIKE \'yes\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'hispanic_no'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('hispanic_yes', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} AND cnsl_client_profile.q_103 LIKE \'yes\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'hispanic_yes'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_entry_0', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id )
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND q_axis_1_total < 1', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_entry_0'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_entry_0_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND q_axis_1_total < 1', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_entry_0_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_entry_1001_1500', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id )
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND q_axis_1_total BETWEEN 1001 AND 1500', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_entry_1001_1500'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_entry_1001_1500_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND q_axis_1_total BETWEEN 1001 AND 1500', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_entry_1001_1500_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_entry_1_150', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id )
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND q_axis_1_total BETWEEN 1 AND 150', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_entry_1_150'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_entry_1_150_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND q_axis_1_total BETWEEN 1 AND 150', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_entry_1_150_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_entry_1501_2000', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id )
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND q_axis_1_total BETWEEN 1501 AND 2000', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_entry_1501_2000'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_entry_1501_2000_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND q_axis_1_total BETWEEN 1501 AND 2000', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_entry_1501_2000_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_entry_151_250', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id )
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND q_axis_1_total BETWEEN 151 AND 250', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_entry_151_250'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_entry_151_250_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND q_axis_1_total BETWEEN 151 AND 250', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_entry_151_250_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_entry_2001', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id )
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND q_axis_1_total > 2000', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_entry_2001'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_entry_2001_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND q_axis_1_total > 2000', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_entry_2001_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_entry_251_500', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id )
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND q_axis_1_total BETWEEN 251 AND 500', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_entry_251_500'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_entry_251_500_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND q_axis_1_total BETWEEN 251 AND 500', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_entry_251_500_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_entry_501_1000', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id )
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND q_axis_1_total BETWEEN 501 AND 1000', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_entry_501_1000'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_entry_501_1000_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND q_axis_1_total BETWEEN 501 AND 1000', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_entry_501_1000_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_exit_0', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end}
{cnsl_household_exit_followup}
AND q_axis_18_total < 1', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_exit_0'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_exit_0_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end}) 
{cnsl_household_exit_followup}
AND q_axis_18_total < 1', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_exit_0_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_exit_1001_1500', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end}
{cnsl_household_exit_followup}
AND q_axis_18_total BETWEEN 1001 AND 1500', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_exit_1001_1500'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_exit_1001_1500_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end}) 
{cnsl_household_exit_followup}
AND q_axis_18_total BETWEEN 1001 AND 1500', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_exit_1001_1500_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_exit_1_150', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end}
{cnsl_household_exit_followup}
AND q_axis_18_total BETWEEN 1 AND 150', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_exit_1_150'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_exit_1_150_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end}) 
{cnsl_household_exit_followup}
AND q_axis_18_total BETWEEN 1 AND 150', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_exit_1_150_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_exit_1501_2000', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end}
{cnsl_household_exit_followup}
AND q_axis_18_total BETWEEN 1501 AND 2000', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_exit_1501_2000'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_exit_1501_2000_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end}) 
{cnsl_household_exit_followup}
AND q_axis_18_total BETWEEN 1501 AND 2000', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_exit_1501_2000_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_exit_151_250', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end}
{cnsl_household_exit_followup}
AND q_axis_18_total BETWEEN 151 AND 250', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_exit_151_250'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_exit_151_250_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end}) 
{cnsl_household_exit_followup}
AND q_axis_18_total BETWEEN 151 AND 250', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_exit_151_250_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_exit_2001', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end}
{cnsl_household_exit_followup}
AND q_axis_18_total > 2000', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_exit_2001'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_exit_2001_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end}) 
{cnsl_household_exit_followup}
AND q_axis_18_total > 2000', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_exit_2001_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_exit_251_500', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end}
{cnsl_household_exit_followup}
AND q_axis_18_total BETWEEN 251 AND 500', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_exit_251_500'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_exit_251_500_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end}) 
{cnsl_household_exit_followup}
AND q_axis_18_total BETWEEN 251 AND 500', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_exit_251_500_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_exit_501_1000', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end}
{cnsl_household_exit_followup}
AND q_axis_18_total BETWEEN 501 AND 1000', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_exit_501_1000'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_exit_501_1000_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end}) 
{cnsl_household_exit_followup}
AND q_axis_18_total BETWEEN 501 AND 1000', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_exit_501_1000_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_employment', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND cnsl_client_income.q_151_1_2 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_employment'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_employment_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND cnsl_client_income.q_151_1_2 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_employment_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_food_stamps', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND cnsl_client_income.q_154 LIKE \'yes\'', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_food_stamps'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_food_stamps_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND cnsl_client_income.q_154 LIKE \'yes\'', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_food_stamps_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_ga', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND cnsl_client_income.q_151_1_10 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_ga'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_ga_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND cnsl_client_income.q_151_1_10 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_ga_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_medicaid', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND cnsl_client_income.q_153 LIKE \'yes\'', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_medicaid'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_medicaid_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND cnsl_client_income.q_153 LIKE \'yes\'', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_medicaid_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_none', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND q_axis_1_total = 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_none'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_none_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND q_axis_1_total = 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_none_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_other', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND cnsl_client_income.q_151_1_16 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_other'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_other_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND cnsl_client_income.q_151_1_16 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_other_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_schip', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND cnsl_client_income.q_155 LIKE \'yes\'', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_schip'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_schip_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND cnsl_client_income.q_155 LIKE \'yes\'', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_schip_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_ss', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND cnsl_client_income.q_151_1_11 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_ss'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_ss_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND cnsl_client_income.q_151_1_11 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_ss_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_ssdi', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND cnsl_client_income.q_151_1_5 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_ssdi'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_ssdi_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND cnsl_client_income.q_151_1_5 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_ssdi_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_ssi', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND cnsl_client_income.q_151_1_4 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_ssi'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_ssi_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND cnsl_client_income.q_151_1_4 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_ssi_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_tanf', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND cnsl_client_income.q_151_1_9 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_tanf'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_tanf_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND cnsl_client_income.q_151_1_9 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_tanf_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_unemployment_benifits', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND cnsl_client_income.q_151_1_3 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_unemployment_benifits'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_unemployment_benifits_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND cnsl_client_income.q_151_1_3 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_unemployment_benifits_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_veterans_benifits', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND cnsl_client_income.q_151_1_12 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_veterans_benifits'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_veterans_benifits_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND cnsl_client_income.q_151_1_12 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_veterans_benifits_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_veterans_health_care', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE cnsl_household_intake.total_adults > 0 
AND cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end}
{cnsl_household_intake}
AND cnsl_client_income.q_157 LIKE \'yes\'', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_veterans_health_care'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_entry_veterans_health_care_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income.client_id)) FROM cnsl_client_income
INNER JOIN report_relationship ON ( cnsl_client_income.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_intake ON ( report_relationship.hh_report_id = cnsl_household_intake.hh_report_id ) 
WHERE 
cnsl_household_intake.total_adults > 0
AND 
(cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} )
{cnsl_household_intake}
AND cnsl_client_income.q_157 LIKE \'yes\'', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_entry_veterans_health_care_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_employment', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id ) 
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end} 
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_163_18_19 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_employment'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_employment_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end})  
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_163_18_19 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_employment_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_food_stamps', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id ) 
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end} 
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_166 LIKE \'yes\'', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_food_stamps'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_food_stamps_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end})  
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_166 LIKE \'yes\'', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_food_stamps_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_ga', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id ) 
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end} 
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_163_18_27 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_ga'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_ga_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end})  
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_163_18_27 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_ga_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_medicaid', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id ) 
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end} 
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_165 LIKE \'yes\'', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_medicaid'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_medicaid_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end})  
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_165 LIKE \'yes\'', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_medicaid_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_none', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id ) 
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end} 
{cnsl_household_exit_followup}
AND q_axis_18_total = 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_none'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_none_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end})  
{cnsl_household_exit_followup}
AND q_axis_18_total = 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_none_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_other', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id ) 
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end} 
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_163_18_33 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_other'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_other_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end})  
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_163_18_33 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_other_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_schip', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id ) 
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end} 
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_167 LIKE \'yes\'', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_schip'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_schip_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end})  
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_167 LIKE \'yes\'', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_schip_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_ss', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id ) 
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end} 
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_163_18_28 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_ss'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_ss_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end})  
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_163_18_28 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_ss_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_ssdi', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id ) 
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end} 
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_163_18_22 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_ssdi'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_ssdi_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end})  
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_163_18_22 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_ssdi_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_ssi', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id ) 
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end} 
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_163_18_21 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_ssi'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_ssi_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end})  
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_163_18_21 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_ssi_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_tanf', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id ) 
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end} 
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_163_18_26 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_tanf'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_tanf_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end})  
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_163_18_26 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_tanf_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_unemployment_benifits', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id ) 
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end} 
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_163_18_20 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_unemployment_benifits'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_unemployment_benifits_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end})  
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_163_18_20 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_unemployment_benifits_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_veterans_benifits', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id ) 
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end} 
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_163_18_23 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_veterans_benifits'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_veterans_benifits_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end})  
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_163_18_23 > 0', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_veterans_benifits_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_veterans_health_care', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id ) 
WHERE cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end} 
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_169 LIKE \'yes\'', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_veterans_health_care'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('income_source_exit_veterans_health_care_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_income_exit_followup.client_id)) FROM cnsl_client_income_exit_followup
INNER JOIN report_relationship ON ( cnsl_client_income_exit_followup.client_id = report_relationship.client_id )  
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
INNER JOIN cnsl_household_exit_followup ON ( report_relationship.hh_report_id = cnsl_household_exit_followup.hh_report_id )
WHERE 
cnsl_household_exit_followup.total_adults > 0
AND 
(cnsl_household_exit_followup.report_date_begin >= {date_begin} 
AND cnsl_household_exit_followup.report_date_begin <= {date_end})  
{cnsl_household_exit_followup}
AND cnsl_client_income_exit_followup.q_169 LIKE \'yes\'', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'income_source_exit_veterans_health_care_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_1', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length BETWEEN 1 AND 30
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_1'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_10', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length 
    > 3600
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_10'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_10_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length > 3600
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_10_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_1_2', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length 
    BETWEEN 31 AND 60
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_1_2'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_1_2_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length BETWEEN 31 AND 60
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_1_2_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_13_24', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length 
    BETWEEN 361 AND 720
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_13_24'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_13_24_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length BETWEEN 361 AND 720
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_13_24_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_1_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length BETWEEN 1 AND 30
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_1_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_25_3', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length 
    BETWEEN 721 AND 1080
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_25_3'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_25_3_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length BETWEEN 721 AND 1080
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_25_3_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_3_6', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length 
    BETWEEN 61 AND 180
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_3_6'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_3_6_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length BETWEEN 61 AND 180
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_3_6_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_4_5', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length 
    BETWEEN 1081 AND 1800
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_4_5'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_4_5_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length BETWEEN 1081 AND 1800
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_4_5_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_6_7', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length 
    BETWEEN 1801 AND 2520
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_6_7'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_6_7_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length BETWEEN 1801 AND 2520
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_6_7_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_7_12', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length 
    BETWEEN 181 AND 360
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_7_12'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_7_12_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length BETWEEN 181 AND 360
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_7_12_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_8_10', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length 
    BETWEEN 2521 AND 3600
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_8_10'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_8_10_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date >= {date_begin}
    AND intake_exit_events.exit_date <= {date_end}
    AND intake_exit_events.event_length BETWEEN 2521 AND 3600
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_8_10_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_1', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date IS NULL    
    
    AND intake_exit_events.intake_date 
    BETWEEN {DAYS_AGO-30} AND {DAYS_AGO-1}
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_1'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_10', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date IS NULL    
    
    AND intake_exit_events.intake_date 
    < {DAYS_AGO-3600} 
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_10'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_10_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date IS NULL    
    AND intake_exit_events.intake_date < {DAYS_AGO-3600}
    
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_10_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_1_2', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date IS NULL    
    
    AND intake_exit_events.intake_date 
    BETWEEN {DAYS_AGO-60} AND {DAYS_AGO-31}
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_1_2'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_1_2_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date IS NULL    
    AND intake_exit_events.intake_date
    BETWEEN {DAYS_AGO-60} AND {DAYS_AGO-31}
    
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_1_2_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_13_24', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date IS NULL    
    
    AND intake_exit_events.intake_date 
    BETWEEN {DAYS_AGO-720} AND {DAYS_AGO-361}
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_13_24'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_13_24_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date IS NULL    
    AND intake_exit_events.intake_date BETWEEN {DAYS_AGO-720} AND {DAYS_AGO-361}
    
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_13_24_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_1_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date IS NULL    
    AND intake_exit_events.intake_date BETWEEN {DAYS_AGO-30} AND {DAYS_AGO-1}
    
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_1_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_25_3', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date IS NULL    
    
    AND intake_exit_events.intake_date 
    BETWEEN {DAYS_AGO-1080} AND {DAYS_AGO-721}
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_25_3'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_25_3_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date IS NULL    
    AND intake_exit_events.intake_date BETWEEN {DAYS_AGO-1080} AND {DAYS_AGO-721}
    
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_25_3_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_3_6', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date IS NULL    
    
    AND intake_exit_events.intake_date 
    BETWEEN {DAYS_AGO-180} AND {DAYS_AGO-61}
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_3_6'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_3_6_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date IS NULL    
    AND intake_exit_events.intake_date BETWEEN {DAYS_AGO-180} AND {DAYS_AGO-61}
    
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_3_6_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_4_5', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date IS NULL    
    
    AND intake_exit_events.intake_date 
    BETWEEN {DAYS_AGO-1800} AND {DAYS_AGO-1081}
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_4_5'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_4_5_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date IS NULL    
    AND intake_exit_events.intake_date BETWEEN {DAYS_AGO-1800} AND {DAYS_AGO-1081}
    
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_4_5_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_6_7', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date IS NULL    
    
    AND intake_exit_events.intake_date 
    BETWEEN {DAYS_AGO-2520} AND {DAYS_AGO-1801}
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_6_7'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_6_7_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date IS NULL    
    AND intake_exit_events.intake_date BETWEEN {DAYS_AGO-2520} AND {DAYS_AGO-1801}
    
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_6_7_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_7_12', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date IS NULL    
    
    AND intake_exit_events.intake_date 
    BETWEEN {DAYS_AGO-360} AND {DAYS_AGO-181}
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_7_12'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_7_12_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date IS NULL    
    AND intake_exit_events.intake_date BETWEEN {DAYS_AGO-360} AND {DAYS_AGO-181}
    
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_7_12_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_8_10', 'SELECT SUM (a.z) FROM (
SELECT 
    DISTINCT(intake_exit_events.lead_client_id), 
    intake_exit_events.total_adults AS z 
FROM
    intake_exit_events
WHERE
    intake_exit_events.exit_date IS NULL    
    
    AND intake_exit_events.intake_date 
    BETWEEN {DAYS_AGO-3600} AND {DAYS_AGO-2521}
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_8_10'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('length_stay_not_leave_8_10_chronic', 'SELECT SUM (a.z) FROM (
SELECT DISTINCT(intake_exit_events.lead_client_id),
intake_exit_events.total_adults AS z
FROM
    cnsl_client_chronic
    INNER JOIN report_relationship ON ( cnsl_client_chronic.client_id = report_relationship.client_id )
    INNER JOIN intake_exit_events ON ( report_relationship.hh_report_id = intake_exit_events.intake_report_id )
 
WHERE
    intake_exit_events.exit_date IS NULL    
    AND intake_exit_events.intake_date BETWEEN {DAYS_AGO-3600} AND {DAYS_AGO-2521}
    
    AND intake_exit_events.total_adults > 0
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'length_stay_not_leave_8_10_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_emergency_shelter', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
WHERE cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake} 
AND cnsl_household_intake.q_192 LIKE \'emergency_shelter\' 
 ) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_emergency_shelter'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_emergency_shelter_chronic', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) 
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
WHERE 
cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake}
AND cnsl_household_intake.q_192 LIKE \'emergency_shelter\'
 ) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_emergency_shelter_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_hospital', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
WHERE cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake} 
AND cnsl_household_intake.q_192 LIKE \'hospital\' 
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_hospital'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_hospital_chronic', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) 
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
WHERE 
cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake}
AND cnsl_household_intake.q_192 LIKE \'hospital\'
 ) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_hospital_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_jail_prison', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
WHERE cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake} 
AND (
cnsl_household_intake.q_192 LIKE \'jail\'
OR cnsl_household_intake.q_192 LIKE \'prison\'
) 
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_jail_prison'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_jail_prison_chronic', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) 
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
WHERE 
cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake}
AND (
cnsl_household_intake.q_192 LIKE \'jail\'
OR cnsl_household_intake.q_192 LIKE \'prison\'
) 
 ) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_jail_prison_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_living_with_someone_else', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
WHERE cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake} 
AND 
cnsl_household_intake.q_192 LIKE \'living_with_someone_else\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_living_with_someone_else'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_living_with_someone_else_chronic', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) 
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
WHERE 
cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake}
AND 
cnsl_household_intake.q_192 LIKE \'living_with_someone_else\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_living_with_someone_else_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_non_housing', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
WHERE cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake} 
AND (
cnsl_household_intake.q_192 LIKE \'a_car_or_other_vehicle\' 
OR cnsl_household_intake.q_192 LIKE \'an_abandoned_building\' 
OR cnsl_household_intake.q_192 LIKE \'at_a_transportation_site\' 
OR cnsl_household_intake.q_192 LIKE \'anywhere_outside\'
)
 ) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_non_housing'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_non_housing_chronic', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) 
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
WHERE 
cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake}
AND (
cnsl_household_intake.q_192 LIKE \'a_car_or_other_vehicle\' 
OR cnsl_household_intake.q_192 LIKE \'an_abandoned_building\' 
OR cnsl_household_intake.q_192 LIKE \'at_a_transportation_site\' 
OR cnsl_household_intake.q_192 LIKE \'anywhere_outside\'
)
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_non_housing_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_other', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
WHERE cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake} 
AND 
cnsl_household_intake.q_192 LIKE \'other\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_other'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_other_chronic', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) 
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
WHERE 
cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake}
AND 
cnsl_household_intake.q_192 LIKE \'other\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_other_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_own_room_apartment_or_house', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
WHERE cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake} 
AND 
cnsl_household_intake.q_192 LIKE \'own_room_apartment_or_house\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_own_room_apartment_or_house'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_own_room_apartment_or_house_chronic', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) 
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
WHERE 
cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake}
AND 
cnsl_household_intake.q_192 LIKE \'own_room_apartment_or_house\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_own_room_apartment_or_house_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_psychiatric_facility', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
WHERE cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake} 
AND cnsl_household_intake.q_192 LIKE \'psychiatric_facility\' 
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_psychiatric_facility'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_psychiatric_facility_chronic', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) 
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
WHERE 
cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake}
AND cnsl_household_intake.q_192 LIKE \'psychiatric_facility\'

 ) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_psychiatric_facility_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_substance_abuse_treatment', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
WHERE cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake} 
AND cnsl_household_intake.q_192 LIKE \'substance_abuse_treatment\' 
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_substance_abuse_treatment'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_substance_abuse_treatment_chronic', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) 
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
WHERE 
cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake}
AND cnsl_household_intake.q_192 LIKE \'substance_abuse_treatment\'

 ) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_substance_abuse_treatment_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_transitional_housing', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
WHERE cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake} 
AND cnsl_household_intake.q_192 LIKE \'transitional_housing_for_homeless\' 
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_transitional_housing'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('living_situation_prior_transitional_housing_chronic', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_adults AS z FROM cnsl_household_intake 
INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) 
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
WHERE 
cnsl_household_intake.report_date_begin >= {date_begin} 
AND cnsl_household_intake.report_date_begin <= {date_end} 
{cnsl_household_intake}
AND cnsl_household_intake.q_192 LIKE \'transitional_housing_for_homeless\'

 ) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'living_situation_prior_transitional_housing_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('minors_in_families_entering', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id), cnsl_household_intake.total_minors AS z FROM cnsl_household_intake WHERE cnsl_household_intake.total_clients > 1 AND
cnsl_household_intake.total_adults > 0 AND
cnsl_household_intake.report_date_begin > {date_begin} AND cnsl_household_intake.report_date_begin < {date_end}
{cnsl_household_intake} 
 ) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'minors_in_families_entering'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('minors_in_families_exiting', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_exit_followup.lead_client_id), cnsl_household_exit_followup.total_minors AS z FROM cnsl_household_exit_followup WHERE cnsl_household_exit_followup.total_clients > 1 
AND cnsl_household_exit_followup.total_adults > 0 
AND cnsl_household_exit_followup.report_date_begin > {date_begin} AND cnsl_household_exit_followup.report_date_begin < {date_end}   {cnsl_household_exit_followup}  
 ) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'minors_in_families_exiting'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('minors_in_families_first_day', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id), cnsl_household_intake.total_minors AS z FROM cnsl_household_intake LEFT JOIN cnsl_household_exit_followup ON (cnsl_household_intake.lead_client_id = cnsl_household_exit_followup.lead_client_id) WHERE cnsl_household_intake.total_adults > 0 AND cnsl_household_intake.total_clients > 1 AND cnsl_household_intake.report_date_begin <= {date_begin} 
AND ( cnsl_household_exit_followup.report_date_begin >= {date_begin}  OR cnsl_household_exit_followup.report_date_begin IS NULL )

{cnsl_household_intake} {cnsl_household_exit_followup_NULL} ) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'minors_in_families_first_day'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('minors_in_families_last_day', 'SELECT SUM(a.z) FROM (SELECT DISTINCT(cnsl_household_intake.lead_client_id),cnsl_household_intake.total_minors AS z FROM cnsl_household_intake LEFT JOIN cnsl_household_exit_followup ON (cnsl_household_intake.lead_client_id = cnsl_household_exit_followup.lead_client_id) WHERE   cnsl_household_intake.total_clients > 1 
AND cnsl_household_intake.total_adults > 0
AND cnsl_household_intake.report_date_begin < {date_end} 
AND ( cnsl_household_exit_followup.report_date_begin >= {date_end}
OR cnsl_household_exit_followup.report_date_begin IS NULL ) 

{cnsl_household_intake} {cnsl_household_exit_followup_NULL} ) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'minors_in_families_last_day'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('needs_alcohol', 'SELECT COUNT(DISTINCT(cnsl_client_assessment.client_id)) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_assessment ON ( report_relationship.client_id = cnsl_client_assessment.client_id ) WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND ( cnsl_client_assessment.q_114 LIKE \'yes\'
OR cnsl_client_assessment.q_115 LIKE \'yes\' )', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'needs_alcohol'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('needs_alcohol_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_assessment.client_id)) FROM cnsl_household_intake 
INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) 
INNER JOIN cnsl_client_assessment ON ( report_relationship.client_id = cnsl_client_assessment.client_id ) 
INNER JOIN cnsl_client_chronic ON ( cnsl_client_assessment.client_id = cnsl_client_chronic.client_id )
WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND ( cnsl_client_assessment.q_114 LIKE \'yes\'
OR cnsl_client_assessment.q_115 LIKE \'yes\' )', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'needs_alcohol_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('needs_developmental_disability', 'SELECT COUNT(DISTINCT(cnsl_client_assessment.client_id)) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_assessment ON ( report_relationship.client_id = cnsl_client_assessment.client_id ) WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND ( cnsl_client_assessment.q_112 LIKE \'yes\' )', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'needs_developmental_disability'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('needs_developmental_disability_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_assessment.client_id)) FROM cnsl_household_intake 
INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) 
INNER JOIN cnsl_client_assessment ON ( report_relationship.client_id = cnsl_client_assessment.client_id ) 
INNER JOIN cnsl_client_chronic ON ( cnsl_client_assessment.client_id = cnsl_client_chronic.client_id )
WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND ( cnsl_client_assessment.q_112 LIKE \'yes\' )', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'needs_developmental_disability_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('needs_domestic_violence', 'SELECT COUNT(DISTINCT(cnsl_client_assessment.client_id)) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_assessment ON ( report_relationship.client_id = cnsl_client_assessment.client_id ) WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND ( cnsl_client_assessment.q_120 LIKE \'yes\' )', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'needs_domestic_violence'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('needs_domestic_violence_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_assessment.client_id)) FROM cnsl_household_intake 
INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) 
INNER JOIN cnsl_client_assessment ON ( report_relationship.client_id = cnsl_client_assessment.client_id ) 
INNER JOIN cnsl_client_chronic ON ( cnsl_client_assessment.client_id = cnsl_client_chronic.client_id )
WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND ( cnsl_client_assessment.q_120 LIKE \'yes\' )', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'needs_domestic_violence_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('needs_drugs', 'SELECT COUNT(DISTINCT(cnsl_client_assessment.client_id)) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_assessment ON ( report_relationship.client_id = cnsl_client_assessment.client_id ) WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND ( cnsl_client_assessment.q_116 LIKE \'yes\'
OR cnsl_client_assessment.q_117 LIKE \'yes\' )', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'needs_drugs'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('needs_drugs_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_assessment.client_id)) FROM cnsl_household_intake 
INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) 
INNER JOIN cnsl_client_assessment ON ( report_relationship.client_id = cnsl_client_assessment.client_id ) 
INNER JOIN cnsl_client_chronic ON ( cnsl_client_assessment.client_id = cnsl_client_chronic.client_id )
WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND ( cnsl_client_assessment.q_116 LIKE \'yes\'
OR cnsl_client_assessment.q_117 LIKE \'yes\' )', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'needs_drugs_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('needs_hiv_aids', 'SELECT COUNT(DISTINCT(cnsl_client_assessment.client_id)) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_assessment ON ( report_relationship.client_id = cnsl_client_assessment.client_id ) WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND ( cnsl_client_assessment.q_124 LIKE \'yes\' )', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'needs_hiv_aids'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('needs_hiv_aids_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_assessment.client_id)) FROM cnsl_household_intake 
INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) 
INNER JOIN cnsl_client_assessment ON ( report_relationship.client_id = cnsl_client_assessment.client_id ) 
INNER JOIN cnsl_client_chronic ON ( cnsl_client_assessment.client_id = cnsl_client_chronic.client_id )
WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND ( cnsl_client_assessment.q_124 LIKE \'yes\' )', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'needs_hiv_aids_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('needs_mental_illness', 'SELECT COUNT(DISTINCT(cnsl_client_assessment.client_id)) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_assessment ON ( report_relationship.client_id = cnsl_client_assessment.client_id ) WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_assessment.q_119 LIKE \'yes\'', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'needs_mental_illness'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('needs_mental_illness_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_assessment.client_id)) FROM cnsl_household_intake 
INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) 
INNER JOIN cnsl_client_assessment ON ( report_relationship.client_id = cnsl_client_assessment.client_id ) 
INNER JOIN cnsl_client_chronic ON ( cnsl_client_assessment.client_id = cnsl_client_chronic.client_id )
WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_assessment.q_119 LIKE \'yes\'', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'needs_mental_illness_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('needs_physical_disability', 'SELECT COUNT(DISTINCT(cnsl_client_assessment.client_id)) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_assessment ON ( report_relationship.client_id = cnsl_client_assessment.client_id ) WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND ( cnsl_client_assessment.q_111 LIKE \'yes\' )', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'needs_physical_disability'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('needs_physical_disability_chronic', 'SELECT COUNT(DISTINCT(cnsl_client_assessment.client_id)) FROM cnsl_household_intake 
INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) 
INNER JOIN cnsl_client_assessment ON ( report_relationship.client_id = cnsl_client_assessment.client_id ) 
INNER JOIN cnsl_client_chronic ON ( cnsl_client_assessment.client_id = cnsl_client_chronic.client_id )
WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND ( cnsl_client_assessment.q_111 LIKE \'yes\' )', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'needs_physical_disability_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('persons_in_families_entering_age_13_to_17_female', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients > 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 13 ) AND cnsl_client_profile.q_100 >= ( {date_end_year} - 17 )
AND cnsl_client_profile.q_101 NOT LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'persons_in_families_entering_age_13_to_17_female'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('persons_in_families_entering_age_13_to_17_male', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients > 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 13 ) AND cnsl_client_profile.q_100 >= ( {date_end_year} - 17 )
AND cnsl_client_profile.q_101 LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'persons_in_families_entering_age_13_to_17_male'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('persons_in_families_entering_age_18_to_30_female', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients > 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 18 ) AND cnsl_client_profile.q_100 >= ( {date_end_year} - 30 )
AND cnsl_client_profile.q_101 NOT LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'persons_in_families_entering_age_18_to_30_female'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('persons_in_families_entering_age_18_to_30_male', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients > 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 18 ) AND cnsl_client_profile.q_100 >= ( {date_end_year} - 30 )
AND cnsl_client_profile.q_101 LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'persons_in_families_entering_age_18_to_30_male'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('persons_in_families_entering_age_1_female', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients > 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
 AND cnsl_client_profile.q_100 >= ( {date_end_year} )
AND cnsl_client_profile.q_101 NOT LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'persons_in_families_entering_age_1_female'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('persons_in_families_entering_age_1_male', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients > 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
 AND cnsl_client_profile.q_100 >= ( {date_end_year} )
AND cnsl_client_profile.q_101 LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'persons_in_families_entering_age_1_male'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('persons_in_families_entering_age_1_to_5_female', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients > 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 1 ) AND cnsl_client_profile.q_100 >= ( {date_end_year} - 5 )
AND cnsl_client_profile.q_101 NOT LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'persons_in_families_entering_age_1_to_5_female'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('persons_in_families_entering_age_1_to_5_male', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients > 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 1 ) AND cnsl_client_profile.q_100 >= ( {date_end_year} - 5 )
AND cnsl_client_profile.q_101 LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'persons_in_families_entering_age_1_to_5_male'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('persons_in_families_entering_age_31_to_50_female', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients > 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 31 ) AND cnsl_client_profile.q_100 >= ( {date_end_year} - 50 )
AND cnsl_client_profile.q_101 NOT LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'persons_in_families_entering_age_31_to_50_female'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('persons_in_families_entering_age_31_to_50_male', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients > 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 31 ) AND cnsl_client_profile.q_100 >= ( {date_end_year} - 50 )
AND cnsl_client_profile.q_101 LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'persons_in_families_entering_age_31_to_50_male'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('persons_in_families_entering_age_51_to_61_female', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients > 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 51 ) AND cnsl_client_profile.q_100 >= ( {date_end_year} - 61 )
AND cnsl_client_profile.q_101 NOT LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'persons_in_families_entering_age_51_to_61_female'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('persons_in_families_entering_age_51_to_61_male', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients > 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 51 ) AND cnsl_client_profile.q_100 >= ( {date_end_year} - 61 )
AND cnsl_client_profile.q_101 LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'persons_in_families_entering_age_51_to_61_male'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('persons_in_families_entering_age_62', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients > 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 62 ) 
AND cnsl_client_profile.q_101 LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'persons_in_families_entering_age_62'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('persons_in_families_entering_age_62_female', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients > 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 62 )
AND cnsl_client_profile.q_101 NOT LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'persons_in_families_entering_age_62_female'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('persons_in_families_entering_age_62_male', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients > 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 62 )
AND cnsl_client_profile.q_101 LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'persons_in_families_entering_age_62_male'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('persons_in_families_entering_age_6_to_12_female', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients > 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 6 ) AND cnsl_client_profile.q_100 >= ( {date_end_year} - 12 )
AND cnsl_client_profile.q_101 NOT LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'persons_in_families_entering_age_6_to_12_female'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('persons_in_families_entering_age_6_to_12_male', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients > 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 6 ) AND cnsl_client_profile.q_100 >= ( {date_end_year} - 12 )
AND cnsl_client_profile.q_101 LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'persons_in_families_entering_age_6_to_12_male'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('race_asian', 'SELECT COUNT(DISTINCT(cnsl_client_profile.client_id)) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_102_6 IS NULL 
AND cnsl_client_profile.q_102_7 = 1
AND cnsl_client_profile.q_102_8 IS NULL
AND cnsl_client_profile.q_102_9 IS NULL
AND cnsl_client_profile.q_102_10 IS NULL', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'race_asian'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('race_asian_white', 'SELECT COUNT(DISTINCT(cnsl_client_profile.client_id)) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_102_6 IS NULL
AND cnsl_client_profile.q_102_7 = 1
AND cnsl_client_profile.q_102_8 IS NULL
AND cnsl_client_profile.q_102_9 IS NULL
AND cnsl_client_profile.q_102_10 = 1', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'race_asian_white'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('race_black', 'SELECT COUNT(DISTINCT(cnsl_client_profile.client_id)) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_102_6 IS NULL 
AND cnsl_client_profile.q_102_7 IS NULL
AND cnsl_client_profile.q_102_8 = 1
AND cnsl_client_profile.q_102_9 IS NULL
AND cnsl_client_profile.q_102_10 IS NULL', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'race_black'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('race_black_white', 'SELECT COUNT(DISTINCT(cnsl_client_profile.client_id)) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_102_6 IS NULL 
AND cnsl_client_profile.q_102_7 IS NULL
AND cnsl_client_profile.q_102_8 = 1
AND cnsl_client_profile.q_102_9 IS NULL
AND cnsl_client_profile.q_102_10 = 1', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'race_black_white'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('race_indian', 'SELECT COUNT(DISTINCT(cnsl_client_profile.client_id)) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_102_6 = 1 
AND cnsl_client_profile.q_102_7 IS NULL
AND cnsl_client_profile.q_102_8 IS NULL
AND cnsl_client_profile.q_102_9 IS NULL
AND cnsl_client_profile.q_102_10 IS NULL', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'race_indian'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('race_indian_black', 'SELECT COUNT(DISTINCT(cnsl_client_profile.client_id)) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_102_6 = 1
AND cnsl_client_profile.q_102_7 IS NULL
AND cnsl_client_profile.q_102_8 = 1
AND cnsl_client_profile.q_102_9 IS NULL
AND cnsl_client_profile.q_102_10 IS NULL', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'race_indian_black'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('race_indian_white', 'SELECT COUNT(DISTINCT(cnsl_client_profile.client_id)) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_102_6 = 1
AND cnsl_client_profile.q_102_7 IS NULL
AND cnsl_client_profile.q_102_8 IS NULL
AND cnsl_client_profile.q_102_9 IS NULL
AND cnsl_client_profile.q_102_10 = 1', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'race_indian_white'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('race_other_multi_racial', '{CALC-hispanic_yes} + {CALC-hispanic_no} - {CALC-race_indian} - {CALC-race_asian} -  {CALC-race_black} - {CALC-race_pacific_islander} - {CALC-race_white} - {CALC-race_indian_white} - {CALC-race_asian_white} - {CALC-race_black_white} - {CALC-race_indian_black}', 'cross_query_calculation', NULL)",
	"Error inserting values into pre_built_queries, row #'race_other_multi_racial'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('race_pacific_islander', 'SELECT COUNT(DISTINCT(cnsl_client_profile.client_id)) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_102_6 IS NULL 
AND cnsl_client_profile.q_102_7 IS NULL
AND cnsl_client_profile.q_102_8 IS NULL
AND cnsl_client_profile.q_102_9 = 1
AND cnsl_client_profile.q_102_10 IS NULL', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'race_pacific_islander'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('race_white', 'SELECT COUNT(DISTINCT(cnsl_client_profile.client_id)) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_102_6 IS NULL 
AND cnsl_client_profile.q_102_7 IS NULL
AND cnsl_client_profile.q_102_8 IS NULL
AND cnsl_client_profile.q_102_9 IS NULL
AND cnsl_client_profile.q_102_10 = 1', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'race_white'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_completed_program', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'completed_program\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_completed_program'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_completed_program_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'completed_program\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_completed_program_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_criminal_activity_violence_destructio_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'criminal_activity_violence_destruction_of_property\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_criminal_activity_violence_destructio_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_criminal_activity_violence_destruction', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'criminal_activity_violence_destruction_of_property\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_criminal_activity_violence_destruction'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_death', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'death\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_death'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_death_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'death\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_death_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_disagreement_with_rules', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'disagreement_with_rules\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_disagreement_with_rules'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_disagreement_with_rules_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'death\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_disagreement_with_rules_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_emergency_shelter', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_188 LIKE \'emergency_shelter\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_emergency_shelter'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_left_for_housing', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'left_for_a_housing_opportunity_before_completing_program\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_left_for_housing'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_left_for_housing_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'left_for_a_housing_opportunity_before_completing_program\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_left_for_housing_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_needs_could_not_be_met_by_program', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'needs_could_not_be_met_by_program\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_needs_could_not_be_met_by_program'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_needs_could_not_be_met_by_program_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'needs_could_not_be_met_by_program\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_needs_could_not_be_met_by_program_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_non_compliance_with_program', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'non_compliance_with_program\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_non_compliance_with_program'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_non_compliance_with_program_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'non_compliance_with_program\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_non_compliance_with_program_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_non_payment_of_rent_occupancy_charge', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'non_payment_of_rent_occupancy_charge\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_non_payment_of_rent_occupancy_charge'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_non_payment_of_rent_occupancy_charge_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'non_payment_of_rent_occupancy_charge\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_non_payment_of_rent_occupancy_charge_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_other', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'other\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_other'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_other_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'unknown_disappeared\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_other_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_unknown_disappeared', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'unknown_disappeared\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_unknown_disappeared'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('reason_leaving_unknown_disappeared_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )  
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_household_exit_followup.q_183 LIKE \'unknown_disappeared\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'reason_leaving_unknown_disappeared_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('singles_not_in_families_entering', 'SELECT DISTINCT(cnsl_household_intake.lead_client_id) 
FROM cnsl_household_intake  
WHERE 
cnsl_household_intake.total_clients = 1 
AND cnsl_household_intake.total_adults = 1 
AND cnsl_household_intake.report_date_begin > {date_begin} AND cnsl_household_intake.report_date_begin < {date_end} {cnsl_household_intake}', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'singles_not_in_families_entering'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('singles_not_in_families_entering_age_17_female', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients = 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} {cnsl_client_profile} AND cnsl_client_profile.q_100 >= ( {date_end_year} - 17 )
AND cnsl_client_profile.q_101 NOT LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'singles_not_in_families_entering_age_17_female'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('singles_not_in_families_entering_age_17_male', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients = 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} {cnsl_client_profile} AND cnsl_client_profile.q_100 >= ( {date_end_year} - 17 )
AND cnsl_client_profile.q_101 LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'singles_not_in_families_entering_age_17_male'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('singles_not_in_families_entering_age_18_to_30_female', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients = 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} {cnsl_client_profile}
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 18 ) AND cnsl_client_profile.q_100 >= ( {date_end_year} - 30 )
AND cnsl_client_profile.q_101 NOT LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'singles_not_in_families_entering_age_18_to_30_female'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('singles_not_in_families_entering_age_18_to_30_male', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients = 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 18 ) AND cnsl_client_profile.q_100 >= ( {date_end_year} - 30 )
AND cnsl_client_profile.q_101 LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'singles_not_in_families_entering_age_18_to_30_male'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('singles_not_in_families_entering_age_31_to_50', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients = 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} 
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 31 ) AND cnsl_client_profile.q_100 >= ( {date_end_year} - 50 )
AND cnsl_client_profile.q_101 LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'singles_not_in_families_entering_age_31_to_50'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('singles_not_in_families_entering_age_31_to_50_female', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients = 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} {cnsl_client_profile}
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 31 ) AND cnsl_client_profile.q_100 >= ( {date_end_year} - 50 )
AND cnsl_client_profile.q_101 NOT LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'singles_not_in_families_entering_age_31_to_50_female'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('singles_not_in_families_entering_age_31_to_50_male', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients = 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} {cnsl_client_profile}
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 31 ) AND cnsl_client_profile.q_100 >= ( {date_end_year} - 50 )
AND cnsl_client_profile.q_101 LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'singles_not_in_families_entering_age_31_to_50_male'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('singles_not_in_families_entering_age_51_to_61_female', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients = 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} {cnsl_client_profile}
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 51 ) AND cnsl_client_profile.q_100 >= ( {date_end_year} - 61 )
AND cnsl_client_profile.q_101 NOT LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'singles_not_in_families_entering_age_51_to_61_female'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('singles_not_in_families_entering_age_51_to_61_male', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients = 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} {cnsl_client_profile}
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 51 ) AND cnsl_client_profile.q_100 >= ( {date_end_year} - 61 )
AND cnsl_client_profile.q_101 LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'singles_not_in_families_entering_age_51_to_61_male'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('singles_not_in_families_entering_age_62', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients = 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} AND cnsl_client_profile.q_100 >  ( {date_begin_year} - 62 )', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'singles_not_in_families_entering_age_62'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('singles_not_in_families_entering_age_62_female', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients = 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} {cnsl_client_profile}
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 62 ) 
AND cnsl_client_profile.q_101 NOT LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'singles_not_in_families_entering_age_62_female'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('singles_not_in_families_entering_age_62_male', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE cnsl_household_intake.total_clients = 1 AND cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} {cnsl_client_profile}
AND cnsl_client_profile.q_100 <= ( {date_end_year} - 62 ) 
AND cnsl_client_profile.q_101 LIKE \'male\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'singles_not_in_families_entering_age_62_male'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('singles_not_in_families_exiting', 'SELECT DISTINCT(cnsl_household_exit_followup.lead_client_id) FROM cnsl_household_exit_followup, cnsl_household_intake WHERE 
cnsl_household_exit_followup.total_clients = 1 
AND cnsl_household_intake.total_adults = 1 
AND cnsl_household_exit_followup.report_date_begin > {date_begin} AND cnsl_household_exit_followup.report_date_begin < {date_end} {cnsl_household_exit_followup}', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'singles_not_in_families_exiting'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('singles_not_in_families_first_day', 'SELECT DISTINCT(cnsl_household_intake.lead_client_id) FROM cnsl_household_intake LEFT JOIN cnsl_household_exit_followup ON (cnsl_household_intake.lead_client_id = cnsl_household_exit_followup.lead_client_id) 
WHERE 
cnsl_household_intake.total_clients = 1
AND cnsl_household_intake.total_adults = 1  
AND cnsl_household_intake.report_date_begin <= {date_begin} 
AND ( cnsl_household_exit_followup.report_date_begin > {date_begin} OR cnsl_household_exit_followup.report_date_begin IS NULL )
{cnsl_household_intake} {cnsl_household_exit_followup_NULL}', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'singles_not_in_families_first_day'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('singles_not_in_families_last_day', 'SELECT DISTINCT(cnsl_household_intake.lead_client_id) FROM cnsl_household_intake LEFT JOIN cnsl_household_exit_followup ON (cnsl_household_intake.lead_client_id = cnsl_household_exit_followup.lead_client_id) 
WHERE 
cnsl_household_intake.total_clients = 1 
AND cnsl_household_intake.total_adults = 1 
AND cnsl_household_intake.report_date_begin < {date_end} 
AND ( cnsl_household_exit_followup.report_date_begin >= {date_end} 
OR cnsl_household_exit_followup.report_date_begin IS NULL  ) 
{cnsl_household_intake} {cnsl_household_exit_followup_NULL}', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'singles_not_in_families_last_day'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('supportive_service_emergency_shelter', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id  )
INNER JOIN cnsl_client_service ON ( report_relationship.client_id = cnsl_client_service.client_id ) 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_client_service.q_99 LIKE \'78\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'supportive_service_emergency_shelter'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('supportive_service_emergency_shelter_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )
INNER JOIN cnsl_client_service ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_client_service.q_99 LIKE \'78\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'supportive_service_emergency_shelter_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('supportive_service_transitional_housing', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id  )
INNER JOIN cnsl_client_service ON ( report_relationship.client_id = cnsl_client_service.client_id ) 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_client_service.q_99 LIKE \'88\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'supportive_service_transitional_housing'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('supportive_service_transitional_housing_chronic', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationship ON ( cnsl_household_exit_followup.hh_report_id = report_relationship.hh_report_id )
INNER JOIN cnsl_client_chronic ON ( report_relationship.client_id = cnsl_client_chronic.client_id )
INNER JOIN cnsl_client_service ON ( report_relationship.client_id = cnsl_client_chronic.client_id ) 
WHERE 
cnsl_household_exit_followup.total_adults = 1
AND cnsl_household_exit_followup.total_clients = 1  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_client_service.q_99 LIKE \'88\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'supportive_service_transitional_housing_chronic'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('supportive_service_transitional_shelter', 'SELECT SUM(a.z) FROM (
SELECT DISTINCT(
cnsl_household_exit_followup.lead_client_id),cnsl_household_exit_followup.total_adults AS z 
FROM 
cnsl_household_exit_followup
INNER JOIN report_relationships ON ( cnsl_household_exit_followup.hh_report_id = report_relationships.hh_report_id  )
INNER JOIN cnsl_client_service ON ( report_relationships.client_id = cnsl_client_service.client_id ) 
WHERE cnsl_household_exit_followup.total_adults > 0  
AND cnsl_household_exit_followup.report_date_begin > {date_begin} 
AND cnsl_household_exit_followup.report_date_begin < {date_end}  {cnsl_household_exit_followup}  
AND cnsl_client_service.q_99 LIKE \'88\'
) AS a', 'sum', NULL)",
	"Error inserting values into pre_built_queries, row #'supportive_service_transitional_shelter'");

run_query("INSERT INTO pre_built_queries (query_title, query_sql, query_type, client_list_elements_template) VALUES ('veterans', 'SELECT DISTINCT(cnsl_client_profile.client_id) FROM cnsl_household_intake INNER JOIN report_relationship ON ( cnsl_household_intake.hh_report_id = report_relationship.hh_report_id ) INNER JOIN cnsl_client_profile ON ( report_relationship.client_id = cnsl_client_profile.client_id ) WHERE  cnsl_household_intake.report_date_begin >= {date_begin} AND cnsl_household_intake.report_date_begin <= {date_end} {cnsl_household_intake} AND cnsl_client_profile.q_105 LIKE \'yes\'', 'count', NULL)",
	"Error inserting values into pre_built_queries, row #'veterans'");


echo ". ";




						
?>
Return current item: Homeless Mangement Information System