def index2():

    # Need CRUD String
    table = s3db.table("cr_shelter", None)

    module_name = settings.modules[module].name_nice
    response.title = module_name
    response.view = "inv/index.html"
    if s3.debug:
        # Start of TEST CODE for multiple dataTables,
        #this also required views/inv/index.html to be modified
        from s3.s3data import S3DataTable
        representation = request.extension
        if representation == "html" or get_vars.id == "warehouse_list_1":
            resource = s3db.resource("inv_warehouse")
            totalrows = resource.count()
            list_fields = ["id",
                           "name",
                           "organisation_id",
                           ]
            orderby = "inv_warehouse.name asc"
            if representation == "aadata":
                query, orderby, left = resource.datatable_filter(list_fields, get_vars)
                if orderby is None:
                    orderby = default_orderby
            start = int(get_vars.displayStart) if get_vars.displayStart else 0
            limit = int(get_vars.pageLength) if get_vars.pageLength else s3.ROWSPERPAGE
            data = resource.select(list_fields,
                                   start=start,
                                   limit=limit,
                                   orderby=orderby,
                                   count=True,
                                   represent=True)
            filteredrows = data["numrows"]
            if totalrows is None:
                totalrows = filteredrows
            rfields = data["rfields"]
            rows = data["rows"]
            dt = S3DataTable(rfields, rows)
            dt.defaultActionButtons(resource)
            if representation == "html":
                warehouses = dt.html(totalrows,
                                     filteredrows,
                                     "warehouse_list_1",
                                     dt_ajax_url=URL(c="inv",
                                                  f="index2",
                                                  extension="aadata",
                                                  vars={"id":"warehouse_list_1"},
                                                  ),
                                     dt_group=2,
                                     dt_searching="true",
                                     )
            else:
                warehouse = dt.json(totalrows,
                                    filteredrows,
                                    "warehouse_list_1",
                                    int(get_vars.draw),
                                    )
                return warehouse
        # Second Table
        if representation == "html" or get_vars.id == "inventory_list_1":
            if "Adjust" in request.post_vars:
                if request.post_vars.selected == "":
                    inventory = "Well you could have selected something :("
                else:
                    inventory = "Adjustment not currently supported... :-) you selected the following items: %s" % request.post_vars.selected
            else:
                resource = s3db.resource("inv_inv_item")
                totalrows = resource.count()
                table = resource.table
                stable = s3db.supply_item
                list_fields = ["id",
                               "site_id",
                               "item_id$name",
                               "quantity",
                               "pack_value",
                               "total_value",
                               ]
                orderby = "inv_inv_item.site_id asc"
                if representation == "aadata":
                    query, orderby, left = resource.datatable_filter(list_fields, get_vars)
                    if orderby is None:
                        orderby = default_orderby
                site_list = {}
                data = resource.select(list_fields,
                                       limit=None,
                                       orderby=orderby,
                                       count=True)
                filteredrows = data["numrows"]
                if totalrows is None:
                    totalrows = filteredrows
                rows = data["rows"]
                for row in rows:
                    site_id = row["inv_inv_item.site_id"]
                    if site_id not in site_list:
                        site_list[site_id] = 1
                    else:
                        site_list[site_id] += 1
                formatted_site_list = {}
                repr = table.site_id.represent
                for (key,value) in site_list.items():
                    formatted_site_list[str(repr(key))] = value
                if isinstance(orderby, bool):
                    orderby = [table.site_id, stable.name, ~table.quantity]
                start = int(get_vars.displayStart) if get_vars.displayStart else 0
                limit = int(get_vars.pageLength) if get_vars.pageLength else s3.ROWSPERPAGE
                data = resource.select(list_fields,
                                       orderby=orderby,
                                       start=start,
                                       limit=limit,
                                       represent=True)
                rfields = data["rfields"]
                rows = data["rows"]
                dt = S3DataTable(rfields,
                                 rows,
                                 orderby=orderby,
                                 )
                custom_actions = [dict(label=str(T("Warehouse")),
                                  _class="action-icon",
                                  img="/%s/static/img/markers/gis_marker.image.Agri_Commercial_Food_Distribution_Center_S1.png" % appname,
                                  url=URL(c="inv", f="warehouse",
                                          args=["[id]", "update"]
                                          )
                                  ),
                                 ]
                dt.defaultActionButtons(resource, custom_actions)
                if representation == "html":
                    rows = current.db(table.quantity<100.0).select(table.id, table.quantity)
                    errorList = []
                    warningList = []
                    alertList = []
                    for row in rows:
                        if row.quantity < 0.0:
                            errorList.append(row.id)
                        elif row.quantity == 0.0:
                            warningList.append(row.id)
                        else:
                            alertList.append(row.id)
                    inventory = dt.html(totalrows,
                                        filteredrows,
                                        "inventory_list_1",
                                        dt_action_col=-1,
                                        dt_ajax_url=URL(c="inv",
                                                     f="index2",
                                                     extension="aadata",
                                                     vars={"id":"inventory_list_1"},
                                                     ),
                                        dt_bulk_actions = "Adjust",
                                        dt_group=[1,2],
                                        dt_group_totals=[formatted_site_list],
                                        dt_searching="true",
                                        dt_styles = {"dtdisable": errorList,
                                                     "dtwarning": warningList,
                                                     "dtalert": alertList,
                                                     },
                                        #dt_text_maximum_len = 10,
                                        #dt_text_condense_len = 8,
                                        #dt_group_space = "true",
                                        dt_shrink_groups = "accordion",
                                        #dt_shrink_groups = "individual",
                                        )

                    s3.actions = None
                elif representation == "aadata":
                    inventory = dt.json(totalrows,
                                        filteredrows,
                                        "inventory_list_1",
                                        int(get_vars.draw),
                                        dt_action_col=-1,
                                        dt_bulk_actions = "Adjust",
                                        dt_group_totals=[formatted_site_list],
                                        )
                    return inventory
                else:
                    # Probably not the way to do it.... but
                    s3db.configure("inv_inv_item",
                                   list_fields=list_fields,
                                   report_groupby="site_id",
                                   pdf_groupby="site_id",
                                   )
                    s3.filter = filter
                    r = s3_request("inv", "inv_item",
                                   vars={"orderby" : orderby})
                    r.resource = resource
                    output = r(
                               pdf_groupby='site_id',
                               dt_group=1,
                               )
                    return output
        # Third table
        if representation == "html" or get_vars.id == "supply_list_1":
            resource = s3db.resource("supply_item")
            list_fields = ["id",
                           "name",
                           "um",
                           "model",
                           ]
            orderby = "inv_inv_item.site_id asc"
            if representation == "aadata":
                query, orderby, left = resource.datatable_filter(list_fields, get_vars)
                if orderby is None:
                    orderby = default_orderby
            data = resource.select(list_fields,
                                   limit=None,
                                   orderby=orderby,
                                   count=True,
                                   represent=True)
            rows = data["rows"]
            rfields = data["rfields"]
            numrows = data["numrows"]
            dt = S3DataTable(rfields, rows)
            dt.defaultActionButtons(resource)
            if representation == "html":
                supply_items = dt.html(numrows,
                                       numrows,
                                       "supply_list_1",
                                       dt_action_col=1,
                                       dt_ajax_url=URL(c="inv",
                                                       f="index2",
                                                       extension="aadata",
                                                       vars={"id": "supply_list_1"},
                                                       ),
                                       dt_pageLength=10,
                                       )
            else:
                supply_items = dt.json(numrows,
                                       numrows,
                                       "supply_list_1",
                                       int(get_vars.draw),
                                       dt_action_col=1,
                                       )
                return supply_items
        r = s3_request(prefix = "inv", name = "inv_item")
        return dict(module_name=module_name,
                    warehouses = warehouses,
                    inventory = inventory,
                    supply_items = supply_items,
                    r = r,
                    )
        # End of TEST CODE
    return dict(module_name=module_name)

# -----------------------------------------------------------------------------
Return the string path to the 'ok' file for the repo.
dataset/ETHPy150Open sahana/eden/controllers/inv.py/index2--crossover with--dataset/ETHPy150Open bloomberg/phabricator-tools/py/abd/abdt_fs.py/Layout.repo_ok