Commit d14a5db9 authored by d.arizona's avatar d.arizona

push brw

parent 35a850b1
...@@ -288,7 +288,7 @@ export default class BalanceSheet extends Component { ...@@ -288,7 +288,7 @@ export default class BalanceSheet extends Component {
} else { } else {
data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
} }
this.forceUpdate() // this.forceUpdate()
// console.log(this.state.dataTable) // console.log(this.state.dataTable)
// this.setState({ // this.setState({
// data: a, // data: a,
...@@ -296,6 +296,32 @@ export default class BalanceSheet extends Component { ...@@ -296,6 +296,32 @@ export default class BalanceSheet extends Component {
} }
render() { render() {
let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta) => {
let val = String(value).split(",").join("")
// let data = this.state.dataTable2
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[tableMeta.rowIndex][2])
if (indexParent > 0) {
// 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)) : (jagain + Number(val))
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
}
}
const handleValue = (data) => {
let total = 0
dataTable2.map((item, index) => {
if (data.rowData[1] == item[2]) {
total = item[data.columnIndex] == undefined ? (total + 0) : (total + item[data.columnIndex])
}
})
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
let a = dataTable2[data.rowIndex][data.columnIndex] = total
// console.log(indexParent);
return a
}
const columns = [{ const columns = [{
name: "", name: "",
options: { options: {
...@@ -367,10 +393,10 @@ export default class BalanceSheet extends Component { ...@@ -367,10 +393,10 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
// this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -384,7 +410,7 @@ export default class BalanceSheet extends Component { ...@@ -384,7 +410,7 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
...@@ -423,10 +449,10 @@ export default class BalanceSheet extends Component { ...@@ -423,10 +449,10 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -440,7 +466,7 @@ export default class BalanceSheet extends Component { ...@@ -440,7 +466,7 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
...@@ -476,10 +502,10 @@ export default class BalanceSheet extends Component { ...@@ -476,10 +502,10 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -493,7 +519,7 @@ export default class BalanceSheet extends Component { ...@@ -493,7 +519,7 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
...@@ -529,10 +555,10 @@ export default class BalanceSheet extends Component { ...@@ -529,10 +555,10 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -546,7 +572,7 @@ export default class BalanceSheet extends Component { ...@@ -546,7 +572,7 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
...@@ -582,10 +608,10 @@ export default class BalanceSheet extends Component { ...@@ -582,10 +608,10 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -599,7 +625,7 @@ export default class BalanceSheet extends Component { ...@@ -599,7 +625,7 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
...@@ -635,10 +661,10 @@ export default class BalanceSheet extends Component { ...@@ -635,10 +661,10 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -652,7 +678,7 @@ export default class BalanceSheet extends Component { ...@@ -652,7 +678,7 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
...@@ -688,10 +714,10 @@ export default class BalanceSheet extends Component { ...@@ -688,10 +714,10 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -705,7 +731,7 @@ export default class BalanceSheet extends Component { ...@@ -705,7 +731,7 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
...@@ -789,7 +815,7 @@ export default class BalanceSheet extends Component { ...@@ -789,7 +815,7 @@ export default class BalanceSheet extends Component {
<div style={{ marginTop: 20, width: '100%' }}> <div style={{ marginTop: 20, width: '100%' }}>
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={this.state.dataTable} data={dataTable2}
columns={columns} columns={columns}
options={options} options={options}
/> />
......
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