Commit 3a36d3ae authored by EKSAD's avatar EKSAD

pl apdet

parent 92eabcd1
...@@ -3,8 +3,6 @@ import { Typography, Paper, createMuiTheme, MuiThemeProvider, TableCell, FormCon ...@@ -3,8 +3,6 @@ import { Typography, Paper, createMuiTheme, MuiThemeProvider, TableCell, FormCon
import MUIDataTable from 'mui-datatables'; import MUIDataTable from 'mui-datatables';
import NumberFormat from 'react-number-format'; import NumberFormat from 'react-number-format';
import api from '../../api'; import api from '../../api';
import AddIcon from '@material-ui/icons/Add';
import { values, type } from 'ramda';
import PropagateLoader from "react-spinners/PropagateLoader" import PropagateLoader from "react-spinners/PropagateLoader"
import Images from '../../assets/Images'; import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip'; import ReactTooltip from 'react-tooltip';
...@@ -225,7 +223,7 @@ export default class ProfitLoss extends Component { ...@@ -225,7 +223,7 @@ export default class ProfitLoss extends Component {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
let a = document.createElement('a'); let a = document.createElement('a');
a.href = url; a.href = url;
a.download = 'Template Profit Loss.xlsx'; a.download = 'Template Master Budget Profit & Loss.xlsx';
a.click(); a.click();
} }
} }
...@@ -360,7 +358,6 @@ export default class ProfitLoss extends Component { ...@@ -360,7 +358,6 @@ export default class ProfitLoss extends Component {
profit_loss: data profit_loss: data
} }
console.log(data); console.log(data);
// 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) {
...@@ -389,7 +386,7 @@ export default class ProfitLoss extends Component { ...@@ -389,7 +386,7 @@ export default class ProfitLoss extends Component {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
let a = document.createElement('a'); let a = document.createElement('a');
a.href = url; a.href = url;
a.download = 'Profit Loss.xlsx'; a.download = 'Master Budget Profit & Loss.xlsx';
a.click(); a.click();
} }
} }
...@@ -423,7 +420,7 @@ export default class ProfitLoss extends Component { ...@@ -423,7 +420,7 @@ export default class ProfitLoss extends Component {
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"periode": this.props.periode, "periode": this.props.periode,
"report_id": this.props.report_id, "report_id": this.props.report_id,
"status": type, "status": "submitted",
"profit_loss": data "profit_loss": data
} }
api.create().validateSubmitReport(payload).then((response) => { api.create().validateSubmitReport(payload).then((response) => {
...@@ -464,8 +461,15 @@ export default class ProfitLoss extends Component { ...@@ -464,8 +461,15 @@ export default class ProfitLoss extends Component {
total += Number(valItem) total += Number(valItem)
} }
}) })
if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "sales price" ) {
dataTable2[tableMeta.rowIndex][20] = 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])
return value
} else {
dataTable2[tableMeta.rowIndex][20] = total dataTable2[tableMeta.rowIndex][20] = total
return total return total
}
// console.log(total); // console.log(total);
} }
const handleNotes = (value, tableMeta) => { const handleNotes = (value, tableMeta) => {
...@@ -1971,7 +1975,7 @@ export default class ProfitLoss extends Component { ...@@ -1971,7 +1975,7 @@ export default class ProfitLoss extends Component {
return ( return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}> <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}> <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Pengajuan Budget Tahunan</Typography> <Typography style={{ fontSize: '16px', color: 'white' }}>Master Budget Submission</Typography>
</div> </div>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}> <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}> <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
...@@ -1983,13 +1987,13 @@ export default class ProfitLoss extends Component { ...@@ -1983,13 +1987,13 @@ export default class ProfitLoss extends Component {
{this.state.visibleProfitLoss === true ? {this.state.visibleProfitLoss === true ?
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}> <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} > <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Budget Tahunan - Profit & Loss </Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Profit & Loss </Typography>
</div> </div>
<div style={{ padding: 20 }}> <div style={{ padding: 20 }}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}> <div style={{ display: 'flex', justifyContent: 'space-between' }}>
<div> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode} (rev.{this.props.revision})</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
...@@ -2151,7 +2155,7 @@ export default class ProfitLoss extends Component { ...@@ -2151,7 +2155,7 @@ export default class ProfitLoss extends Component {
<div style={{ padding: 25 }}> <div style={{ padding: 25 }}>
<div> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
{this.state.dataLoaded && ( {this.state.dataLoaded && (
......
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