����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����
Server IP : 74.208.127.88 / Your IP : 3.128.190.205 Web Server : Apache/2.4.41 (Ubuntu) System : Linux ubuntu 5.4.0-163-generic #180-Ubuntu SMP Tue Sep 5 13:21:23 UTC 2023 x86_64 User : www-data ( 33) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/t/sae/appsae/core/app/model/ |
Upload File : |
<?php class SpendGData { public static $tablename = "spendg"; public function SpendGData(){ $this->name = ""; $this->price_in = ""; $this->price = ""; $this->unit = ""; $this->person_id = ""; $this->type_spend_id = ""; $this->id_dev = ""; $this->presentation = "0"; $this->created_at = "NOW()"; } public function getCategory(){ return SpendGData::getById($this->category_id);} public function add1(){ $sql = "insert into spendg (name,price,type_spend_id,f_pago ,created_at)"; $sql .= "value (\"$this->name\",$this->price,$this->type_spend_id,$this->f_pago ,$this->created_at)"; Executor::doit($sql); } public function add(){ $sql = "insert into spend (name,price,created_at,id_dev)"; $sql .= "value (\"$this->name\",$this->price,$this->created_at, $this->id_dev)"; Executor::doit($sql); } public static function delById($id){ $sql = "delete from ".self::$tablename." where id=$id"; Executor::doit($sql); } public function del(){ $sql = "delete from ".self::$tablename." where id=$this->id"; Executor::doit($sql); } // partiendo de que ya tenemos creado un objecto CategoryData previamente utilizamos el contexto public function update(){ $sql = "update ".self::$tablename." set name=\"$this->name\",price=$this->price where id=$this->id"; Executor::doit($sql); } public function update_box(){ $sql = "update ".self::$tablename." set box_id=$this->box_id where box_id is NULL"; Executor::doit($sql); } public function del_category(){ $sql = "update ".self::$tablename." set category_id=NULL where id=$this->id"; Executor::doit($sql); } public function update_image(){ $sql = "update ".self::$tablename." set image=\"$this->image\" where id=$this->id"; Executor::doit($sql); } public static function getById($id){ $sql = "select * from ".self::$tablename." where id=$id"; $query = Executor::doit($sql); return Model::one($query[0],new SpendGData()); } public static function getAll(){ $sql = "select * from ".self::$tablename." order by created_at "; $query = Executor::doit($sql); return Model::many($query[0],new SpendGData()); } public static function getAllUnBoxed(){ $sql = "select * from ".self::$tablename." where box_id is null order by created_at desc "; $query = Executor::doit($sql); return Model::many($query[0],new SpendGData()); } //GASTOS DEL DIA public static function getAllDay(){ $sql = "select SUM(price) as suma from ".self::$tablename." where date(created_at) = CURDATE() and box_id is null"; $query = Executor::doit($sql); return Model::many($query[0],new SpendGData()); } //GASTOS TOTALES PERO QUE NO SE HECHO CORTE //SELECT SUM(`price`) AS total FROM `spendg` WHERE `box_id` is NULL public static function getAllDayBOX(){ $sql = "select SUM(price) as suma from ".self::$tablename." where box_id is null"; $query = Executor::doit($sql); return Model::many($query[0],new SpendGData()); } public static function getAllDev(){ $sql = "select * from ".self::$tablename." where id_dev > 0 order by created_at desc"; $query = Executor::doit($sql); return Model::many($query[0],new SpendGData()); } public static function getAllByPage($start_from,$limit){ $sql = "select * from ".self::$tablename." where id>=$start_from limit $limit"; $query = Executor::doit($sql); return Model::many($query[0],new SpendGData()); } public static function getLike($p){ $sql = "select * from ".self::$tablename." where barcode like '%$p%' or name like '%$p%' or id like '%$p%'"; $query = Executor::doit($sql); return Model::many($query[0],new SpendGData()); } public static function getAllByUserId($user_id){ $sql = "select * from ".self::$tablename." where user_id=$user_id order by created_at desc"; $query = Executor::doit($sql); return Model::many($query[0],new SpendGData()); } public static function getAllByCategoryId($category_id){ $sql = "select * from ".self::$tablename." where category_id=$category_id order by created_at desc"; $query = Executor::doit($sql); return Model::many($query[0],new SpendGData()); } public static function getAllByDateDev($start,$end){ $sql = "select * from ".self::$tablename." where (date(created_at)>=\"$start\" and date(created_at)<=\"$end\") and id_dev > 0 order by created_at desc"; $query = Executor::doit($sql); return Model::many($query[0],new SpendGData()); } //gatos totales por rango fecha public static function getGroupByDateOp($start,$end){ $sql = "select sum(price) as t from ".self::$tablename." where date(created_at) >= \"$start\" and date(created_at) <= \"$end\" GROUP BY created_at"; $query = Executor::doit($sql); return Model::many($query[0],new SpendGData()); } //SELECT SUM(`price`) AS t FROM `spendg` WHERE date(`created_at`) = "2024/11/12" public static function getByDateOp($start){ $sql = "SELECT SUM(`price`) AS t FROM `spendg` WHERE date(`created_at`) = \"$start\" "; $query = Executor::doit($sql); return Model::many($query[0],new SpendGData()); } } ?>