$onsiteprocentage = $row['NETT_ONSITE'] / $row['TOTAL_WEIGHT']; $onsiteweight = $row['NETT_ONSITE']; //PREPARATION $prepqty = $row['QTY_PREPARATION']; $prepprocentage = $row['NETT_PREPARATION'] / $row['TOTAL_WEIGHT']; $prepweight = $row['NETT_PREPARATION']; //ERECTION $erecqty = $row['QTY_ERECTION']; $erectprocentage = $row['NETT_ERECTION'] / $row['TOTAL_WEIGHT']; $erectweight = $row['NETT_ERECTION']; //QC $qcqty = $row['QTY_QC']; $qcprocentage = $row['NETT_QC'] / $row['TOTAL_WEIGHT']; $qcweight = $row['NETT_QC']; //OVERALL PROGRESS $prosentaseakhir = hitungProsentase($onsiteprocentage, $prepprocentage, $erectprocentage, $qcprocentage); $totalakhir = $prosentaseakhir * $row['TOTAL_WEIGHT']; $objPHPExcel->setActiveSheetIndex(0)->setCellValue("B{$baris}", $no)->setCellValue("C{$baris}", "{$compType}")->setCellValue("D{$baris}", "{$totalQty}")->mergeCells("E{$baris}:F{$baris}")->setCellValue("E{$baris}", number_format($totalWeight, 2))->setCellValue("G{$baris}", "{$onsiteqty}")->setCellValue("H{$baris}", number_format($onsiteprocentage * 100, 2))->setCellValue("I{$baris}", number_format($onsiteweight, 2))->setCellValue("J{$baris}", "{$prepqty}")->setCellValue("K{$baris}", number_format($prepprocentage * 100, 2))->setCellValue("L{$baris}", number_format($prepweight, 2))->setCellValue("M{$baris}", "{$erecqty}")->setCellValue("N{$baris}", number_format($erectprocentage * 100, 2))->setCellValue("O{$baris}", number_format($erectweight, 2))->setCellValue("P{$baris}", "{$qcqty}")->setCellValue("Q{$baris}", number_format($qcprocentage * 100, 2))->setCellValue("R{$baris}", number_format($qcweight, 2))->setCellValue("S{$baris}", number_format($prosentaseakhir * 100, 2))->setCellValue("T{$baris}", number_format($totalakhir, 2)); $objPHPExcel->getActiveSheet()->getStyle("B{$baris}:T{$baris}")->applyFromArray($styleBorder); $objPHPExcel->getActiveSheet()->getStyle("B{$baris}:T{$baris}")->applyFromArray($styleDTNow); $overallprogresskg += $totalakhir; $baris++; $no++; } //FOOTER $objPHPExcel->setActiveSheetIndex(0)->mergeCells("B{$baris}:C{$baris}")->setCellValue("B{$baris}", 'TOTAL'); $footerSql = "SELECT \r\n SUM (TOTAL_QTY) QTY,\r\n SUM (QTY_ONSITE) QTY_ONSITE,\r\n SUM(QTY_PREPARATION) QTY_PREPARATION,\r\n SUM(QTY_ERECTION) QTY_ERECTION,\r\n SUM(QTY_QC) QTY_QC,\r\n SUM (NETT_ONSITE) ONSITE,\r\n SUM (NETT_PREPARATION) PREPARATION,\r\n SUM (NETT_ERECTION) ERECTION,\r\n SUM (NETT_QC) QC,\r\n SUM (TOTAL_WEIGHT) TOTAL\r\n FROM SITE_TIER_TWO_VW WHERE PROJECT_NAME = '{$buildingName}'"; //echo "$footerSql"; $footerParse = oci_parse($conn, $footerSql); oci_execute($footerParse); while ($row1 = oci_fetch_array($footerParse)) {
$prosentasevalueprogress1 = $totalakhir1 / $nettAll * 100; $totalLastweek += $prosentaseakhir1; } //PHYSICAL THIS WEEK $totalakhir2 = 0; $prosentaseakhir2 = 0; $prosentasevalueprogress2 = 0; $sqlThisWeek = "SELECT NVL(SUM (NETT_ONSITE),0) NETT_ONSITE, \r\n NVL(SUM(NETT_PREP) ,0) NETT_PREP, \r\n NVL(SUM(NETT_ERECT),0) NETT_ERECT, \r\n NVL(SUM(NETT_QC),0) NETT_QC, \r\n COMP_TYPE\r\n FROM VW_SHOW_DATA\r\n WHERE PROJECT_NAME = '{$projectName}'\r\n AND COMP_TYPE = '{$comp_type}'\r\n AND TO_DATE(UPD_DATE, 'DD MM YYYY') BETWEEN TO_DATE(SYSDATE, 'DD MM YYYY')-{$today} AND TO_DATE(SYSDATE, 'DD MM YYYY') + (6 - {$today})\r\n GROUP BY COMP_TYPE"; $parseThisWeek = oci_parse($conn, $sqlThisWeek); oci_execute($parseThisWeek); while ($row2 = oci_fetch_array($parseThisWeek)) { $persenOnsite = $row2['NETT_ONSITE'] / $totat_weight * 100; $persenPrep = $row2['NETT_PREP'] / $totat_weight * 100; $persenErection = $row2['NETT_ERECT'] / $totat_weight * 100; $persenQc = $row2['NETT_QC'] / $totat_weight * 100; $prosentaseakhir2 = hitungProsentase($persenOnsite, $persenPrep, $persenErection, $persenQc); $totalakhir2 = $prosentaseakhir2 * $totat_weight / 100; $prosentaseakhir2 = $totalakhir2 / $totat_weight * 100; $prosentasevalueprogress2 = $totalakhir2 / $nettAll * 100; $totalthisweek += $totalakhir2; } //PHYSICAL TO THIS WEEK $totalakhir3 = $totalakhir1 + $totalakhir2; $prosentaseakhir3 = $prosentaseakhir1 + $prosentaseakhir2; $prosentasevalueprogress3 = $prosentasevalueprogress1 + $prosentasevalueprogress2; $totaltothisweek = $totalLastweek + $totalthisweek; $objPHPExcel->setActiveSheetIndex(0)->mergeCells("B{$baris}:E{$baris}")->setCellValue("B{$baris}", " " . $comp_type)->setCellValue("F{$baris}", number_format($totat_weight, 2))->setCellValue("G{$baris}", number_format($prosentaseproject, 2) . " %")->setCellValue("H{$baris}", "")->setCellValue("I{$baris}", number_format($prosentaseakhir1, 2) . " %")->setCellValue("J{$baris}", number_format($prosentaseakhir2, 2) . " %")->setCellValue("K{$baris}", number_format($prosentaseakhir3, 2) . " %")->setCellValue("L{$baris}", number_format($prosentasevalueprogress1, 2) . " %")->setCellValue("M{$baris}", number_format($prosentasevalueprogress2, 2) . " %")->setCellValue("N{$baris}", number_format($prosentasevalueprogress3, 2) . " %"); $baris++; } $objPHPExcel->setActiveSheetIndex(0)->mergeCells("B{$baris}:E{$baris}")->setCellValue("B{$baris}", "SUB TOTAL")->setCellValue("F{$baris}", number_format($nettWeight, 2))->setCellValue("G{$baris}", number_format($procentNett, 2) . " %")->setCellValue("H{$baris}", "")->setCellValue("I{$baris}", number_format($physiscalLastWeek, 2) . " %")->setCellValue("J{$baris}", number_format($physiscalThisWeek, 2) . " %")->setCellValue("K{$baris}", number_format($phisyscaltothisweek, 2) . " %")->setCellValue("L{$baris}", number_format($valuelastweek, 2) . " %")->setCellValue("M{$baris}", number_format($valuethisweek, 2) . " %")->setCellValue("N{$baris}", number_format($valuetothisweek, 2) . " %"); $objPHPExcel->getActiveSheet()->getStyle("B{$baris}:N{$baris}")->applyFromArray($styleBold);