Commit 0bbfcc0b authored by EKSAD's avatar EKSAD

apdet

parent e3a4a5ed
...@@ -63,7 +63,7 @@ export default class ProfitLoss extends Component { ...@@ -63,7 +63,7 @@ export default class ProfitLoss extends Component {
componentDidMount() { componentDidMount() {
this.getItemHierarki() this.getItemHierarki()
this.getLatestUpdate() this.getLatestUpdate()
// // console.log(this.props); // console.log(this.props);
} }
getLatestUpdate() { getLatestUpdate() {
...@@ -95,7 +95,7 @@ export default class ProfitLoss extends Component { ...@@ -95,7 +95,7 @@ export default class ProfitLoss extends Component {
"submission_id": this.props.submissionID "submission_id": this.props.submissionID
} }
api.create().getDetailReportMB(payload).then(response => { api.create().getDetailReportMB(payload).then(response => {
// // console.log(response); // console.log(response);
let dataTable = [] let dataTable = []
this.setState({ visibleProfitLoss: true }) this.setState({ visibleProfitLoss: true })
if (response.data) { if (response.data) {
...@@ -173,7 +173,7 @@ export default class ProfitLoss extends Component { ...@@ -173,7 +173,7 @@ export default class ProfitLoss extends Component {
} }
} }
}) })
// // console.log(dataTable) console.log(dataTable)
this.setState({ dataTable, loading: false, buttonError: true, editable: true }, () => { this.setState({ dataTable, loading: false, buttonError: true, editable: true }, () => {
// console.log(dataTable) // console.log(dataTable)
}) })
...@@ -193,7 +193,7 @@ export default class ProfitLoss extends Component { ...@@ -193,7 +193,7 @@ export default class ProfitLoss extends Component {
}) })
let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2]) let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2])
let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total
// // console.log(indexParent); // console.log(indexParent);
return a return a
} }
...@@ -202,7 +202,7 @@ export default class ProfitLoss extends Component { ...@@ -202,7 +202,7 @@ export default class ProfitLoss extends Component {
let data = this.state.dataTable let data = this.state.dataTable
let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2]) let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2])
if (indexParent > 0) { if (indexParent > 0) {
// // console.log(indexParent) // console.log(indexParent)
let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
let jagain = data[indexParent][tableMeta.columnIndex] let jagain = data[indexParent][tableMeta.columnIndex]
a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val)) a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
...@@ -243,7 +243,7 @@ export default class ProfitLoss extends Component { ...@@ -243,7 +243,7 @@ export default class ProfitLoss extends Component {
"status": type, "status": type,
"profit_loss": data "profit_loss": data
} }
// // console.log(data); // console.log(data);
this.setState({ loading: false }) this.setState({ loading: false })
this.props.saveToMasterBudget(payload) this.props.saveToMasterBudget(payload)
this.props.onClickClose() this.props.onClickClose()
...@@ -254,7 +254,7 @@ export default class ProfitLoss extends Component { ...@@ -254,7 +254,7 @@ export default class ProfitLoss extends Component {
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}` `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
) )
res = await res.blob() res = await res.blob()
// // console.log(res) // console.log(res)
if (res.size > 0) { if (res.size > 0) {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
let a = document.createElement('a'); let a = document.createElement('a');
...@@ -267,13 +267,13 @@ export default class ProfitLoss extends Component { ...@@ -267,13 +267,13 @@ export default class ProfitLoss extends Component {
fileHandler = (event) => { fileHandler = (event) => {
let fileObj = event let fileObj = event
ExcelRenderer(fileObj, (err, resp) => { ExcelRenderer(fileObj, (err, resp) => {
// // console.log(resp) // console.log(resp)
if (err) { if (err) {
// // console.log(err); // console.log(err);
} }
else { else {
let isi = resp.rows.slice(3) let isi = resp.rows.slice(3)
// // console.log(resp.rows[2]); // console.log(resp.rows[2]);
let payload = [] let payload = []
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/; let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
isi.map((i, index) => { isi.map((i, index) => {
...@@ -307,7 +307,7 @@ export default class ProfitLoss extends Component { ...@@ -307,7 +307,7 @@ export default class ProfitLoss extends Component {
report_id: this.props.report_id, report_id: this.props.report_id,
profit_loss: payload profit_loss: payload
} }
// // console.log(body) // console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] }) this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
} }
}); });
...@@ -315,8 +315,8 @@ export default class ProfitLoss extends Component { ...@@ -315,8 +315,8 @@ export default class ProfitLoss extends Component {
checkUpload() { checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => { api.create().checkUploadMB(this.state.payload).then(response => {
// // console.log(JSON.stringify(this.state.payload)); // console.log(JSON.stringify(this.state.payload));
// // console.log(response) // console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleProfitLoss: false, loading: true }) this.setState({ visibleUpload: false, visibleProfitLoss: false, loading: true })
...@@ -352,11 +352,11 @@ export default class ProfitLoss extends Component { ...@@ -352,11 +352,11 @@ export default class ProfitLoss extends Component {
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[24].length > 0) { if (item[24].length > 0) {
// // console.log('masuk') // console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true }) this.setState({ buttonError: true, errorPreview: true, editable: true })
} }
}) })
// // console.log(this.state.buttonError) // console.log(this.state.buttonError)
}) })
} }
} }
...@@ -395,9 +395,9 @@ export default class ProfitLoss extends Component { ...@@ -395,9 +395,9 @@ export default class ProfitLoss extends Component {
profit_loss: data, profit_loss: data,
status: type status: type
} }
// // console.log(data); // console.log(data);
api.create('UPLOAD').uploadMasterBudget(body).then(response => { api.create('UPLOAD').uploadMasterBudget(body).then(response => {
// // console.log(response); // console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.props.onClickClose() this.props.onClickClose()
...@@ -417,7 +417,7 @@ export default class ProfitLoss extends Component { ...@@ -417,7 +417,7 @@ export default class ProfitLoss extends Component {
async downloadAllData() { async downloadAllData() {
let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}` let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
let sub_null = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}` let sub_null = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
// // console.log(url); // console.log(url);
let res = await fetch( let res = await fetch(
this.props.submissionID == null ? sub_null : url this.props.submissionID == null ? sub_null : url
) )
...@@ -434,7 +434,7 @@ export default class ProfitLoss extends Component { ...@@ -434,7 +434,7 @@ export default class ProfitLoss extends Component {
handleValidate() { handleValidate() {
let data = [] let data = []
// // console.log(this.state.dataTable) // console.log(this.state.dataTable)
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
data.push({ data.push({
item_report_id: i[1], item_report_id: i[1],
...@@ -465,9 +465,9 @@ export default class ProfitLoss extends Component { ...@@ -465,9 +465,9 @@ export default class ProfitLoss extends Component {
"profit_loss": data, "profit_loss": data,
"status": "submitted" "status": "submitted"
} }
// // console.log(payload) // console.log(payload)
api.create().validateSubmitReport(payload).then((response) => { api.create().validateSubmitReport(payload).then((response) => {
// // console.log(response) // console.log(response)
if (response.data.data.result) { if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: false }) this.setState({ loading: false, buttonError: false, editable: false })
} else { } else {
...@@ -489,7 +489,7 @@ export default class ProfitLoss extends Component { ...@@ -489,7 +489,7 @@ export default class ProfitLoss extends Component {
} else { } else {
// let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[tableMeta.rowIndex][2]) // let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[tableMeta.rowIndex][2])
// if (indexParent > 0) { // if (indexParent > 0) {
// // // // console.log(indexParent) // console.log(indexParent)
// let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) // let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
// let jagain = dataTable2[indexParent][tableMeta.columnIndex] // let jagain = dataTable2[indexParent][tableMeta.columnIndex]
// a = dataTable2[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (Number(jagain) + Number(val)) // a = dataTable2[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (Number(jagain) + Number(val))
...@@ -520,12 +520,12 @@ export default class ProfitLoss extends Component { ...@@ -520,12 +520,12 @@ export default class ProfitLoss extends Component {
dataTable2[tableMeta.rowIndex][20] = total dataTable2[tableMeta.rowIndex][20] = total
return total return total
} }
// // console.log(total); // console.log(total);
} }
const handleNotes = (value, tableMeta) => { const handleNotes = (value, tableMeta) => {
// // console.log(value) // console.log(value)
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
// // console.log(dataTable2[tableMeta.rowIndex]); // console.log(dataTable2[tableMeta.rowIndex]);
} }
const handleValue = (data) => { const handleValue = (data) => {
let total = 0 let total = 0
...@@ -536,7 +536,7 @@ export default class ProfitLoss extends Component { ...@@ -536,7 +536,7 @@ export default class ProfitLoss extends Component {
}) })
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2]) let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total) let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
// // console.log(indexParent); // console.log(indexParent);
return a return a
} }
const handleFormula = (data, tableMeta, month) => { const handleFormula = (data, tableMeta, month) => {
...@@ -702,7 +702,7 @@ export default class ProfitLoss extends Component { ...@@ -702,7 +702,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleNotes(event.target.value, tableMeta) handleNotes(event.target.value, tableMeta)
// // console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -776,7 +776,7 @@ export default class ProfitLoss extends Component { ...@@ -776,7 +776,7 @@ export default class ProfitLoss extends Component {
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -866,7 +866,7 @@ export default class ProfitLoss extends Component { ...@@ -866,7 +866,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -956,7 +956,7 @@ export default class ProfitLoss extends Component { ...@@ -956,7 +956,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1046,7 +1046,7 @@ export default class ProfitLoss extends Component { ...@@ -1046,7 +1046,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1136,7 +1136,7 @@ export default class ProfitLoss extends Component { ...@@ -1136,7 +1136,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1226,7 +1226,7 @@ export default class ProfitLoss extends Component { ...@@ -1226,7 +1226,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1316,7 +1316,7 @@ export default class ProfitLoss extends Component { ...@@ -1316,7 +1316,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1406,7 +1406,7 @@ export default class ProfitLoss extends Component { ...@@ -1406,7 +1406,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1496,7 +1496,7 @@ export default class ProfitLoss extends Component { ...@@ -1496,7 +1496,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1586,7 +1586,7 @@ export default class ProfitLoss extends Component { ...@@ -1586,7 +1586,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1676,7 +1676,7 @@ export default class ProfitLoss extends Component { ...@@ -1676,7 +1676,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1766,7 +1766,7 @@ export default class ProfitLoss extends Component { ...@@ -1766,7 +1766,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1903,7 +1903,7 @@ export default class ProfitLoss extends Component { ...@@ -1903,7 +1903,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1993,7 +1993,7 @@ export default class ProfitLoss extends Component { ...@@ -1993,7 +1993,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
......
...@@ -31,6 +31,12 @@ const style2 = { ...@@ -31,6 +31,12 @@ const style2 = {
zIndex: 100, zIndex: 100,
top: 0 top: 0
}; };
const stylenotes = {
position: "sticky",
background: "white",
zIndex: 101,
left: 350
};
export default class ProfitLossMR extends Component { export default class ProfitLossMR extends Component {
constructor(props) { constructor(props) {
...@@ -60,14 +66,21 @@ export default class ProfitLossMR extends Component { ...@@ -60,14 +66,21 @@ export default class ProfitLossMR extends Component {
} }
}, },
{ {
name: "Keterangan", name: "Notes",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid'}}> <TableCell key={columnMeta.index} style={{ ...stylenotes, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 96, borderLeft: '1px #fff solid'}}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
setCellProps: () => ({ style2 }), setCellProps: () => ({
style: {
position: "sticky",
background: "white",
zIndex: 101,
left: 350
}
}),
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment