Commit a54d5983 authored by qorri_di's avatar qorri_di

Merge branch 'ENV-PROD' into 'ENV-DEPLOYMENT-PROD'

Merge from Env prod

See merge request !1631
parents 750f8370 c09af89e
...@@ -11,6 +11,7 @@ import { ExcelRenderer } from 'react-excel-renderer'; ...@@ -11,6 +11,7 @@ import { ExcelRenderer } from 'react-excel-renderer';
import Constant from '../../library/Constant'; import Constant from '../../library/Constant';
import UploadFile from "../../library/Upload"; import UploadFile from "../../library/Upload";
import { Alert } from '@material-ui/lab'; import { Alert } from '@material-ui/lab';
import {fixNumber, roundMath} from "../../library/Utils";
const LightTooltip = withStyles((theme) => ({ const LightTooltip = withStyles((theme) => ({
tooltip: { tooltip: {
...@@ -94,7 +95,7 @@ export default class ProfitLossROO extends Component { ...@@ -94,7 +95,7 @@ export default class ProfitLossROO extends Component {
this.getItemHierarki() this.getItemHierarki()
this.getLatestUpdate() this.getLatestUpdate()
// this.getSettingControl() // this.getSettingControl()
this.handleViewOnly() // this.handleViewOnly()
} }
handleViewOnly() { handleViewOnly() {
...@@ -135,6 +136,7 @@ export default class ProfitLossROO extends Component { ...@@ -135,6 +136,7 @@ export default class ProfitLossROO extends Component {
// this.getLatestUpdate() // this.getLatestUpdate()
// this.getSettingControl() // this.getSettingControl()
this.getItemHierarki() this.getItemHierarki()
}) })
} }
...@@ -216,9 +218,9 @@ export default class ProfitLossROO extends Component { ...@@ -216,9 +218,9 @@ export default class ProfitLossROO extends Component {
"revision": Number(this.props.revision), "revision": Number(this.props.revision),
"rolling_outlook_id": this.props.rollingOutlookID "rolling_outlook_id": this.props.rollingOutlookID
} }
console.log(payload); console.log("getItemHierarki payload",payload);
api.create().getRollingOutlookPL(payload).then(response => { api.create().getRollingOutlookPL(payload).then(response => {
console.log(response); console.log("getItemHierarki getRollingOutlookPL",response);
let dataTable = [] let dataTable = []
let err = false let err = false
...@@ -313,7 +315,7 @@ export default class ProfitLossROO extends Component { ...@@ -313,7 +315,7 @@ export default class ProfitLossROO extends Component {
} else { } else {
this.setState({ dataTable, loading: false, buttonError: true, saveDraft: true, refresh: false }) this.setState({ dataTable, loading: false, buttonError: true, saveDraft: true, refresh: false })
} }
console.log(dataTable); console.log("getItemHierarki dataTable",dataTable);
}) })
} }
...@@ -390,10 +392,10 @@ export default class ProfitLossROO extends Component { ...@@ -390,10 +392,10 @@ export default class ProfitLossROO extends Component {
"status": type, "status": type,
"profit_loss": data "profit_loss": data
} }
console.log(payload); console.log("backToRollingOutlook payload",payload);
// console.log(JSON.stringify(payload)); // console.log(JSON.stringify(payload));
api.create('UPLOAD').createRollingOutlookPL(payload).then(response => { api.create('UPLOAD').createRollingOutlookPL(payload).then(response => {
console.log(response); console.log("backToRollingOutlook createRollingOutlookPL",response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
if (type == 'submitted') { if (type == 'submitted') {
...@@ -440,21 +442,22 @@ export default class ProfitLossROO extends Component { ...@@ -440,21 +442,22 @@ export default class ProfitLossROO extends Component {
"item_report_id": i[1] === undefined ? 0 : i[1], "item_report_id": i[1] === undefined ? 0 : i[1],
"item_report": i[2] === undefined ? "" : String(i[2]).trim(), "item_report": i[2] === undefined ? "" : String(i[2]).trim(),
"notes": i[3] === undefined ? "" : reg.test(String(i[3])) === false ? "" : String(i[3]).trim(), "notes": i[3] === undefined ? "" : reg.test(String(i[3])) === false ? "" : String(i[3]).trim(),
"january": i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(), "january": i[5] === undefined ? "0" : reg.test(String(fixNumber(Number(i[5]),1))) === false ? "0" : String(fixNumber(Number(i[5]),1)).trim(),
"february": i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(), "february": i[6] === undefined ? "0" : reg.test(String(fixNumber(Number(i[6]),1))) === false ? "0" : String(fixNumber(Number(i[6]),1)).trim(),
"march": i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(), "march": i[7] === undefined ? "0" : reg.test(String(fixNumber(Number(i[7]),1))) === false ? "0" : String(fixNumber(Number(i[7]),1)).trim(),
"april": i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(), "april": i[8] === undefined ? "0" : reg.test(String(fixNumber(Number(i[8]),1))) === false ? "0" : String(fixNumber(Number(i[8]),1)).trim(),
"may": i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(), "may": i[9] === undefined ? "0" : reg.test(String(fixNumber(Number(i[9]),1))) === false ? "0" : String(fixNumber(Number(i[9]),1)).trim(),
"june": i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(), "june": i[10] === undefined ? "0" : reg.test(String(fixNumber(Number(i[10]),1))) === false ? "0" : String(fixNumber(Number(i[10]),1)).trim(),
"july": i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(), "july": i[11] === undefined ? "0" : reg.test(String(fixNumber(Number(i[11]),1))) === false ? "0" : String(fixNumber(Number(i[11]),1)).trim(),
"august": i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(), "august": i[12] === undefined ? "0" : reg.test(String(fixNumber(Number(i[12]),1))) === false ? "0" : String(fixNumber(Number(i[12]),1)).trim(),
"september": i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(), "september": i[13] === undefined ? "0" : reg.test(String(fixNumber(Number(i[13]),1))) === false ? "0" : String(fixNumber(Number(i[13]),1)).trim(),
"october": i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(), "october": i[14] === undefined ? "0" : reg.test(String(fixNumber(Number(i[14]),1))) === false ? "0" : String(fixNumber(Number(i[14]),1)).trim(),
"november": i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(), "november": i[15] === undefined ? "0" : reg.test(String(fixNumber(Number(i[15]),1))) === false ? "0" : String(fixNumber(Number(i[15]),1)).trim(),
"december": i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(), "december": i[16] === undefined ? "0" : reg.test(String(fixNumber(Number(i[16]),1))) === false ? "0" : String(fixNumber(Number(i[16]),1)).trim(),
}) })
} }
}) })
console.log("fileHandler payload",payload)
let body = { let body = {
company_id: this.props.company.company_id, company_id: this.props.company.company_id,
periode: this.props.periode, periode: this.props.periode,
...@@ -464,7 +467,7 @@ export default class ProfitLossROO extends Component { ...@@ -464,7 +467,7 @@ export default class ProfitLossROO extends Component {
status: 'submitted', status: 'submitted',
profit_loss: payload profit_loss: payload
} }
console.log(body) console.log("fileHandler body",body)
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[0][0] }) this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[0][0] })
} }
}); });
...@@ -473,7 +476,7 @@ export default class ProfitLossROO extends Component { ...@@ -473,7 +476,7 @@ export default class ProfitLossROO extends Component {
checkUpload() { checkUpload() {
api.create().checkImportRollingOutlookPL(this.state.payload).then(response => { api.create().checkImportRollingOutlookPL(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload)); // console.log(JSON.stringify(this.state.payload));
console.log(response) console.log("checkUpload Response",response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visiblePLRO: false, loading: true }) this.setState({ visibleUpload: false, visiblePLRO: false, loading: true })
...@@ -513,7 +516,7 @@ export default class ProfitLossROO extends Component { ...@@ -513,7 +516,7 @@ export default class ProfitLossROO extends Component {
}) })
// console.log(this.state.buttonError) // console.log(this.state.buttonError)
}) })
console.log(dataTable); console.log("checkUpload DataTable",dataTable);
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
...@@ -551,6 +554,7 @@ export default class ProfitLossROO extends Component { ...@@ -551,6 +554,7 @@ export default class ProfitLossROO extends Component {
"current_year_total": String(Number(i[20]).toFixed(1)), "current_year_total": String(Number(i[20]).toFixed(1)),
}) })
}) })
console.log("uploadProfitLossRO Data",data)
let body = { let body = {
"monthly_report_id": this.props.monthlyReportId, "monthly_report_id": this.props.monthlyReportId,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
...@@ -561,9 +565,9 @@ export default class ProfitLossROO extends Component { ...@@ -561,9 +565,9 @@ export default class ProfitLossROO extends Component {
"status": type, "status": type,
"profit_loss": data "profit_loss": data
} }
console.log(data); console.log("uploadProfitLossRO Body",body);
api.create('UPLOAD').importRollingOutlookPL(body).then(response => { api.create('UPLOAD').importRollingOutlookPL(body).then(response => {
console.log(response); console.log("uploadProfitLossRO importRollingOutlookPL",response);
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status === "success") { if (response.data.status === "success") {
...@@ -677,6 +681,7 @@ export default class ProfitLossROO extends Component { ...@@ -677,6 +681,7 @@ export default class ProfitLossROO extends Component {
console.log(dataTable2); console.log(dataTable2);
let val = String(value).split(",").join("") let val = String(value).split(",").join("")
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
console.log("handleChange ",val)
} }
const handleValue = (value, data) => { const handleValue = (value, data) => {
...@@ -695,7 +700,7 @@ export default class ProfitLossROO extends Component { ...@@ -695,7 +700,7 @@ export default class ProfitLossROO extends Component {
// console.log(total); // console.log(total);
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)
return a return a
} }
...@@ -758,7 +763,7 @@ export default class ProfitLossROO extends Component { ...@@ -758,7 +763,7 @@ export default class ProfitLossROO extends Component {
} else if (opt == "kurang") { } else if (opt == "kurang") {
total = Number(total) - Number(item) total = Number(total) - Number(item)
} else if (opt == "kali") { } else if (opt == "kali") {
total = Number(total) * Number(item) total = fixNumber(Number(total),1) * fixNumber(Number(item),1)// angka yg diupload menjadi bilangan bulat
} else if (opt == "bagi") { } else if (opt == "bagi") {
total = R.equals((Number(total) / Number(item)), NaN) ? '0' : (R.equals((Number(total) / Number(item)), Infinity) ? '0' : (Number(total) / Number(item) == "-Infinity") ? "0.0" : Number(total) / Number(item)) total = R.equals((Number(total) / Number(item)), NaN) ? '0' : (R.equals((Number(total) / Number(item)), Infinity) ? '0' : (Number(total) / Number(item) == "-Infinity") ? "0.0" : Number(total) / Number(item))
} else { } else {
...@@ -772,10 +777,14 @@ export default class ProfitLossROO extends Component { ...@@ -772,10 +777,14 @@ export default class ProfitLossROO extends Component {
// console.log(arrayJumlah); // console.log(arrayJumlah);
// } // }
// if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === "" || dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === undefined || dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === null) { // if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === "" || dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === undefined || dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === null) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(1) // dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(1)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = fixNumber(Number(total),1)//hasil dari penjumlahan/kali/pembagian menjadi bilangan bulat
// } // }
return Number(total) return Number(total)
} }
const handleTotal = (val, tableMeta) => { const handleTotal = (val, tableMeta) => {
...@@ -790,12 +799,12 @@ export default class ProfitLossROO extends Component { ...@@ -790,12 +799,12 @@ export default class ProfitLossROO extends Component {
let value = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20]) let value = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20])
dataTable2[tableMeta.rowIndex][20] = R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value)) dataTable2[tableMeta.rowIndex][20] = R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value))
return R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value)) return R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value))
} }
// else if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "total man power") { // else if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "total man power") {
// let totalTMP = dataTable2[tableMeta.rowIndex][20] = dataTable2[tableMeta.rowIndex][19] // let totalTMP = dataTable2[tableMeta.rowIndex][20] = dataTable2[tableMeta.rowIndex][19]
// return totalTMP // return totalTMP
// } else if (indexParent !== -1 && String(dataTable2[indexParent][5]).toLocaleUpperCase() == "GROSS PROFIT MARGIN (% OF REVENUE)") { // } else if (indexParent !== -1 && String(dataTable2[indexParent][5]).toLocaleUpperCase() == "GROSS PROFIT MARGIN (% OF REVENUE)") {
// return handleFormula(0, tableMeta, 0) // return handleFormula(0, tableMeta, 0)
// } // }
else { else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
...@@ -803,7 +812,7 @@ export default class ProfitLossROO extends Component { ...@@ -803,7 +812,7 @@ export default class ProfitLossROO extends Component {
} }
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total // dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
// if (String(tableMeta.rowData[5]).toLocaleLowerCase === "sales volume") { // if (String(tableMeta.rowData[5]).toLocaleLowerCase === "sales volume") {
// console.log(total); // console.log(total);
// } // }
// return total // return total
} }
...@@ -1014,22 +1023,22 @@ export default class ProfitLossROO extends Component { ...@@ -1014,22 +1023,22 @@ export default class ProfitLossROO extends Component {
// /> // />
// </div> // </div>
// : // :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={val} value={val}
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(val).toFixed(1)} value={Number(val).toFixed(1)}
/> />
} }
/> />
</div> </div>
} }
</div> </div>
) )
...@@ -1112,22 +1121,22 @@ export default class ProfitLossROO extends Component { ...@@ -1112,22 +1121,22 @@ export default class ProfitLossROO extends Component {
// /> // />
// </div> // </div>
// : // :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={val} value={val}
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={val === "0" ? "" : Number(val).toFixed(1)} value={val === "0" ? "" : Number(val).toFixed(1)}
/> />
} }
/> />
</div> </div>
} }
</div> </div>
) )
...@@ -1210,22 +1219,22 @@ export default class ProfitLossROO extends Component { ...@@ -1210,22 +1219,22 @@ export default class ProfitLossROO extends Component {
// /> // />
// </div> // </div>
// : // :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={val} value={val}
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={val === "0" ? "" : Number(val).toFixed(1)} value={val === "0" ? "" : Number(val).toFixed(1)}
/> />
} }
/> />
</div> </div>
} }
</div> </div>
) )
...@@ -1308,22 +1317,22 @@ export default class ProfitLossROO extends Component { ...@@ -1308,22 +1317,22 @@ export default class ProfitLossROO extends Component {
// /> // />
// </div> // </div>
// : // :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={val} value={val}
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={val === "0" ? "" : Number(val).toFixed(1)} value={val === "0" ? "" : Number(val).toFixed(1)}
/> />
} }
/> />
</div> </div>
} }
</div> </div>
) )
...@@ -1721,7 +1730,8 @@ export default class ProfitLossROO extends Component { ...@@ -1721,7 +1730,8 @@ export default class ProfitLossROO extends Component {
) )
} }
} }
}, { },
{
name: this.props.quarter == 'q3' ? `Aug ${this.props.periode} Actual` : `Aug ${this.props.periode}`, name: this.props.quarter == 'q3' ? `Aug ${this.props.periode} Actual` : `Aug ${this.props.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
...@@ -1819,8 +1829,8 @@ export default class ProfitLossROO extends Component { ...@@ -1819,8 +1829,8 @@ export default class ProfitLossROO extends Component {
) )
} }
} }
}, { },
name: this.props.quarter == 'q3' ? `Sep ${this.props.periode} Actual` : `Sep ${this.props.periode}`, { name: this.props.quarter == 'q3' ? `Sep ${this.props.periode} Actual` : `Sep ${this.props.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
...@@ -1917,8 +1927,9 @@ export default class ProfitLossROO extends Component { ...@@ -1917,8 +1927,9 @@ export default class ProfitLossROO extends Component {
) )
} }
} }
}, { },
name: `Oct ${this.props.periode}`,
{ name: `Oct ${this.props.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
...@@ -2015,8 +2026,9 @@ export default class ProfitLossROO extends Component { ...@@ -2015,8 +2026,9 @@ export default class ProfitLossROO extends Component {
) )
} }
} }
}, { },
name: `Nov ${this.props.periode}`,
{name: `Nov ${this.props.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
...@@ -2234,7 +2246,7 @@ export default class ProfitLossROO extends Component { ...@@ -2234,7 +2246,7 @@ export default class ProfitLossROO extends Component {
disabled={true} disabled={true}
value={Number(val).toFixed(1)} value={Number(val).toFixed(1)}
/> />
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2358,7 +2370,7 @@ export default class ProfitLossROO extends Component { ...@@ -2358,7 +2370,7 @@ export default class ProfitLossROO extends Component {
}} }}
onClick={() => onClick={() =>
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
this.downloadAllData() this.downloadAllData()
})} })}
> >
<img src={Images.download} /> <img src={Images.download} />
...@@ -2387,11 +2399,11 @@ export default class ProfitLossROO extends Component { ...@@ -2387,11 +2399,11 @@ export default class ProfitLossROO extends Component {
<div style={{ marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10 }}> <div style={{ marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10 }}>
{ {
this.state.updateBy.length > 0 ? this.state.updateBy.reverse().map((item, index) => { this.state.updateBy.length > 0 ? this.state.updateBy.reverse().map((item, index) => {
return ( return (
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
) )
}) : }) :
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
} }
</div> </div>
</div> </div>
...@@ -2424,7 +2436,7 @@ export default class ProfitLossROO extends Component { ...@@ -2424,7 +2436,7 @@ export default class ProfitLossROO extends Component {
<div className="col-2"> <div className="col-2">
</div> : </div> :
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}> <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
{this.state.get_for == 'view' && this.state.viewOnly && {this.state.get_for == 'view' && this.state.viewOnly &&
<button <button
className="button" className="button"
type="button" type="button"
...@@ -2510,7 +2522,8 @@ export default class ProfitLossROO extends Component { ...@@ -2510,7 +2522,8 @@ export default class ProfitLossROO extends Component {
}} }}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete3</Typography>
{/*save & complete ini muncul setelah pencet tombol edit, kemudian setelah upload suatu file*/}
</div> </div>
</button>} </button>}
</div> </div>
...@@ -2630,6 +2643,7 @@ export default class ProfitLossROO extends Component { ...@@ -2630,6 +2643,7 @@ export default class ProfitLossROO extends Component {
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
{/*save & complete ini muncul setelah pencet tombol edit, kemudian setelah upload suatu file*/}
</div> </div>
</button> </button>
</div> </div>
......
...@@ -2,7 +2,7 @@ export function titleCase(text) { ...@@ -2,7 +2,7 @@ export function titleCase(text) {
var value = String(text).replace(/\./g, ' ') var value = String(text).replace(/\./g, ' ')
.replace(/\s/g, ' ') .replace(/\s/g, ' ')
.replace(/^(.)/, function($1) { return $1.toUpperCase(); }) .replace(/^(.)/, function($1) { return $1.toUpperCase(); })
// .replace(/\s(.)/g, function($1) { return $1.toUpperCase(); }) // .replace(/\s(.)/g, function($1) { return $1.toUpperCase(); })
return value return value
} }
...@@ -10,4 +10,9 @@ export function titleCase(text) { ...@@ -10,4 +10,9 @@ export function titleCase(text) {
export function roundMath(number, decimalPlaces) { export function roundMath(number, decimalPlaces) {
const factorOfTen = Math.pow(10, decimalPlaces) const factorOfTen = Math.pow(10, decimalPlaces)
return Math.round(number * factorOfTen) / factorOfTen return Math.round(number * factorOfTen) / factorOfTen
}
export function fixNumber(num, decimalCount = 2) {
const output = Math.round((num + Number.EPSILON) * (Math.pow(10,decimalCount))) / (Math.pow(10,decimalCount))
return output
} }
\ No newline at end of file
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