Commit 0bbfcc0b authored by EKSAD's avatar EKSAD

apdet

parent e3a4a5ed
......@@ -63,7 +63,7 @@ export default class ProfitLoss extends Component {
componentDidMount() {
this.getItemHierarki()
this.getLatestUpdate()
// // console.log(this.props);
// console.log(this.props);
}
getLatestUpdate() {
......@@ -95,7 +95,7 @@ export default class ProfitLoss extends Component {
"submission_id": this.props.submissionID
}
api.create().getDetailReportMB(payload).then(response => {
// // console.log(response);
// console.log(response);
let dataTable = []
this.setState({ visibleProfitLoss: true })
if (response.data) {
......@@ -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 }, () => {
// console.log(dataTable)
})
......@@ -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 a = this.state.dataTable[data.rowIndex][data.columnIndex] = total
// // console.log(indexParent);
// console.log(indexParent);
return a
}
......@@ -202,7 +202,7 @@ export default class ProfitLoss extends Component {
let data = this.state.dataTable
let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2])
if (indexParent > 0) {
// // console.log(indexParent)
// console.log(indexParent)
let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
let jagain = data[indexParent][tableMeta.columnIndex]
a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
......@@ -243,7 +243,7 @@ export default class ProfitLoss extends Component {
"status": type,
"profit_loss": data
}
// // console.log(data);
// console.log(data);
this.setState({ loading: false })
this.props.saveToMasterBudget(payload)
this.props.onClickClose()
......@@ -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}`
)
res = await res.blob()
// // console.log(res)
// console.log(res)
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
......@@ -267,13 +267,13 @@ export default class ProfitLoss extends Component {
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
// // console.log(resp)
// console.log(resp)
if (err) {
// // console.log(err);
// console.log(err);
}
else {
let isi = resp.rows.slice(3)
// // console.log(resp.rows[2]);
// console.log(resp.rows[2]);
let payload = []
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
isi.map((i, index) => {
......@@ -307,7 +307,7 @@ export default class ProfitLoss extends Component {
report_id: this.props.report_id,
profit_loss: payload
}
// // console.log(body)
// console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
}
});
......@@ -315,8 +315,8 @@ export default class ProfitLoss extends Component {
checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => {
// // console.log(JSON.stringify(this.state.payload));
// // console.log(response)
// console.log(JSON.stringify(this.state.payload));
// console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleProfitLoss: false, loading: true })
......@@ -352,11 +352,11 @@ export default class ProfitLoss extends Component {
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.state.dataTable.map(item => {
if (item[24].length > 0) {
// // console.log('masuk')
// console.log('masuk')
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 {
profit_loss: data,
status: type
}
// // console.log(data);
// console.log(data);
api.create('UPLOAD').uploadMasterBudget(body).then(response => {
// // console.log(response);
// console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.props.onClickClose()
......@@ -417,7 +417,7 @@ export default class ProfitLoss extends Component {
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 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(
this.props.submissionID == null ? sub_null : url
)
......@@ -434,7 +434,7 @@ export default class ProfitLoss extends Component {
handleValidate() {
let data = []
// // console.log(this.state.dataTable)
// console.log(this.state.dataTable)
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
......@@ -465,9 +465,9 @@ export default class ProfitLoss extends Component {
"profit_loss": data,
"status": "submitted"
}
// // console.log(payload)
// console.log(payload)
api.create().validateSubmitReport(payload).then((response) => {
// // console.log(response)
// console.log(response)
if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: false })
} else {
......@@ -489,7 +489,7 @@ export default class ProfitLoss extends Component {
} else {
// let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[tableMeta.rowIndex][2])
// if (indexParent > 0) {
// // // // console.log(indexParent)
// console.log(indexParent)
// let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
// let jagain = dataTable2[indexParent][tableMeta.columnIndex]
// a = dataTable2[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (Number(jagain) + Number(val))
......@@ -520,12 +520,12 @@ export default class ProfitLoss extends Component {
dataTable2[tableMeta.rowIndex][20] = total
return total
}
// // console.log(total);
// console.log(total);
}
const handleNotes = (value, tableMeta) => {
// // console.log(value)
// console.log(value)
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
// // console.log(dataTable2[tableMeta.rowIndex]);
// console.log(dataTable2[tableMeta.rowIndex]);
}
const handleValue = (data) => {
let total = 0
......@@ -536,7 +536,7 @@ export default class ProfitLoss extends Component {
})
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
// // console.log(indexParent);
// console.log(indexParent);
return a
}
const handleFormula = (data, tableMeta, month) => {
......@@ -702,7 +702,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleNotes(event.target.value, tableMeta)
// // console.log(dataTable2)
// console.log(dataTable2)
}}
/>
}
......@@ -776,7 +776,7 @@ export default class ProfitLoss extends Component {
value={Number(value).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// console.log(dataTable2)
}}
/>
}
......@@ -866,7 +866,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// console.log(dataTable2)
}}
/>
}
......@@ -956,7 +956,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// console.log(dataTable2)
}}
/>
}
......@@ -1046,7 +1046,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// console.log(dataTable2)
}}
/>
}
......@@ -1136,7 +1136,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// console.log(dataTable2)
}}
/>
}
......@@ -1226,7 +1226,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// console.log(dataTable2)
}}
/>
}
......@@ -1316,7 +1316,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// console.log(dataTable2)
}}
/>
}
......@@ -1406,7 +1406,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// console.log(dataTable2)
}}
/>
}
......@@ -1496,7 +1496,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// console.log(dataTable2)
}}
/>
}
......@@ -1586,7 +1586,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// console.log(dataTable2)
}}
/>
}
......@@ -1676,7 +1676,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// console.log(dataTable2)
}}
/>
}
......@@ -1766,7 +1766,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// console.log(dataTable2)
}}
/>
}
......@@ -1903,7 +1903,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// console.log(dataTable2)
}}
/>
}
......@@ -1993,7 +1993,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// console.log(dataTable2)
}}
/>
}
......
......@@ -31,6 +31,12 @@ const style2 = {
zIndex: 100,
top: 0
};
const stylenotes = {
position: "sticky",
background: "white",
zIndex: 101,
left: 350
};
export default class ProfitLossMR extends Component {
constructor(props) {
......@@ -60,14 +66,21 @@ export default class ProfitLossMR extends Component {
}
},
{
name: "Keterangan",
name: "Notes",
options: {
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>
</TableCell>
),
setCellProps: () => ({ style2 }),
setCellProps: () => ({
style: {
position: "sticky",
background: "white",
zIndex: 101,
left: 350
}
}),
customBodyRender: (val, tableMeta) => {
return (
<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