Commit 7579513c authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

bobo nyenyak

See merge request !488
parents ef94db22 7d662834
......@@ -102,18 +102,18 @@ export default class FixedAssetsMovement extends Component {
item.level,
item.description,
item.fixed_asset_movement.total_actual_before === null ? "0" : item.fixed_asset_movement.total_actual_before === "" ? "0" : item.fixed_asset_movement.total_actual_before,
item.fixed_asset_movement.january,
item.fixed_asset_movement.february,
item.fixed_asset_movement.march,
item.fixed_asset_movement.april,
item.fixed_asset_movement.may,
item.fixed_asset_movement.june,
item.fixed_asset_movement.july,
item.fixed_asset_movement.august,
item.fixed_asset_movement.september,
item.fixed_asset_movement.october,
item.fixed_asset_movement.november,
item.fixed_asset_movement.december,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.january, formula: item.fixed_asset_movement.january_formula} : item.fixed_asset_movement.january,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.february, formula: item.fixed_asset_movement.february_formula} : item.fixed_asset_movement.february,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.march, formula: item.fixed_asset_movement.march_formula} : item.fixed_asset_movement.march,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.april, formula: item.fixed_asset_movement.april_formula} : item.fixed_asset_movement.april,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.may, formula: item.fixed_asset_movement.may_formula} : item.fixed_asset_movement.may,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.june, formula: item.fixed_asset_movement.june_formula} : item.fixed_asset_movement.june,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.july, formula: item.fixed_asset_movement.july_formula} : item.fixed_asset_movement.july,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.august, formula: item.fixed_asset_movement.august_formula} : item.fixed_asset_movement.august,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.september, formula: item.fixed_asset_movement.september_formula} : item.fixed_asset_movement.september,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.october, formula: item.fixed_asset_movement.october_formula} : item.fixed_asset_movement.october,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.november, formula: item.fixed_asset_movement.november_formula} : item.fixed_asset_movement.november,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.december, formula: item.fixed_asset_movement.december_formula} : item.fixed_asset_movement.december,
item.fixed_asset_movement.total_current_year,
item.fixed_asset_movement.total_next_year,
item.fixed_asset_movement.total_more_year,
......@@ -137,18 +137,18 @@ export default class FixedAssetsMovement extends Component {
item.level,
item.description,
item.fixed_asset_movement.total_actual_before === null ? "0" : item.fixed_asset_movement.total_actual_before === "" ? "0" : item.fixed_asset_movement.total_actual_before,
item.fixed_asset_movement.january,
item.fixed_asset_movement.february,
item.fixed_asset_movement.march,
item.fixed_asset_movement.april,
item.fixed_asset_movement.may,
item.fixed_asset_movement.june,
item.fixed_asset_movement.july,
item.fixed_asset_movement.august,
item.fixed_asset_movement.september,
item.fixed_asset_movement.october,
item.fixed_asset_movement.november,
item.fixed_asset_movement.december,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.january, formula: item.fixed_asset_movement.january_formula} : item.fixed_asset_movement.january,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.february, formula: item.fixed_asset_movement.february_formula} : item.fixed_asset_movement.february,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.march, formula: item.fixed_asset_movement.march_formula} : item.fixed_asset_movement.march,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.april, formula: item.fixed_asset_movement.april_formula} : item.fixed_asset_movement.april,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.may, formula: item.fixed_asset_movement.may_formula} : item.fixed_asset_movement.may,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.june, formula: item.fixed_asset_movement.june_formula} : item.fixed_asset_movement.june,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.july, formula: item.fixed_asset_movement.july_formula} : item.fixed_asset_movement.july,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.august, formula: item.fixed_asset_movement.august_formula} : item.fixed_asset_movement.august,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.september, formula: item.fixed_asset_movement.september_formula} : item.fixed_asset_movement.september,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.october, formula: item.fixed_asset_movement.october_formula} : item.fixed_asset_movement.october,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.november, formula: item.fixed_asset_movement.november_formula} : item.fixed_asset_movement.november,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.fixed_asset_movement.december, formula: item.fixed_asset_movement.december_formula} : item.fixed_asset_movement.december,
item.fixed_asset_movement.total_current_year,
item.fixed_asset_movement.total_next_year,
item.fixed_asset_movement.total_more_year,
......@@ -458,6 +458,101 @@ export default class FixedAssetsMovement extends Component {
render() {
let dataTable2 = this.state.dataTable
const handleValueFormula = (value, tableMeta) => {
let splitFormula = String(tableMeta.rowData[3]).split('@')
let baru = []
let anjay = []
splitFormula.map((item,index) => {
let items = String(item).substr(Number(String(item).length) -1, 1)
let re = /^[a-zA-Z0-9_]+$/;
let asd = ''
if (item !== "") {
if (!re.test(items)) {
baru.push(String(item).substr(0, Number(String(item).length) -1))
baru.push(String(item).substr(Number(String(item).length) -1, 1))
} else {
baru.push(String(item))
}
}
})
// console.log(baru)
baru.map((item,index) => {
if (item == '-' || item == '+' || item == '/' || item == '*') {
anjay.push(item)
} else {
if (String(item).includes('#')) {
if (String(item).includes('[M-1]')) {
let tst = String(item).replace('[M-1]', '')
let indexID = tableMeta.rowData[18].formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == Number(this.props.periode)-1)
// console.log(indexID)
if (indexID !== -1) {
let valuezz = tableMeta.rowData[18].formula[indexID].value
// baru.push(valuezz)
anjay.push(valuezz)
// console.log(valuezz)
}
} else {
let indexID = value.formula.findIndex((val) => val.item_formula == String(`@${item}`))
// console.log(indexID)
if (indexID !== -1) {
// console.log(value.formula[indexID].value)
let valuezz = value.formula[indexID].value
anjay.push(valuezz)
}
}
} else {
// console.log(item)
let indexID = dataTable2.findIndex((val) => val[22] == item)
// console.log(dataTable2[indexID][tableMeta.columnIndex])
if (indexID !== -1) {
let valuezz = dataTable2[indexID][tableMeta.columnIndex].value == undefined? dataTable2[indexID][tableMeta.columnIndex] : dataTable2[indexID][tableMeta.columnIndex].value
anjay.push(valuezz)
}
}
}
})
let total = 0
let opt = ""
anjay.map((item, index) => {
if (item == "+") {
opt = "tambah"
} else if (item == "-") {
opt = "kurang"
} else if (item == "*") {
opt = "kali"
} else if (item == "/") {
opt = "bagi"
} else {
if (opt == "tambah") {
total = Number(total) + Number(item)
} else if (opt == "kurang") {
total = Number(total) - Number(item)
} else if (opt == "kali") {
total = Number(total) * Number(item)
} else if (opt == "bagi") {
total = Number(total) / Number(item) == NaN? 0 : Number(total) / Number(item)
} else {
total += Number(item)
}
}
})
// console.log(tableMeta.rowData[5])
// console.log(baru)
// console.log(anjay)
// console.log(total)
// console.log(splitFormula)
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = total
}
return total
}
const handleChange = (value, tableMeta, type) => {
let val = String(value).split(",").join("")
if (type === "actual") {
......@@ -744,7 +839,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -758,7 +853,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 1)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -833,7 +928,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -847,7 +942,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 2)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -922,7 +1017,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -936,7 +1031,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 3)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1011,7 +1106,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1025,7 +1120,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 4)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1100,7 +1195,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1114,7 +1209,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 5)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1189,7 +1284,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1203,7 +1298,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 6)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1278,7 +1373,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1292,7 +1387,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 7)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1367,7 +1462,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1381,7 +1476,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 8)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1456,7 +1551,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1470,7 +1565,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 9)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1545,7 +1640,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1559,7 +1654,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 10)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1634,7 +1729,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1648,7 +1743,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 11)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1723,7 +1818,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
/>
</span>
:
......
......@@ -108,6 +108,27 @@ export default class OperatingIndicator extends Component {
if (response.data) {
if (response.data.status === 'success') {
let data = response.data.data
let compActive = []
let userCompActive = []
this.state.userCompany.map((item, index) => {
let indeks = data.findIndex((val) => val.company_id == item)
if (indeks !== -1 && String(data[indeks].status).toLocaleLowerCase() == 'active'){
userCompActive.push(item)
}
})
data.map(( item, index ) => {
if (String(item.status).toLocaleLowerCase() == 'active') {
compActive.push(item)
}
})
if (compActive.length == userCompActive.length){
this.setState({ superUser: false})
} else {
this.setState({ superUser: true})
}
let companyData = data.map((item) => {
return {
company_id: item.company_id,
......@@ -501,7 +522,7 @@ export default class OperatingIndicator extends Component {
})}
getReport={() => this.getReport()}
saveOperatingInd={this.saveOperatingInd.bind(this)}
superUser={this.state.superUser}
/>
}
......
......@@ -1244,7 +1244,7 @@ export default class BalanceSheet extends Component {
</div>
<div style={{ width: '50%' }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template">
{this.props.superUser && <a data-tip={'Download Template'} data-for="template">
<button
style={{
backgroundColor: 'transparent',
......@@ -1256,9 +1256,9 @@ export default class BalanceSheet extends Component {
>
<img src={Images.template} />
</button>
</a>
</a>}
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload'} data-for="upload">
{this.props.superUser && <a data-tip={'Upload'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
......@@ -1270,7 +1270,7 @@ export default class BalanceSheet extends Component {
>
<img src={Images.upload} />
</button>
</a>
</a>}
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Download'} data-for="download">
<button
......@@ -1323,7 +1323,7 @@ export default class BalanceSheet extends Component {
</div>
</button>
</div>
{!this.state.emptyData && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
{!this.state.emptyData && this.props.superUser && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
type="button"
onClick={() =>
......
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