import { RodtepReportReq } from '@gtpl/shared-models/finance';
import { CollectionsService, PurchasesProductService } from '@gtpl/shared-services/finance';
import { Button, Card, Col, DatePicker, Form, Input, Row, Select, Table, Typography } from 'antd';
import {  UndoOutlined,DownloadOutlined,SearchOutlined } from '@ant-design/icons';
import { useForm } from 'antd/lib/form/Form';
import moment, { Moment } from 'moment';
import React, { useEffect, useRef, useState } from 'react';
import { Excel } from 'antd-table-saveas-excel';
import { getMetadataStorage } from 'class-validator';
import Highlighter from 'react-highlight-words';
import {PortOfEntryCodes} from 'libs/shared-models/sale-management/src/lib/sale-order/port-of-entries-input'

const RodtepReport = () => {

    const service = new CollectionsService();
    const [data, setData] = useState([]);
    const {RangePicker}= DatePicker;
    const[form] = useForm()
    const { Text } = Typography;
    const purchaseService = new PurchasesProductService()
    const [factoriesData, setFactoriesData] = useState([]);
    const [unitCodes,setUnitCodes]=useState([])
    const role = JSON.parse(localStorage.getItem('role')) 
    const {Option}=Select;
    const [searchText, setSearchText] = useState('');
    const [searchedColumn, setSearchedColumn] = useState('');
    const searchInput = useRef(null);


    useEffect(() => {
        form.setFieldsValue({ date: defaultFinancialYear });
        getRodtepReport();
      }, []);

      useEffect(()=>{
        getAllUnits();
        getAllCompanyNames()
    },[])


      const getAllCompanyNames = () => {
        purchaseService.getAllCompanys().then((res) => {
            if (res.status) {
                setFactoriesData(res.data)
            }
        })
    }

    const getAllUnits = () => {
      purchaseService.getAllUnits().then((res) => {
          if (res.status) {
              setUnitCodes(res.data)
          }
      })
  }



    const getRodtepReport = () => {
        const req =new RodtepReportReq()
        // console.log(req,"reqqqqqqqqqqqqqqqq")
        if(form.getFieldValue('date')!= undefined){
      req.fromDate = moment(form.getFieldValue('date')[0]).format('YYYY-MM-DD')
      // console.log(req.fromDate,"444444444444")
      req.toDate = moment(form.getFieldValue('date')[1]).format('YYYY-MM-DD')
      // console.log(req.toDate,"777777777777777")
    }
    if (form.getFieldValue('company') !== undefined) {
      req.company = form.getFieldValue('company')
    }
    if (form.getFieldValue('unitId') !== undefined) {
      req.unitId = form.getFieldValue('unitId')
    }
    const loggedInRole = JSON.parse(localStorage.getItem('role'));
    const loggedInUnitId = Number(localStorage.getItem('unit_id'));

    if (loggedInRole !== 'SUPERADMIN') {
      req.unitId = loggedInUnitId // Convert number to string
  }
        service.getRodtepReport(req).then((res) => {
          // console.log(res,"ressssssssssssssssssssssssss")
          if (res.status) {
            setData(res.data);
          }else{
            setData([])
          }
        });
      };

      const search =() =>{
        getRodtepReport()
      }

      const resetHandler =() =>{
        form.resetFields()
        getRodtepReport()
      }

      function handleSearch(selectedKeys, confirm, dataIndex) {
        confirm();
        setSearchText(selectedKeys[0]);
        setSearchedColumn(dataIndex);
    };
    function handleReset(clearFilters) {
        clearFilters();
        setSearchText('');
    };
    const getColumnSearchProps = (dataIndex: string) => ({
        filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters }) => (
            <div style={{ padding: 8 }}>
                <Input
                    ref={searchInput}
                    placeholder={`Search ${dataIndex}`}
                    value={selectedKeys[0]}
                    onChange={e => setSelectedKeys(e.target.value ? [e.target.value] : [])}
                    onPressEnter={() => handleSearch(selectedKeys, confirm, dataIndex)}
                    style={{ width: 188, marginBottom: 8, display: 'block' }}
                />
                <Button
                    type="primary"
                    onClick={() => handleSearch(selectedKeys, confirm, dataIndex)}
                    icon={<SearchOutlined />}
                    size="small"
                    style={{ width: 90, marginRight: 8 }}
                >
                    Search
                </Button>
                <Button onClick={() => handleReset(clearFilters)} size="small" style={{ width: 90 }}>
                    Reset
                </Button>
            </div>
        ),
        filterIcon: filtered => (
            <SearchOutlined type="search" style={{ color: filtered ? '#1890ff' : undefined }} />
        ),
        onFilter: (value, record) =>
            record[dataIndex]
                ? record[dataIndex]
                    .toString()
                    .toLowerCase()
                    .includes(value.toLowerCase())
                : false,
        onFilterDropdownVisibleChange: visible => {
            if (visible) { setTimeout(() => searchInput.current.select()); }
        },
        render: text =>
            text ? (
                searchedColumn === dataIndex ? (
                    <Highlighter
                        highlightStyle={{ backgroundColor: '#ffc069', padding: 0 }}
                        searchWords={[searchText]}
                        autoEscape
                        textToHighlight={text.toString()}
                    />
                ) : text
            ) : null
    });

      const getDefaultFinancialYear = (): [Moment, Moment] => {
        const currentYear = moment().year();
        const startOfFinancialYear = moment(`04-01-${currentYear}`, 'MM-DD-YYYY');
        const endOfFinancialYear = startOfFinancialYear.clone().add(1, 'year').subtract(1, 'day');
        return [startOfFinancialYear, endOfFinancialYear];
      };
    
      const defaultFinancialYear = getDefaultFinancialYear();

      const currentYear = moment().year();
      const startOfFinancialYear = moment(`04-01-${currentYear}`, 'MM-DD-YYYY');
      let endOfFinancialYear = startOfFinancialYear.clone().add(1, 'year').subtract(1, 'day');
      if (moment().isAfter(endOfFinancialYear)) {
        endOfFinancialYear = endOfFinancialYear.clone().add(1, 'year');
      }
      const financialYear = `${startOfFinancialYear.format('YYYY')}-${endOfFinancialYear.format('YYYY')}`;

      // const getPortName = (portOfLoading) => {
      //   console.log(portOfLoading,"port of loading id")
      //   const port = PortOfEntryCodes.find((item) => item.value === portOfLoading);
      //   console.log(port,"portttttt")
      //   console.log(port.name,"portnameeeeeeeeeeee")
      //   return port ? port.name : '-';
      // };

      const getPortName = (portOfLoading) => {
        const port = PortOfEntryCodes.find((item) => item.value === Number(portOfLoading));
        return port ? port.name : '-';
      };

  const columns :any= [
    {
      title: 'S.No',
      render: (text, object, index) => (index == data.length ? null : index + 1),
      width:"20px"
    },
    {
      title: "Company",
      dataIndex: "company",
      sorter: (a, b) => a.company?.localeCompare(b.company),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps('company')

  },
    {
      title: 'Invoice No',
      dataIndex: 'invNum',
      render: (text, record) => record.invNum ?  record.invNum: "-",

      width:"40px",
      sorter: (a, b) => a.invNum?.localeCompare(b.invNum),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps('invNum')
    },
    {
      title: 'Shipping Bill No',
      dataIndex: 'shippingNum',
      render: (text, record) => record.shippingNum ? record.shippingNum: "-",

      width:"60px",
      sorter: (a, b) => a.shippingNum?.localeCompare(b.shippingNum),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps('shippingNum')
    },
    {
      title: 'Shipping Bill Date',
      dataIndex: 'shippingDate',
      render: (text) => {
        if (!text) return '-';
        const date = new Date(text);
        if (isNaN(date.getTime())) return '-';
        const day = String(date.getDate()).padStart(2, '0');
        const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are zero-based
        const year = date.getFullYear();
        return `${day}-${month}-${year}`;
      },
      width:"60px"
    },
    {
      title: 'Leo Date',
      dataIndex: 'leoDate',
      render: (text, record) => record.leoDate  ? record.leoDate: "-",

      width:"40px"
    },
    {
      title: 'BRC REL Date as per SB',
      dataIndex: 'brcRelDate',
      render: (text, record) => record.brcRelDate  ? record.brcRelDate: "-",

      width:"1500px"
    },
    {
      title: 'Net Weight',
      dataIndex: 'netWeight',
      render: (text, record) =>
        record.netWeight ? (
          <div style={{ textAlign: 'right' }}>{(record.netWeight).toFixed(2)}</div>
        ) : (
          "-"
        ),
      width: "50px",
      sorter: (a, b) => a.netWeight?.localeCompare(b.netWeight),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps('netWeight'),
    },
    {
      title: 'INV value USD',
      align:'left',
      dataIndex: 'totalAmount',
      render: (text, record) =>{
        console.log(typeof(record.totalAmount))
        return(
          <span>{Number(parseFloat(record.totalAmount)).toLocaleString()}</span>
        ) },
      width: "50px",
      sorter: (a, b) => a.totalAmount?.localeCompare(b.totalAmount),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps('totalAmount'),
    },
    {
      title: 'BRC Value',
      dataIndex: 'brcValue',
      render: (text, record) =>
        record.brcValue ? (
          <div style={{ textAlign: 'right' }}>{Number(record.brcValue).toLocaleString()}</div>
        ) : (
          "-"
        ),
      width: "50px",
      sorter: (a, b) => a.brcValue?.localeCompare(b.brcValue),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps('brcValue'),
    },
    // {
    //   title: 'Difference',
    //   dataIndex: 'difference',
    //   render: (text, record) => (
    //     <div style={{ textAlign: 'right' }}>{Number(record.totalAmount - record.brcValue).toLocaleString()}</div>
    //   ),
    //   width: "50px",
    // },
    {
      title: 'FOB Value',
      dataIndex: 'fobValue',
      render: (text, record) => (
        <div style={{ textAlign: 'right' }}>{Number(record.totalAmount - record.freightCharges).toLocaleString()}</div>
      ),
      width: "50px",
    },
    {
      title: 'Buyer Name',
      dataIndex: 'buyerName',
      render: (text, record) => record.buyerName? record.buyerName : "-",

      width:"50px",
      sorter: (a, b) => a.buyerName?.localeCompare(b.buyerName),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps('buyerName')
    },
    {
      title: 'Total Amount',
      dataIndex: 'totalAmount',
      render: (text, record) =>{
        console.log(typeof(record.totalAmount));
        
        return(
        record.totalAmount ? (
          <div style={{ textAlign: 'right' }}>{Number(record.totalAmount).toLocaleString()}</div>
        ) : (
          "-"
        ))},
      width: "50px",
      sorter: (a, b) => a.totalAmount?.localeCompare(b.totalAmount),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps('totalAmount'),
    },
    {
      title: 'Received',
      dataIndex: 'received',
      render: (text, record) => record.rodtepStatus === 'sold' ? record.totalAmount : 0,
      width:"50px"
    },
    {
      title: 'To Be Received',
      dataIndex: 'toBeReceived',
      render: (text, record) => {
        if (record.rodtepStatus === 'sold') {
          return record.totalAmount - record.totalAmount;
        } else {
          return record.totalAmount;
        }
      },
      width:"50px"
    },
    {
      title: 'Final Amount',
      dataIndex: 'finalAmount',
      render: (text, record) => {
        const received = record.rodtepStatus === 'sold' ? Number(record.totalAmount) : 0;
        const toBeReceived = record.rodtepStatus === 'sold' ? 0 : Number(record.totalAmount);
        return (received + toBeReceived).toFixed(2); // toFixed(2) ensures two decimal places
      },
      width: "50px"
    },
    
    {
      title: 'CHA',
      dataIndex: 'cha',
      render: (text, record) => record.cha?record.cha: "-",
      sorter: (a, b) => a.cha?.localeCompare(b.cha),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps('cha'),
      width:"50px"
    },
    {
      title: 'License No',
      dataIndex: 'liscenceNo',
      render: (text, record) => record.liscenceNo ? record.liscenceNo: "-",

      width:"50px"
    },
    {
      title: 'License Date',
      dataIndex: 'liscenceDate',
      render: (text, record) => record.liscenceDate ? moment(record.liscenceDate).format('DD-MM-YYYY') : "-",
      width:"50px"
    },
    {
      title: 'Port Code', 
      dataIndex: 'portCode',
      render: (text, record) => getPortName(record.portOfLoading),  
      width:"50px",
      // sorter: (a, b) => a.totalAmount?.localeCompare(b.totalAmount),
      // sortDirections: ['descend', 'ascend'],
      // ...getColumnSearchProps('totalAmount')
    },
    {
      title: 'BRC Status',
      dataIndex: 'brcNum',
      render: (text, record) => record.brcNum?  record.brcNum: "-",

      width:"50px",
      sorter: (a, b) => a.totalAmount?.localeCompare(b.totalAmount),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps('totalAmount')
    },
    {
      title: 'BRC Date',
      dataIndex: 'brcDate',
      render: (text, record) => record.brcDate ? moment(record.brcDate).format('YYYY-MM-DD') : "-",
      width:"50px"
    },
    {
      title: 'Amount as Per Ice Gate',
      dataIndex: 'amountAsPerIceGate',
      render: (text, record) => record.amountAsPerIceGate ? record.amountAsPerIceGate: "-",

      width:"70px"
    },
    {
      title: 'Difference',
      dataIndex: 'totalAmount',
      render: (text, record) => {
        const received = record.rodtepStatus === 'sold' ? record.totalAmount : 0;
        const toBeReceived = record.rodtepStatus === 'sold' ? 0 : record.totalAmount;
        const finalAmount = received + toBeReceived;
        return Number(Number(record.totalAmount) - Number(record.brcValue)).toFixed(2)
      },
      width:"70px"
    },
    {
      title: 'Result',
      dataIndex: 'rodtepStatus',
      width:"50px"
    },
    {
      title: 'SOLD/HOLD',
      dataIndex: 'soldHold',
      render: (text, record) => record.rodtepStatus === 'SOLD' ? "Sold": "Hold",
      width:"50px",
    },
    {
      title: 'IRM Number',
      dataIndex: 'irmNum',
      render: (text, record) => record.irmNum ?record.irmNum : "-",

      width:"50px"
    },
  ];


  const exportedData =[];
  const execlData =  data
  let x = 1;
  const excelDataReport = [
    { title: 'S No', dataIndex: 'sNo', width: 100, height: 40, render: (text, object, index) => { return x++; } },
    { title: 'Invoice No', dataIndex: 'invNum', width: 150, height: 40,    render: (text, record) => { return record.invNum ?  record.invNum: "-"}  },
    { title: 'Shipping Bill No', dataIndex: 'shippingNum', width: 100, height: 40, render: (text, record) => record.shippingNum ? record.shippingNum: "-",    },
    { title: 'Shipping Bill Date', dataIndex: 'shippingDate', width: 150, height: 40,       render: (text) => {
      if (!text) return '-';
      const date = new Date(text);
      if (isNaN(date.getTime())) return '-';
      const day = String(date.getDate()).padStart(2, '0');
      const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are zero-based
      const year = date.getFullYear();
      return `${day}-${month}-${year}`;
    } },
    { title: 'Leo Date', dataIndex: 'leoDate', width: 150, height: 40,      render: (text, record) => { return record.leoDate  ? record.leoDate: "-"}   },
    { title: 'BRC REL Date as per SB', dataIndex: 'brcRelDate', width: 200, height: 40,      render: (text, record) => { return record.brcRelDate  ? record.brcRelDate: "-" }   },
    { title: 'Net Weight', dataIndex: 'netWeight', width: 150, height: 40,       render: (text, record) => { return record.netWeight  ? record.netWeight: "-"  } },
    { title: 'INV value USD', dataIndex: 'totalAmount', width: 150, height: 40,       render: (text, record) => { return record.totalAmount  ? record.totalAmount: "-"}  },
    { title: 'BRC Value', dataIndex: 'brcValue', width: 100, height: 40,      render: (text, record) => { return record.brcValue  ?  record.brcValue : "-" }   },
    { title: 'Difference', dataIndex: 'difference', width: 100, height: 40,       render: (text, record) => { return   Number(Number(record.totalAmount) - Number(record.brcValue)).toFixed(2)
}    },
    { title: 'FOB Value', dataIndex: 'fobValue', width: 100, height: 40,       render: (text, record) =>{  return record.fobValue ? record.fobValue: "-"}    },
    { title: 'Buyer Name', dataIndex: 'buyerName', width: 100, height: 40,       render: (text, record) => { return record.buyerName? record.buyerName : "-"}    },
    { title: 'Total Amount%', dataIndex: 'totalAmount', width: 100, height: 40,       render: (text, record) => { return record.totalAmount? record.totalAmount: "-" }   },
    { title: 'Received', dataIndex: 'received', width: 100, height: 40,       render: (text, record) => { return record.rodtepStatus === 'sold' ? record.totalAmount : "0"}    },
    { title: 'To Be Received', dataIndex: 'toBeReceived', width: 100, height: 40,    render: (text, record) => {
      if (record.rodtepStatus === 'sold') {
        return record.totalAmount - record.totalAmount;
      } else {
        return record.totalAmount;
      }
    } },
    { title: 'Final Amount', dataIndex: 'finalAmount', width: 100, height: 40,   render: (text, record) => {
      const received = record.rodtepStatus === 'sold' ? record.totalAmount : 0;
      const toBeReceived = record.rodtepStatus === 'sold' ? 0 : record.totalAmount;
      return received + toBeReceived;
    } },
    { title: 'CHA', dataIndex: 'cha', width: 100, height: 40,      render: (text, record) => { return record.cha?record.cha: "-" }   },
    { title: 'License No', dataIndex: 'liscenceNo', width: 100, height: 40,       render: (text, record) => { return record.liscenceNo ? record.liscenceNo: "-"}    },
    { title: 'License Date', dataIndex: 'licenseDate', width: 100, height: 40,      render: (text, record) => { return record.licenseDate? record.licenseDate: "-" }   },
    { title: 'Port Code', dataIndex: 'portCode', width: 100, height: 40,       render: (text, record) => { return record.portCode ? record.portCode: "-"}    },
    { title: 'BRC Status', dataIndex: 'brcNum', width: 100, height: 40,       render: (text, record) => { return record.brcNum?  record.brcNum: "-" }   },
    { title: 'BRC Date', dataIndex: 'brcDate', width: 100, height: 40,      render: (text, record) => { return record.brcDate ? moment(record.brcDate).format('YYYY-MM-DD') : "-" }   },
    { title: 'Amount as Per Ice Gate', dataIndex: 'amountAsPerIceGate', width: 100, height: 40,      render: (text, record) => { return record.amountAsPerIceGate ? record.amountAsPerIceGate: "-" }   },
    { title: 'Difference', dataIndex: 'totalAmount', width: 100, height: 40,       render: (text, record) => {
      const received = record.rodtepStatus === 'sold' ? record.totalAmount : 0;
      const toBeReceived = record.rodtepStatus === 'sold' ? 0 : record.totalAmount;
      const finalAmount = received + toBeReceived;
        return Number(Number(record.totalAmount) - Number(record.brcValue)).toFixed(2)
    }},
    { title: 'Result', dataIndex: 'rodtepStatus', width: 100, height: 40, render: (text, record) => { return record.rodtepStatus ? record.rodtepStatus : '-' } },
    { title: 'SOLD/HOLD', dataIndex: 'soldHold', width: 100, height: 40,       render: (text, record) => { return record.rodtepStatus === 'sold' ? "Sold": "Hold" }   },
    { title: 'IRM Number', dataIndex: 'irmNum', width: 100, height: 40,       render: (text, record) => { return record.irmNum ?record.irmNum : "-"}    },


];

  const exportExcel = () => {
    const excel = new Excel();
    excel
      .addSheet('rodtep-report')
      .addColumns(excelDataReport)
      .addDataSource(data, { str2num: true })
      .saveAs('rodtep.xlsx');
  }



  return (
    <div>
      <Card
      size='small'
      title={<span style={{ color: 'white' }}>RODTEP Report</span>}
      style={{ textAlign: 'center' }}
      headStyle={{ backgroundColor: '#69c0ff', border: 0 }}
      extra={
        <div>
          <Button icon={<DownloadOutlined />} onClick={() => { exportExcel(); }} style={{marginRight:30}}>
            Get Excel
          </Button></div>}
      >
         <div style={{ textAlign: 'center' }}>
      <h2 style={{ fontWeight: 'bold' }}>BMRIPL RODTEP Details For The Period {financialYear}</h2>
    </div>
    <br />
        <Form form={form} layout='vertical' onFinish={search}>
      <Row gutter={24}>
        <Col xs={{ span: 24 }} sm={{ span: 24 }} md={{ span: 10 }} lg={{ span: 8 }} xl={{ span: 6 }}>
          <Form.Item label='Date' name='date' initialValue={getDefaultFinancialYear()}>
            <RangePicker defaultValue={getDefaultFinancialYear()} />
          </Form.Item>
        </Col>
        <Col xs={{ span: 24 }} sm={{ span: 24 }} md={{ span: 5 }} lg={{ span: 5 }} xl={{ span: 5 }}>
                        <Form.Item name="company" label="Company" >
             
                   
                            <Select
                                placeholder="Select Company"
                                showSearch
                                optionFilterProp="children"
                                filterOption={(input, option) => option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                                allowClear

                            >
                                {factoriesData.map(dropData => {
                                    return <Option value={dropData.unitCodeId}>{dropData.company}</Option>
                                })}
                            </Select>
                        </Form.Item>
                    </Col>
                    <Col xs={{ span: 24 }} sm={{ span: 24 }} md={{ span: 5 }} lg={{ span: 5 }} xl={{ span: 5 }}>
                        <Form.Item name="unitId" label="Unit"
                        //  rules={[{ required: true, message: 'Missing Unit' }]}
                         >
                            <Select
                                placeholder="Select Unit"
                                showSearch
                                optionFilterProp="children"
                                filterOption={(input, option) => option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                                allowClear
                                disabled={Number(localStorage.getItem('unit_id')) != 5 ? true : false}
                                defaultValue={role == 'SUPERADMIN' ? 'all' : Number(localStorage.getItem('unit_id'))}
                            >
                                {unitCodes.map(dropData => {
                                    return <Option value={dropData.unitCodeId}>{dropData.plantCode}</Option>
                                })}
                            </Select>
                        </Form.Item>
                    </Col>
                    <Col style={{ paddingLeft: '10px', marginTop: '30px' }}>          
                    <Form.Item>
            <Button type='primary' htmlType='submit'>Get Report</Button>
          </Form.Item>
        </Col>
        <Col style={{ paddingLeft: '10px', marginTop: '30px' }}>          
        <Form.Item>
            <Button
              onClick={resetHandler}
              type="primary"
            >
              Reset
            </Button>
          </Form.Item>
        </Col>
      </Row>
        </Form>
        <Table columns={columns} dataSource={data} scroll={{x:true}} 
         summary={(pageData) => {
          let totalNetWeight = 0;
          let totalInvValueInUsd = 0
          let totFobValue = 0
          let totAmount=0
          let totIceGate=0
          console.log(pageData,'oooooooooo');
          
          pageData.forEach((e) => {
            console.log(e.total,'summaryyyyyyyyy');
            
            totalNetWeight += Number(e.netWeight);
            totalInvValueInUsd += Number(e.totalAmount);
            totFobValue += Number(e.totalAmount - e.freightCharges);
            totAmount+=Number(e.totalAmount);
            totIceGate+=Number(e.amountAsPerIceGate)
  
          });
  
          return (
            <>
              <Table.Summary.Row className='tableFooter' >
                
                <Table.Summary.Cell index={1}><Text style={{ textAlign: 'end' }}>Total</Text></Table.Summary.Cell>
                <Table.Summary.Cell index={2} ><Text ></Text></Table.Summary.Cell>
                <Table.Summary.Cell index={3} ><Text ></Text></Table.Summary.Cell>
                <Table.Summary.Cell index={4} ><Text ></Text></Table.Summary.Cell>
                <Table.Summary.Cell index={5} ><Text ></Text></Table.Summary.Cell>
                <Table.Summary.Cell index={6} ><Text ></Text></Table.Summary.Cell>
                <Table.Summary.Cell index={6} ><Text ></Text></Table.Summary.Cell>
                <Table.Summary.Cell index={7}><Text style={{ textAlign: 'center' }}>{totalNetWeight}</Text></Table.Summary.Cell>
                <Table.Summary.Cell index={8}><Text style={{ textAlign: 'end' }}>{totalInvValueInUsd}</Text></Table.Summary.Cell>
                <Table.Summary.Cell index={6} ><Text ></Text></Table.Summary.Cell>
                <Table.Summary.Cell index={6} ><Text ></Text></Table.Summary.Cell>
                <Table.Summary.Cell index={8}><Text style={{ textAlign: 'end' }}>{totFobValue}</Text></Table.Summary.Cell>
                <Table.Summary.Cell index={6} ><Text ></Text></Table.Summary.Cell>
                <Table.Summary.Cell index={8}><Text style={{ textAlign: 'end' }}>{totAmount}</Text></Table.Summary.Cell>
                <Table.Summary.Cell index={6} ><Text ></Text></Table.Summary.Cell>
                <Table.Summary.Cell index={6} ><Text ></Text></Table.Summary.Cell>
                <Table.Summary.Cell index={6} ><Text ></Text></Table.Summary.Cell>
                <Table.Summary.Cell index={6} ><Text ></Text></Table.Summary.Cell>
                <Table.Summary.Cell index={6} ><Text ></Text></Table.Summary.Cell>
                <Table.Summary.Cell index={6} ><Text ></Text></Table.Summary.Cell>
                <Table.Summary.Cell index={6} ><Text ></Text></Table.Summary.Cell>
                <Table.Summary.Cell index={6} ><Text ></Text></Table.Summary.Cell>
                <Table.Summary.Cell index={6} ><Text ></Text></Table.Summary.Cell>
                <Table.Summary.Cell index={8}><Text style={{ textAlign: 'end' }}>{totIceGate}</Text></Table.Summary.Cell>

                {/* <Table.Summary.Cell index={9}><Text style={{ textAlign: 'end' }}>{totAmt}</Text></Table.Summary.Cell> */}
              </Table.Summary.Row>
            </>
          );
        }
        }/>
      </Card>
    </div>
  );
};

export default RodtepReport;
