����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����
Server IP : 74.208.127.88 / Your IP : 3.137.159.3 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/muebles/pos11/core/app/model/ |
Upload File : |
<?php class ProductData { public static $tablename = "m_item"; public function ProductData(){ $this->barcode = ""; $this->name = ""; $this->price_in = ""; $this->price_out = ""; $this->iva = ""; $this->unit = ""; $this->user_id = ""; $this->is_service = ""; $this->presentation = "0"; $this->status = ""; $this->created_at = "NOW()"; $this->finish_at = ""; } public function getCategory(){ return CategoryData::getById($this->category_id);} public function add(){ $sql = "insert into product (barcode,name,description,price_in,price_out,iva,user_id,is_service,presentation,unit,category_id,inventary_min,created_at) "; $sql .= "value (\"$this->barcode\",\"$this->name\",\"$this->description\",\"$this->price_in\",\"$this->price_out\",\"$this->iva\",$this->user_id,\"$this->is_service\",\"$this->presentation\",\"$this->unit\",$this->category_id,$this->inventary_min,$this->created_at)"; return Executor::doit($sql); } public function add_with_image(){ $sql = "insert into product (barcode,image,name,description,price_in,price_out,iva,user_id,presentation,unit,category_id,inventary_min) "; $sql .= "value (\"$this->barcode\",\"$this->image\",\"$this->name\",\"$this->description\",\"$this->price_in\",\"$this->price_out\",\"$this->iva\",$this->user_id,\"$this->presentation\",\"$this->unit\",$this->category_id,$this->inventary_min)"; return Executor::doit($sql); } //alta de tabla m_item public function add2($id_item,$item_name,$barcode,$stock,$price,$unit){ $sql = "insert into ".self::$tablename." (id_item,item_name,barcode,stock,price,unit) "; $sql .= "value (\"$id_item\",\"$item_name\",\"$barcode\",\"$stock\",\"$price\",$unit)"; return Executor::doit($sql); } public static function delById($id){ $sql = "delete from ".self::$tablename." where id=$id"; Executor::doit($sql); } public function del2($barcode){ $sql = "delete from ".self::$tablename." where barcode=$barcode"; Executor::doit($sql); } public function del(){ $sql = "delete from product where id=$this->id"; Executor::doit($sql); } // partiendo de que ya tenemos creado un objecto ProductData previamente utilizamos el contexto public function update(){ $sql = "update product set barcode=\"$this->barcode\",name=\"$this->name\",price_in=\"$this->price_in\",price_out=\"$this->price_out\",iva=\"$this->iva\",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($barcode,$price){ $sql = "update ".self::$tablename." set price='$price' where barcode='$barcode'"; Executor::doit($sql); } public function updateStock($barcode,$stock){ $sql = "update ".self::$tablename." set stock='$stock' where barcode='$barcode'"; Executor::doit($sql); } public function updateStatus($barcode,$status){ $sql = "update ".self::$tablename." set status='$status' where barcode='$barcode'"; Executor::doit($sql); } public function updateP2($barcode,$price){ $sql = "update product set price_out='$price' where barcode='$barcode'"; 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 product set image=\"$this->image\" where id=$this->id"; Executor::doit($sql); } public static function getById($id){ $sql = "select * from product where id='$id'"; $query = Executor::doit($sql); return Model::one($query[0],new ProductData()); } public static function getById2($id_item){ $sql = "select * from ".self::$tablename." where id_item='$id_item'"; $query = Executor::doit($sql); return Model::one($query[0],new ProductData()); } public static function getByIdMax(){ $sql = "select MAX(id_item) AS id from ".self::$tablename." "; $query = Executor::doit($sql); return Model::many($query[0],new ProductData()); } //SELECT MAX(autoid) AS id FROM t_sale_detail public static function getBycode($search){ $sql = "select * from product where barcode = '$search' "; $query = Executor::doit($sql); return Model::one($query[0],new ProductData()); } public static function getBycodeItem($search){ $sql = "select * from ".self::$tablename." where barcode = '$search'"; $query = Executor::doit($sql); return Model::one($query[0],new ProductData()); } public static function getAll(){ $sql = "select * from ".self::$tablename." order by item_name desc "; $query = Executor::doit($sql); return Model::many($query[0],new ProductData()); } public static function getAll200(){ $sql = "select * from ".self::$tablename." order by created_at desc"; $query = Executor::doit($sql); return Model::many($query[0],new ProductData()); } public static function getAllProducts(){ $sql = "select * from product order by name asc "; $query = Executor::doit($sql); return Model::many($query[0],new ProductData()); } public static function getAll_(){ $sql = "select * from product where category_id = 2 order by name desc"; $query = Executor::doit($sql); return Model::many($query[0],new ProductData()); } public static function getAll2(){ $sql = "select id,barcode,name,price_out from product order by name desc"; $query = Executor::doit($sql); return Model::many($query[0],new ProductData()); } public static function getAllDate($start,$end){ $sql = "select id,barcode,name,price_out from product where (date(created_at) >= \"$start\" and date(created_at) <= \"$end\") order by name desc"; $query = Executor::doit($sql); return Model::many($query[0],new ProductData()); } public static function getAllCategory($category_id){ $sql = "select id,barcode,name,price_out from product where category_id = '$category_id' order by name desc"; $query = Executor::doit($sql); return Model::many($query[0],new ProductData()); } public static function getAll_2($id){ $sql = "select * from product where name like '%$id%'"; $query = Executor::doit($sql); return Model::many($query[0],new ProductData()); } public static function getAllByName($name){ $sql = "select * from product where name ='$name' "; $query = Executor::doit($sql); return Model::many($query[0],new ProductData()); } public static function getAllByName2($name){ $sql = "select * from ".self::$tablename." where item_name like '%$name%' "; $query = Executor::doit($sql); return Model::many($query[0],new ProductData()); } public static function getAllByNameLike($name){ $sql = "select * from product where name like '%$name%' "; $query = Executor::doit($sql); return Model::many($query[0],new ProductData()); } public static function getAllByCategoryId($id){ $sql = "select * from product where category_id='$id'"; $query = Executor::doit($sql); return Model::many($query[0],new ProductData()); } public static function getAllByCategoryNull(){ $sql = "select * from product where category_id is NULL order by name desc"; $query = Executor::doit($sql); return Model::many($query[0],new ProductData()); } 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 ProductData()); } public static function getLike($p){ $sql = "select * from product where name like '%$p%'"; $query = Executor::doit($sql); return Model::many($query[0],new ProductData()); } public static function getBycode2($search){ $sql = "select * from product where barcode ='$search'"; $query = Executor::doit($sql); return Model::many($query[0],new ProductData()); } 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 ProductData()); } } ?>