Browse Source

update report analysis

pull/1/head
wahyu 1 year ago
parent
commit
441bc316b3
  1. 26
      src/views/SimproV2/CreatedProyek/ReportAnalysis.js

26
src/views/SimproV2/CreatedProyek/ReportAnalysis.js

@ -21,6 +21,8 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
const [openDialogFormAnalysis, setOpenDialogFormAnalysis] = useState(false); const [openDialogFormAnalysis, setOpenDialogFormAnalysis] = useState(false);
const [dataDetail, setDataDetail] = useState(null); const [dataDetail, setDataDetail] = useState(null);
const [avgActivityHr, setAvgActivityHr] = useState(0); const [avgActivityHr, setAvgActivityHr] = useState(0);
const [sumVolPlan, setSumVolPlan] = useState(0);
const [sumVolAct, setSumVolAct] = useState(0);
const [avgActivity, setAvgActivity] = useState(0); const [avgActivity, setAvgActivity] = useState(0);
const [dataTable, setDatatable] = useState([]); const [dataTable, setDatatable] = useState([]);
const [dataTableActivityToHr, setDataTableActivityToHr] = useState([]); const [dataTableActivityToHr, setDataTableActivityToHr] = useState([]);
@ -57,6 +59,20 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
const columns = [ const columns = [
{title: "Gantt", dataIndex: "name_version", key: "name_version"}, {title: "Gantt", dataIndex: "name_version", key: "name_version"},
{title: "Start Date", dataIndex: "start_date", key: "start_date",
render: (text, record) => (
<>
{moment(record.start_date).format("DD-MM-YYYY")}
</>
),
},
{title: "End Date", dataIndex: "end_date", key: "end_date",
render: (text, record) => (
<>
{moment(record.end_date).format("DD-MM-YYYY")}
</>
),
},
{title: "Assign HR", dataIndex: "user_name", key: "user_name"}, {title: "Assign HR", dataIndex: "user_name", key: "user_name"},
{title: "Volume Plan", dataIndex: "qty_planning", key: "qty_planning", {title: "Volume Plan", dataIndex: "qty_planning", key: "qty_planning",
render: (text, record) => render: (text, record) =>
@ -352,8 +368,12 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
const getDataActivity = async () => { const getDataActivity = async () => {
setAvgActivity(0); setAvgActivity(0);
setSumVolPlan(0);
setSumVolAct(0);
setDatatable([]); setDatatable([]);
let sum = 0; let sum = 0;
let sumPlan = 0;
let sumAct = 0;
const payload = { const payload = {
columns: [ columns: [
{ {
@ -383,8 +403,12 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
dataRes.forEach(element => { dataRes.forEach(element => {
element.persentase_progress ? sum += parseInt(element.persentase_progress) : sum += 0; element.persentase_progress ? sum += parseInt(element.persentase_progress) : sum += 0;
element.qty_planning ? sumPlan += parseInt(element.qty_planning) : sumPlan += 0;
element.qty ? sumAct += parseInt(element.qty) : sumAct += 0;
}); });
setAvgActivity(sum / dataRes.length); setAvgActivity(sum / dataRes.length);
setSumVolPlan(sumPlan);
setSumVolAct(sumAct);
setDatatable(dataRes); setDatatable(dataRes);
} else { } else {
NotificationManager.error("Gagal Mengambil Data!!", "Failed"); NotificationManager.error("Gagal Mengambil Data!!", "Failed");
@ -438,7 +462,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
<div style={{ textAlign: 'center' }}> <div style={{ textAlign: 'center' }}>
<h1> <h1>
{ {
search && avgActivity ? `Activity ${search} adalah ${avgActivity.toFixed(2)} %` : null search ? `Activity ${search} Plan : ${sumVolPlan ? sumVolPlan.toFixed(0) : 0}, Actual : ${sumVolAct ? sumVolAct.toFixed(0) : 0}` : null
} }
</h1> </h1>
</div> </div>

Loading…
Cancel
Save