Commit 9d48658f authored by Riri Novita's avatar Riri Novita

Issue save pl

parent e70bba9a
...@@ -339,12 +339,12 @@ export default class ProfitLoss extends Component { ...@@ -339,12 +339,12 @@ export default class ProfitLoss extends Component {
} }
console.log(payload); console.log(payload);
this.setState({ loading: false }) this.setState({ loading: false })
// if (type == 'submitted') { if (type == 'submitted') {
// this.props.saveToMasterBudget(payload, 'PL') this.props.saveToMasterBudget(payload, 'PL')
// } else { } else {
// this.props.saveToMasterBudget(payload, 'DraftPL') this.props.saveToMasterBudget(payload, 'DraftPL')
// } }
// this.props.onClickClose() this.props.onClickClose()
} }
downloadTemplate = async () => { downloadTemplate = async () => {
...@@ -435,22 +435,22 @@ export default class ProfitLoss extends Component { ...@@ -435,22 +435,22 @@ export default class ProfitLoss extends Component {
item.level, item.level,
item.item_report, item.item_report,
item.notes, item.notes,
Number(item.total_actual_before), item.total_actual_before == 0 ? "0.0" : item.total_actual_before,
Number(item.january), item.january == 0 ? "0.0" : item.january,
Number(item.february), item.february == 0 ? "0.0" : item.february,
Number(item.march), item.march == 0 ? "0.0" : item.march,
Number(item.april), item.april == 0 ? "0.0" : item.april,
Number(item.may), item.may == 0 ? "0.0" : item.may,
Number(item.june), item.june == 0 ? "0.0" : item.june,
Number(item.july), item.july == 0 ? "0.0" : item.july,
Number(item.august), item.august == 0 ? "0.0" : item.august,
Number(item.september), item.september == 0 ? "0.0" : item.september,
Number(item.october), item.october == 0 ? "0.0" : item.october,
Number(item.november), item.november == 0 ? "0.0" : item.november,
Number(item.december), item.december == 0 ? "0.0" : item.december,
Number(item.total_current_year), item.total_current_year == 0 ? "0.0" : item.total_current_year,
Number(item.total_next_year), item.total_next_year == 0 ? "0.0" : item.total_next_year,
Number(item.total_more_year), item.total_more_year == 0 ? "0.0" : item.total_more_year,
item.orders, item.orders,
item.error item.error
] ]
...@@ -574,39 +574,39 @@ export default class ProfitLoss extends Component { ...@@ -574,39 +574,39 @@ export default class ProfitLoss extends Component {
console.log(body); console.log(body);
// console.log(this.state.dataTable); // console.log(this.state.dataTable);
// console.log(JSON.stringify(body)); // console.log(JSON.stringify(body));
// api.create('UPLOAD').uploadMasterBudget(body).then(response => { api.create('UPLOAD').uploadMasterBudget(body).then(response => {
// console.log(response); console.log(response);
// if (response.data) { if (response.data) {
// if (response.ok) { if (response.ok) {
// if (response.data.status === "success") { if (response.data.status === "success") {
// this.props.onClickClose() this.props.onClickClose()
// if (type == 'submitted') { if (type == 'submitted') {
// this.props.getReport('PL') this.props.getReport('PL')
// } else { } else {
// this.props.getReport() this.props.getReport()
// } }
// } else { } else {
// if (response.data.message == "Please Set Up Rate Currency First") { if (response.data.message == "Please Set Up Rate Currency First") {
// this.setState({ visibleAlertSave: true }) this.setState({ visibleAlertSave: true })
// } 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")) {
// setTimeout(() => { setTimeout(() => {
// localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
// window.location.reload(); window.location.reload();
// }, 1000); }, 1000);
// } }
// }) })
// } }
// // alert(response.data.status) // alert(response.data.status)
// } }
// } else { } else {
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
// } }
// } else { } else {
// this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false })
// } }
// }) })
} }
async downloadAllData() { async downloadAllData() {
...@@ -1053,7 +1053,7 @@ export default class ProfitLoss extends Component { ...@@ -1053,7 +1053,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)} value={handleValue(value, tableMeta) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16} decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
// decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)} // decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)}
/> />
...@@ -1186,7 +1186,7 @@ export default class ProfitLoss extends Component { ...@@ -1186,7 +1186,7 @@ export default class ProfitLoss extends Component {
disabled={true} disabled={true}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16} decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
// decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)} // decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)} value={handleValue(value, tableMeta) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)}
/> />
</span> </span>
: :
...@@ -1327,7 +1327,7 @@ export default class ProfitLoss extends Component { ...@@ -1327,7 +1327,7 @@ export default class ProfitLoss extends Component {
disabled={true} disabled={true}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16} decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
// decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)} // decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)} value={handleValue(value, tableMeta) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)}
/> />
</span> </span>
: :
...@@ -1468,7 +1468,7 @@ export default class ProfitLoss extends Component { ...@@ -1468,7 +1468,7 @@ export default class ProfitLoss extends Component {
disabled={true} disabled={true}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16} decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
// decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)} // decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)} value={handleValue(value, tableMeta) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)}
/> />
</span> </span>
: :
...@@ -1609,7 +1609,7 @@ export default class ProfitLoss extends Component { ...@@ -1609,7 +1609,7 @@ export default class ProfitLoss extends Component {
disabled={true} disabled={true}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16} decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
// decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)} // decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)} value={handleValue(value, tableMeta) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)}
/> />
</span> </span>
: :
...@@ -1750,7 +1750,7 @@ export default class ProfitLoss extends Component { ...@@ -1750,7 +1750,7 @@ export default class ProfitLoss extends Component {
disabled={true} disabled={true}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16} decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
// decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)} // decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)} value={handleValue(value, tableMeta) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)}
/> />
</span> </span>
: :
...@@ -1891,7 +1891,7 @@ export default class ProfitLoss extends Component { ...@@ -1891,7 +1891,7 @@ export default class ProfitLoss extends Component {
disabled={true} disabled={true}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16} decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
// decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)} // decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)} value={handleValue(value, tableMeta) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)}
/> />
</span> </span>
: :
...@@ -2032,7 +2032,7 @@ export default class ProfitLoss extends Component { ...@@ -2032,7 +2032,7 @@ export default class ProfitLoss extends Component {
disabled={true} disabled={true}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16} decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
// decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)} // decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)} value={handleValue(value, tableMeta) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)}
/> />
</span> </span>
: :
...@@ -2173,7 +2173,7 @@ export default class ProfitLoss extends Component { ...@@ -2173,7 +2173,7 @@ export default class ProfitLoss extends Component {
disabled={true} disabled={true}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16} decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
// decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)} // decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)} value={handleValue(value, tableMeta) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)}
/> />
</span> </span>
: :
...@@ -2314,7 +2314,7 @@ export default class ProfitLoss extends Component { ...@@ -2314,7 +2314,7 @@ export default class ProfitLoss extends Component {
disabled={true} disabled={true}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16} decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
// decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)} // decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)} value={handleValue(value, tableMeta) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)}
/> />
</span> </span>
: :
...@@ -2455,7 +2455,7 @@ export default class ProfitLoss extends Component { ...@@ -2455,7 +2455,7 @@ export default class ProfitLoss extends Component {
disabled={true} disabled={true}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16} decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
// decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)} // decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)} value={handleValue(value, tableMeta) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)}
/> />
</span> </span>
: :
...@@ -2596,7 +2596,7 @@ export default class ProfitLoss extends Component { ...@@ -2596,7 +2596,7 @@ export default class ProfitLoss extends Component {
disabled={true} disabled={true}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16} decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
// decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)} // decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)} value={handleValue(value, tableMeta) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)}
/> />
</span> </span>
: :
...@@ -2832,7 +2832,7 @@ export default class ProfitLoss extends Component { ...@@ -2832,7 +2832,7 @@ export default class ProfitLoss extends Component {
disabled={true} disabled={true}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16} decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
// decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)} // decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)} value={handleValue(value, tableMeta) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)}
/> />
</span> </span>
: :
...@@ -2973,7 +2973,7 @@ export default class ProfitLoss extends Component { ...@@ -2973,7 +2973,7 @@ export default class ProfitLoss extends Component {
disabled={true} disabled={true}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16} decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
// decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)} // decimalScale={this.props.defaultCurrency.id == 1 ? 1 : (String(value).includes(".") && this.state.previewUpload == true ? String(value).split(".")[1].length : 16)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)} value={handleValue(value, tableMeta) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : handleValue(value, tableMeta)}
/> />
</span> </span>
: :
......
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