import React, { useRef, useState, Suspense,useEffect } from 'react';
import moment from 'moment'; // 时间相关引用，没有使用可以删除
import { connect } from 'umi';

import useRequest from '@ahooksjs/use-request'; // 请求数据的引用
import Draggable from 'react-draggable';
import ProTable from '@ant-design/pro-table';
import ProDescriptions from '@ant-design/pro-descriptions';
import ProForm, { ProFormDatePicker,ProFormDateTimePicker,ProFormRadio, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormUploadButton } from '@ant-design/pro-form';
import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-layout';
import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect } from 'antd';

import type { CurrentUser } from "umi";
import type { ConnectState } from '@/models/connect';
import type { ActionType, ProColumns } from '@ant-design/pro-table';
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import type { FormInstance } from 'antd';
import type { BUDGETDETAIL_AHModel } from './data';

import {getFieldEnum, getFieldEnumTree,getFieldEnumName} from "@/services/options"; // 枚举的引用，没有使用可以删除
import {getList, delbudgetdetail_ah, updatebudgetdetail_ah, handleSaveList, handleDetailTableList} from './service';
import {black} from "chalk";
import {updatebudgetproject_ah} from "@/pages/Test/financialBudget/service"; // 接口相关对象的引用

const handelDelete = async (budgetdetail_ahid: number) => {
    const hide = message.loading('正在删除...');
    try {
        const result = await delbudgetdetail_ah(budgetdetail_ahid);

        hide();
        if (result.Result_Code !== 100) {
            message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`);
            return false;
        }
        message.success('删除成功！');
        return true;
    } catch (error) {
        hide();
        message.error('删除失败');
        return false;
    }
};

const handleAddUpdate = async (fields: BUDGETDETAIL_AHModel) => {
    const hide = message.loading('正在提交...');

    const result = await updatebudgetdetail_ah(fields);
    hide();
    if (result.Result_Code !== 100) {
        message.error(`${result.Result_Desc}` || `${result.Result_Code}:提交失败`);
        return false;
    }
    return result.Result_Data ? result.Result_Data : true;
};

const BUDGETDETAIL_AHTable: React.FC<{ currentUser: CurrentUser | undefined,currentRowParent?: any}> = (props) => {
    const { currentUser,currentRowParent } = props
    const actionRef = useRef<ActionType>();
    const formRef = useRef<FormInstance>();
    const [currentRow, setCurrentRow] = useState<BUDGETDETAIL_AHModel>();
    const [showDetail, setShowDetail] = useState<boolean>();
    const [modalVisible, handleModalVisible] = useState<boolean>();
    const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
    const [searchParams, setSearchParams] = useState<any>();
    // 悬浮框内的表格数据
    const [modalTableData,setModalTableData] = useState<any>([])
    const [budgeType,setBudgeType] = useState<number>(0)
    // 科目代码枚举解析
    const { data: account_codeTree } = useRequest(async () => {
      const data = await getFieldEnumTree({ FieldExplainField: 'ACCOUNT_CODE', sessionName: 'ACCOUNT_CODE' })
      return data
    })
    // 数据状态（0：删除；1：有效）枚举解析
    const { data: isvalidTree = [] } = useRequest(async () => {
        return await getFieldEnumTree({ FieldExplainField: 'ISVALID', sessionName: 'ISVALID' })
    })
    // 定义列表字段内容
    const columns: ProColumns<BUDGETDETAIL_AHModel>[] = [
        {
            title: '查询条件',
            dataIndex: 'searchKey',
            hideInTable: true,
            hideInDescriptions: true,
            fieldProps: {
                placeholder: "请输入备注说明"
            }
        },
        {
            dataIndex: 'ACCOUNT_CODE',
            title: '科目代码',
            valueType: 'treeSelect',
            align: 'center',
            hideInDescriptions: true,
            // request: async () => {
            //   return await getFieldEnumTree({ FieldExplainField: 'ACCOUNT_CODE', sessionName: 'ACCOUNT_CODE' });
            // },
            render: (_, record) => {
                return <a onClick={() => { // 点击科目代码时 打开抽屉 展示详情
                    setCurrentRow(record);
                    setShowDetail(true);
                }}>{
                    getFieldEnumName("ACCOUNT_CODE",record?.ACCOUNT_CODE)
                }</a>
            },
        },
        {
            dataIndex: 'STATISTICS_MONTH',
            title: '统计月份',
            align: 'center',
            hideInSearch: true,
            render:(_, record)=>{
              return <a>{record.STATISTICS_MONTH}</a>
            }
        },
        {
            dataIndex: 'BUDGETDETAIL_AMOUNT',
            title: '预算金额',
            valueType: 'money',
            align: 'center',
            hideInSearch: true,
        },
        {
            dataIndex: 'REVENUE_AMOUNT',
            title: '实际营收额',
            align: 'center',
            hideInSearch: true,
        },
        {
            dataIndex: 'UPDATE_TIME',
            title: '更新日期',
            valueType: 'date',
            align: 'center',
            hideInSearch: true,
            hideInTable: true,
        },
        // {
        //     dataIndex: 'BUDGETDETAIL_AH_STATE',
        //     title: '数据状态',
        //     valueType: 'select',
        //     align: 'center',
        //     // request: async () => {
        //     //     return await getFieldEnumTree({ FieldExplainField: 'ISVALID', sessionName: 'ISVALID' });
        //     // },
        // },
        {
            dataIndex: 'STAFF_NAME',
            title: '操作人员',
            hideInSearch: true,
            hideInTable: true,
        },
        {
            dataIndex: 'OPERATE_DATE',
            title: '操作时间',
            valueType: 'fromNow',
            hideInSearch: true,
            hideInTable: true,
        },
        {
            dataIndex: 'BUDGETDETAIL_AH_DESC',
            title: '备注说明',
            align: 'center',
            hideInSearch: true,
        },
        {
            title: '查询月份',
            dataIndex: 'search_months',
            valueType: 'dateRange',
            hideInTable: true,
            hideInDescriptions: true,
            search: {
                transform: (value) => {
                    return {
                        // format中的格式决定入参内容
                        STATISTICS_MONTH_Start: moment(value[0]).startOf("month").format('YYYY-MM-DD'),
                        STATISTICS_MONTH_End: moment(value[1]).endOf("month").format('YYYY-MM-DD'),
                    };
                },
            },
            fieldProps: {
                picker: "month",
                format: 'YYYY-MM',
},
            initialValue: [moment().add(-1, 'day').format('YYYY-MM'), moment().add(-1, 'day').format('YYYY-MM')],
        },
        {
            dataIndex: 'option',
            title: '操作',
            valueType: 'option',
            hideInSearch: true,
            render: (_, record) => {
                return (
                    <Space>
                        <a
                            onClick={() => {
                              console.log('record222',record)
                              const value = {...record}
                              if (record.STATISTICS_MONTH % 100 >13){
                                value.BUDGETTPE=3
                                setBudgeType(3)
                              }else if(record.STATISTICS_MONTH % 100 <13){
                                value.BUDGETTPE=1
                                setBudgeType(1)
                              }else{
                                value.BUDGETTPE=2
                                setBudgeType(2)
                              }
                                if (value.BUDGETTPE===1){
                                  value.STATISTICS_MONTH = moment(value.STATISTICS_MONTH.toString()).format('YYYY-MM')
                                }else{
                                  value.month =  value.STATISTICS_MONTH
                                  value.STATISTICS_MONTH = undefined
                                }
                                setCurrentRow({ ...value });
                                handleModalVisible(true);
                            }}
                        >
                            编辑
                        </a>
                        <Popconfirm
                            title="确认删除该安徽财务预算明细表列表信息吗?"
                            onConfirm={async () => {
                                const sucesse = await handelDelete(record.BUDGETDETAIL_AH_ID);
                                if (sucesse && actionRef.current) {
                                    actionRef.current.reload();
                                }
                            }}
                        >
                            <a>删除</a>
                        </Popconfirm>
                    </Space>
                );
            },
        },
    ];
    const modalColumns: ProColumns<any>[] = [
        {
            title: '查询条件',
            dataIndex: 'searchKey',
            hideInTable: true,
            hideInDescriptions: true,
            fieldProps: {
                placeholder: "请输入备注说明"
            }
        },
        {
            dataIndex: 'ACCOUNT_CODE',
            title: '科目名称',
            valueType: 'treeSelect',
            align: 'center',
            hideInDescriptions: true,
            // request: async () => {
            //   return await getFieldEnumTree({ FieldExplainField: 'ACCOUNT_CODE', sessionName: 'ACCOUNT_CODE' });
            // },
            render: (_, record) => {
                return <a onClick={() => { // 点击科目代码时 打开抽屉 展示详情
                    setCurrentRow(record);
                    setShowDetail(true);
                }}>{
                    getFieldEnumName("ACCOUNT_CODE",record?.ACCOUNT_CODE)
                }</a>
            },
        },
        {
            dataIndex: 'STATISTICS_MONTH',
            title: '统计月份',
            align: 'center',
            hideInSearch: true,
            render:(_, record)=>{
              return <a>{record.STATISTICS_MONTH}</a>
            }
        },
        {
            dataIndex: 'BUDGETDETAIL_AMOUNT',
            title: '预算金额',
            valueType: 'money',
            align: 'center',
            hideInSearch: true,
        },
        {
            dataIndex: 'REVENUE_AMOUNT',
            title: '实际营收额',
            align: 'center',
            hideInSearch: true,
        },
        {
            dataIndex: 'UPDATE_TIME',
            title: '更新日期',
            valueType: 'date',
            align: 'center',
            hideInSearch: true,
            hideInTable: true,
        },
        // {
        //     dataIndex: 'BUDGETDETAIL_AH_STATE',
        //     title: '数据状态',
        //     valueType: 'select',
        //     align: 'center',
        //     // request: async () => {
        //     //     return await getFieldEnumTree({ FieldExplainField: 'ISVALID', sessionName: 'ISVALID' });
        //     // },
        // },
        {
            dataIndex: 'STAFF_NAME',
            title: '操作人员',
            hideInSearch: true,
            hideInTable: true,
        },
        {
            dataIndex: 'OPERATE_DATE',
            title: '操作时间',
            valueType: 'fromNow',
            hideInSearch: true,
            hideInTable: true,
        },
        {
            dataIndex: 'BUDGETDETAIL_AH_DESC',
            title: '备注说明',
            align: 'center',
            hideInSearch: true,
        },
        {
            title: '查询月份',
            dataIndex: 'search_months',
            valueType: 'dateRange',
            hideInTable: true,
            hideInDescriptions: true,
            search: {
                transform: (value) => {
                    return {
                        // format中的格式决定入参内容
                        STATISTICS_MONTH_Start: moment(value[0]).startOf("month").format('YYYY-MM-DD'),
                        STATISTICS_MONTH_End: moment(value[1]).endOf("month").format('YYYY-MM-DD'),
                    };
                },
            },
            fieldProps: {
                picker: "month",
                format: 'YYYY-MM',
},
            initialValue: [moment().add(-1, 'day').format('YYYY-MM'), moment().add(-1, 'day').format('YYYY-MM')],
        },
        {
            dataIndex: 'option',
            title: '操作',
            valueType: 'option',
            hideInSearch: true,
            render: (_, record) => {
                return (
                    <Space>
                        <Popconfirm
                            title="确认删除?"
                            onConfirm={async () => {
                              const list: any = JSON.parse(JSON.stringify(modalTableData))
                              if (list && list.length>0){
                                const newList: any = []
                                list.forEach((item: any)=>{
                                  if (item.key!==record.key){
                                    newList.push(item)
                                  }
                                })
                                newList.forEach((item: any,index: number)=>{
                                  item.key = index + 1
                                })
                                setModalTableData(newList)
                              }
                            }}
                        >
                            <a>删除</a>
                        </Popconfirm>
                    </Space>
                );
            },
        },
    ];
    return (
        <PageContainer header={{
            title: '',
            breadcrumb: { }
        }}>
            <ProTable<BUDGETDETAIL_AHModel>
                style={{height:'calc(100vh - 135px)',background:'#fff'}}
                scroll={{y:'calc(100vh - 410px)'}}
                rowKey={(record) => {
                    return `${record?.BUDGETDETAIL_AH_ID}`
                }}
                formRef={formRef}
                headerTitle="安徽财务预算明细表列表" // 列表表头
                actionRef={actionRef}
                search={{ span: 6, labelWidth: 'auto' }}
                // 请求数据
                request={async (params, sorter) => {
                    // 排序字段
                    const sortstr = Object.keys(sorter).map(n => {
                        const value = sorter[n]
                        return value ? `${n} ${value.replace('end', '')}` : ''
                    })
                    const searchWholeParams = {
                        searchParameter: {
                            BUDGETPROJECT_AH_ID:props.currentRowParent.BUDGETPROJECT_AH_ID,
                          BUDGETDETAIL_AH_STATE:1
                        },
                        keyWord: params.searchKey ? { key: "BUDGETDETAIL_AH_DESC", value: params.searchKey } : null, // 关键词查询
                        sortstr: sortstr.length ? sortstr.toString() : "",
                        BUDGETPROJECT_AH_ID:params.BUDGETPROJECT_AH_ID,
                        pagesize: 999999
                    }
                    setSearchParams(searchWholeParams)
                        // searchWholeParams.pagesize = params.pageSize
                    const data = await handleDetailTableList(searchWholeParams);
                    return data;
                }}
                columns={columns}
                toolbar={{
                    actions: [
                        // 新增按钮
                        <Button
                            key="new"
                            icon={<PlusOutlined />}
                            type="primary"
                            onClick={() => {
                                handleModalVisible(true);
                            }}
                        >
                            安徽财务预算明细表
                        </Button>,
                    ],
                }}
                options={false} // 隐藏刷新组件
                pagination={{ defaultPageSize: 10 }}
            />


            <Drawer
                width={600}
                visible={showDetail}
                onClose={() => {
                    setCurrentRow(undefined);
                    setShowDetail(false);
                }}
                closable={false}
            >
                {currentRow?.BUDGETDETAIL_AH_ID && (
                    <ProDescriptions<BUDGETDETAIL_AHModel>
                        column={2}
                        // title={getFieldEnumName("ACCOUNT_CODE",currentRow?.ACCOUNT_CODE)}
                        request={async () => ({
                            data: currentRow || {},
                        })}
                        params={{
                            id: currentRow?.BUDGETDETAIL_AH_ID,
                        }}
                        columns={columns as ProDescriptionsItemProps<BUDGETDETAIL_AHModel>[]}
                    />
                )}
            </Drawer>


            <Modal
                title={currentRow ? '更新安徽财务预算明细表' : '新建安徽财务预算明细表'}
                destroyOnClose={true}
                width={900}
                open={modalVisible}
                confirmLoading={confirmLoading}
                afterClose={() => {
                    formRef.current?.resetFields();
                    setCurrentRow(undefined);
                  setBudgeType(1)
                }}
                onCancel={() => {
                  handleConfirmLoading(false)
                  handleModalVisible(false)
                  setModalTableData([])
                }}
                onOk={async () => { // 提交框内的数据
                  if (currentRow){
                    formRef?.current?.validateFields().then(async (res)=>{
                      console.log('res.BUDGETTPE',res.BUDGETTPE)
                      console.log('currentRow',currentRow)
                      const newValue = [{ ...res,
                        BUDGETDETAIL_AH_ID: currentRow.BUDGETDETAIL_AH_ID,
                        STATISTICS_MONTH: res.BUDGETTPE!==1?currentRow.month:res.STATISTICS_MONTH
                      }];
                      console.log('newValue',newValue)
                      const data = await handleSaveList(newValue);
                      console.log('data',data)
                      if (data.Result_Code===100){
                        message.success(data.Result_Desc)
                        actionRef.current?.reload()
                        handleConfirmLoading(false)
                        handleModalVisible(false)
                        setModalTableData([])
                      }else{
                        message.error(data.Result_Desc)
                      }
                    })
                  }else{
                    if (modalTableData && modalTableData.length>0){
                      const list: any = JSON.parse(JSON.stringify(modalTableData))
                      list.forEach((item: any)=>{
                        if (item.BUDGETTPE===1){
                          item.STATISTICS_MONTH = moment(item.STATISTICS_MONTH).format('YYYYMM')
                        }
                        item.BUDGETPROJECT_AH_ID = props.currentRowParent.BUDGETPROJECT_AH_ID
                      })
                      const data = await handleSaveList(list)
                      console.log('data231231232',data)
                      if (data.Result_Code===100){
                        message.success(data.Result_Desc)
                        actionRef.current?.reload()
                        handleConfirmLoading(false)
                        handleModalVisible(false)
                        setModalTableData([])
                      }else{
                        message.error(data.Result_Desc)
                      }
                    }else{
                      message.error('请先添加数据')
                    }
                  }
                }}
            >
                <ProForm<BUDGETDETAIL_AHModel>
                    layout={'horizontal'}
                    wrapperCol={{ span: 16 }} // 表单项 填写部分所占的栅格数
                    labelCol={{ span: 6 }} // 表单项 标题所占的栅格数
                    formRef={formRef}
                    autoFocusFirstInput
                    submitter={false}
                    preserve={false}
                    initialValues={currentRow}
                >
                    <Row>
                        <Col span={12}>
                            <Form.Item
                                name="ACCOUNT_CODE"
                                label="科目代码"
                            >
                                <TreeSelect
                                    placeholder="请选择科目代码"
                                    dropdownStyle={{ maxHeight: 300, overflow: 'auto' }}
                                    treeData={account_codeTree}
                                    allowClear
                                />
                            </Form.Item>
                        </Col>
                        <Col span={12}>
                            <ProFormDatePicker.Month
                                name="STATISTICS_MONTH"
                                label="统计月份"
                                width="lg"
                                disabled={budgeType===2||budgeType===3}
                                placeholder="请选择统计月份"
                                rules={[
                                    {
                                        required: !(budgeType===2||budgeType===3),
                                        message: '请选择统计月份',
                                    },
                                ]}
                            />
                        </Col>
                        <Col span={12}>
                            <ProFormRadio.Group
                                name="BUDGETTPE"
                                label="预算类型"
                                disabled={currentRow}
                                options={[{label: '月份',value:1},{label: '全年',value:2},{label: '调整',value:3}]}
                                initialValue={1}
                                fieldProps={{
                                  onChange:(val)=>{
                                    console.log('val',val)
                                    setBudgeType(val.target.value)
                                    if (val.target.value ===2 || val.target.value===3){
                                      formRef.current?.setFieldsValue({STATISTICS_MONTH:undefined})
                                      formRef.current?.setFieldsValue({REVENUE_AMOUNT:''})
                                    }
                                  }
                                }}
                                rules={[
                                  {
                                    required: true,
                                    message: '请选择预算类型',
                                  },
                                ]}
                            />
                        </Col>
                        <Col span={12}>
                            <ProFormMoney
                                width="lg"
                                fieldProps={{
                                    moneySymbol: false,
                                }}
                                name="BUDGETDETAIL_AMOUNT"
                                label="预算金额"
                                placeholder="请输入预算金额"
                                rules={[
                                    {
                                        required: true,
                                        message: '请输入预算金额',
                                    },
                                ]}
                            />
                        </Col>
                        <Col span={12}>
                            <ProFormMoney
                                width="lg"
                                fieldProps={{
                                    moneySymbol: false,
                                }}
                                name="REVENUE_AMOUNT"
                                label="实际营收额"
                                disabled={budgeType===2||budgeType===3}
                                placeholder="请输入实际营收额"
                                rules={[
                                    {
                                        required: !(budgeType===2||budgeType===3),
                                        message: '请输入实际营收额',
                                    },
                                ]}
                            />
                        </Col>
                        <Col span={12}>
                            <ProFormDatePicker
                                name="UPDATE_TIME"
                                label="更新日期"
                                width="lg"
                                readonly
                            />
                        </Col>
                        <Col span={12}>
                            <Form.Item
                                name="BUDGETDETAIL_AH_STATE"
                                label="数据状态"
                            >
                                <TreeSelect
                                    placeholder="请选择数据状态"
                                    dropdownStyle={{ maxHeight: 300, overflow: 'auto' }}
                                    treeData={isvalidTree}
                                    allowClear
                                />
                            </Form.Item>
                        </Col>
                        <Col span={12}>
                            <ProFormText
                                name="STAFF_NAME"
                                label="操作人员"
                                readonly
                            />
                        </Col>
                        <Col span={12}>
                            <ProFormDatePicker
                                name="OPERATE_DATE"
                                label="操作时间"
                                width="lg"
                                readonly
                            />
                        </Col>
                        <Col span={24}>
                            <ProFormTextArea
                                name="BUDGETDETAIL_AH_DESC"
                                label="备注说明"
                                labelCol={{ span: 3 }}
                                wrapperCol={{ span: 20 }}
                                placeholder="请输入备注说明"
                                // rules={[
                                //     {
                                //         required: true,
                                //         message: '请输入备注说明',
                                //     },
                                // ]}
                            />
                        </Col>
                        <Col style={{ display: 'none' }}>
                            <ProFormText
                                name="BUDGETDETAIL_AH_ID"
                                label="安徽财务预算明细表内码"
                            />
                        </Col>
                        <Col style={{ display: 'none' }}>
                            <ProFormText
                                name="BUDGETPROJECT_AH_ID"
                                label="安徽财务预算表内码"
                            />
                        </Col>
                        <Col style={{ display: 'none' }}>
                            <ProFormText
                                name="ACCOUNT_PCODE"
                                label="父级科目代码"
                            />
                        </Col>
                        <Col style={{ display: 'none' }}>
                            <ProFormText
                                name="STAFF_ID"
                                label="操作人内码"
                            />
                        </Col>
                    </Row>
                  {
                    currentRow?
                      '':
                      <>
                        <div style={{width:'100%',display:'flex',justifyContent:'flex-end'}}>
                          <Button type={'primary'} onClick={()=>{
                            formRef.current?.validateFields().then(res=>{
                              console.log('res',res)
                              const list: any = JSON.parse(JSON.stringify(modalTableData))
                              if (res?.BUDGETTPE===2){
                                res.STATISTICS_MONTH = `${moment(res.STATISTICS_MONTH).format('YYYY')}13`
                              }else if(res?.BUDGETTPE===3){
                                res.STATISTICS_MONTH = null
                              }
                              if (list && list.length>0){
                                if (res.BUDGETTPE===1){
                                  const filter = list.filter(item=>moment(item.STATISTICS_MONTH).format('YYYY-MM')===moment(res.STATISTICS_MONTH).format('YYYY-MM') && res.ACCOUNT_CODE===item.ACCOUNT_CODE)
                                  if(filter && filter.length>0){
                                    message.error('已存在相同月份或相同月份的科目代码，请检查')
                                  }else{
                                    list.push(res)
                                  }
                                }else if (res.BUDGETTPE===2){
                                  const filter = list.filter(item=>item.BUDGETTPE===res.BUDGETTPE && res.ACCOUNT_CODE===item.ACCOUNT_CODE)
                                  if(filter && filter.length>0){
                                    message.error('该预算类型相同科目代码只能存在一个，请检查')
                                  }else{
                                    list.push(res)
                                  }
                                }else if (res.BUDGETTPE===3){
                                  const filter = list.filter(item=>item.BUDGETTPE===res.BUDGETTPE && res.ACCOUNT_CODE===item.ACCOUNT_CODE)
                                  if(filter && filter.length>0){
                                    message.error('该预算类型相同科目代码只能存在一个，请检查')
                                  }else{
                                    list.push(res)
                                  }
                                }
                              }else{
                                list.push(res)
                              }
                              list.forEach((item: any,index: number)=>{
                                item.key = index + 1
                                if (item.BUDGETTPE===1){
                                  item.STATISTICS_MONTH = moment(item.STATISTICS_MONTH).format('YYYYMM')
                                }
                                item.BUDGETDETAIL_AH_STATE = 1
                              })
                              console.log('list',list)
                              setModalTableData(list)
                            })
                          }}>添加</Button>
                        </div>
                        <ProTable
                          columns={modalColumns}
                          dataSource={modalTableData}
                          search={false}
                          options={false}
                        >

                        </ProTable>
                      </>
                  }
                </ProForm>
            </Modal>
        </PageContainer>
    );
};
export default connect(({ user }: ConnectState) => ({
    currentUser: user.currentUser
}))(BUDGETDETAIL_AHTable);
