Commit ce1548a0 authored by Deni Rinaldi's avatar Deni Rinaldi

gajelas

parent 5b11b9d7
......@@ -104,31 +104,31 @@ export default class BalanceSheet extends Component {
item.level,
item.description,
item.uom,
item.master_budget.total_actual_before == ""? item.master_budget.total_actual_before : String(item.master_budget.total_actual_before).indexOf(".") == -1? Number(item.master_budget.total_actual_before) : Number(item.master_budget.total_actual_before).toFixed(1),
item.master_budget.january == ""? item.master_budget.january : String(item.master_budget.january).indexOf(".") == -1? Number(item.master_budget.january) : Number(item.master_budget.january).toFixed(1),
item.master_budget.february == ""? item.master_budget.february : String(item.master_budget.february).indexOf(".") == -1? Number(item.master_budget.february) : Number(item.master_budget.february).toFixed(1),
item.master_budget.march == ""? item.master_budget.march : String(item.master_budget.march).indexOf(".") == -1? Number(item.master_budget.march) : Number(item.master_budget.march).toFixed(1),
item.master_budget.april == ""? item.master_budget.april : String(item.master_budget.april).indexOf(".") == -1? Number(item.master_budget.april) : Number(item.master_budget.april).toFixed(1),
item.master_budget.may == ""? item.master_budget.may : String(item.master_budget.may).indexOf(".") == -1? Number(item.master_budget.may) : Number(item.master_budget.may).toFixed(1),
item.master_budget.june == ""? item.master_budget.june : String(item.master_budget.june).indexOf(".") == -1? Number(item.master_budget.june) : Number(item.master_budget.june).toFixed(1),
item.master_budget.july == ""? item.master_budget.july : String(item.master_budget.july).indexOf(".") == -1? Number(item.master_budget.july) : Number(item.master_budget.july).toFixed(1),
item.master_budget.august == ""? item.master_budget.august : String(item.master_budget.august).indexOf(".") == -1? Number(item.master_budget.august) : Number(item.master_budget.august).toFixed(1),
item.master_budget.september == ""? item.master_budget.september : String(item.master_budget.september).indexOf(".") == -1? Number(item.master_budget.september) : Number(item.master_budget.september).toFixed(1),
item.master_budget.october == ""? item.master_budget.october : String(item.master_budget.october).indexOf(".") == -1? Number(item.master_budget.october) : Number(item.master_budget.october).toFixed(1),
item.master_budget.november == ""? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1),
item.master_budget.december == ""? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1),
item.master_budget.total_current_year == ""? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1),
item.master_budget.total_actual_before == "" ? item.master_budget.total_actual_before : String(item.master_budget.total_actual_before).indexOf(".") == -1 ? Number(item.master_budget.total_actual_before) : Number(item.master_budget.total_actual_before).toFixed(1),
item.master_budget.january == "" ? item.master_budget.january : String(item.master_budget.january).indexOf(".") == -1 ? Number(item.master_budget.january) : Number(item.master_budget.january).toFixed(1),
item.master_budget.february == "" ? item.master_budget.february : String(item.master_budget.february).indexOf(".") == -1 ? Number(item.master_budget.february) : Number(item.master_budget.february).toFixed(1),
item.master_budget.march == "" ? item.master_budget.march : String(item.master_budget.march).indexOf(".") == -1 ? Number(item.master_budget.march) : Number(item.master_budget.march).toFixed(1),
item.master_budget.april == "" ? item.master_budget.april : String(item.master_budget.april).indexOf(".") == -1 ? Number(item.master_budget.april) : Number(item.master_budget.april).toFixed(1),
item.master_budget.may == "" ? item.master_budget.may : String(item.master_budget.may).indexOf(".") == -1 ? Number(item.master_budget.may) : Number(item.master_budget.may).toFixed(1),
item.master_budget.june == "" ? item.master_budget.june : String(item.master_budget.june).indexOf(".") == -1 ? Number(item.master_budget.june) : Number(item.master_budget.june).toFixed(1),
item.master_budget.july == "" ? item.master_budget.july : String(item.master_budget.july).indexOf(".") == -1 ? Number(item.master_budget.july) : Number(item.master_budget.july).toFixed(1),
item.master_budget.august == "" ? item.master_budget.august : String(item.master_budget.august).indexOf(".") == -1 ? Number(item.master_budget.august) : Number(item.master_budget.august).toFixed(1),
item.master_budget.september == "" ? item.master_budget.september : String(item.master_budget.september).indexOf(".") == -1 ? Number(item.master_budget.september) : Number(item.master_budget.september).toFixed(1),
item.master_budget.october == "" ? item.master_budget.october : String(item.master_budget.october).indexOf(".") == -1 ? Number(item.master_budget.october) : Number(item.master_budget.october).toFixed(1),
item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1),
item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1),
item.master_budget.total_current_year == "" ? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1 ? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1),
])
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items,indexs) => {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
}
res.map((item,index) => {
res.map((item, index) => {
dataTable.push([
item.type_report_id,
item.id,
......@@ -137,32 +137,32 @@ export default class BalanceSheet extends Component {
item.level,
item.description,
item.uom,
item.master_budget.total_actual_before == ""? item.master_budget.total_actual_before : String(item.master_budget.total_actual_before).indexOf(".") == -1? Number(item.master_budget.total_actual_before) : Number(item.master_budget.total_actual_before).toFixed(1),
item.master_budget.january == ""? item.master_budget.january : String(item.master_budget.january).indexOf(".") == -1? Number(item.master_budget.january) : Number(item.master_budget.january).toFixed(1),
item.master_budget.february == ""? item.master_budget.february : String(item.master_budget.february).indexOf(".") == -1? Number(item.master_budget.february) : Number(item.master_budget.february).toFixed(1),
item.master_budget.march == ""? item.master_budget.march : String(item.master_budget.march).indexOf(".") == -1? Number(item.master_budget.march) : Number(item.master_budget.march).toFixed(1),
item.master_budget.april == ""? item.master_budget.april : String(item.master_budget.april).indexOf(".") == -1? Number(item.master_budget.april) : Number(item.master_budget.april).toFixed(1),
item.master_budget.may == ""? item.master_budget.may : String(item.master_budget.may).indexOf(".") == -1? Number(item.master_budget.may) : Number(item.master_budget.may).toFixed(1),
item.master_budget.june == ""? item.master_budget.june : String(item.master_budget.june).indexOf(".") == -1? Number(item.master_budget.june) : Number(item.master_budget.june).toFixed(1),
item.master_budget.july == ""? item.master_budget.july : String(item.master_budget.july).indexOf(".") == -1? Number(item.master_budget.july) : Number(item.master_budget.july).toFixed(1),
item.master_budget.august == ""? item.master_budget.august : String(item.master_budget.august).indexOf(".") == -1? Number(item.master_budget.august) : Number(item.master_budget.august).toFixed(1),
item.master_budget.september == ""? item.master_budget.september : String(item.master_budget.september).indexOf(".") == -1? Number(item.master_budget.september) : Number(item.master_budget.september).toFixed(1),
item.master_budget.october == ""? item.master_budget.october : String(item.master_budget.october).indexOf(".") == -1? Number(item.master_budget.october) : Number(item.master_budget.october).toFixed(1),
item.master_budget.november == ""? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1),
item.master_budget.december == ""? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1),
item.master_budget.total_current_year == ""? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1),
item.master_budget.total_actual_before == "" ? item.master_budget.total_actual_before : String(item.master_budget.total_actual_before).indexOf(".") == -1 ? Number(item.master_budget.total_actual_before) : Number(item.master_budget.total_actual_before).toFixed(1),
item.master_budget.january == "" ? item.master_budget.january : String(item.master_budget.january).indexOf(".") == -1 ? Number(item.master_budget.january) : Number(item.master_budget.january).toFixed(1),
item.master_budget.february == "" ? item.master_budget.february : String(item.master_budget.february).indexOf(".") == -1 ? Number(item.master_budget.february) : Number(item.master_budget.february).toFixed(1),
item.master_budget.march == "" ? item.master_budget.march : String(item.master_budget.march).indexOf(".") == -1 ? Number(item.master_budget.march) : Number(item.master_budget.march).toFixed(1),
item.master_budget.april == "" ? item.master_budget.april : String(item.master_budget.april).indexOf(".") == -1 ? Number(item.master_budget.april) : Number(item.master_budget.april).toFixed(1),
item.master_budget.may == "" ? item.master_budget.may : String(item.master_budget.may).indexOf(".") == -1 ? Number(item.master_budget.may) : Number(item.master_budget.may).toFixed(1),
item.master_budget.june == "" ? item.master_budget.june : String(item.master_budget.june).indexOf(".") == -1 ? Number(item.master_budget.june) : Number(item.master_budget.june).toFixed(1),
item.master_budget.july == "" ? item.master_budget.july : String(item.master_budget.july).indexOf(".") == -1 ? Number(item.master_budget.july) : Number(item.master_budget.july).toFixed(1),
item.master_budget.august == "" ? item.master_budget.august : String(item.master_budget.august).indexOf(".") == -1 ? Number(item.master_budget.august) : Number(item.master_budget.august).toFixed(1),
item.master_budget.september == "" ? item.master_budget.september : String(item.master_budget.september).indexOf(".") == -1 ? Number(item.master_budget.september) : Number(item.master_budget.september).toFixed(1),
item.master_budget.october == "" ? item.master_budget.october : String(item.master_budget.october).indexOf(".") == -1 ? Number(item.master_budget.october) : Number(item.master_budget.october).toFixed(1),
item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1),
item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1),
item.master_budget.total_current_year == "" ? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1 ? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1),
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items,indexs) => {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
})
this.setState({dataTable, loading: false}, () => {
if(this.state.dataTable.length == 0) {
this.setState({emptyData: true})
this.setState({ dataTable, loading: false }, () => {
if (this.state.dataTable.length == 0) {
this.setState({ emptyData: true })
}
})
})
......@@ -171,7 +171,7 @@ export default class BalanceSheet extends Component {
createData(type) {
let payloadMB = []
this.state.dataTable.map((item,index) => {
this.state.dataTable.map((item, index) => {
payloadMB.push({
"item_report_id": item[1],
"total_actual_before": String(Number(item[7]).toFixed(1)),
......@@ -284,10 +284,10 @@ export default class BalanceSheet extends Component {
async downloadAllData() {
// console.log('masuk')
let bram = [this.props.data.operatingIndID,this.props.report_id,this.props.data.company.company_id,this.props.data.periode]
let bram = [this.props.data.operatingIndID, this.props.report_id, this.props.data.company.company_id, this.props.data.periode]
console.log(bram)
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/operating_indicator/export_operating_indicator?operating_indicator_id=${this.props.data.operatingIndID == null? "" : this.props.data.operatingIndID}&&report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}`
`https://tia.eksad.com/tia-reporting-dev/public/transaction/operating_indicator/export_operating_indicator?operating_indicator_id=${this.props.data.operatingIndID == null ? "" : this.props.data.operatingIndID}&&report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}`
)
res = await res.blob()
......@@ -398,7 +398,7 @@ export default class BalanceSheet extends Component {
data.push({
"item_report_id": i[1],
"item_report": String(i[5]),
"total_actual_before": String(Number(i[7] == null? "0": i[7]).toFixed(1)),
"total_actual_before": String(Number(i[7] == null ? "0" : i[7]).toFixed(1)),
"january": String(Number(i[8]).toFixed(1)),
"february": String(Number(i[9]).toFixed(1)),
"march": String(Number(i[10]).toFixed(1)),
......@@ -463,9 +463,9 @@ export default class BalanceSheet extends Component {
let val = String(value).split(",").join("")
let total = 0
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
dataTable2[tableMeta.rowIndex].map((item,index) => {
dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 8 && index <= 19) {
let valItem = item == undefined || item == ""? 0 : item
let valItem = item == undefined || item == "" ? 0 : item
total += Number(valItem)
}
})
......@@ -650,7 +650,7 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
<NumberFormat
......@@ -678,7 +678,7 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
<div style={{ flex: 1 }}>
......@@ -720,7 +720,7 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
<div style={{ flex: 1 }}>
......@@ -802,7 +802,7 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
<div style={{ flex: 1 }}>
......@@ -843,7 +843,7 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
<div style={{ flex: 1 }}>
......@@ -884,7 +884,7 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
<div style={{ flex: 1 }}>
......@@ -925,7 +925,7 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
<div style={{ flex: 1 }}>
......@@ -966,7 +966,7 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1007,7 +1007,7 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1048,7 +1048,7 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1089,7 +1089,7 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1130,7 +1130,7 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1171,7 +1171,7 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1312,8 +1312,7 @@ export default class BalanceSheet extends Component {
cursor: 'pointer',
borderColor: 'transparent',
}}
onClick={() =>
{
onClick={() => {
this.props.onClickClose()
this.props.getReport()
}
......@@ -1447,7 +1446,6 @@ export default class BalanceSheet extends Component {
<button
className="button"
type="button"
disabled={this.state.editable}
style={{
backgroundColor: 'transparent',
cursor: this.state.editable === true ? 'default' : 'pointer',
......@@ -1455,7 +1453,9 @@ export default class BalanceSheet extends Component {
outline: 'none',
marginRight: 20
}}
onClick={() => this.setState({ loading: true }, () => {
onClick={() =>
this.state.editable === true ?
null : this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadOI("draft")
}, 100);
......@@ -1467,8 +1467,10 @@ export default class BalanceSheet extends Component {
</button>
<button
type="button"
disabled={this.state.editable}
onClick={() => this.setState({ loading: true }, () => {
onClick={() =>
this.state.editable === true ?
null :
this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadOI("submitted")
}, 100);
......
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