Ejemplo n.º 1
0
 public function onCloseMonth($sender, $param)
 {
     if (count($this->DataGrid->DataKeys) === 0) {
         $pBack = array('koMsg' => Prado::localize('Select one item'));
         $this->Response->redirect($this->Service->constructUrl('components.timuxuser.closemonth.closemonth', $pBack));
     }
     $cbs = $this->findControlsByType("TActiveCheckBox");
     if (count($cbs)) {
         $nDelete = 0;
         foreach ($cbs as $cb) {
             if ((bool) $cb->getChecked() && $cb->Value != "0") {
                 $employee = new employee($cb->Value);
                 $employee->closeMonth($this->FilterMonth->getSelectedValue(), $this->FilterYear->getSelectedValue());
                 $param = Prado::getApplication()->getParameters();
                 $computation2 = $param['computation2'];
                 if ($computation2 != '') {
                     Prado::using('horux.pages.components.timuxuser.' . $computation2);
                     if (class_exists($computation2)) {
                         $extendCloseMonth = new $computation2();
                         if ($extendCloseMonth) {
                             $extendCloseMonth->closeMonth($this->FilterMonth->getSelectedValue(), $this->FilterYear->getSelectedValue(), $employee);
                         }
                     }
                 }
             }
         }
         $pBack = array('okMsg' => Prado::localize('The month was closed'));
         $this->Response->redirect($this->Service->constructUrl('components.timuxuser.closemonth.closemonth', $pBack));
     } else {
         $pBack = array('koMsg' => Prado::localize('Select one item'));
         $this->Response->redirect($this->Service->constructUrl('components.timuxuser.closemonth.closemonth', $pBack));
     }
 }