function Footer()
 {
     $this->SetY(-13);
     $this->SetFont('helvetica', 'I', 7);
     $this->Cell(98, 5, utf8_decode("Fecha Impresión " . Date::today()), 0, 0, 'L');
     $this->Cell(98, 5, utf8_decode('Página') . $this->PageNo() . '/{nb}', 0, 0, 'R');
 }
 /**
  * Parse the input string and set our elements based on the contents of the
  * input string. Elements not found in the string will be null.
  * 
  * @return void
  * @access private
  * @since 5/24/05
  */
 function parse()
 {
     $term = trim(strtolower($this->input));
     if (in_array($term, $this->nowArray())) {
         $timespan = Timespan::current();
     } else {
         if (in_array($term, $this->todayArray())) {
             $timespan = Date::today();
         } else {
             if (in_array($term, $this->tomorrowArray())) {
                 $timespan = Date::tomorrow();
             } else {
                 if (in_array($term, $this->yesterdayArray())) {
                     $timespan = Date::yesterday();
                 }
             }
         }
     }
     $dateAndTime = $timespan->start();
     $offset = $dateAndTime->offset();
     $this->setYear($dateAndTime->year());
     $this->setMonth($dateAndTime->month());
     $this->setDay($dateAndTime->dayOfMonth());
     $this->setHour($dateAndTime->hour());
     $this->setMinute($dateAndTime->minute());
     $this->setSecond($dateAndTime->second());
     $this->setOffsetHour($offset->hours());
     $this->setOffsetMinute($offset->minutes());
     $this->setOffsetSecond($offset->seconds());
 }
 /**
  * Test the methods.
  */
 function test_today()
 {
     $parser = new KeywordStringParser('today');
     $this->assertTrue($parser->canHandle());
     $date = Date::today();
     $dateAndTime = $date->start();
     $offset = $dateAndTime->offset();
     $this->assertEqual($parser->year(), $dateAndTime->year());
     $this->assertEqual($parser->month(), $dateAndTime->month());
     $this->assertEqual($parser->day(), $dateAndTime->dayOfMonth());
     $this->assertEqual($parser->hour(), 0);
     $this->assertEqual($parser->minute(), 0);
     $this->assertEqual($parser->second(), 0);
     $this->assertEqual($parser->offsetHour(), $offset->hours());
     $this->assertEqual($parser->offsetMinute(), $offset->minutes());
     $this->assertEqual($parser->offsetSecond(), $offset->seconds());
 }
Esempio n. 4
0
 function grabarUsuario()
 {
     header('Content-Type: application/json');
     if ($_POST['id_personal'] == '') {
         $error['id'] = 0;
         $error['mensaje'] = "Seleccione al personal";
         echo json_encode($error);
     } else {
         if ($_POST['nom_usuario'] == '') {
             $error['id'] = 0;
             $error['mensaje'] = "Ingrese un nombre de usuario valido";
             echo json_encode($error);
         } else {
             if ($_POST['password'] == '') {
                 $error['id'] = 0;
                 $error['mensaje'] = "Ingrese una Contraseña";
                 echo json_encode($error);
             } else {
                 $funcion = new funciones();
                 Session::init();
                 $dataUsuario['id_usuario'] = $funcion->model->getLastID('s_usuario', 5);
                 $dataUsuario['id_personal'] = $_POST['id_personal'];
                 $dataUsuario['nom_usuario'] = $_POST['nom_usuario'];
                 $dataUsuario['password'] = Hash::create(ALGO, $_POST["password"], HASH_KEY);
                 $dataUsuario['id_estado'] = '01';
                 $dataUsuario['id_usuario_crea'] = Session::getValue('ID');
                 $dataUsuario['fecha_crea'] = Date::invertDate2(Date::today()) . ' ' . Date::now();
                 if ($this->model->grabarUsuario($dataUsuario)) {
                     echo 1;
                 } else {
                     $error['id'] = 0;
                     $error['mensaje'] = "No se registró";
                     echo json_encode($error);
                 }
             }
         }
     }
 }
Esempio n. 5
0
 /**
  * Answer a Date that represents this object
  * 
  * @return object Date
  * @access public
  * @since 5/5/05
  */
 function asDate()
 {
     $obj = Date::today();
     return $obj;
 }
