Пример #1
0
 function date_add($isodate, $days, $months = 0, $years = 0)
 {
     $tms = timestampFromDBDate($date);
     $datearr = getdate($tms);
     $day = $datearr["mday"] + $days;
     $month = $datearr["mon"] + $months;
     $year = $datearr["year"] + $years;
     $newtms = mktime(0, 0, 0, $month, $day, $year);
     return dbDateFromTimestamp($newtms);
 }
Пример #2
0
 function cajerostatus($scaj)
 {
     $dbscaj = $this->CI->db->escape($scaj);
     $rcaj = trim($this->CI->datasis->dameval("SELECT tipo FROM rcaj WHERE fecha=CURDATE() AND cajero={$dbscaj}"));
     if (!empty($rcaj)) {
         $this->set_message('cajerostatus', "Ya hay un procedimiento de cierre para el cajero {$scaj}");
         return false;
     }
     $mSQL = "SELECT fechac,status FROM scaj WHERE cajero={$dbscaj}";
     $query = $this->CI->db->query($mSQL);
     if ($query->num_rows() > 0) {
         $this->set_message('cajerostatus', "El cajero {$scaj} ya fue cerrado para esta fecha");
         $row = $query->row();
         if ($row->status == 'C') {
             $tmc = timestampFromDBDate($row->fechac);
             //momento de cierre
             $tmt = mktime(0, 0, 0);
             if ($tmt > $tmc) {
                 //Chequea si lo puede abrir
                 $data = array('fechaa' => date('Ymd'), 'horaa' => date('H:i:s'), 'status' => 'A');
                 $mSQL_2 = $this->CI->db->update_string('scaj', $data, "cajero={$dbscaj}");
                 $rt = $this->CI->db->simple_query($mSQL_2);
                 return $rt;
             } else {
                 return false;
             }
         } else {
             return true;
         }
     } else {
         $this->set_message('cajerostatus', "Cajero inexistente {$scaj}");
         return false;
     }
 }