����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����
Server IP : 74.208.127.88 / Your IP : 3.140.254.100 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 SpendData { public static $tablename = "spend"; public function SpendData(){ $this->name = ""; $this->price_in = ""; $this->price_out = ""; $this->unit = ""; $this->user_id = ""; $this->f_pago = ""; $this->id_dev = ""; $this->presentation = "0"; $this->created_at = "NOW()"; } public function getCategory(){ return SpendData::getById($this->category_id);} public function add1(){ $sql = "insert into spend (name,price,created_at)"; $sql .= "value (\"$this->name\",$this->price,$this->created_at)"; Executor::doit($sql); } public function add(){ $sql = "insert into spend (q,name,price,created_at,id_dev,f_pago,id_seller)"; $sql .= "value (\"$this->q\",\"$this->name\",$this->price,$this->created_at, $this->id_dev,$this->f_pago,$this->id_seller)"; 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($id){ $sql = "update ".self::$tablename." set box_id=$this->box_id where id_d=$id"; 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 SpendData()); } public static function getById_dev($id){ $sql = "select * from ".self::$tablename." where id_dev=$id"; $query = Executor::doit($sql); return Model::many($query[0],new SpendData()); } public static function getAllDay(){ $sql = "select SUM(price) as suma from ".self::$tablename." WHERE date(created_at) = CURDATE() order by created_at "; $query = Executor::doit($sql); return Model::many($query[0],new SpendData()); } public static function getAll(){ $sql = "select * from ".self::$tablename." order by created_at "; $query = Executor::doit($sql); return Model::many($query[0],new SpendData()); } public static function getAllSpends($id){ $sql = "select * from ".self::$tablename." where box_id is NULL and id_seller = '$id' order by created_at "; $query = Executor::doit($sql); return Model::many($query[0],new SpendData()); } public static function getAllUnBoxed(){ $sql = "select * from spend order a by created_at desc"; $query = Executor::doit($sql); return Model::many($query[0],new SpendData()); } public static function getAllDev(){ $sql = "select * from ".self::$tablename." where id_dev > 0 order by created_at asc"; $query = Executor::doit($sql); return Model::many($query[0],new SpendData()); } 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 SpendData()); } 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 SpendData()); } 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 SpendData()); } 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 SpendData()); } 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 SpendData()); } public static function getGroupByDateOp($start,$end){ $sql = "select *from ".self::$tablename." where date(created_at) >= \"$start\" and date(created_at) <= \"$end\""; $query = Executor::doit($sql); return Model::many($query[0],new SpendData()); } public static function getGroupByDateOp2($id,$start,$end){ $sql = "select * from ".self::$tablename." where date(created_at) >= \"$start\" and date(created_at) <= \"$end\" and id_seller=$id and id_dev > 0 order by created_at desc"; $query = Executor::doit($sql); return Model::many($query[0],new SpendData()); } public static function getGroupByid($id){ $sql = "select *,sum(price) as t from ".self::$tablename." where id_seller=$id"; $query = Executor::doit($sql); return Model::many($query[0],new SpendData()); } } ?>