Commit 67aeec3d authored by Riri Novita's avatar Riri Novita

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into riri

parents 32322226 b16b9314
......@@ -585,7 +585,7 @@ export default class BalanceSheetMR extends Component {
if (response.data.data.result && err === false && errorContrl === false ) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
} else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: true })
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
......@@ -734,7 +734,7 @@ export default class BalanceSheetMR extends Component {
}
} else {
let data = tableMeta.rowData[20] == null? [] : tableMeta.rowData[20]
let indexID = data.findIndex((val) => val.item_formula == String(`${item}`))
let indexID = data.findIndex((val) => val.item_formula == String(`@${item}`))
if (indexID !== -1) {
// console.log(tableMeta)
let valuezz = data[indexID].value
......@@ -746,14 +746,18 @@ export default class BalanceSheetMR extends Component {
let tst = String(item).replace('[M-1]', '')
let indexID = dataTable2.findIndex((val) => val[21] == tst)
if (indexID !== -1) {
let valuezz = dataTable2[indexID][9]
let valuezz = dataTable2[indexID][10]
if (item == dataTable2[tableMeta.rowIndex][21]) {
anjay.push(0)
} else {
anjay.push(valuezz == "" ? 0 : valuezz)
}
}
} else {
let indexID = dataTable2.findIndex((val) => val[21] == item)
if (indexID !== -1) {
let valuezz = dataTable2[indexID][colIdx]
if (item == dataTable2[tableMeta.rowIndex][24]) {
if (item == dataTable2[tableMeta.rowIndex][21]) {
anjay.push(0)
} else {
anjay.push(valuezz == "" ? 0 : valuezz)
......@@ -2054,16 +2058,17 @@ export default class BalanceSheetMR extends Component {
<LightTooltip title={"MTD Explanation vs Prev Month is Reqiured"} arrow>
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
// disabled={false}
multiline={true}
defaultValue={tableMeta.rowData[17]}
inputProps={{
style: {
color: "#5198ea",
textAlign: 'right',
textAlign: 'left',
backgroundColor: '#ffac99'
}
}}
......@@ -2111,16 +2116,17 @@ export default class BalanceSheetMR extends Component {
// :
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
// disabled={Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? false : true}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
multiline={true}
defaultValue={tableMeta.rowData[17]}
inputProps={{
style: {
color: Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? "#5198ea" : '#5198ea',
textAlign: 'right'
textAlign: 'left'
}
}}
onBlur={(event) => {
......@@ -2147,16 +2153,17 @@ export default class BalanceSheetMR extends Component {
<LightTooltip title={"MTD Explanation vs MB is Reqiured"} arrow>
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
multiline={true}
// disabled={false}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
defaultValue={tableMeta.rowData[18]}
inputProps={{
style: {
color: "#5198ea",
textAlign: 'right',
textAlign: 'left',
backgroundColor: '#ffac99'
}
}}
......@@ -2204,8 +2211,9 @@ export default class BalanceSheetMR extends Component {
// :
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
multiline={true}
placeholder=""
// disabled={Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? false : true}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
......@@ -2213,7 +2221,7 @@ export default class BalanceSheetMR extends Component {
inputProps={{
style: {
color: Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? "#5198ea" : '#5198ea',
textAlign: 'right'
textAlign: 'left'
}
}}
onBlur={(event) => {
......@@ -2240,8 +2248,9 @@ export default class BalanceSheetMR extends Component {
<LightTooltip title={"MTD Explanation vs RB is Reqiured"} arrow>
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
multiline={true}
placeholder=""
// disabled={false}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
......@@ -2249,7 +2258,7 @@ export default class BalanceSheetMR extends Component {
inputProps={{
style: {
color: "#5198ea",
textAlign: 'right',
textAlign: 'left',
backgroundColor: '#ffac99'
}
}}
......@@ -2297,8 +2306,9 @@ export default class BalanceSheetMR extends Component {
// :
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
multiline={true}
placeholder=""
// disabled={Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue ? false : true}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
......@@ -2306,7 +2316,7 @@ export default class BalanceSheetMR extends Component {
inputProps={{
style: {
color: Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue ? "#5198ea" : '#5198ea',
textAlign: 'right'
textAlign: 'left'
}
}}
onBlur={(event) => {
......@@ -2583,9 +2593,9 @@ export default class BalanceSheetMR extends Component {
marginRight: 20
}}
onClick={() =>
// this.state.saveDraft ?
// this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
// :
this.state.saveDraft ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => {
this.backToMonthlyReport('draft')
......
......@@ -627,7 +627,8 @@ export default class FixedAssetsMovementMR extends Component {
}
const handleChange = (value, tableMeta, type) => {
dataTable2[tableMeta.rowIndex][type] = value
let val = String(value).split(",").join("")
dataTable2[tableMeta.rowIndex][type] = val
// console.log(dataTable2)
// console.log(dataTable2[tableMeta.rowIndex][type]);
// console.log(value);
......@@ -696,7 +697,7 @@ export default class FixedAssetsMovementMR extends Component {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
// console.log(total);
}
return total
return total * 100
}
let columns = [
......@@ -885,7 +886,7 @@ export default class FixedAssetsMovementMR extends Component {
}
/>
</div> :
tableMeta.rowData[0] === 5 ?
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -1099,7 +1100,7 @@ export default class FixedAssetsMovementMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[11]).toFixed(1)}
value={Number(Number(tableMeta.rowData[11]) * 100).toFixed(1)}
/>
}
/>
......@@ -1143,7 +1144,7 @@ export default class FixedAssetsMovementMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[12]).toFixed(1)}
value={Number(Number(tableMeta.rowData[12]) * 100).toFixed(1)}
/>
}
/>
......@@ -1182,7 +1183,7 @@ export default class FixedAssetsMovementMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[13]).toFixed(1)}
value={Number(Number(tableMeta.rowData[13]) * 100).toFixed(1)}
/>
}
/>
......
......@@ -89,7 +89,9 @@ export default class ListOfCreditFacilities extends Component {
visibleLOCFMR: true,
saveDraft: true,
saveComp: true,
get_for: 'view'
get_for: 'view',
updateBy: '-',
notes: "",
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -98,6 +100,7 @@ export default class ListOfCreditFacilities extends Component {
this.getBankData()
this.getTypeOfCredit()
this.getSubmission()
this.getLatestUpdate()
}
handleGetFor(type) {
......@@ -105,6 +108,7 @@ export default class ListOfCreditFacilities extends Component {
this.getBankData()
this.getTypeOfCredit()
this.getSubmission()
this.getLatestUpdate()
})
}
......@@ -197,13 +201,13 @@ export default class ListOfCreditFacilities extends Component {
item.formula,
item.level,
// item.description,
item.locf.borrower_comp_name === null ? "" : item.locf.borrower_comp_name === "" ? "" : item.locf.borrower_comp_name,
item.locf.borrower_comp_name === null || item.locf.borrower_comp_name === "" ? this.props.company.company_name : item.locf.borrower_comp_name,
item.locf.bank_name === null ? null : item.locf.bank_name === "" ? null : {value: item.locf.bank_name},
item.locf.type_of_credit === null ? null : item.locf.type_of_credit === "" ? null : {value: item.locf.type_of_credit},
item.locf.remarks === null ? "0.0" : item.locf.remarks === "" ? "0.0" : item.locf.remarks,
item.locf.loan_maturity_date === null ? "0.0" : item.locf.loan_maturity_date === "" ? "0.0" : item.locf.loan_maturity_date,
item.locf.interest === null ? "0.0" : item.locf.interest === "" ? "0.0" : item.locf.interest,
item.locf.currency === null ? "0.0" : item.locf.currency === "" ? "0.0" : item.locf.currency,
item.locf.loan_maturity_date === null || item.locf.loan_maturity_date === "" ? null : item.locf.loan_maturity_date,
item.locf.interest === null || item.locf.interest === "" ? "0.00" : item.locf.interest,
item.locf.currency === null || item.locf.currency === "" ? "" : item.locf.currency,
item.locf.loan_plafond_amount_ori,
item.locf.loan_plafond_amount_idr === null ? "0.0" : item.locf.loan_plafond_amount_idr === "" ? "0.0" : item.locf.loan_plafond_amount_idr,
item.locf.out_loan_ki_amount_ori,
......@@ -236,11 +240,12 @@ export default class ListOfCreditFacilities extends Component {
item.locf.other_ratio3_financial,
item.locf.other_ratio3_current === null ? "0.0" : item.locf.other_ratio3_current === "" ? "0.0" : item.locf.other_ratio3_current,
item.locf.other_ratio4_ratio_name,
item.locf.other_ratio4_financia,,
item.locf.other_ratio4_financial,
item.locf.other_ratio4_current === null ? "0.0" : item.locf.other_ratio4_current === "" ? "0.0" : item.locf.other_ratio4_current,
item.notes,
item.locf.notes,
// item.per_bs === null ? "0.0" : item.locf.per_bs === "" ? "0.0" : item.locf.per_bs,
// item.diff === null ? "0.0" : item.locf.diff === "" ? "0.0" : item.locf.diff,
index
],
[9, "", "", "", "", "", {value: "Grand Total"}, null, "", "", "", "0", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "notes", 999999 ],
)
......@@ -252,13 +257,13 @@ export default class ListOfCreditFacilities extends Component {
item.formula,
item.level,
// item.description,
item.locf.borrower_comp_name === null ? "0.0" : item.locf.borrower_comp_name === "" ? "0.0" : item.locf.borrower_comp_name,
item.locf.borrower_comp_name === null || item.locf.borrower_comp_name === "" ? this.props.company.company_name : item.locf.borrower_comp_name,
item.locf.bank_name === null ? null : item.locf.bank_name === "" ? null : {value: item.locf.bank_name},
item.locf.type_of_credit === null ? null : item.locf.type_of_credit === "" ? null : {value: item.locf.type_of_credit},
item.locf.remarks === null ? "0.0" : item.locf.remarks === "" ? "0.0" : item.locf.remarks,
item.locf.loan_maturity_date === null ? "0.0" : item.locf.loan_maturity_date === "" ? "0.0" : item.locf.loan_maturity_date,
item.locf.interest === null ? "0.0" : item.locf.interest === "" ? "0.0" : item.locf.interest,
item.locf.currency === null ? "0.0" : item.locf.currency === "" ? "0.0" : item.locf.currency,
item.locf.loan_maturity_date === null || item.locf.loan_maturity_date === "" ? null : item.locf.loan_maturity_date,
item.locf.interest === null || item.locf.interest === "" ? "0.00" : item.locf.interest,
item.locf.currency === null || item.locf.currency === "" ? "" : item.locf.currency,
item.locf.loan_plafond_amount_ori,
item.locf.loan_plafond_amount_idr === null ? "0.0" : item.locf.loan_plafond_amount_idr === "" ? "0.0" : item.locf.loan_plafond_amount_idr,
item.locf.out_loan_ki_amount_ori,
......@@ -291,9 +296,10 @@ export default class ListOfCreditFacilities extends Component {
item.locf.other_ratio3_financial,
item.locf.other_ratio3_current === null ? "0.0" : item.locf.other_ratio3_current === "" ? "0.0" : item.locf.other_ratio3_current,
item.locf.other_ratio4_ratio_name,
item.locf.other_ratio4_financia,,
item.locf.other_ratio4_financial,
item.locf.other_ratio4_current === null ? "0.0" : item.locf.other_ratio4_current === "" ? "0.0" : item.locf.other_ratio4_current,
item.notes,
item.locf.notes,
index
// item.per_bs === null ? "0.0" : item.locf.per_bs === "" ? "0.0" : item.locf.per_bs,
// item.diff === null ? "0.0" : item.locf.diff === "" ? "0.0" : item.locf.diff,
])
......@@ -310,7 +316,7 @@ export default class ListOfCreditFacilities extends Component {
// console.log(dataTable);
if (dataTable.length == 0 && this.state.get_for == 'edit') {
dataTable.push(
[3, "", "", "", "", this.props.company.company_name, null, null, "", this.state.currentDate, "", "0", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "notes", 0 ],
[3, "", "", "", "", this.props.company.company_name, null, null, "", this.state.currentDate, "0.00", "", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "notes", 0 ],
[9, "", "", "", "", "", {value: "Grand Total"}, null, "", "", "", "0", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "notes", 999999 ],
)
}
......@@ -323,6 +329,41 @@ export default class ListOfCreditFacilities extends Component {
})
}
getLatestUpdate() {
let payload = {
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId,
"months": this.props.month.month_id
}
// console.log(payload)
api.create().getLastestUpdateMR(payload).then(response => {
console.log(JSON.stringify(response))
if (response.data) {
if (response.data.status === "success") {
this.setState({
updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update,
notes: response.data.data.notes_update === null ? "" : response.data.data.notes_update
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, typeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
// console.log('brrrrrrrr')
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
......@@ -417,9 +458,9 @@ export default class ListOfCreditFacilities extends Component {
item.bank_name === null ? null : item.bank_name === "" ? null : {value: item.bank_name},
item.type_of_credit === null ? null : item.type_of_credit === "" ? null : {value: item.type_of_credit},
item.remarks === null ? "" : item.remarks === "" ? "" : item.remarks,
item.loan_maturity_date === null ? this.state.currentDate : item.loan_maturity_date === "" ? this.state.currentDate : item.loan_maturity_date,
item.interest === null ? "0" : item.interest === "" ? "0" : item.interest,
item.currency === null ? "0.0" : item.currency === "" ? "0.0" : item.currency,
item.loan_maturity_date === null || item.loan_maturity_date === "" ? null : item.loan_maturity_date,
item.interest === null || item.interest === "" ? "0.00" : item.interest,
item.currency === null || item.currency === "" ? "" : item.currency,
item.loan_plafond_amount_ori,
item.loan_plafond_amount_idr === null ? "0.0" : item.loan_plafond_amount_idr === "" ? "0.0" : item.loan_plafond_amount_idr,
item.out_loan_ki_amount_ori,
......@@ -468,9 +509,9 @@ export default class ListOfCreditFacilities extends Component {
item.bank_name === null ? null : item.bank_name === "" ? null : {value: item.bank_name},
item.type_of_credit === null ? null : item.type_of_credit === "" ? null : {value: item.type_of_credit},
item.remarks === null ? "" : item.remarks === "" ? "" : item.remarks,
item.loan_maturity_date === null ? this.state.currentDate : item.loan_maturity_date === "" ? this.state.currentDate : item.loan_maturity_date,
item.interest === null ? "0" : item.interest === "" ? "0" : item.interest,
item.currency === null ? "0.0" : item.currency === "" ? "0.0" : item.currency,
item.loan_maturity_date === null || item.loan_maturity_date === "" ? null : item.loan_maturity_date,
item.interest === null || item.interest === "" ? "0.00" : item.interest,
item.currency === null || item.currency === "" ? "" : item.currency,
item.loan_plafond_amount_ori,
item.loan_plafond_amount_idr === null ? "0.0" : item.loan_plafond_amount_idr === "" ? "0.0" : item.loan_plafond_amount_idr,
item.out_loan_ki_amount_ori,
......@@ -519,7 +560,7 @@ export default class ListOfCreditFacilities extends Component {
// console.log(dataTable);
if (dataTable.length == 0) {
dataTable.push(
[3, "", "", "", "", this.props.company.company_name, null, null, "", this.state.currentDate, "", "0", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "notes", 0 ],
[3, "", "", "", "", this.props.company.company_name, null, null, "", this.state.currentDate, "0.00", "", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "notes", 0 ],
[9, "", "", "", "", "", {value: "Grand Total"}, null, "", "", "", "0", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "notes", 999999 ],
)
}
......@@ -542,8 +583,12 @@ export default class ListOfCreditFacilities extends Component {
uploadLOCF(type) {
let data = []
let error = false
this.state.dataTable.map(i => {
if (i[0] == 3) {
if (i[6].value == null || i[7].value == null || i[8] == "" || i[9] == "" || i[10] == "" || i[11] == "") {
error = true
}
data.push({
"item_report_id": i[1],
"borrower_comp_name": i[5],
......@@ -571,7 +616,7 @@ export default class ListOfCreditFacilities extends Component {
"current_ratio_current": i[26],
"der_financial": i[27],
"der_current": i[28],
"debt_to_ebitda_financial": i[20],
"debt_to_ebitda_financial": i[29],
"debt_to_ebitda_current": i[30],
"ebitda_to_interest_financial": i[31],
"ebitda_to_interest_current": i[32],
......@@ -586,7 +631,7 @@ export default class ListOfCreditFacilities extends Component {
"other_ratio3_current": i[41],
"other_ratio4_ratio_name": i[42],
"other_ratio4_financial": i[43],
"other_ratio4_current": i[4],
"other_ratio4_current": i[44],
"notes": i[45],
})
}
......@@ -604,6 +649,9 @@ export default class ListOfCreditFacilities extends Component {
"total_loan" : this.state.totalOutStand
}
// console.log(data);
if (error) {
this.setState({handleTekTekTek: 0, saveDraft: true, saveComp: true, loading: false})
} else {
api.create('UPLOAD').uploadMonthlyReportLOCF(body).then(response => {
console.log(response);
if (response.data) {
......@@ -631,6 +679,7 @@ export default class ListOfCreditFacilities extends Component {
}
})
}
}
getBankData() {
let body = {
......@@ -913,8 +962,12 @@ export default class ListOfCreditFacilities extends Component {
backToMonthlyReport(type) {
// this.setState({ loading: true })
let data = []
let error = false
this.state.dataTable.map(i => {
if (i[0] == 3) {
if (i[6].value == null || i[7].value == null || i[8] == "" || i[9] == "" || i[10] == "" || i[11] == "") {
error = true
}
data.push({
"item_report_id": i[1],
"borrower_comp_name": i[5],
......@@ -942,7 +995,7 @@ export default class ListOfCreditFacilities extends Component {
"current_ratio_current": i[26],
"der_financial": i[27],
"der_current": i[28],
"debt_to_ebitda_financial": i[20],
"debt_to_ebitda_financial": i[29],
"debt_to_ebitda_current": i[30],
"ebitda_to_interest_financial": i[31],
"ebitda_to_interest_current": i[32],
......@@ -957,7 +1010,7 @@ export default class ListOfCreditFacilities extends Component {
"other_ratio3_current": i[41],
"other_ratio4_ratio_name": i[42],
"other_ratio4_financial": i[43],
"other_ratio4_current": i[4],
"other_ratio4_current": i[44],
"notes": i[45],
})
}
......@@ -975,7 +1028,10 @@ export default class ListOfCreditFacilities extends Component {
"total_loan" : this.state.totalOutStand
}
console.log(payload)
console.log(JSON.stringify(payload))
if (error) {
this.setState({handleTekTekTek: 0, saveDraft: true, saveComp: true, loading: false})
} else {
api.create('UPLOAD').createMonthlyReportLOCF(payload).then(response => {
console.log(response);
if (response.data) {
......@@ -994,6 +1050,7 @@ export default class ListOfCreditFacilities extends Component {
}
})
}
}
handleCalculate = () => {
......@@ -1071,8 +1128,8 @@ export default class ListOfCreditFacilities extends Component {
null,
"",
this.state.currentDate,
"0.00",
"",
"0",
"",
"0",
"",
......@@ -1106,7 +1163,7 @@ export default class ListOfCreditFacilities extends Component {
"",
"",
"",
"notez",
"",
index],
items,
)
......@@ -1133,8 +1190,8 @@ export default class ListOfCreditFacilities extends Component {
null,
"",
this.state.currentDate,
"0.00",
"",
"0",
"",
"0",
"",
......@@ -1168,7 +1225,7 @@ export default class ListOfCreditFacilities extends Component {
"",
"",
"",
"notez",
"",
index],
items,
)
......@@ -1372,8 +1429,8 @@ export default class ListOfCreditFacilities extends Component {
null,
"",
this.state.currentDate,
"0.00",
"",
"0",
"",
"0",
"",
......@@ -1407,7 +1464,7 @@ export default class ListOfCreditFacilities extends Component {
"",
"",
"",
"notez",
"",
indexxx],
)
......@@ -1632,11 +1689,29 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ textAlign: 'right', width: 90 }}>
{ tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null :
<div style={{ padding: 0, margin: 0 }}>
<textarea disabled={this.state.get_for == 'view'} style={{ borderColor: 'white', width: 96, textAlign: 'center', justifyContent:'center', padding: 0, margin: 0, color: this.state.get_for == 'view'? "black" : "#5198ea" }} type="text" defaultValue={tableMeta.rowData[8]}
onBlur={(event) => handleChange(event.target.value, tableMeta, tableMeta.columnIndex)} />
</div>
// <div style={{ padding: 0, margin: 0 }}>
// <textarea disabled={this.state.get_for == 'view'} style={{ borderColor: 'white', width: 96, textAlign: 'center', justifyContent:'center', padding: 0, margin: 0, color: this.state.get_for == 'view'? "black" : "#5198ea" }} type="text" defaultValue={tableMeta.rowData[8]}
// onBlur={(event) => handleChange(event.target.value, tableMeta, tableMeta.columnIndex)} />
// </div>
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
disabled={tableMeta.rowData[0] == 8 || tableMeta.rowData[0] == 9 || this.state.get_for == 'view'? true : false}
defaultValue={tableMeta.rowData[8]}
// disabled={false}
multiline={true}
inputProps={{
style: {
color: this.state.get_for == 'view'? "black" : "#5198ea",
textAlign: 'center',
backgroundColor: 'white'
}
}}
/>
// <ThemeProvider theme={theme}>
// <Input
// disableUnderline={true}
// style={{color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginBottom: -105 }}
......@@ -3335,22 +3410,39 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null :
<ThemeProvider theme={theme}>
<Input
disableUnderline={true}
style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
disabled={this.state.get_for == 'view'? true : false}
defaultValue={tableMeta.rowData[45]}
onBlur={(event) => {
// // // console.log(event.target.value)
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta, 45)
// // // console.log(dataTable2)
// disabled={false}
multiline={true}
inputProps={{
style: {
color: this.state.get_for == 'view'? "black" : "#5198ea",
textAlign: 'center',
backgroundColor: 'white'
}
}}
/>
</ThemeProvider>
// <ThemeProvider theme={theme}>
// <Input
// disableUnderline={true}
// style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
// type="text"
// placeholder=""
// disabled={this.state.get_for == 'view'}
// defaultValue={tableMeta.rowData[45]}
// multin
// onBlur={(event) => {
// // // // console.log(event.target.value)
// // updateValue(event.target.value)
// handleChange(event.target.value, tableMeta, 45)
// // // // console.log(dataTable2)
// }}
// />
// </ThemeProvider>
}
</div>
)
......@@ -3585,7 +3677,10 @@ export default class ListOfCreditFacilities extends Component {
</MuiThemeProvider>}
</div>
<div style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingLeft: 15, paddingRight: 15, marginTop: 5}}>
<div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15, marginTop: 5}}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10 }}>Last Updated by : {this.state.updateBy}</Typography>
</div>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{padding: 5}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Total Outstanding Loan</Typography>
......@@ -3595,7 +3690,10 @@ export default class ListOfCreditFacilities extends Component {
</div>
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingLeft: 15, paddingRight: 15}}>
<div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15}}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10 }}>Notes : {this.state.notes}</Typography>
</div>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{padding: 5}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Diff</Typography>
......@@ -3605,6 +3703,26 @@ export default class ListOfCreditFacilities extends Component {
</div>
</div>
</div>
{/* <div style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingLeft: 15, paddingRight: 15, marginTop: 5}}>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{padding: 5}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Total Outstanding Loan</Typography>
</div>
<div style={{border: '1px solid black', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end'}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{formatSeparator(this.state.totalOutStand)}</Typography>
</div>
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingLeft: 15, paddingRight: 15}}>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{padding: 5}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Diff</Typography>
</div>
<div style={{borderStyle: 'solid', borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end'}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{formatSeparator(this.state.diff)}</Typography>
</div>
</div>
</div> */}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
......@@ -3752,7 +3870,34 @@ export default class ListOfCreditFacilities extends Component {
</MuiThemeProvider>}
</div>
<div style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingLeft: 15, paddingRight: 15, marginTop: 5}}>
<div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15, marginTop: 5}}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10 }}>Last Updated by : {this.state.updateBy}</Typography>
</div>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{padding: 5}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Total Outstanding Loan</Typography>
</div>
<div style={{border: '1px solid black', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end'}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{formatSeparator(this.state.totalOutStand)}</Typography>
</div>
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15}}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10 }}>Notes : {this.state.notes}</Typography>
</div>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{padding: 5}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Diff</Typography>
</div>
<div style={{borderStyle: 'solid', borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end'}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{formatSeparator(this.state.diff)}</Typography>
</div>
</div>
</div>
{/* <div style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingLeft: 15, paddingRight: 15, marginTop: 5}}>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{padding: 5}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Total Outstanding Loan</Typography>
......@@ -3771,7 +3916,7 @@ export default class ListOfCreditFacilities extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{(formatSeparator(this.state.diff))}</Typography>
</div>
</div>
</div>
</div> */}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
......
......@@ -49,12 +49,12 @@ export default class TaxPlanningMR extends Component {
editable: false,
judulColumn: null,
updateBy: '-',
notesUpdate: '-',
notesUpdate: "",
buttonDraft: true,
handleTekTekTek: 0,
saveDraft: true,
buttonError: true,
get_for: 'view'
get_for: "view"
}
this.fileHandler = this.fileHandler.bind(this);
......@@ -81,13 +81,27 @@ export default class TaxPlanningMR extends Component {
}
api.create().getAllSettingByType(body).then(response => {
// console.log(response);
if (response.data) {
if (response.data.status === 'success') {
this.setState({
minValue: response.data.data[0] ? response.data.data[0].min_value : null,
maxValue: response.data.data[0] ? response.data.data[0].max_value : null,
}, () => {
this.getItemHierarki()
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
......@@ -106,7 +120,7 @@ export default class TaxPlanningMR extends Component {
if (response.data.status === "success") {
this.setState({
updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update,
notesUpdate: response.data.data.notes_update === null ? '-' : response.data.data.notes_update
notesUpdate: response.data.data.notes_update === null ? "" : response.data.data.notes_update
})
}
}
......@@ -122,7 +136,7 @@ export default class TaxPlanningMR extends Component {
"company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId,
"months": this.props.month.month_id,
"get_for": "edit"
"get_for": this.state.get_for
}
api.create().getHierarkiMontlyReportTP(payload).then(response => {
console.log(response);
......@@ -443,7 +457,7 @@ export default class TaxPlanningMR extends Component {
}
}
})
this.setState({ loading: false, buttonError: errorContrl, editable: editAble, saveDraft: false })
// this.setState({ loading: false, buttonError: errorContrl, editable: editAble, saveDraft: false })
let i = this.state.dataTable
let payload = {
......@@ -455,29 +469,29 @@ export default class TaxPlanningMR extends Component {
"months": this.props.month.month_id,
"tax_planning": data
}
// api.create().validateSubmitReportMRTP(payload).then((response) => {
// console.log(response)
// if (response.data) {
// if (response.data.status === "success") {
// if (response.data.data.result) {
// this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
// } else {
// this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
// }
// } else {
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
// if (response.data.message.includes("Someone Logged In")) {
// setTimeout(() => {
// localStorage.removeItem(Constant.TOKEN)
// window.location.reload();
// }, 1000);
// }
// })
// }
// } else {
// this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
// }
// })
api.create().validateSubmitReportMRTP(payload).then((response) => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.result && errorContrl === false && editAble === false ) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
} else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
downloadTemplate = async () => {
......@@ -521,7 +535,7 @@ export default class TaxPlanningMR extends Component {
render() {
let dataTable2 = this.state.dataTable
const handleValueFormula = (value, tableMeta, dex, xntd, forecast, periode) => {
let form = dex === 1 ? tableMeta.rowData[6].tbc : dex === 2 ? tableMeta.rowData[6].fcp : tableMeta.rowData[6].tbf
let form = dex === 1 ? tableMeta.rowData[6].tbc : dex === 2 ? tableMeta.rowData[6].fcp : dex === 3 ? tableMeta.rowData[6].tbf : tableMeta.rowData[6].tbf
let splitFormula = String(form).split('@')
let baru = []
let anjay = []
......@@ -588,7 +602,7 @@ export default class TaxPlanningMR extends Component {
anjay.push(valuezz == "" ? 0 : valuezz)
}
} else {
let data = tableMeta.rowData[12]
let data = tableMeta.rowData[12] === null ? [] : tableMeta.rowData[12]
let indexID = data.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
if (indexID !== -1) {
let valuezz = data[indexID].value
......@@ -602,7 +616,7 @@ export default class TaxPlanningMR extends Component {
if (dataTable2[indexID][13] == tableMeta.rowData[13]) {
anjay.push(0)
} else {
let data = dex == 1 ? dataTable2[indexID][tableMeta.columnIndex].tbc : dex == 2 ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf
let data = dex == 1 ? dataTable2[indexID][tableMeta.columnIndex].tbc : dex == 2 ? dataTable2[indexID][tableMeta.columnIndex].fcp : dex == 3 ? dataTable2[indexID][tableMeta.columnIndex].tbf : dataTable2[indexID][tableMeta.columnIndex]
let valuezz = data.value == undefined ? data : data.value
anjay.push(valuezz == "" ? 0 : valuezz)
}
......@@ -704,7 +718,7 @@ export default class TaxPlanningMR extends Component {
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value = Number(total).toFixed(1)
}
} else {
} else if (dex == 3) {
if (tableMeta.rowData[8] == "Corporate Income Tax") {
if (total < 0) {
total = 0
......@@ -717,6 +731,12 @@ export default class TaxPlanningMR extends Component {
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value = Number(total).toFixed(1)
}
} else {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(1)
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = Number(total).toFixed(1)
}
}
return Number(total).toFixed(1)
......@@ -1106,15 +1126,6 @@ export default class TaxPlanningMR extends Component {
/>
</div>
:
// tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleTotal(tableMeta, 6)).toFixed(1)}
// />
tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 ?
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -1211,7 +1222,7 @@ export default class TaxPlanningMR extends Component {
type="text"
placeholder=""
disabled={true}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value).toFixed(2) : Number(value).toFixed(1)}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(tableMeta.rowData[16]).toFixed(2) : Number(tableMeta.rowData[16]).toFixed(1)}
/>
}
/>
......@@ -1230,8 +1241,8 @@ export default class TaxPlanningMR extends Component {
</span>
:
tableMeta.rowData[3] === 7 ?
// (Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
(Number(value).toFixed(1) >= Number(this.state.minValue) && Number(value).toFixed(1) <= Number(this.state.maxValue)) ?
(Number(handleValueFormula(value, tableMeta, 4)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 4)).toFixed(1) <= Number(this.state.maxValue)) ?
// (Number(value).toFixed(1) >= Number(this.state.minValue) && Number(value).toFixed(1) <= Number(this.state.maxValue)) ?
<NumberFormat
thousandSeparator={true}
style={{
......@@ -1324,7 +1335,7 @@ export default class TaxPlanningMR extends Component {
type="text"
placeholder=""
disabled={true}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value).toFixed(2) : Number(value).toFixed(1)}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(tableMeta.rowData[11]).toFixed(2) : Number(tableMeta.rowData[11]).toFixed(1)}
/>
}
/>
......@@ -1623,7 +1634,7 @@ export default class TaxPlanningMR extends Component {
// disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data incomplete', tipeAlert: 'warning' })
this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => {
......@@ -1743,7 +1754,7 @@ export default class TaxPlanningMR extends Component {
outline: 'none',
}}
onClick={() => this.state.editable === true ?
null
this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => {
......
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