Esempio n. 6
0
 function grabarAsistencia()
 {
     Session::init();
     if (sizeof($this->model->listarAsistencias("where t1.fecha='" . Date::invertDate2(Date::today()) . "' and t1.id_personal='" . $_POST['personal'] . "' and tipo_asistencia='01' ")) > 0) {
         header("location: " . URL . "personal/asistencia");
     } else {
         if (sizeof($this->model->listarAsistencias("where t1.fecha='" . Date::invertDate2(Date::today()) . "' and t1.id_personal='" . $_POST['personal'] . "' and tipo_asistencia='00' ")) > 0) {
             $data['tipo_asistencia'] = '01';
         }
         $funcion = new funciones();
         $data['id_asistencia'] = $funcion->model->getLastID('r_asistencia', 5);
         $data['id_personal'] = $_POST['personal'];
         $data['hora'] = Date::now();
         $data['fecha'] = Date::invertDate2(Date::today());
         $data['id_usuario_crea'] = Session::getValue('ID');
         $this->model->grabarAsistencia($data);
         $periodo = new periodo();
         $sem = $periodo->model->listarPeriodo(" where fin_periodo >= '" . $data['fecha'] . "' and  inicio_periodo <= '" . $data['fecha'] . "' and id_periodo >'2015200'")[0];
         $inicio = $sem['inicio_periodo'];
         $fin = $sem['fin_periodo'];
         if (sizeof($this->model->asistenciaPersonal($_POST['personal'], " and t1.fecha BETWEEN '{$inicio}' AND '{$fin}' ")) == 6) {
             $dataDom['id_asistencia'] = $funcion->model->getLastID('r_asistencia', 5);
             $dataDom['id_personal'] = $_POST['personal'];
             $dataDom['tipo_asistencia'] = '00';
             $dataDom['hora'] = '09:00:00';
             $dataDom['fecha'] = $fin;
             $dataDom['id_usuario_crea'] = Session::getValue('ID');
             $this->model->grabarAsistencia($dataDom);
             $dataDom['id_asistencia'] = $funcion->model->getLastID('r_asistencia', 5);
             $dataDom['id_personal'] = $_POST['personal'];
             $dataDom['tipo_asistencia'] = '01';
             $dataDom['hora'] = '18:00:00';
             $dataDom['fecha'] = $fin;
             $dataDom['id_usuario_crea'] = Session::getValue('ID');
             $this->model->grabarAsistencia($dataDom);
         }
         header("location: " . URL . "Personal/asistencia");
     }
 }
Esempio n. 7
0
 /**
  * Test converting methods
  * 
  */
 function test_converting()
 {
     $time = Time::withHourMinuteSecond(15, 25, 10);
     // asDate ()
     $temp = $time->asDate();
     $this->assertTrue($temp->isEqualTo(Date::today()));
     $this->assertEqual(strtolower(get_class($temp)), 'date');
     // asDateAndTime ()
     $temp = $time->asDateAndTime();
     $comparison = DateAndTime::midnight();
     $comparison = $comparison->plus(Duration::withSeconds(55510));
     $this->assertTrue($temp->isEqualTo($comparison));
     $this->assertEqual(strtolower(get_class($temp)), 'dateandtime');
     // asDuration ()
     $temp = $time->asDuration();
     $this->assertTrue($temp->isEqualTo(Duration::withSeconds(55510)));
     $this->assertEqual(strtolower(get_class($temp)), 'duration');
     // asMonth ()
     $temp = $time->asMonth();
     $this->assertTrue($temp->isEqualTo(Month::starting(Date::today())));
     $this->assertEqual(strtolower(get_class($temp)), 'month');
     // asSeconds ()
     $this->assertEqual($time->asSeconds(), 55510);
     // asTime ()
     $temp = $time->asTime();
     $this->assertTrue($temp->isEqualTo($time));
     $this->assertEqual(strtolower(get_class($temp)), 'time');
     // asTimeStamp ()
     $temp = $time->asTimeStamp();
     $comparison = TimeStamp::midnight();
     $comparison = $comparison->plus(Duration::withSeconds(55510));
     $this->assertTrue($temp->isEqualTo($comparison));
     $this->assertEqual(strtolower(get_class($temp)), 'timestamp');
     // asWeek ()
     $temp = $time->asWeek();
     $this->assertTrue($temp->isEqualTo(Week::starting(Date::today())));
     $this->assertEqual(strtolower(get_class($temp)), 'week');
     // asYear ()
     $temp = $time->asYear();
     $this->assertTrue($temp->isEqualTo(Year::starting(Date::today())));
     $this->assertEqual(strtolower(get_class($temp)), 'year');
     // to ()
     $today = DateAndTime::today();
     $tomorrow = DateAndTime::tomorrow();
     $result = $time->to($tomorrow);
     $this->assertEqual(strtolower(get_class($result)), 'timespan');
     $this->assertTrue($result->isEqualTo(Timespan::startingDuration($today->plus(Duration::withSeconds(55510)), Duration::withDaysHoursMinutesSeconds(0, 8, 34, 50))));
     $result = $time->to(Time::withHourMinuteSecond(23, 25, 10));
     $this->assertEqual(strtolower(get_class($result)), 'timespan');
     $this->assertTrue($result->isEqualTo(Timespan::startingDuration($today->plus(Duration::withSeconds(55510)), Duration::withDaysHoursMinutesSeconds(0, 8, 0, 0))));
 }
