Commit f0ab7251 authored by rifkaki's avatar rifkaki

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

parents cda99427 27694341
...@@ -449,10 +449,12 @@ export default class BudgetTahunan extends Component { ...@@ -449,10 +449,12 @@ export default class BudgetTahunan extends Component {
options: periodeData, options: periodeData,
getOptionLabel: (option) => option.periode, getOptionLabel: (option) => option.periode,
}; };
let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod) let periode = (this.state.lastPeriod == "" ? String(Number(currentYear)) : this.state.lastPeriod)
let index = data.sort((a, b) => a - b).findIndex((val) => val === periode) let index = data.sort((a, b) => a - b).findIndex((val) => val === periode)
// // console.log(this.props.location.state.rawData) // // console.log(this.props.location.state.rawData)
// console.log(this.state.lastPeriod) console.log(this.state.lastPeriod)
console.log(periode)
console.log(index)
// console.log(periodeData) // console.log(periodeData)
// // // console.log(index) // // // console.log(index)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => { this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
...@@ -1158,7 +1160,8 @@ export default class BudgetTahunan extends Component { ...@@ -1158,7 +1160,8 @@ export default class BudgetTahunan extends Component {
item.order, item.order,
item.condition_it_should_be, item.condition_it_should_be,
item.condition_if_wrong, item.condition_if_wrong,
item.profit_detail.forecast_formula == null ? [] : item.profit_detail.forecast_formula item.profit_detail.forecast_formula == null ? [] : item.profit_detail.forecast_formula,
item.profit_detail.notes
]) ])
if (item.children !== null) { if (item.children !== null) {
...@@ -1196,7 +1199,8 @@ export default class BudgetTahunan extends Component { ...@@ -1196,7 +1199,8 @@ export default class BudgetTahunan extends Component {
item.order, item.order,
item.condition_it_should_be, item.condition_it_should_be,
item.condition_if_wrong, item.condition_if_wrong,
item.profit_detail.forecast_formula == null ? [] : item.profit_detail.forecast_formula item.profit_detail.forecast_formula == null ? [] : item.profit_detail.forecast_formula,
item.profit_detail.notes
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -1206,7 +1210,7 @@ export default class BudgetTahunan extends Component { ...@@ -1206,7 +1210,7 @@ export default class BudgetTahunan extends Component {
} }
} }
}) })
// console.log(dataTable) console.log(dataTable)
this.setState({ dbPL: dataTable, loading: false }, () => { this.setState({ dbPL: dataTable, loading: false }, () => {
this.olahDataPL(this.state.dbPL, type) this.olahDataPL(this.state.dbPL, type)
}) })
...@@ -1545,7 +1549,7 @@ export default class BudgetTahunan extends Component { ...@@ -1545,7 +1549,7 @@ export default class BudgetTahunan extends Component {
"total_current_year": String(item[19]), "total_current_year": String(item[19]),
"total_next_year": String(item[20] != ''? Number(item[20]).toFixed(1) : item[20]), "total_next_year": String(item[20] != ''? Number(item[20]).toFixed(1) : item[20]),
"total_more_year": String(item[21] != ''? Number(item[21]).toFixed(1) : item[21]), "total_more_year": String(item[21] != ''? Number(item[21]).toFixed(1) : item[21]),
"notes": "", "notes": String(item[26]),
} }
) )
......
...@@ -100,8 +100,13 @@ class HomePage extends Component { ...@@ -100,8 +100,13 @@ class HomePage extends Component {
options: MR, options: MR,
getOptionLabel: (option) => option.name, getOptionLabel: (option) => option.name,
}; };
// console.log(MR[MR.length - 1])
let dateNow = new Date()
dateNow.setMonth(dateNow.getMonth() - 1);
let yearNow = dateNow.getFullYear()
let indexMonthMR = MR.findIndex((val) => val.value == yearNow)
this.setState({listPeriodeMB: defaultPropsMB, periodeMB: MB[MB.length - 1], listPeriodeMR: defaultPropsMR, periodeMR: MR[MR.length - 1]}, () => { this.setState({listPeriodeMB: defaultPropsMB, periodeMB: MB[MB.length - 1], listPeriodeMR: defaultPropsMR, periodeMR: MR[indexMonthMR]}, () => {
this.getListUserSubcoMB() this.getListUserSubcoMB()
this.getListUserSubcoMR() this.getListUserSubcoMR()
}) })
...@@ -109,9 +114,10 @@ class HomePage extends Component { ...@@ -109,9 +114,10 @@ class HomePage extends Component {
getMonth() { getMonth() {
api.create().getMonthTransaction().then(response => { api.create().getMonthTransaction().then(response => {
let dateNow = new Date let dateNow = new Date()
dateNow.setMonth(dateNow.getMonth() - 1);
let month = format(dateNow, 'MMMM') let month = format(dateNow, 'MMMM')
console.log(response); // console.log(month);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
// console.log(response); // console.log(response);
...@@ -312,7 +318,7 @@ class HomePage extends Component { ...@@ -312,7 +318,7 @@ class HomePage extends Component {
let listDashboard = [] let listDashboard = []
let rawData = [] let rawData = []
api.create().getDashboard().then((response) => { api.create().getDashboard().then((response) => {
// console.log(response); console.log(response);
if (String(response.data.status).toLocaleLowerCase() == 'success') { if (String(response.data.status).toLocaleLowerCase() == 'success') {
let data = response.data.data let data = response.data.data
data.map((item, index) => { data.map((item, index) => {
...@@ -398,6 +404,14 @@ class HomePage extends Component { ...@@ -398,6 +404,14 @@ class HomePage extends Component {
} }
render() { render() {
const getDataMonth = (item) => {
let months = item.months
let dataMonth = this.state.listMonth.options
let indexID = dataMonth.findIndex((val) => val.month_id == months)
// console.log(dataMonth[indexID])
return dataMonth[indexID]
}
const columns = ["#", "ID", "Company", "Report Type", "Revision", const columns = ["#", "ID", "Company", "Report Type", "Revision",
{ {
name: "", name: "",
...@@ -416,7 +430,7 @@ class HomePage extends Component { ...@@ -416,7 +430,7 @@ class HomePage extends Component {
state: { state: {
userType: 'approver', userType: 'approver',
rawData: this.state.rawData[tableMeta.rowIndex], rawData: this.state.rawData[tableMeta.rowIndex],
month: String(tableMeta.rowData[3]).toLocaleLowerCase().includes("master") ? null : this.state.month month: String(tableMeta.rowData[3]).toLocaleLowerCase().includes("master") ? null : getDataMonth(this.state.rawData[tableMeta.rowIndex])
} }
}}> }}>
<button <button
......
...@@ -166,12 +166,17 @@ export default class SubHolding extends Component { ...@@ -166,12 +166,17 @@ export default class SubHolding extends Component {
getOptionLabel: (option) => option.periode, getOptionLabel: (option) => option.periode,
}; };
let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod) let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod)
let index = data.sort((a, b) => a - b).findIndex((val) => val === periode) let dateNow = new Date()
dateNow.setMonth(dateNow.getMonth() - 1);
let yearNow = dateNow.getFullYear()
console.log(yearNow)
console.log(periode)
let index = data.sort((a, b) => a - b).findIndex((val) => val == (String(this.state.report.label).toLocaleLowerCase().includes('summary') ? yearNow : periode))
// console.log(data) // console.log(data)
// console.log(this.state.latestPeriode) // console.log(this.state.latestPeriode)
// console.log(periodeData) // console.log(periodeData)
// console.log(index) console.log(index)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => { this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
// this.getDataTable() // this.getDataTable()
// this.getSubmission() // this.getSubmission()
...@@ -189,8 +194,9 @@ export default class SubHolding extends Component { ...@@ -189,8 +194,9 @@ export default class SubHolding extends Component {
getMonth() { getMonth() {
api.create().getMonthTransaction().then(response => { api.create().getMonthTransaction().then(response => {
let dateNow = new Date let dateNow = new Date()
let month = format(dateNow, 'MMMM') dateNow.setMonth(dateNow.getMonth() - 1);
let month = format(dateNow, 'MMMM')
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
...@@ -260,6 +266,20 @@ export default class SubHolding extends Component { ...@@ -260,6 +266,20 @@ export default class SubHolding extends Component {
} }
getReportType() { getReportType() {
console.log('sini deh')
let data = this.state.listPeriode.options
let currentYear = new Date().getFullYear()
let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod)
let dateNow = new Date()
dateNow.setMonth(dateNow.getMonth() - 1);
let yearNow = dateNow.getFullYear()
// console.log(data)
// console.log(yearNow)
// console.log(periode)
let index = data.sort((a, b) => a - b).findIndex((val) => val.periode == (String(this.state.report.label).toLocaleLowerCase().includes('summary') ? yearNow : periode))
// console.log(index)
this.setState({periode: data[index]})
let payload = { let payload = {
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
...@@ -832,7 +852,7 @@ export default class SubHolding extends Component { ...@@ -832,7 +852,7 @@ export default class SubHolding extends Component {
FRID = null FRID = null
} }
this.setState({ FRID }, () => { this.setState({ FRID }, () => {
let payloads = {...payload, submission_id: this.state.FRID, months: this.state.month.month_id, quarter: 0} let payloads = {...payload, report_id: 29, submission_id: this.state.FRID, months: this.state.month.month_id, quarter: 0}
api.create().getReportFR(payloads).then(response => { api.create().getReportFR(payloads).then(response => {
console.log(payload); console.log(payload);
console.log(response); console.log(response);
......
...@@ -307,7 +307,8 @@ export default class MonthlyReport extends Component { ...@@ -307,7 +307,8 @@ export default class MonthlyReport extends Component {
getMonth() { getMonth() {
api.create().getMonthTransaction().then(response => { api.create().getMonthTransaction().then(response => {
let dateNow = new Date let dateNow = new Date()
dateNow.setMonth(dateNow.getMonth() - 1);
let month = format(dateNow, 'MMMM') let month = format(dateNow, 'MMMM')
console.log(response); console.log(response);
if (response.data) { if (response.data) {
...@@ -402,11 +403,16 @@ export default class MonthlyReport extends Component { ...@@ -402,11 +403,16 @@ export default class MonthlyReport extends Component {
getOptionLabel: (option) => option.periode, getOptionLabel: (option) => option.periode,
}; };
let periode = (this.state.lastPeriod == "" ? String(Number(currentYear)) : this.state.lastPeriod === undefined ? String(Number(currentYear)) : this.state.lastPeriod) let periode = (this.state.lastPeriod == "" ? String(Number(currentYear)) : this.state.lastPeriod === undefined ? String(Number(currentYear)) : this.state.lastPeriod)
let index = data.sort((a, b) => a - b).findIndex((val) => val === periode) let dateNow = new Date()
dateNow.setMonth(dateNow.getMonth() - 1);
let yearNow = dateNow.getFullYear()
// let indexMonthMR = MR.findIndex((val) => val.value == yearNow)
// console.log(yearNow)
let index = data.sort((a, b) => a - b).findIndex((val) => val == yearNow)
// console.log(data) // console.log(data)
console.log(this.state.lastPeriod) // console.log(this.state.lastPeriod)
// console.log(periodeData) // console.log(periodeData)
console.log(index) // console.log(index)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => { this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
// if (this.state.isApprover === true && this.state.submittedOnly) { // if (this.state.isApprover === true && this.state.submittedOnly) {
this.getDetailUser() this.getDetailUser()
...@@ -1461,6 +1467,7 @@ export default class MonthlyReport extends Component { ...@@ -1461,6 +1467,7 @@ export default class MonthlyReport extends Component {
{ value: item.profit_detail.november, formula: item.profit_detail.november_formula } : { value: item.profit_detail.november, formula: item.profit_detail.november_formula } :
{ value: item.profit_detail.december, formula: item.profit_detail.december_formula }, { value: item.profit_detail.december, formula: item.profit_detail.december_formula },
item.order, item.order,
item.profit_detail.notes
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -1503,6 +1510,7 @@ export default class MonthlyReport extends Component { ...@@ -1503,6 +1510,7 @@ export default class MonthlyReport extends Component {
{ value: item.profit_detail.november, formula: item.profit_detail.november_formula } : { value: item.profit_detail.november, formula: item.profit_detail.november_formula } :
{ value: item.profit_detail.december, formula: item.profit_detail.december_formula }, { value: item.profit_detail.december, formula: item.profit_detail.december_formula },
item.order, item.order,
item.profit_detail.notes
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -1762,12 +1770,14 @@ export default class MonthlyReport extends Component { ...@@ -1762,12 +1770,14 @@ export default class MonthlyReport extends Component {
item[6].value = this.handleValueFormulaDBPLMR(item[6],item,6) item[6].value = this.handleValueFormulaDBPLMR(item[6],item,6)
listPL.push({ listPL.push({
"item_report_id": item[1], "item_report_id": item[1],
"actual": item[0] == 1? "" : Number(item[6].value).toFixed(1) "actual": item[0] == 1? "" : Number(item[6].value).toFixed(1),
"notes": item[8]
}) })
} else { } else {
listPL.push({ listPL.push({
"item_report_id": item[1], "item_report_id": item[1],
"actual": item[0] == 1? "" : Number(item[6].value).toFixed(1) "actual": item[0] == 1? "" : Number(item[6].value).toFixed(1),
"notes": item[8]
}) })
} }
......
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