public function dashboardAction() { try { $sessionNamespace = new Zend_Session_Namespace(); if ($sessionNamespace->loginAuth == true) { $authDetail = $sessionNamespace->authDetail; $oprType = $authDetail->getType(); $this->view->oprType = $oprType; $this->view->oprId = $authDetail->getId(); if ($oprType == 1) { /* $cMapper = new Gyuser_Model_OtherCavesDataMapper(); $cObj = new Gyuser_Model_OtherCaves(); $cObj->setId(1); $cList = $cMapper->GetCaveById($cObj); $this->view->cList = $cList; $sMapper = new Gyuser_Model_SupplierOperationsDataMapper(); $sList = $sMapper->GetAllSuppliers(); */ $pMapper = new Gyuser_Model_ProvidersDataMapper(); $this->view->pList = $pMapper->getProviders(); $cMapper = new Gyuser_Model_ChequesDataMapper(); $cObj = new Gyuser_Model_Cheques(); $cObj->setStatus(1); $this->view->ctAmount = $cMapper->GetTotalAmountByStats($cObj); $cObj->setStatus(4); $this->view->cpAmount = $cMapper->GetTotalAmountByStats($cObj); $sMapper = new Gyuser_Model_OperationsDataMapper(); $current_date = date('Y-m-d'); /*************************************** Operaciones widget values *****************************/ $this->view->CurrentMonthHalfCave = $sMapper->GetOperationsAmount(findFirstAndLastDay($current_date), true); $this->view->CurrentMonth = $sMapper->GetOperationsAmount(findFirstAndLastDay($current_date), true); $this->view->CurrentQuarter = $sMapper->GetOperationsAmount(findFirstAndLastDatesOfCurrentQuater($current_date), true); $this->view->CurrentSemester = $sMapper->GetOperationsAmount(findFirstAndLastDatesOfCurrentSemester($current_date), true); $this->view->CurrentYear = $sMapper->GetOperationsAmount(findFirstAndLastDatesOfCurrentYear($current_date), true); $this->view->PrevMonthToDate = $sMapper->GetOperationsAmount(prevFirstAndCurrentDay($current_date), true); $this->view->PrevQuaterToDate = $sMapper->GetOperationsAmount(findFirstAndLastCurrentDatesOfPrevQuater($current_date), true); $this->view->PrevSemesterToDate = $sMapper->GetOperationsAmount(findFirstAndLastCurrentDatesOfPrevSemester($current_date), true); $this->view->PrevYearToDate = $sMapper->GetOperationsAmount(findFirstAndLastCurrentDatesOfPrevYear($current_date), true); $PrevMonthTotal = $sMapper->GetOperationsAmount(findPrevMonthFirstAndLastDay($current_date), true, true); $PrevQuaterTotal = $sMapper->GetOperationsAmount(findFirstAndLastDatesOfPrevQuater($current_date), true, true); $PrevSemesterTotal = $sMapper->GetOperationsAmount(findFirstAndLastDatesOfPrevSemester($current_date), true, true); $PrevYearTotal = $sMapper->GetOperationsAmount(findFirstAndLastDatesOfPrevYear($current_date), true, true); $this->view->PrevMonthTotal = $PrevMonthTotal; $this->view->PrevQuaterTotal = $PrevQuaterTotal; $this->view->PrevSemesterTotal = $PrevSemesterTotal; $this->view->PrevYearTotal = $PrevYearTotal; $this->view->PrevMonthToDateAvg = $sMapper->GetOperationsAmountAvg(findPrevMonthFirstAndLastDay($current_date), findFirstAndLastDay($current_date), $PrevMonthTotal); $this->view->PrevQuaterToDateAvg = $sMapper->GetOperationsAmountAvg(findFirstAndLastDatesOfPrevQuater($current_date), findFirstAndLastDatesOfCurrentQuater($current_date), $PrevQuaterTotal); $this->view->PrevSemesterToDateAvg = $sMapper->GetOperationsAmountAvg(findFirstAndLastDatesOfPrevSemester($current_date), findFirstAndLastDatesOfCurrentSemester($current_date), $PrevSemesterTotal); $this->view->PrevYearToDateAvg = $sMapper->GetOperationsAmountAvg(findFirstAndLastDatesOfPrevYear($current_date), findFirstAndLastDatesOfCurrentYear($current_date), $PrevYearTotal); $OperationsAmountByPrevMonths = $sMapper->GetOperationsAmountByPrevMonths($current_date, 4); $this->view->OperationsAmountByPrevMonths = json_encode($OperationsAmountByPrevMonths, JSON_FORCE_OBJECT); /************************************ EOF Operaciones widget values ***********************************/ $AmounByPayedCheques = $cMapper->GetAmounByPayedCheques(); $AmounByPayedCheques0To30Days = $cMapper->GetAmounByPayedCheques0To30Days(); $AmounByPayedCheques30To60Days = $cMapper->GetAmounByPayedCheques30To60Days(); $AmounByPayedCheques60To90Days = $cMapper->GetAmounByPayedCheques60To90Days(); $AmounByPayedCheques120Days = $cMapper->GetAmounByPayedCheques120Days(); $this->view->AmounByPayedCheques = $AmounByPayedCheques; $this->view->AmounByPayedCheques0To30Days = $AmounByPayedCheques0To30Days; $this->view->AmounByPayedCheques30To60Days = $AmounByPayedCheques30To60Days; $this->view->AmounByPayedCheques60To90Days = $AmounByPayedCheques60To90Days; $this->view->AmounByPayedCheques120Days = $AmounByPayedCheques120Days; $AmounByChequesStatusAcredited = $cMapper->GetAmounByChequesStatusAcredited($current_date); $ChequeAmountByPrevMonths = $cMapper->GetChequeAmountByPrevMonths($current_date, 4); $this->view->AmounByChequesStatusAcredited = $AmounByChequesStatusAcredited; $this->view->ChequeAmountByPrevMonths = $ChequeAmountByPrevMonths; $RejectedChequesBalanceByCal = $cMapper->GetRejectedChequesBalanceByCal(); $PrecOfRejectedChequesByPassed = $cMapper->GetPrecOfRejectedChequesByPassed(); $RejectedChequesBalanceByCaves = $cMapper->getRejectedChequesBalance(); //GetRejectedChequesBalanceByCaves(); $RejectedChequesBalanceByCavesAndMonths = $cMapper->GetRejectedChequesBalanceByCavesAndMonths($current_date, 4); /* $AmounByPayedCheques0To30DaysByCaves = $cMapper->GetAmounByPayedCheques0To30DaysByCaves(); $AmounByPayedCheques30To60DaysByCaves = $cMapper->GetAmounByPayedCheques30To60DaysByCaves(); $AmounByPayedCheques60To90DaysByCaves = $cMapper->GetAmounByPayedCheques60To90DaysByCaves(); $AmounByPayedChequesAfter90DaysByCaves = $cMapper->GetAmounByPayedChequesAfter90DaysByCaves(); $this->view->AmounByPayedCheques0To30DaysByCaves = $AmounByPayedCheques0To30DaysByCaves; $this->view->AmounByPayedCheques30To60DaysByCaves = $AmounByPayedCheques30To60DaysByCaves; $this->view->AmounByPayedCheques60To90DaysByCaves = $AmounByPayedCheques60To90DaysByCaves; $this->view->AmounByPayedChequesAfter90DaysByCaves = $AmounByPayedChequesAfter90DaysByCaves; */ $this->view->amountsPassedByDates = $cMapper->getEachAmountPassedByDates(); $this->view->RejectedChequesBalanceByCal = $RejectedChequesBalanceByCal; $this->view->PrecOfRejectedChequesByPassed = $PrecOfRejectedChequesByPassed; $this->view->RejectedChequesBalanceByCaves = $RejectedChequesBalanceByCaves; $this->view->RejectedChequesBalanceByCavesAndMonths = $RejectedChequesBalanceByCavesAndMonths; } /* notification tasks starts */ $tasksModel = new Gyuser_Model_CRMTasks(); $this->view->myTasks = $tasksModel->getMyTasks(); //$this->view->pending = $tasksModel->getMyPendingTasks(); if ($oprType == 1) { $this->view->adminPending = $tasksModel->getMyPendingTasks(true); $this->view->adminMonitor = $tasksModel->getAdminMonitor(); $this->view->completedTasks = FALSE; } else { $this->view->adminPending = FALSE; $this->view->adminMonitor = FALSE; $this->view->completedTasks = $tasksModel->getCompletedTasks(); } $this->view->oprType = $oprType; /* notification tasks ends */ } else { $this->_helper->redirector('login', 'index', 'gyuser'); } } catch (Exception $e) { echo $e; } }
public function GetChequeAmountByPrevMonths($date, $monthCount) { $table = $this->getDbTable(); $result = array(); for ($i = 0; $i < $monthCount; $i++) { if (!$i) { $flDatesArr = findFirstAndLastDay($date); } else { $flDatesArr = findPrevMonthFirstAndLastDay($date); } $select = $table->select(); $select->setIntegrityCheck(false); $select->from(array('chk' => 'cheques'), array('amount')); $select->where('chk.status =?', 2); $select->where('chk.date >=?', $flDatesArr[0]); $select->where('chk.date <=?', $flDatesArr[1]); $resultSet = $table->fetchAll($select); $amount = 0; if ($resultSet) { foreach ($resultSet as $row) { $amount += $row->amount; } } $result[month_lang($flDatesArr[2])] = $amount; $date = $flDatesArr[0]; } return $result; }
$tglB2 = ''; foreach ($resPeriod as $row) { if ($param['jnsGaji'] == 'Harian') { isset($row['tanggalmulai']) ? $tglH1 = $row['tanggalmulai'] : ($tglH1 = ''); isset($row['tanggalsampai']) ? $tglH2 = $row['tanggalsampai'] : ($tglH2 = ''); } else { isset($row['tanggalmulai']) ? $tglB1 = $row['tanggalmulai'] : ($tglB1 = ''); isset($row['tanggalsampai']) ? $tglB2 = $row['tanggalsampai'] : ($tglB2 = ''); } } if ($tglB2 != '') { $dtTgl = $tglB2; } else { $dtTgl = $tglH2; } $tglTerakhir = findFirstAndLastDay($dtTgl); #======== Get Data Bulanan ============ if ($param['jnsGaji'] == 'Bulanan') { $cols1 = "karyawanid,namakaryawan,tipekaryawan,kodejabatan,subbagian,bagian,tanggalmasuk," . "COALESCE(ROUND(DATEDIFF('" . $tglAbis . "',tanggalmasuk)/365.25,3),0) as masakerja"; $where1 = "tipekaryawan in (1,2,3,6) and alokasi=0 and lokasitugas='" . $_SESSION['empl']['lokasitugas'] . "' and sistemgaji='" . $param['jnsGaji'] . "' and \r\n (tanggalkeluar>'" . $row['tanggalmulai'] . "' or tanggalkeluar='0000-00-00')"; $query1 = selectQuery($dbname, 'datakaryawan', $cols1, $where1); $resBln = fetchData($query1); } else { if ($param['jnsGaji'] == 'Harian') { #======== Get Data Harian ============ $cols2 = "karyawanid,namakaryawan,tipekaryawan,kodejabatan,subbagian,bagian,tanggalmasuk," . "COALESCE(ROUND(DATEDIFF('" . $tglAbis . "',tanggalmasuk)/365.25,3),0) as masakerja"; $where2 = "tipekaryawan in (1,2,3,6) and alokasi=0 and lokasitugas='" . $_SESSION['empl']['lokasitugas'] . "' and sistemgaji='" . $param['jnsGaji'] . "' and\r\n (tanggalkeluar>'" . $row['tanggalmulai'] . "' or tanggalkeluar='0000-00-00')"; $query2 = selectQuery($dbname, 'datakaryawan', $cols2, $where2); $resHrn = fetchData($query2); } }
public function GetOperationsAmountByPrevMonths($date, $monthCount) { $table = $this->getDbTable(); $result = array(); for ($i = 0; $i < $monthCount; $i++) { if (!$i) { $flDatesArr = findFirstAndLastDay($date); } else { $flDatesArr = findPrevMonthFirstAndLastDay($date); } $select = $table->select(); $select->setIntegrityCheck(false); $select->from(array('opr' => 'operations'), array('amount', 'cave_id')); $select->where('opr.state_order_id = 11 OR opr.state_order_id = 9 OR opr.state_order_id = 10 '); $select->where('opr.date >=?', $flDatesArr[0]); if (!$i) { $select->where('opr.date <?', $flDatesArr[1]); } else { $select->where('opr.date <=?', $flDatesArr[1]); } $resultSet = $table->fetchAll($select); $caveAmount = 0; $soloAmount = 0; if ($resultSet) { foreach ($resultSet as $row) { if ($row->cave_id) { $caveAmount += $row->amount / 2; } else { $soloAmount += $row->amount; } } } $result[month_lang($flDatesArr[2])] = array('cave' => $caveAmount, 'solo' => $soloAmount); $date = $flDatesArr[0]; } return $result; }