Commit ad5e4aec authored by Deni Rinaldi's avatar Deni Rinaldi

- valdiasi preview

parent 05195493
...@@ -787,23 +787,24 @@ export default class BalanceSheet extends Component { ...@@ -787,23 +787,24 @@ export default class BalanceSheet extends Component {
isi.map((i, index) => { isi.map((i, index) => {
if (i.length > 0) { if (i.length > 0) {
payload.push({ payload.push({
item_report: i[0] === undefined ? "" : String(i[0]), item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
total_actual_before: i[1] === undefined ? "" : String(i[1]), item_report: i[1] === undefined ? "" : String(i[1]).trim(),
january: i[2] === undefined ? "" : String(i[2]), total_actual_before: i[2] === undefined ? "" : String(i[2]).trim(),
february: i[3] === undefined ? "" : String(i[3]), january: i[3] === undefined ? "" : String(i[3]).trim(),
march: i[4] === undefined ? "" : String(i[4]), february: i[4] === undefined ? "" : String(i[4]).trim(),
april: i[5] === undefined ? "" : String(i[5]), march: i[5] === undefined ? "" : String(i[5]).trim(),
may: i[6] === undefined ? "" : String(i[6]), april: i[6] === undefined ? "" : String(i[6]).trim(),
june: i[7] === undefined ? "" : String(i[7]), may: i[7] === undefined ? "" : String(i[7]).trim(),
july: i[8] === undefined ? "" : String(i[8]), june: i[8] === undefined ? "" : String(i[8]).trim(),
august: i[9] === undefined ? "" : String(i[9]), july: i[9] === undefined ? "" : String(i[9]).trim(),
september: i[10] === undefined ? "" : String(i[10]), august: i[10] === undefined ? "" : String(i[10]).trim(),
october: i[11] === undefined ? "" : String(i[11]), september: i[11] === undefined ? "" : String(i[11]).trim(),
november: i[12] === undefined ? "" : String(i[12]), october: i[12] === undefined ? "" : String(i[12]).trim(),
december: i[13] === undefined ? "" : String(i[13]), november: i[13] === undefined ? "" : String(i[13]).trim(),
total_current_year: i[14] === undefined ? "" : String(i[14]), december: i[14] === undefined ? "" : String(i[14]).trim(),
total_next_year: i[15] === undefined ? "" : String(i[15]), total_current_year: i[15] === undefined ? "" : String(i[15]).trim(),
total_more_year: i[16] === undefined ? "" : String(i[16]) total_next_year: i[16] === undefined ? "" : String(i[16]).trim(),
total_more_year: i[16] === undefined ? "" : String(i[17]).trim()
}) })
} }
}) })
...@@ -851,7 +852,35 @@ export default class BalanceSheet extends Component { ...@@ -851,7 +852,35 @@ export default class BalanceSheet extends Component {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ dataLoaded: true, visibleBalanceSheet: false, visibleUpload: false }) this.setState({ visibleUpload: false, visibleBalanceSheet: false, loading: true })
let dataTable = response.data.data.map((item, index) => {
return [
item.type_report_id,
item.item_report_id,
item.parent,
item.formula,
item.level,
item.item_report,
item.total_actual_before,
item.january,
item.february,
item.march,
item.april,
item.may,
item.june,
item.july,
item.august,
item.september,
item.october,
item.november,
item.december,
item.total_current_year,
item.total_next_year,
item.total_more_year,
item.error
]
})
this.setState({ dataTable, dataLoaded: true, loading: false })
} }
} }
}) })
...@@ -965,13 +994,42 @@ export default class BalanceSheet extends Component { ...@@ -965,13 +994,42 @@ export default class BalanceSheet extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ width: 300 }}> <div style={{ width: 300 }}>
{tableMeta.rowData[4] == 0 ? {tableMeta.rowData[22] ?
tableMeta.rowData[22].length > 0 ?
tableMeta.rowData[22][0].field === 'item' ?
tableMeta.rowData[4] == 0 ?
<a data-tip={tableMeta.rowData[22][0].message} data-for="account">
<span style={{ fontSize: 12, fontWeight: 'bold', color: 'red' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
</a>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<a data-tip={tableMeta.rowData[22][0].message} data-for="account">
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</a>
</div>
:
tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
:
tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
:
tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span> <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
: :
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}> <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span> <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div> </div>
} }
<ReactTooltip border={true} id="account" place="bottom" type="light" effect="solid" />
</div> </div>
) )
} }
...@@ -2352,6 +2410,12 @@ export default class BalanceSheet extends Component { ...@@ -2352,6 +2410,12 @@ export default class BalanceSheet extends Component {
) )
} }
} }
},
{
name: "",
options: {
display: false
}
} }
] ]
const loadingComponent = ( const loadingComponent = (
...@@ -2467,13 +2531,14 @@ export default class BalanceSheet extends Component { ...@@ -2467,13 +2531,14 @@ export default class BalanceSheet extends Component {
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none' outline: 'none',
marginRight: 20
}} }}
onClick={() => { onClick={() => {
this.props.onClickClose() this.props.onClickClose()
}} }}
> >
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960', marginRight: 20 }}> <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography>
</div> </div>
</button> </button>
...@@ -2485,10 +2550,11 @@ export default class BalanceSheet extends Component { ...@@ -2485,10 +2550,11 @@ export default class BalanceSheet extends Component {
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.disabledSave === true ? 'default' : 'pointer', cursor: this.state.disabledSave === true ? 'default' : 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none' outline: 'none',
marginRight: 20
}} }}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', marginRight: 20 }}> <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</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography>
</div> </div>
</button> </button>
...@@ -2519,41 +2585,63 @@ export default class BalanceSheet extends Component { ...@@ -2519,41 +2585,63 @@ export default class BalanceSheet extends Component {
: :
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}> <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div> <div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25 }}>
<label style={{ color: 'white', fontSize: 16, alignSelf: 'center' }}>Preview Data</label>
</div>
<div style={{ padding: 25 }}> <div style={{ padding: 25 }}>
<div>
<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' }}>in IDR mn</Typography>
</div>
{this.state.dataLoaded && ( {this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150), height: this.props.height - 400 }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150), height: this.props.height - 400 }}>
<MuiThemeProvider theme={getMuiTheme()}> {!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
theme={getMuiTheme()} data={dataTable2}
data={this.state.rows}
columns={columns} columns={columns}
options={options} options={options}
/> />
</MuiThemeProvider> </MuiThemeProvider>}
</div> </div>
)} )}
</div> </div>
<div style={{ display: 'flex', width: '100%', placeContent: 'flex-end', padding: 20 }}> <div style={{ display: 'flex', width: '100%', placeContent: 'flex-end', padding: 20 }}>
<button <button
type="button" type="button"
onClick={() => this.setState({ visibleBalanceSheet: true })} onClick={() => this.setState({ visibleBalanceSheet: true }, () => this.getItemHierarki())}
style={{ marginRight: 20 }} style={{ marginRight: 20 }}
> >
<div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960'}}>
<span style={{ color: '#354960', fontSize: 11 }}>Cancel</span> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography>
</div> </div>
</button> </button>
<button <button
type="button" type="button"
disabled={this.state.buttonError == true ? true : false} disabled={this.state.buttonError == true ? true : false}
onClick={() => null} onClick={() => null}
style={{}} style={{ marginRight: 20 }}
>
<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</Typography>
</div>
</button>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: false })
}, 100);
})
}}
> >
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Save</span> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography>
</div> </div>
</button> </button>
</div> </div>
......
...@@ -777,6 +777,21 @@ export default class ProfitLoss extends Component { ...@@ -777,6 +777,21 @@ export default class ProfitLoss extends Component {
this.props.onClickClose() this.props.onClickClose()
} }
downloadTemplate = async () => {
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
)
res = await res.blob()
console.log(res)
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Template Profit Loss.xlsx';
a.click();
}
}
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta) => { const handleChange = (value, tableMeta) => {
...@@ -2357,7 +2372,7 @@ export default class ProfitLoss extends Component { ...@@ -2357,7 +2372,7 @@ export default class ProfitLoss extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => null} onClick={() => this.downloadTemplate()}
> >
<img src={Images.template} /> <img src={Images.template} />
</button> </button>
......
...@@ -22,7 +22,8 @@ const style = { ...@@ -22,7 +22,8 @@ const style = {
const style2 = { const style2 = {
position: "sticky", position: "sticky",
background: "white", background: "white",
zIndex: 100 zIndex: 100,
top: 0
}; };
export default class TaxPlanning extends Component { export default class TaxPlanning extends Component {
...@@ -1443,6 +1444,21 @@ export default class TaxPlanning extends Component { ...@@ -1443,6 +1444,21 @@ export default class TaxPlanning extends Component {
this.props.onClickClose() this.props.onClickClose()
} }
downloadTemplate = async () => {
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
)
res = await res.blob()
console.log(res)
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Template Tax Planning.xlsx';
a.click();
}
}
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta) => { const handleChange = (value, tableMeta) => {
...@@ -1843,11 +1859,11 @@ export default class TaxPlanning extends Component { ...@@ -1843,11 +1859,11 @@ export default class TaxPlanning extends Component {
name: "Feb 2021", name: "Feb 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<th style={{ backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} > <th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> {/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell> */}
{/* <div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div> */} <div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
<div className="grid grid-3x" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}> <div className="grid grid-3x" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}> <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
<span>{"Trial Balance (Commercial) MTD"}</span> <span>{"Trial Balance (Commercial) MTD"}</span>
...@@ -5362,7 +5378,7 @@ export default class TaxPlanning extends Component { ...@@ -5362,7 +5378,7 @@ export default class TaxPlanning extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => null} onClick={() => this.downloadTemplate()}
> >
<img src={Images.template} /> <img src={Images.template} />
</button> </button>
......
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