|
|
|
@ -68,6 +68,13 @@ const Resource = ({ params }) => {
|
|
|
|
|
getDataMaterialR() |
|
|
|
|
}, [search, rowsPerPage, currentPage]) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
const cekData = dataExport || [] |
|
|
|
|
if (cekData.length > 0) { |
|
|
|
|
exportExcel() |
|
|
|
|
} |
|
|
|
|
}, [dataExport]) |
|
|
|
|
|
|
|
|
|
const getDataMaterialR = async () => { |
|
|
|
|
|
|
|
|
|
let start = 0; |
|
|
|
@ -163,6 +170,17 @@ const Resource = ({ params }) => {
|
|
|
|
|
setTypeDialog(type) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const exportExcel = () => { |
|
|
|
|
const dataExcel = dataExport || []; |
|
|
|
|
const fileName = `Data ${pageName}.xlsx`; |
|
|
|
|
const ws = XLSX.utils.json_to_sheet(dataExcel); |
|
|
|
|
const wb = XLSX.utils.book_new(); |
|
|
|
|
XLSX.utils.book_append_sheet(wb, ws, `Data ${pageName}`); |
|
|
|
|
XLSX.writeFile(wb, fileName); |
|
|
|
|
setDataExport([]) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleExportExcel = async () => { |
|
|
|
|
|
|
|
|
|
const payload = { |
|
|
|
@ -177,6 +195,7 @@ const Resource = ({ params }) => {
|
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const result = await axios |
|
|
|
|
.post(PROYEK_SEARCH, payload, HEADER) |
|
|
|
|
.then(res => res) |
|
|
|
@ -392,7 +411,7 @@ const Resource = ({ params }) => {
|
|
|
|
|
{ title: 'QTY', dataIndex: 'qty', key: 'qty', render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? text : "-"}</div>) }, |
|
|
|
|
{ title: 'UOM', dataIndex: 'uom', key: 'uom', render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? text : "-"}</div>) }, |
|
|
|
|
{ title: 'QTY Received', dataIndex: 'qty_received', key: 'qty_received', className: "nowrap", render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? text : "-"}</div>) }, |
|
|
|
|
{ title: 'Unit Price', dataIndex: 'price', key: 'price', render: (text, record) => { return renderFormatNumber(text, "Rp") }}, |
|
|
|
|
{ title: 'Unit Price', dataIndex: 'price', key: 'price', render: (text, record) => { return renderFormatNumber(text, "Rp") } }, |
|
|
|
|
{ title: 'FOM Date', dataIndex: 'fom_date', key: 'fom_date', render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{moment(text).format("D-M-YYYY")}</div>) }, |
|
|
|
|
{ title: 'PR Date', dataIndex: 'pr_date', key: 'pr_date', className: "nowrap", render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? moment(text).format("D-M-YYYY") : "-"}</div>) }, |
|
|
|
|
{ title: 'PO Date', dataIndex: 'po_date', key: 'po_date', className: "nowrap", render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? moment(text).format("D-M-YYYY") : "-"}</div>) }, |
|
|
|
|