Esempio n. 8
0
                                        <div class="form-group">
                                            <div class="col-md-9 col-sm-9 col-xs-12 col-md-offset-1">
                                               <button type="button" onclick="window.location.href='<?php 
echo URL;
?>
Personal'" class="btn btn-default">Regresar</button>
                                               <button id="send" type="submit" class="btn btn-success">Grabar</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                             <div class="x_panel">
                                <div class="x_title">
                                    <h2>Lista de Asistencias al <?php 
echo Date::today();
?>
</h2>                                    
                                    <div class="clearfix"></div>
                                </div>
                                <div class="x_content">
                                    <?php 
include 'list/personal_asistencia_list.php';
?>
                                </div>
                            </div>
                        </div>                    
                    </div>
                <!-- /page content -->
                <!-- footer content -->
                <?php 
Esempio n. 9
0
 function cambiarEstadoUsuario()
 {
     Session::init();
     $bono = new bono();
     $data['id_estado'] = $_REQUEST['opc'];
     $data['id_usuario_mod'] = Session::getValue('ID');
     $data['fecha_mod'] = Date::invertDate2(Date::today()) . ' ' . Date::now();
     $bono->model->modificarBono($data, $_REQUEST['id']);
     header("location: " . URL . "Mantenimiento/bono");
 }
 /**
  * testPublish method
  *
  * @return void
  */
 public function testPublishWithDate()
 {
     $this->Product->Behaviors->attach('Utils.Publishable', array('field' => 'published', 'field_date' => 'publish_date', 'find' => true));
     Configure::write('Publishable.disable', false);
     $this->Product->id = 3;
     $this->assertEqual($this->Product->publish(3), true);
     sleep(6);
     $date = new Date(strtotime('2010-10-17 00:00:00'));
     $this->assertTrue($this->Product->field('published'));
     echo $date->today();
     $this->assertEquals($this->Product->field('publish_date'), $date->today());
     $this->Product->Behaviors->detach('Utils.Publishable');
     debug($this->Product->findById(3));
     //$this->assertNull($this->Product->field('publish_date'));
 }
Esempio n. 11
0
 function grabarDescuento()
 {
     header('Content-Type: application/json');
     Session::init();
     if ($_POST['id_planilla'] == '') {
         $error['id'] = 0;
         $error['mensaje'] = "No se seleccionó la planilla";
         echo json_encode($error);
     } else {
         if ($_POST['id_personal'] == '') {
             $error['id'] = 0;
             $error['mensaje'] = "No se seleccionó el personal";
             echo json_encode($error);
         } else {
             if ($_POST['id_descuento'] == '') {
                 $error['id'] = 0;
                 $error['mensaje'] = "No se seleccionó el concepto";
                 echo json_encode($error);
             } else {
                 if ($_POST['monto_descuento'] == '') {
                     $error['id'] = 0;
                     $error['mensaje'] = "No se seleccionó el monto";
                     echo json_encode($error);
                 } else {
                     $personal = new personal();
                     $planillaData = $this->model->listarPlanilla(" where t1.id_planilla = '" . $_POST['id_planilla'] . "' ")[0];
                     $inicio = $planillaData['inicio_periodo'];
                     $fin = $planillaData['fin_periodo'];
                     $p = $personal->model->listarPersonal(" where t1.id_personal='" . $_POST['id_personal'] . "' and t1.fecha_ingreso<'{$inicio}'");
                     if (sizeof($p) > 0) {
                         $funcion = new funciones();
                         $data['nro'] = $funcion->model->getLastNum('r_planilla_det_descuento', 'nro', " where id_planilla='" . $_POST['id_planilla'] . "' and id_personal='" . $_POST['id_personal'] . "' and id_descuento='" . $_POST['id_descuento'] . "' ");
                         $data['id_planilla'] = $_POST['id_planilla'];
                         $data['id_personal'] = $_POST['id_personal'];
                         $data['id_descuento'] = $_POST['id_descuento'];
                         $data['detalle_descuento'] = $_POST['detalle_descuento'];
                         $data['monto_descuento'] = $_POST['monto_descuento'];
                         $data['id_usuario_crea'] = Session::getValue('ID');
                         $data['fecha_crea'] = Date::invertDate2(Date::today()) . ' ' . Date::now();
                         $this->model->grabarPlanillaDetDescuento($data);
                         echo 1;
                     } else {
                         $error['id'] = 0;
                         $error['mensaje'] = "El personal no laboraba en esa fecha";
                         echo json_encode($error);
                     }
                 }
             }
         }
     }
 }